Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Manuel Bottini | b412fab | 2018-12-10 17:40:23 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2017-2019 ARM Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
Anthony Barbier | 4dbc0a9 | 2018-08-27 13:39:47 +0100 | [diff] [blame] | 24 | #ifndef __ARM_COMPUTE_TYPE_PRINTER_H__ |
| 25 | #define __ARM_COMPUTE_TYPE_PRINTER_H__ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 26 | |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/CL/CLTypes.h" |
Anthony Barbier | 8914e32 | 2018-08-10 15:28:25 +0100 | [diff] [blame] | 28 | #include "arm_compute/core/CPP/CPPTypes.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 29 | #include "arm_compute/core/Dimensions.h" |
| 30 | #include "arm_compute/core/Error.h" |
Michele Di Giorgio | b8fc60f | 2018-04-25 11:58:07 +0100 | [diff] [blame] | 31 | #include "arm_compute/core/GPUTarget.h" |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 32 | #include "arm_compute/core/HOGInfo.h" |
| 33 | #include "arm_compute/core/Size2D.h" |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 34 | #include "arm_compute/core/Strides.h" |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 35 | #include "arm_compute/core/TensorInfo.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 36 | #include "arm_compute/core/Types.h" |
| 37 | |
| 38 | #include <ostream> |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 39 | #include <sstream> |
| 40 | #include <string> |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 41 | |
| 42 | namespace arm_compute |
| 43 | { |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 44 | /** Formatted output if arg is not null |
| 45 | * |
| 46 | * @param[in] arg Object to print |
| 47 | * |
| 48 | * @return String representing arg. |
| 49 | */ |
| 50 | template <typename T> |
| 51 | std::string to_string_if_not_null(T *arg) |
| 52 | { |
| 53 | if(arg == nullptr) |
| 54 | { |
| 55 | return "nullptr"; |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | return to_string(*arg); |
| 60 | } |
| 61 | } |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 62 | /** Formatted output of the Dimensions type. |
| 63 | * |
| 64 | * @param[out] os Output stream. |
| 65 | * @param[in] dimensions Type to output. |
| 66 | * |
| 67 | * @return Modified output stream. |
| 68 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 69 | template <typename T> |
| 70 | inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions) |
| 71 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 72 | if(dimensions.num_dimensions() > 0) |
| 73 | { |
| 74 | os << dimensions[0]; |
| 75 | |
| 76 | for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d) |
| 77 | { |
Moritz Pflanzer | c87fbf8 | 2017-07-18 14:02:10 +0100 | [diff] [blame] | 78 | os << "x" << dimensions[d]; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 82 | return os; |
| 83 | } |
| 84 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 85 | /** Formatted output of the NonLinearFilterFunction type. |
| 86 | * |
| 87 | * @param[out] os Output stream. |
| 88 | * @param[in] function Type to output. |
| 89 | * |
| 90 | * @return Modified output stream. |
| 91 | */ |
Isabella Gottardi | 3b77e9d | 2017-06-22 11:05:41 +0100 | [diff] [blame] | 92 | inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function) |
| 93 | { |
| 94 | switch(function) |
| 95 | { |
| 96 | case NonLinearFilterFunction::MAX: |
| 97 | os << "MAX"; |
| 98 | break; |
| 99 | case NonLinearFilterFunction::MEDIAN: |
| 100 | os << "MEDIAN"; |
| 101 | break; |
| 102 | case NonLinearFilterFunction::MIN: |
| 103 | os << "MIN"; |
| 104 | break; |
| 105 | default: |
| 106 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 107 | } |
| 108 | |
| 109 | return os; |
| 110 | } |
| 111 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 112 | /** Formatted output of the NonLinearFilterFunction type. |
| 113 | * |
| 114 | * @param[in] function Type to output. |
| 115 | * |
| 116 | * @return Formatted string. |
| 117 | */ |
John Richardson | 6f4d49f | 2017-09-07 11:21:10 +0100 | [diff] [blame] | 118 | inline std::string to_string(const NonLinearFilterFunction &function) |
| 119 | { |
| 120 | std::stringstream str; |
| 121 | str << function; |
| 122 | return str.str(); |
| 123 | } |
| 124 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 125 | /** Formatted output of the MatrixPattern type. |
| 126 | * |
| 127 | * @param[out] os Output stream. |
| 128 | * @param[in] pattern Type to output. |
| 129 | * |
| 130 | * @return Modified output stream. |
| 131 | */ |
Isabella Gottardi | 3b77e9d | 2017-06-22 11:05:41 +0100 | [diff] [blame] | 132 | inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern) |
| 133 | { |
| 134 | switch(pattern) |
| 135 | { |
| 136 | case MatrixPattern::BOX: |
| 137 | os << "BOX"; |
| 138 | break; |
| 139 | case MatrixPattern::CROSS: |
| 140 | os << "CROSS"; |
| 141 | break; |
| 142 | case MatrixPattern::DISK: |
| 143 | os << "DISK"; |
| 144 | break; |
| 145 | case MatrixPattern::OTHER: |
| 146 | os << "OTHER"; |
| 147 | break; |
| 148 | default: |
| 149 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 150 | } |
| 151 | |
| 152 | return os; |
| 153 | } |
| 154 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 155 | /** Formatted output of the MatrixPattern type. |
| 156 | * |
| 157 | * @param[in] pattern Type to output. |
| 158 | * |
| 159 | * @return Formatted string. |
| 160 | */ |
John Richardson | 6f4d49f | 2017-09-07 11:21:10 +0100 | [diff] [blame] | 161 | inline std::string to_string(const MatrixPattern &pattern) |
| 162 | { |
| 163 | std::stringstream str; |
| 164 | str << pattern; |
| 165 | return str.str(); |
| 166 | } |
| 167 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 168 | /** Formatted output of the RoundingPolicy type. |
| 169 | * |
| 170 | * @param[out] os Output stream. |
| 171 | * @param[in] rounding_policy Type to output. |
| 172 | * |
| 173 | * @return Modified output stream. |
| 174 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 175 | inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 176 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 177 | switch(rounding_policy) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 178 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 179 | case RoundingPolicy::TO_ZERO: |
| 180 | os << "TO_ZERO"; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 181 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 182 | case RoundingPolicy::TO_NEAREST_UP: |
| 183 | os << "TO_NEAREST_UP"; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 184 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 185 | case RoundingPolicy::TO_NEAREST_EVEN: |
| 186 | os << "TO_NEAREST_EVEN"; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 187 | break; |
| 188 | default: |
| 189 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 190 | } |
| 191 | |
| 192 | return os; |
| 193 | } |
| 194 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 195 | /** Formatted output of the WeightsInfo type. |
| 196 | * |
| 197 | * @param[out] os Output stream. |
| 198 | * @param[in] weights_info Type to output. |
| 199 | * |
| 200 | * @return Modified output stream. |
| 201 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 202 | inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info) |
Isabella Gottardi | 1fab09f | 2017-07-13 15:55:57 +0100 | [diff] [blame] | 203 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 204 | os << weights_info.are_reshaped() << ";"; |
| 205 | os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 206 | |
| 207 | return os; |
| 208 | } |
| 209 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 210 | /** Formatted output of the ROIPoolingInfo type. |
| 211 | * |
| 212 | * @param[out] os Output stream. |
| 213 | * @param[in] pool_info Type to output. |
| 214 | * |
| 215 | * @return Modified output stream. |
| 216 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 217 | inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info) |
Sanghoon Lee | 70f8291 | 2017-08-24 14:21:24 +0100 | [diff] [blame] | 218 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 219 | os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale(); |
Georgios Pinitas | d976958 | 2017-08-03 10:19:40 +0100 | [diff] [blame] | 220 | return os; |
| 221 | } |
| 222 | |
giuros01 | 1887081 | 2018-09-13 09:31:40 +0100 | [diff] [blame] | 223 | /** Formatted output of the ROIPoolingInfo type. |
| 224 | * |
| 225 | * @param[in] pool_info Type to output. |
| 226 | * |
| 227 | * @return Formatted string. |
| 228 | */ |
| 229 | inline std::string to_string(const ROIPoolingLayerInfo &pool_info) |
| 230 | { |
| 231 | std::stringstream str; |
| 232 | str << pool_info; |
| 233 | return str.str(); |
| 234 | } |
| 235 | |
giuros01 | c04a0e8 | 2018-10-03 12:44:35 +0100 | [diff] [blame] | 236 | /** Formatted output of the BoundingBoxTransformInfo type. |
| 237 | * |
| 238 | * @param[out] os Output stream. |
| 239 | * @param[in] bbox_info Type to output. |
| 240 | * |
| 241 | * @return Modified output stream. |
| 242 | */ |
| 243 | inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info) |
| 244 | { |
| 245 | auto weights = bbox_info.weights(); |
| 246 | os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights = {" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << |
| 247 | "})"; |
| 248 | return os; |
| 249 | } |
| 250 | |
| 251 | /** Formatted output of the BoundingBoxTransformInfo type. |
| 252 | * |
| 253 | * @param[in] bbox_info Type to output. |
| 254 | * |
| 255 | * @return Formatted string. |
| 256 | */ |
| 257 | inline std::string to_string(const BoundingBoxTransformInfo &bbox_info) |
| 258 | { |
| 259 | std::stringstream str; |
| 260 | str << bbox_info; |
| 261 | return str.str(); |
| 262 | } |
| 263 | |
giuros01 | cd96a26 | 2018-10-03 12:44:35 +0100 | [diff] [blame] | 264 | /** Formatted output of the ComputeAnchorsInfo type. |
| 265 | * |
| 266 | * @param[out] os Output stream. |
| 267 | * @param[in] anchors_info Type to output. |
| 268 | * |
| 269 | * @return Modified output stream. |
| 270 | */ |
| 271 | inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info) |
| 272 | { |
| 273 | os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale(); |
| 274 | return os; |
| 275 | } |
| 276 | |
| 277 | /** Formatted output of the ComputeAnchorsInfo type. |
| 278 | * |
| 279 | * @param[in] anchors_info Type to output. |
| 280 | * |
| 281 | * @return Formatted string. |
| 282 | */ |
| 283 | inline std::string to_string(const ComputeAnchorsInfo &anchors_info) |
| 284 | { |
| 285 | std::stringstream str; |
| 286 | str << anchors_info; |
| 287 | return str.str(); |
| 288 | } |
| 289 | |
| 290 | /** Formatted output of the GenerateProposalsInfo type. |
| 291 | * |
| 292 | * @param[out] os Output stream. |
| 293 | * @param[in] proposals_info Type to output. |
| 294 | * |
| 295 | * @return Modified output stream. |
| 296 | */ |
| 297 | inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info) |
| 298 | { |
| 299 | os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale(); |
| 300 | return os; |
| 301 | } |
| 302 | |
| 303 | /** Formatted output of the GenerateProposalsInfo type. |
| 304 | * |
| 305 | * @param[in] proposals_info Type to output. |
| 306 | * |
| 307 | * @return Formatted string. |
| 308 | */ |
| 309 | inline std::string to_string(const GenerateProposalsInfo &proposals_info) |
| 310 | { |
| 311 | std::stringstream str; |
| 312 | str << proposals_info; |
| 313 | return str.str(); |
| 314 | } |
| 315 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 316 | /** Formatted output of the QuantizationInfo type. |
| 317 | * |
| 318 | * @param[out] os Output stream. |
| 319 | * @param[in] quantization_info Type to output. |
| 320 | * |
| 321 | * @return Modified output stream. |
| 322 | */ |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 323 | inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info) |
| 324 | { |
| 325 | os << "Scale:" << quantization_info.scale << "~" |
| 326 | << "Offset:" << quantization_info.offset; |
| 327 | return os; |
| 328 | } |
| 329 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 330 | /** Formatted output of the QuantizationInfo type. |
| 331 | * |
| 332 | * @param[in] quantization_info Type to output. |
| 333 | * |
| 334 | * @return Formatted string. |
| 335 | */ |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 336 | inline std::string to_string(const QuantizationInfo &quantization_info) |
| 337 | { |
| 338 | std::stringstream str; |
| 339 | str << quantization_info; |
| 340 | return str.str(); |
| 341 | } |
| 342 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 343 | /** Formatted output of the activation function type. |
| 344 | * |
| 345 | * @param[out] os Output stream. |
| 346 | * @param[in] act_function Type to output. |
| 347 | * |
| 348 | * @return Modified output stream. |
| 349 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 350 | inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function) |
| 351 | { |
| 352 | switch(act_function) |
| 353 | { |
| 354 | case ActivationLayerInfo::ActivationFunction::ABS: |
| 355 | os << "ABS"; |
| 356 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 357 | case ActivationLayerInfo::ActivationFunction::LINEAR: |
| 358 | os << "LINEAR"; |
| 359 | break; |
| 360 | case ActivationLayerInfo::ActivationFunction::LOGISTIC: |
| 361 | os << "LOGISTIC"; |
| 362 | break; |
| 363 | case ActivationLayerInfo::ActivationFunction::RELU: |
| 364 | os << "RELU"; |
| 365 | break; |
Georgios Pinitas | 579c049 | 2017-07-12 16:12:12 +0100 | [diff] [blame] | 366 | case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU: |
| 367 | os << "BOUNDED_RELU"; |
| 368 | break; |
| 369 | case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: |
| 370 | os << "LEAKY_RELU"; |
| 371 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 372 | case ActivationLayerInfo::ActivationFunction::SOFT_RELU: |
| 373 | os << "SOFT_RELU"; |
| 374 | break; |
| 375 | case ActivationLayerInfo::ActivationFunction::SQRT: |
| 376 | os << "SQRT"; |
| 377 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 378 | case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU: |
| 379 | os << "LU_BOUNDED_RELU"; |
Kevin Petit | d9f8071 | 2017-12-06 12:18:48 +0000 | [diff] [blame] | 380 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 381 | case ActivationLayerInfo::ActivationFunction::SQUARE: |
| 382 | os << "SQUARE"; |
| 383 | break; |
| 384 | case ActivationLayerInfo::ActivationFunction::TANH: |
| 385 | os << "TANH"; |
| 386 | break; |
| 387 | default: |
| 388 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 389 | } |
| 390 | |
| 391 | return os; |
| 392 | } |
| 393 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 394 | /** Formatted output of the activation function info type. |
| 395 | * |
| 396 | * @param[in] info Type to output. |
| 397 | * |
| 398 | * @return Formatted string. |
| 399 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 400 | inline std::string to_string(const arm_compute::ActivationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 401 | { |
| 402 | std::stringstream str; |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 403 | if(info.enabled()) |
| 404 | { |
| 405 | str << info.activation(); |
| 406 | } |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 407 | return str.str(); |
| 408 | } |
| 409 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 410 | /** Formatted output of the activation function type. |
| 411 | * |
| 412 | * @param[in] function Type to output. |
| 413 | * |
| 414 | * @return Formatted string. |
| 415 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 416 | inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function) |
| 417 | { |
| 418 | std::stringstream str; |
| 419 | str << function; |
| 420 | return str.str(); |
| 421 | } |
| 422 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 423 | /** Formatted output of the NormType type. |
| 424 | * |
| 425 | * @param[out] os Output stream. |
| 426 | * @param[in] norm_type Type to output. |
| 427 | * |
| 428 | * @return Modified output stream. |
| 429 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 430 | inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type) |
| 431 | { |
| 432 | switch(norm_type) |
| 433 | { |
| 434 | case NormType::CROSS_MAP: |
| 435 | os << "CROSS_MAP"; |
| 436 | break; |
| 437 | case NormType::IN_MAP_1D: |
| 438 | os << "IN_MAP_1D"; |
| 439 | break; |
| 440 | case NormType::IN_MAP_2D: |
| 441 | os << "IN_MAP_2D"; |
| 442 | break; |
| 443 | default: |
| 444 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 445 | } |
| 446 | |
| 447 | return os; |
| 448 | } |
| 449 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 450 | /** Formatted output of @ref NormalizationLayerInfo. |
| 451 | * |
| 452 | * @param[in] info Type to output. |
| 453 | * |
| 454 | * @return Formatted string. |
| 455 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 456 | inline std::string to_string(const arm_compute::NormalizationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 457 | { |
| 458 | std::stringstream str; |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 459 | str << info.type() << ":NormSize=" << info.norm_size(); |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 460 | return str.str(); |
| 461 | } |
| 462 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 463 | /** Formatted output of @ref NormalizationLayerInfo. |
| 464 | * |
| 465 | * @param[out] os Output stream. |
| 466 | * @param[in] info Type to output. |
| 467 | * |
| 468 | * @return Modified output stream. |
| 469 | */ |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 470 | inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info) |
| 471 | { |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 472 | os << info.type() << ":NormSize=" << info.norm_size(); |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 473 | return os; |
| 474 | } |
| 475 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 476 | /** Formatted output of the PoolingType type. |
| 477 | * |
| 478 | * @param[out] os Output stream. |
| 479 | * @param[in] pool_type Type to output. |
| 480 | * |
| 481 | * @return Modified output stream. |
| 482 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 483 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type) |
| 484 | { |
| 485 | switch(pool_type) |
| 486 | { |
| 487 | case PoolingType::AVG: |
| 488 | os << "AVG"; |
| 489 | break; |
| 490 | case PoolingType::MAX: |
| 491 | os << "MAX"; |
| 492 | break; |
Georgios Pinitas | cdf5145 | 2017-08-31 14:21:36 +0100 | [diff] [blame] | 493 | case PoolingType::L2: |
| 494 | os << "L2"; |
| 495 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 496 | default: |
| 497 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 498 | } |
| 499 | |
| 500 | return os; |
| 501 | } |
| 502 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 503 | /** Formatted output of @ref PoolingLayerInfo. |
| 504 | * |
| 505 | * @param[out] os Output stream. |
| 506 | * @param[in] info Type to output. |
| 507 | * |
| 508 | * @return Modified output stream. |
| 509 | */ |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 510 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) |
| 511 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 512 | os << info.pool_type(); |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 513 | |
| 514 | return os; |
| 515 | } |
| 516 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 517 | /** Formatted output of @ref RoundingPolicy. |
| 518 | * |
| 519 | * @param[in] rounding_policy Type to output. |
| 520 | * |
| 521 | * @return Formatted string. |
| 522 | */ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 523 | inline std::string to_string(const RoundingPolicy &rounding_policy) |
| 524 | { |
| 525 | std::stringstream str; |
| 526 | str << rounding_policy; |
| 527 | return str.str(); |
| 528 | } |
| 529 | |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 530 | /** [Print DataLayout type] **/ |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 531 | /** Formatted output of the DataLayout type. |
| 532 | * |
| 533 | * @param[out] os Output stream. |
| 534 | * @param[in] data_layout Type to output. |
| 535 | * |
| 536 | * @return Modified output stream. |
| 537 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 538 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout) |
| 539 | { |
| 540 | switch(data_layout) |
| 541 | { |
| 542 | case DataLayout::UNKNOWN: |
| 543 | os << "UNKNOWN"; |
| 544 | break; |
| 545 | case DataLayout::NHWC: |
| 546 | os << "NHWC"; |
| 547 | break; |
| 548 | case DataLayout::NCHW: |
| 549 | os << "NCHW"; |
| 550 | break; |
| 551 | default: |
| 552 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 553 | } |
| 554 | |
| 555 | return os; |
| 556 | } |
| 557 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 558 | /** Formatted output of the DataLayout type. |
| 559 | * |
| 560 | * @param[in] data_layout Type to output. |
| 561 | * |
| 562 | * @return Formatted string. |
| 563 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 564 | inline std::string to_string(const arm_compute::DataLayout &data_layout) |
| 565 | { |
| 566 | std::stringstream str; |
| 567 | str << data_layout; |
| 568 | return str.str(); |
| 569 | } |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 570 | /** [Print DataLayout type] **/ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 571 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 572 | /** Formatted output of the DataLayoutDimension type. |
| 573 | * |
| 574 | * @param[out] os Output stream. |
| 575 | * @param[in] data_layout_dim Data layout dimension to print. |
| 576 | * |
| 577 | * @return Modified output stream. |
| 578 | */ |
| 579 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim) |
| 580 | { |
| 581 | switch(data_layout_dim) |
| 582 | { |
| 583 | case DataLayoutDimension::WIDTH: |
| 584 | os << "WIDTH"; |
| 585 | break; |
| 586 | case DataLayoutDimension::HEIGHT: |
| 587 | os << "HEIGHT"; |
| 588 | break; |
| 589 | case DataLayoutDimension::CHANNEL: |
| 590 | os << "CHANNEL"; |
| 591 | break; |
| 592 | case DataLayoutDimension::BATCHES: |
| 593 | os << "BATCHES"; |
| 594 | break; |
| 595 | default: |
| 596 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 597 | } |
| 598 | return os; |
| 599 | } |
| 600 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 601 | /** Formatted output of the DataType type. |
| 602 | * |
| 603 | * @param[out] os Output stream. |
| 604 | * @param[in] data_type Type to output. |
| 605 | * |
| 606 | * @return Modified output stream. |
| 607 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 608 | inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) |
| 609 | { |
| 610 | switch(data_type) |
| 611 | { |
| 612 | case DataType::UNKNOWN: |
| 613 | os << "UNKNOWN"; |
| 614 | break; |
| 615 | case DataType::U8: |
| 616 | os << "U8"; |
| 617 | break; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 618 | case DataType::QASYMM8: |
| 619 | os << "QASYMM8"; |
| 620 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 621 | case DataType::S8: |
| 622 | os << "S8"; |
| 623 | break; |
| 624 | case DataType::U16: |
| 625 | os << "U16"; |
| 626 | break; |
| 627 | case DataType::S16: |
| 628 | os << "S16"; |
| 629 | break; |
| 630 | case DataType::U32: |
| 631 | os << "U32"; |
| 632 | break; |
| 633 | case DataType::S32: |
| 634 | os << "S32"; |
| 635 | break; |
| 636 | case DataType::U64: |
| 637 | os << "U64"; |
| 638 | break; |
| 639 | case DataType::S64: |
| 640 | os << "S64"; |
| 641 | break; |
| 642 | case DataType::F16: |
| 643 | os << "F16"; |
| 644 | break; |
| 645 | case DataType::F32: |
| 646 | os << "F32"; |
| 647 | break; |
| 648 | case DataType::F64: |
| 649 | os << "F64"; |
| 650 | break; |
| 651 | case DataType::SIZET: |
| 652 | os << "SIZET"; |
| 653 | break; |
| 654 | default: |
| 655 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 656 | } |
| 657 | |
| 658 | return os; |
| 659 | } |
| 660 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 661 | /** Formatted output of the DataType type. |
| 662 | * |
| 663 | * @param[in] data_type Type to output. |
| 664 | * |
| 665 | * @return Formatted string. |
| 666 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 667 | inline std::string to_string(const arm_compute::DataType &data_type) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 668 | { |
| 669 | std::stringstream str; |
| 670 | str << data_type; |
| 671 | return str.str(); |
| 672 | } |
| 673 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 674 | /** Formatted output of the Format type. |
| 675 | * |
| 676 | * @param[out] os Output stream. |
| 677 | * @param[in] format Type to output. |
| 678 | * |
| 679 | * @return Modified output stream. |
| 680 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 681 | inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) |
| 682 | { |
| 683 | switch(format) |
| 684 | { |
| 685 | case Format::UNKNOWN: |
| 686 | os << "UNKNOWN"; |
| 687 | break; |
| 688 | case Format::U8: |
| 689 | os << "U8"; |
| 690 | break; |
| 691 | case Format::S16: |
| 692 | os << "S16"; |
| 693 | break; |
| 694 | case Format::U16: |
| 695 | os << "U16"; |
| 696 | break; |
| 697 | case Format::S32: |
| 698 | os << "S32"; |
| 699 | break; |
| 700 | case Format::U32: |
| 701 | os << "U32"; |
| 702 | break; |
| 703 | case Format::F16: |
| 704 | os << "F16"; |
| 705 | break; |
| 706 | case Format::F32: |
| 707 | os << "F32"; |
| 708 | break; |
| 709 | case Format::UV88: |
| 710 | os << "UV88"; |
| 711 | break; |
| 712 | case Format::RGB888: |
| 713 | os << "RGB888"; |
| 714 | break; |
| 715 | case Format::RGBA8888: |
| 716 | os << "RGBA8888"; |
| 717 | break; |
| 718 | case Format::YUV444: |
| 719 | os << "YUV444"; |
| 720 | break; |
| 721 | case Format::YUYV422: |
| 722 | os << "YUYV422"; |
| 723 | break; |
| 724 | case Format::NV12: |
| 725 | os << "NV12"; |
| 726 | break; |
| 727 | case Format::NV21: |
| 728 | os << "NV21"; |
| 729 | break; |
| 730 | case Format::IYUV: |
| 731 | os << "IYUV"; |
| 732 | break; |
| 733 | case Format::UYVY422: |
| 734 | os << "UYVY422"; |
| 735 | break; |
| 736 | default: |
| 737 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 738 | } |
| 739 | |
| 740 | return os; |
| 741 | } |
| 742 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 743 | /** Formatted output of the Format type. |
| 744 | * |
| 745 | * @param[in] format Type to output. |
| 746 | * |
| 747 | * @return Formatted string. |
| 748 | */ |
Moritz Pflanzer | 7655a67 | 2017-09-23 11:57:33 +0100 | [diff] [blame] | 749 | inline std::string to_string(const Format &format) |
| 750 | { |
| 751 | std::stringstream str; |
| 752 | str << format; |
| 753 | return str.str(); |
| 754 | } |
| 755 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 756 | /** Formatted output of the Channel type. |
| 757 | * |
| 758 | * @param[out] os Output stream. |
| 759 | * @param[in] channel Type to output. |
| 760 | * |
| 761 | * @return Modified output stream. |
| 762 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 763 | inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) |
| 764 | { |
| 765 | switch(channel) |
| 766 | { |
| 767 | case Channel::UNKNOWN: |
| 768 | os << "UNKNOWN"; |
| 769 | break; |
| 770 | case Channel::C0: |
| 771 | os << "C0"; |
| 772 | break; |
| 773 | case Channel::C1: |
| 774 | os << "C1"; |
| 775 | break; |
| 776 | case Channel::C2: |
| 777 | os << "C2"; |
| 778 | break; |
| 779 | case Channel::C3: |
| 780 | os << "C3"; |
| 781 | break; |
| 782 | case Channel::R: |
| 783 | os << "R"; |
| 784 | break; |
| 785 | case Channel::G: |
| 786 | os << "G"; |
| 787 | break; |
| 788 | case Channel::B: |
| 789 | os << "B"; |
| 790 | break; |
| 791 | case Channel::A: |
| 792 | os << "A"; |
| 793 | break; |
| 794 | case Channel::Y: |
| 795 | os << "Y"; |
| 796 | break; |
| 797 | case Channel::U: |
| 798 | os << "U"; |
| 799 | break; |
| 800 | case Channel::V: |
| 801 | os << "V"; |
| 802 | break; |
| 803 | default: |
| 804 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 805 | } |
| 806 | |
| 807 | return os; |
| 808 | } |
| 809 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 810 | /** Formatted output of the Channel type. |
| 811 | * |
| 812 | * @param[in] channel Type to output. |
| 813 | * |
| 814 | * @return Formatted string. |
| 815 | */ |
Ioan-Cristian Szabo | 9414f64 | 2017-10-27 17:35:40 +0100 | [diff] [blame] | 816 | inline std::string to_string(const Channel &channel) |
| 817 | { |
| 818 | std::stringstream str; |
| 819 | str << channel; |
| 820 | return str.str(); |
| 821 | } |
| 822 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 823 | /** Formatted output of the BorderMode type. |
| 824 | * |
| 825 | * @param[out] os Output stream. |
| 826 | * @param[in] mode Type to output. |
| 827 | * |
| 828 | * @return Modified output stream. |
| 829 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 830 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) |
| 831 | { |
| 832 | switch(mode) |
| 833 | { |
| 834 | case BorderMode::UNDEFINED: |
| 835 | os << "UNDEFINED"; |
| 836 | break; |
| 837 | case BorderMode::CONSTANT: |
| 838 | os << "CONSTANT"; |
| 839 | break; |
| 840 | case BorderMode::REPLICATE: |
| 841 | os << "REPLICATE"; |
| 842 | break; |
| 843 | default: |
| 844 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 845 | } |
| 846 | |
| 847 | return os; |
| 848 | } |
| 849 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 850 | /** Formatted output of the BorderSize type. |
| 851 | * |
| 852 | * @param[out] os Output stream. |
| 853 | * @param[in] border Type to output. |
| 854 | * |
| 855 | * @return Modified output stream. |
| 856 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 857 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) |
| 858 | { |
Moritz Pflanzer | c87fbf8 | 2017-07-18 14:02:10 +0100 | [diff] [blame] | 859 | os << border.top << "," |
| 860 | << border.right << "," |
| 861 | << border.bottom << "," |
| 862 | << border.left; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 863 | |
| 864 | return os; |
| 865 | } |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 866 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 867 | /** Formatted output of the PaddingList type. |
| 868 | * |
| 869 | * @param[out] os Output stream. |
| 870 | * @param[in] padding Type to output. |
| 871 | * |
| 872 | * @return Modified output stream. |
| 873 | */ |
| 874 | inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding) |
| 875 | { |
| 876 | os << "{"; |
| 877 | for(auto const &p : padding) |
| 878 | { |
| 879 | os << "{" << p.first << "," << p.second << "}"; |
| 880 | } |
| 881 | os << "}"; |
| 882 | return os; |
| 883 | } |
| 884 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 885 | /** Formatted output of the Multiples type. |
| 886 | * |
| 887 | * @param[out] os Output stream. |
| 888 | * @param[in] multiples Type to output. |
| 889 | * |
| 890 | * @return Modified output stream. |
| 891 | */ |
| 892 | inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples) |
| 893 | { |
| 894 | os << "("; |
| 895 | for(size_t i = 0; i < multiples.size() - 1; i++) |
| 896 | { |
| 897 | os << multiples[i] << ", "; |
| 898 | } |
| 899 | os << multiples.back() << ")"; |
| 900 | return os; |
| 901 | } |
| 902 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 903 | /** Formatted output of the InterpolationPolicy type. |
| 904 | * |
| 905 | * @param[out] os Output stream. |
| 906 | * @param[in] policy Type to output. |
| 907 | * |
| 908 | * @return Modified output stream. |
| 909 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 910 | inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) |
| 911 | { |
| 912 | switch(policy) |
| 913 | { |
| 914 | case InterpolationPolicy::NEAREST_NEIGHBOR: |
| 915 | os << "NEAREST_NEIGHBOR"; |
| 916 | break; |
| 917 | case InterpolationPolicy::BILINEAR: |
| 918 | os << "BILINEAR"; |
| 919 | break; |
| 920 | case InterpolationPolicy::AREA: |
| 921 | os << "AREA"; |
| 922 | break; |
| 923 | default: |
| 924 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 925 | } |
| 926 | |
| 927 | return os; |
| 928 | } |
| 929 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 930 | /** Formatted output of the SamplingPolicy type. |
| 931 | * |
| 932 | * @param[out] os Output stream. |
| 933 | * @param[in] policy Type to output. |
| 934 | * |
| 935 | * @return Modified output stream. |
| 936 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 937 | inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy) |
| 938 | { |
| 939 | switch(policy) |
| 940 | { |
| 941 | case SamplingPolicy::CENTER: |
| 942 | os << "CENTER"; |
| 943 | break; |
| 944 | case SamplingPolicy::TOP_LEFT: |
| 945 | os << "TOP_LEFT"; |
| 946 | break; |
| 947 | default: |
| 948 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 949 | } |
| 950 | |
| 951 | return os; |
| 952 | } |
| 953 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 954 | /** Formatted output of the TensorInfo type. |
| 955 | * |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 956 | * @param[out] os Output stream. |
| 957 | * @param[in] info Type to output. |
| 958 | * |
| 959 | * @return Modified output stream. |
| 960 | */ |
| 961 | inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info) |
| 962 | { |
| 963 | os << "{Shape=" << info.tensor_shape() << "," |
| 964 | << "Type=" << info.data_type() << "," |
| 965 | << "Channels=" << info.num_channels() << "}"; |
| 966 | return os; |
| 967 | } |
| 968 | /** Formatted output of the TensorInfo type. |
| 969 | * |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 970 | * @param[in] info Type to output. |
| 971 | * |
| 972 | * @return Formatted string. |
| 973 | */ |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 974 | inline std::string to_string(const TensorInfo &info) |
| 975 | { |
| 976 | std::stringstream str; |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 977 | str << info; |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 978 | return str.str(); |
| 979 | } |
| 980 | |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 981 | //FIXME: Check why this doesn't work and the TensorShape and Coordinates overload are needed |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 982 | /** Formatted output of the Dimensions type. |
| 983 | * |
| 984 | * @param[in] dimensions Type to output. |
| 985 | * |
| 986 | * @return Formatted string. |
| 987 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 988 | template <typename T> |
| 989 | inline std::string to_string(const Dimensions<T> &dimensions) |
| 990 | { |
| 991 | std::stringstream str; |
| 992 | str << dimensions; |
| 993 | return str.str(); |
| 994 | } |
| 995 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 996 | /** Formatted output of the Strides type. |
| 997 | * |
| 998 | * @param[in] stride Type to output. |
| 999 | * |
| 1000 | * @return Formatted string. |
| 1001 | */ |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 1002 | inline std::string to_string(const Strides &stride) |
| 1003 | { |
| 1004 | std::stringstream str; |
| 1005 | str << stride; |
| 1006 | return str.str(); |
| 1007 | } |
| 1008 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1009 | /** Formatted output of the TensorShape type. |
| 1010 | * |
| 1011 | * @param[in] shape Type to output. |
| 1012 | * |
| 1013 | * @return Formatted string. |
| 1014 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1015 | inline std::string to_string(const TensorShape &shape) |
| 1016 | { |
| 1017 | std::stringstream str; |
| 1018 | str << shape; |
| 1019 | return str.str(); |
| 1020 | } |
| 1021 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1022 | /** Formatted output of the Coordinates type. |
| 1023 | * |
| 1024 | * @param[in] coord Type to output. |
| 1025 | * |
| 1026 | * @return Formatted string. |
| 1027 | */ |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 1028 | inline std::string to_string(const Coordinates &coord) |
| 1029 | { |
| 1030 | std::stringstream str; |
| 1031 | str << coord; |
| 1032 | return str.str(); |
| 1033 | } |
| 1034 | |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1035 | /** Formatted output of the GEMMReshapeInfo type. |
| 1036 | * |
| 1037 | * @param[out] os Output stream. |
| 1038 | * @param[in] info Type to output. |
| 1039 | * |
| 1040 | * @return Modified output stream. |
| 1041 | */ |
| 1042 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info) |
| 1043 | { |
| 1044 | os << "{m=" << info.m() << ","; |
| 1045 | os << "n=" << info.n() << ","; |
| 1046 | os << "k=" << info.k() << ","; |
| 1047 | os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ","; |
| 1048 | os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height(); |
| 1049 | os << "}"; |
| 1050 | |
| 1051 | return os; |
| 1052 | } |
| 1053 | |
| 1054 | /** Formatted output of the GEMMInfo type. |
| 1055 | * |
| 1056 | * @param[out] os Output stream. |
| 1057 | * @param[in] info Type to output. |
| 1058 | * |
| 1059 | * @return Modified output stream. |
| 1060 | */ |
| 1061 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info) |
| 1062 | { |
| 1063 | os << "{is_a_reshaped=" << info.is_a_reshaped() << ","; |
| 1064 | os << "is_b_reshaped=" << info.is_b_reshaped() << ","; |
| 1065 | os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ","; |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1066 | os << "}"; |
| 1067 | |
| 1068 | return os; |
| 1069 | } |
| 1070 | |
| 1071 | /** Formatted output of the Window::Dimension type. |
| 1072 | * |
| 1073 | * @param[out] os Output stream. |
| 1074 | * @param[in] dim Type to output. |
| 1075 | * |
| 1076 | * @return Modified output stream. |
| 1077 | */ |
| 1078 | inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim) |
| 1079 | { |
| 1080 | os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}"; |
| 1081 | |
| 1082 | return os; |
| 1083 | } |
| 1084 | /** Formatted output of the Window type. |
| 1085 | * |
| 1086 | * @param[out] os Output stream. |
| 1087 | * @param[in] win Type to output. |
| 1088 | * |
| 1089 | * @return Modified output stream. |
| 1090 | */ |
| 1091 | inline ::std::ostream &operator<<(::std::ostream &os, const Window &win) |
| 1092 | { |
| 1093 | os << "{"; |
| 1094 | for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++) |
| 1095 | { |
| 1096 | if(i > 0) |
| 1097 | { |
| 1098 | os << ", "; |
| 1099 | } |
| 1100 | os << win[i]; |
| 1101 | } |
| 1102 | os << "}"; |
| 1103 | |
| 1104 | return os; |
| 1105 | } |
| 1106 | |
| 1107 | /** Formatted output of the WeightsInfo type. |
| 1108 | * |
| 1109 | * @param[in] info Type to output. |
| 1110 | * |
| 1111 | * @return Formatted string. |
| 1112 | */ |
| 1113 | inline std::string to_string(const WeightsInfo &info) |
| 1114 | { |
| 1115 | std::stringstream str; |
| 1116 | str << info; |
| 1117 | return str.str(); |
| 1118 | } |
| 1119 | |
| 1120 | /** Formatted output of the GEMMReshapeInfo type. |
| 1121 | * |
| 1122 | * @param[in] info Type to output. |
| 1123 | * |
| 1124 | * @return Formatted string. |
| 1125 | */ |
| 1126 | inline std::string to_string(const GEMMReshapeInfo &info) |
| 1127 | { |
| 1128 | std::stringstream str; |
| 1129 | str << info; |
| 1130 | return str.str(); |
| 1131 | } |
| 1132 | |
| 1133 | /** Formatted output of the GEMMInfo type. |
| 1134 | * |
| 1135 | * @param[in] info Type to output. |
| 1136 | * |
| 1137 | * @return Formatted string. |
| 1138 | */ |
| 1139 | inline std::string to_string(const GEMMInfo &info) |
| 1140 | { |
| 1141 | std::stringstream str; |
| 1142 | str << info; |
| 1143 | return str.str(); |
| 1144 | } |
| 1145 | |
| 1146 | /** Formatted output of the Window::Dimension type. |
| 1147 | * |
| 1148 | * @param[in] dim Type to output. |
| 1149 | * |
| 1150 | * @return Formatted string. |
| 1151 | */ |
| 1152 | inline std::string to_string(const Window::Dimension &dim) |
| 1153 | { |
| 1154 | std::stringstream str; |
| 1155 | str << dim; |
| 1156 | return str.str(); |
| 1157 | } |
| 1158 | /** Formatted output of the Window type. |
| 1159 | * |
| 1160 | * @param[in] win Type to output. |
| 1161 | * |
| 1162 | * @return Formatted string. |
| 1163 | */ |
| 1164 | inline std::string to_string(const Window &win) |
| 1165 | { |
| 1166 | std::stringstream str; |
| 1167 | str << win; |
| 1168 | return str.str(); |
| 1169 | } |
| 1170 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1171 | /** Formatted output of the Rectangle type. |
| 1172 | * |
| 1173 | * @param[out] os Output stream. |
| 1174 | * @param[in] rect Type to output. |
| 1175 | * |
| 1176 | * @return Modified output stream. |
| 1177 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1178 | inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) |
| 1179 | { |
| 1180 | os << rect.width << "x" << rect.height; |
| 1181 | os << "+" << rect.x << "+" << rect.y; |
| 1182 | |
| 1183 | return os; |
| 1184 | } |
| 1185 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1186 | /** Formatted output of the PadStrideInfo type. |
| 1187 | * |
| 1188 | * @param[out] os Output stream. |
| 1189 | * @param[in] pad_stride_info Type to output. |
| 1190 | * |
| 1191 | * @return Modified output stream. |
| 1192 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1193 | inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) |
| 1194 | { |
| 1195 | os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; |
| 1196 | os << ";"; |
Jaroslaw Rzepecki | a1ed41f | 2017-10-13 11:13:58 +0100 | [diff] [blame] | 1197 | os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," |
| 1198 | << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom(); |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1199 | |
| 1200 | return os; |
| 1201 | } |
| 1202 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1203 | /** Formatted output of the PadStrideInfo type. |
| 1204 | * |
| 1205 | * @param[in] pad_stride_info Type to output. |
| 1206 | * |
| 1207 | * @return Formatted string. |
| 1208 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1209 | inline std::string to_string(const PadStrideInfo &pad_stride_info) |
| 1210 | { |
| 1211 | std::stringstream str; |
| 1212 | str << pad_stride_info; |
| 1213 | return str.str(); |
| 1214 | } |
| 1215 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1216 | /** Formatted output of the BorderMode type. |
| 1217 | * |
| 1218 | * @param[in] mode Type to output. |
| 1219 | * |
| 1220 | * @return Formatted string. |
| 1221 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1222 | inline std::string to_string(const BorderMode &mode) |
| 1223 | { |
| 1224 | std::stringstream str; |
| 1225 | str << mode; |
| 1226 | return str.str(); |
| 1227 | } |
| 1228 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1229 | /** Formatted output of the BorderSize type. |
| 1230 | * |
| 1231 | * @param[in] border Type to output. |
| 1232 | * |
| 1233 | * @return Formatted string. |
| 1234 | */ |
John Richardson | b482ce1 | 2017-09-18 12:44:01 +0100 | [diff] [blame] | 1235 | inline std::string to_string(const BorderSize &border) |
| 1236 | { |
| 1237 | std::stringstream str; |
| 1238 | str << border; |
| 1239 | return str.str(); |
| 1240 | } |
| 1241 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 1242 | /** Formatted output of the PaddingList type. |
| 1243 | * |
| 1244 | * @param[in] padding Type to output. |
| 1245 | * |
| 1246 | * @return Formatted string. |
| 1247 | */ |
| 1248 | inline std::string to_string(const PaddingList &padding) |
| 1249 | { |
| 1250 | std::stringstream str; |
| 1251 | str << padding; |
| 1252 | return str.str(); |
| 1253 | } |
| 1254 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 1255 | /** Formatted output of the Multiples type. |
| 1256 | * |
| 1257 | * @param[in] multiples Type to output. |
| 1258 | * |
| 1259 | * @return Formatted string. |
| 1260 | */ |
| 1261 | inline std::string to_string(const Multiples &multiples) |
| 1262 | { |
| 1263 | std::stringstream str; |
| 1264 | str << multiples; |
| 1265 | return str.str(); |
| 1266 | } |
| 1267 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1268 | /** Formatted output of the InterpolationPolicy type. |
| 1269 | * |
| 1270 | * @param[in] policy Type to output. |
| 1271 | * |
| 1272 | * @return Formatted string. |
| 1273 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1274 | inline std::string to_string(const InterpolationPolicy &policy) |
| 1275 | { |
| 1276 | std::stringstream str; |
| 1277 | str << policy; |
| 1278 | return str.str(); |
| 1279 | } |
| 1280 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1281 | /** Formatted output of the SamplingPolicy type. |
| 1282 | * |
| 1283 | * @param[in] policy Type to output. |
| 1284 | * |
| 1285 | * @return Formatted string. |
| 1286 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 1287 | inline std::string to_string(const SamplingPolicy &policy) |
| 1288 | { |
| 1289 | std::stringstream str; |
| 1290 | str << policy; |
| 1291 | return str.str(); |
| 1292 | } |
| 1293 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1294 | /** Formatted output of the ConvertPolicy type. |
| 1295 | * |
| 1296 | * @param[out] os Output stream. |
| 1297 | * @param[in] policy Type to output. |
| 1298 | * |
| 1299 | * @return Modified output stream. |
| 1300 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1301 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) |
| 1302 | { |
| 1303 | switch(policy) |
| 1304 | { |
| 1305 | case ConvertPolicy::WRAP: |
| 1306 | os << "WRAP"; |
| 1307 | break; |
| 1308 | case ConvertPolicy::SATURATE: |
| 1309 | os << "SATURATE"; |
| 1310 | break; |
| 1311 | default: |
| 1312 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1313 | } |
| 1314 | |
| 1315 | return os; |
| 1316 | } |
| 1317 | |
| 1318 | inline std::string to_string(const ConvertPolicy &policy) |
| 1319 | { |
| 1320 | std::stringstream str; |
| 1321 | str << policy; |
| 1322 | return str.str(); |
| 1323 | } |
| 1324 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1325 | /** Formatted output of the ArithmeticOperation type. |
| 1326 | * |
| 1327 | * @param[out] os Output stream. |
| 1328 | * @param[in] op Operation to output. |
| 1329 | * |
| 1330 | * @return Modified output stream. |
| 1331 | */ |
| 1332 | inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op) |
| 1333 | { |
| 1334 | switch(op) |
| 1335 | { |
| 1336 | case ArithmeticOperation::ADD: |
| 1337 | os << "ADD"; |
| 1338 | break; |
| 1339 | case ArithmeticOperation::SUB: |
| 1340 | os << "SUB"; |
| 1341 | break; |
| 1342 | case ArithmeticOperation::DIV: |
| 1343 | os << "DIV"; |
| 1344 | break; |
| 1345 | case ArithmeticOperation::MAX: |
| 1346 | os << "MAX"; |
| 1347 | break; |
| 1348 | case ArithmeticOperation::MIN: |
| 1349 | os << "MIN"; |
| 1350 | break; |
| 1351 | case ArithmeticOperation::SQUARED_DIFF: |
| 1352 | os << "SQUARED_DIFF"; |
| 1353 | break; |
| 1354 | default: |
| 1355 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1356 | } |
| 1357 | |
| 1358 | return os; |
| 1359 | } |
| 1360 | |
| 1361 | /** Formatted output of the Arithmetic Operation |
| 1362 | * |
| 1363 | * @param[in] op Type to output. |
| 1364 | * |
| 1365 | * @return Formatted string. |
| 1366 | */ |
| 1367 | inline std::string to_string(const ArithmeticOperation &op) |
| 1368 | { |
| 1369 | std::stringstream str; |
| 1370 | str << op; |
| 1371 | return str.str(); |
| 1372 | } |
| 1373 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1374 | /** Formatted output of the Reduction Operations. |
| 1375 | * |
| 1376 | * @param[out] os Output stream. |
| 1377 | * @param[in] op Type to output. |
| 1378 | * |
| 1379 | * @return Modified output stream. |
| 1380 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1381 | inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op) |
| 1382 | { |
| 1383 | switch(op) |
| 1384 | { |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1385 | case ReductionOperation::SUM: |
| 1386 | os << "SUM"; |
| 1387 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1388 | case ReductionOperation::SUM_SQUARE: |
| 1389 | os << "SUM_SQUARE"; |
| 1390 | break; |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1391 | case ReductionOperation::MEAN_SUM: |
| 1392 | os << "MEAN_SUM"; |
| 1393 | break; |
Michalis Spyrou | 7930db4 | 2018-11-22 17:36:28 +0000 | [diff] [blame] | 1394 | case ReductionOperation::ARG_IDX_MAX: |
| 1395 | os << "ARG_IDX_MAX"; |
| 1396 | break; |
| 1397 | case ReductionOperation::ARG_IDX_MIN: |
| 1398 | os << "ARG_IDX_MIN"; |
| 1399 | break; |
Manuel Bottini | b412fab | 2018-12-10 17:40:23 +0000 | [diff] [blame^] | 1400 | case ReductionOperation::PROD: |
| 1401 | os << "PROD"; |
| 1402 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1403 | default: |
| 1404 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1405 | } |
| 1406 | |
| 1407 | return os; |
| 1408 | } |
| 1409 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1410 | /** Formatted output of the Reduction Operations. |
| 1411 | * |
| 1412 | * @param[in] op Type to output. |
| 1413 | * |
| 1414 | * @return Formatted string. |
| 1415 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1416 | inline std::string to_string(const ReductionOperation &op) |
| 1417 | { |
| 1418 | std::stringstream str; |
| 1419 | str << op; |
| 1420 | return str.str(); |
| 1421 | } |
| 1422 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1423 | /** Formatted output of the Comparison Operations. |
| 1424 | * |
| 1425 | * @param[out] os Output stream. |
| 1426 | * @param[in] op Type to output. |
| 1427 | * |
| 1428 | * @return Modified output stream. |
| 1429 | */ |
| 1430 | inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op) |
| 1431 | { |
| 1432 | switch(op) |
| 1433 | { |
| 1434 | case ComparisonOperation::Equal: |
| 1435 | os << "Equal"; |
| 1436 | break; |
| 1437 | case ComparisonOperation::NotEqual: |
| 1438 | os << "NotEqual"; |
| 1439 | break; |
| 1440 | case ComparisonOperation::Greater: |
| 1441 | os << "Greater"; |
| 1442 | break; |
| 1443 | case ComparisonOperation::GreaterEqual: |
| 1444 | os << "GreaterEqual"; |
| 1445 | break; |
| 1446 | case ComparisonOperation::Less: |
| 1447 | os << "Less"; |
| 1448 | break; |
| 1449 | case ComparisonOperation::LessEqual: |
| 1450 | os << "LessEqual"; |
| 1451 | break; |
| 1452 | default: |
| 1453 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1454 | } |
| 1455 | |
| 1456 | return os; |
| 1457 | } |
| 1458 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1459 | /** Formatted output of the Elementwise unary Operations. |
| 1460 | * |
| 1461 | * @param[out] os Output stream. |
| 1462 | * @param[in] op Type to output. |
| 1463 | * |
| 1464 | * @return Modified output stream. |
| 1465 | */ |
| 1466 | inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op) |
| 1467 | { |
| 1468 | switch(op) |
| 1469 | { |
| 1470 | case ElementWiseUnary::RSQRT: |
| 1471 | os << "RSQRT"; |
| 1472 | break; |
| 1473 | case ElementWiseUnary::EXP: |
| 1474 | os << "EXP"; |
| 1475 | break; |
| 1476 | default: |
| 1477 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1478 | } |
| 1479 | |
| 1480 | return os; |
| 1481 | } |
| 1482 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1483 | /** Formatted output of the Comparison Operations. |
| 1484 | * |
| 1485 | * @param[in] op Type to output. |
| 1486 | * |
| 1487 | * @return Formatted string. |
| 1488 | */ |
| 1489 | inline std::string to_string(const ComparisonOperation &op) |
| 1490 | { |
| 1491 | std::stringstream str; |
| 1492 | str << op; |
| 1493 | return str.str(); |
| 1494 | } |
| 1495 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1496 | /** Formatted output of the Elementwise unary Operations. |
| 1497 | * |
| 1498 | * @param[in] op Type to output. |
| 1499 | * |
| 1500 | * @return Formatted string. |
| 1501 | */ |
| 1502 | inline std::string to_string(const ElementWiseUnary &op) |
| 1503 | { |
| 1504 | std::stringstream str; |
| 1505 | str << op; |
| 1506 | return str.str(); |
| 1507 | } |
| 1508 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1509 | /** Formatted output of the Norm Type. |
| 1510 | * |
| 1511 | * @param[in] type Type to output. |
| 1512 | * |
| 1513 | * @return Formatted string. |
| 1514 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1515 | inline std::string to_string(const NormType &type) |
| 1516 | { |
| 1517 | std::stringstream str; |
| 1518 | str << type; |
| 1519 | return str.str(); |
| 1520 | } |
| 1521 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1522 | /** Formatted output of the Pooling Type. |
| 1523 | * |
| 1524 | * @param[in] type Type to output. |
| 1525 | * |
| 1526 | * @return Formatted string. |
| 1527 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1528 | inline std::string to_string(const PoolingType &type) |
| 1529 | { |
| 1530 | std::stringstream str; |
| 1531 | str << type; |
| 1532 | return str.str(); |
| 1533 | } |
| 1534 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1535 | /** Formatted output of the Pooling Layer Info. |
| 1536 | * |
| 1537 | * @param[in] info Type to output. |
| 1538 | * |
| 1539 | * @return Formatted string. |
| 1540 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1541 | inline std::string to_string(const PoolingLayerInfo &info) |
| 1542 | { |
| 1543 | std::stringstream str; |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1544 | str << "{Type=" << info.pool_type() << "," |
| 1545 | << "IsGlobalPooling=" << info.is_global_pooling(); |
| 1546 | if(!info.is_global_pooling()) |
| 1547 | { |
| 1548 | str << "," |
Isabella Gottardi | 6e464c3 | 2018-01-26 12:32:45 +0000 | [diff] [blame] | 1549 | << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << "," |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1550 | << "PadStride=" << info.pad_stride_info(); |
| 1551 | } |
| 1552 | str << "}"; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1553 | return str.str(); |
| 1554 | } |
| 1555 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 1556 | /** Formatted output of the PriorBoxLayerInfo. |
| 1557 | * |
| 1558 | * @param[in] info Type to output. |
| 1559 | * |
| 1560 | * @return Formatted string. |
| 1561 | */ |
| 1562 | inline std::string to_string(const PriorBoxLayerInfo &info) |
| 1563 | { |
| 1564 | std::stringstream str; |
| 1565 | str << "{"; |
| 1566 | str << "Clip:" << info.clip() |
| 1567 | << "Flip:" << info.flip() |
| 1568 | << "StepX:" << info.steps()[0] |
| 1569 | << "StepY:" << info.steps()[1] |
| 1570 | << "MinSizes:" << info.min_sizes().size() |
| 1571 | << "MaxSizes:" << info.max_sizes().size() |
| 1572 | << "ImgSizeX:" << info.img_size().x |
| 1573 | << "ImgSizeY:" << info.img_size().y |
| 1574 | << "Offset:" << info.offset() |
| 1575 | << "Variances:" << info.variances().size(); |
| 1576 | str << "}"; |
| 1577 | return str.str(); |
| 1578 | } |
| 1579 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1580 | /** Formatted output of the KeyPoint type. |
| 1581 | * |
| 1582 | * @param[out] os Output stream |
| 1583 | * @param[in] point Type to output. |
| 1584 | * |
| 1585 | * @return Modified output stream. |
| 1586 | */ |
Moritz Pflanzer | 6c6597c | 2017-09-24 12:09:41 +0100 | [diff] [blame] | 1587 | inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point) |
| 1588 | { |
| 1589 | os << "{x=" << point.x << "," |
| 1590 | << "y=" << point.y << "," |
| 1591 | << "strength=" << point.strength << "," |
| 1592 | << "scale=" << point.scale << "," |
| 1593 | << "orientation=" << point.orientation << "," |
| 1594 | << "tracking_status=" << point.tracking_status << "," |
| 1595 | << "error=" << point.error << "}"; |
| 1596 | |
| 1597 | return os; |
| 1598 | } |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1599 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1600 | /** Formatted output of the PhaseType type. |
| 1601 | * |
| 1602 | * @param[out] os Output stream |
| 1603 | * @param[in] phase_type Type to output. |
| 1604 | * |
| 1605 | * @return Modified output stream. |
| 1606 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1607 | inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type) |
| 1608 | { |
| 1609 | switch(phase_type) |
| 1610 | { |
| 1611 | case PhaseType::SIGNED: |
| 1612 | os << "SIGNED"; |
| 1613 | break; |
| 1614 | case PhaseType::UNSIGNED: |
| 1615 | os << "UNSIGNED"; |
| 1616 | break; |
| 1617 | default: |
| 1618 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1619 | } |
| 1620 | |
| 1621 | return os; |
| 1622 | } |
| 1623 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1624 | /** Formatted output of the PhaseType type. |
| 1625 | * |
| 1626 | * @param[in] type Type to output. |
| 1627 | * |
| 1628 | * @return Formatted string. |
| 1629 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1630 | inline std::string to_string(const arm_compute::PhaseType &type) |
| 1631 | { |
| 1632 | std::stringstream str; |
| 1633 | str << type; |
| 1634 | return str.str(); |
| 1635 | } |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1636 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1637 | /** Formatted output of the MagnitudeType type. |
| 1638 | * |
| 1639 | * @param[out] os Output stream |
| 1640 | * @param[in] magnitude_type Type to output. |
| 1641 | * |
| 1642 | * @return Modified output stream. |
| 1643 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1644 | inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type) |
| 1645 | { |
| 1646 | switch(magnitude_type) |
| 1647 | { |
| 1648 | case MagnitudeType::L1NORM: |
| 1649 | os << "L1NORM"; |
| 1650 | break; |
| 1651 | case MagnitudeType::L2NORM: |
| 1652 | os << "L2NORM"; |
| 1653 | break; |
| 1654 | default: |
| 1655 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1656 | } |
| 1657 | |
| 1658 | return os; |
| 1659 | } |
| 1660 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1661 | /** Formatted output of the MagnitudeType type. |
| 1662 | * |
| 1663 | * @param[in] type Type to output. |
| 1664 | * |
| 1665 | * @return Formatted string. |
| 1666 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1667 | inline std::string to_string(const arm_compute::MagnitudeType &type) |
| 1668 | { |
| 1669 | std::stringstream str; |
| 1670 | str << type; |
| 1671 | return str.str(); |
| 1672 | } |
John Richardson | 1c52992 | 2017-11-01 10:57:48 +0000 | [diff] [blame] | 1673 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1674 | /** Formatted output of the HOGNormType type. |
| 1675 | * |
| 1676 | * @param[out] os Output stream |
| 1677 | * @param[in] norm_type Type to output |
| 1678 | * |
| 1679 | * @return Modified output stream. |
| 1680 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1681 | inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type) |
| 1682 | { |
| 1683 | switch(norm_type) |
| 1684 | { |
| 1685 | case HOGNormType::L1_NORM: |
| 1686 | os << "L1_NORM"; |
| 1687 | break; |
| 1688 | case HOGNormType::L2_NORM: |
| 1689 | os << "L2_NORM"; |
| 1690 | break; |
| 1691 | case HOGNormType::L2HYS_NORM: |
| 1692 | os << "L2HYS_NORM"; |
| 1693 | break; |
| 1694 | default: |
| 1695 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1696 | } |
| 1697 | |
| 1698 | return os; |
| 1699 | } |
| 1700 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1701 | /** Formatted output of the HOGNormType type. |
| 1702 | * |
| 1703 | * @param[in] type Type to output |
| 1704 | * |
| 1705 | * @return Formatted string. |
| 1706 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1707 | inline std::string to_string(const HOGNormType &type) |
| 1708 | { |
| 1709 | std::stringstream str; |
| 1710 | str << type; |
| 1711 | return str.str(); |
| 1712 | } |
| 1713 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1714 | /** Formatted output of the Size2D type. |
| 1715 | * |
| 1716 | * @param[out] os Output stream |
| 1717 | * @param[in] size Type to output |
| 1718 | * |
| 1719 | * @return Modified output stream. |
| 1720 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1721 | inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size) |
| 1722 | { |
| 1723 | os << size.width << "x" << size.height; |
| 1724 | |
| 1725 | return os; |
| 1726 | } |
| 1727 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1728 | /** Formatted output of the Size2D type. |
| 1729 | * |
| 1730 | * @param[in] type Type to output |
| 1731 | * |
| 1732 | * @return Formatted string. |
| 1733 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1734 | inline std::string to_string(const Size2D &type) |
| 1735 | { |
| 1736 | std::stringstream str; |
| 1737 | str << type; |
| 1738 | return str.str(); |
| 1739 | } |
| 1740 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1741 | /** Formatted output of the HOGInfo type. |
| 1742 | * |
| 1743 | * @param[out] os Output stream |
| 1744 | * @param[in] hog_info Type to output |
| 1745 | * |
| 1746 | * @return Modified output stream. |
| 1747 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1748 | inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info) |
| 1749 | { |
| 1750 | os << "{CellSize=" << hog_info.cell_size() << "," |
| 1751 | << "BlockSize=" << hog_info.block_size() << "," |
| 1752 | << "DetectionWindowSize=" << hog_info.detection_window_size() << "," |
| 1753 | << "BlockStride=" << hog_info.block_stride() << "," |
| 1754 | << "NumBins=" << hog_info.num_bins() << "," |
| 1755 | << "NormType=" << hog_info.normalization_type() << "," |
| 1756 | << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << "," |
| 1757 | << "PhaseType=" << hog_info.phase_type() << "}"; |
| 1758 | |
| 1759 | return os; |
| 1760 | } |
| 1761 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1762 | /** Formatted output of the HOGInfo type. |
| 1763 | * |
| 1764 | * @param[in] type Type to output |
| 1765 | * |
| 1766 | * @return Formatted string. |
| 1767 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1768 | inline std::string to_string(const HOGInfo &type) |
| 1769 | { |
| 1770 | std::stringstream str; |
| 1771 | str << type; |
| 1772 | return str.str(); |
| 1773 | } |
| 1774 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1775 | /** Formatted output of the ConvolutionMethod type. |
| 1776 | * |
| 1777 | * @param[out] os Output stream |
| 1778 | * @param[in] conv_method Type to output |
| 1779 | * |
| 1780 | * @return Modified output stream. |
| 1781 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1782 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method) |
| 1783 | { |
| 1784 | switch(conv_method) |
| 1785 | { |
| 1786 | case ConvolutionMethod::GEMM: |
| 1787 | os << "GEMM"; |
| 1788 | break; |
| 1789 | case ConvolutionMethod::DIRECT: |
| 1790 | os << "DIRECT"; |
| 1791 | break; |
| 1792 | case ConvolutionMethod::WINOGRAD: |
| 1793 | os << "WINOGRAD"; |
| 1794 | break; |
| 1795 | default: |
| 1796 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1797 | } |
| 1798 | |
| 1799 | return os; |
| 1800 | } |
| 1801 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1802 | /** Formatted output of the ConvolutionMethod type. |
| 1803 | * |
| 1804 | * @param[in] conv_method Type to output |
| 1805 | * |
| 1806 | * @return Formatted string. |
| 1807 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1808 | inline std::string to_string(const ConvolutionMethod &conv_method) |
| 1809 | { |
| 1810 | std::stringstream str; |
| 1811 | str << conv_method; |
| 1812 | return str.str(); |
| 1813 | } |
| 1814 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1815 | /** Formatted output of the GPUTarget type. |
| 1816 | * |
| 1817 | * @param[out] os Output stream |
| 1818 | * @param[in] gpu_target Type to output |
| 1819 | * |
| 1820 | * @return Modified output stream. |
| 1821 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1822 | inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target) |
| 1823 | { |
| 1824 | switch(gpu_target) |
| 1825 | { |
| 1826 | case GPUTarget::GPU_ARCH_MASK: |
| 1827 | os << "GPU_ARCH_MASK"; |
| 1828 | break; |
| 1829 | case GPUTarget::MIDGARD: |
| 1830 | os << "MIDGARD"; |
| 1831 | break; |
| 1832 | case GPUTarget::BIFROST: |
| 1833 | os << "BIFROST"; |
| 1834 | break; |
| 1835 | case GPUTarget::T600: |
| 1836 | os << "T600"; |
| 1837 | break; |
| 1838 | case GPUTarget::T700: |
| 1839 | os << "T700"; |
| 1840 | break; |
| 1841 | case GPUTarget::T800: |
| 1842 | os << "T800"; |
| 1843 | break; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1844 | case GPUTarget::G71: |
| 1845 | os << "G71"; |
| 1846 | break; |
| 1847 | case GPUTarget::G72: |
| 1848 | os << "G72"; |
| 1849 | break; |
| 1850 | case GPUTarget::G51: |
| 1851 | os << "G51"; |
| 1852 | break; |
| 1853 | case GPUTarget::G51BIG: |
| 1854 | os << "G51BIG"; |
| 1855 | break; |
| 1856 | case GPUTarget::G51LIT: |
| 1857 | os << "G51LIT"; |
| 1858 | break; |
Georgios Pinitas | b03f7c5 | 2018-07-12 10:49:53 +0100 | [diff] [blame] | 1859 | case GPUTarget::G76: |
| 1860 | os << "G76"; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1861 | break; |
| 1862 | case GPUTarget::TTRX: |
| 1863 | os << "TTRX"; |
| 1864 | break; |
| 1865 | case GPUTarget::TBOX: |
| 1866 | os << "TBOX"; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1867 | break; |
| 1868 | default: |
| 1869 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1870 | } |
| 1871 | |
| 1872 | return os; |
| 1873 | } |
| 1874 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1875 | /** Formatted output of the GPUTarget type. |
| 1876 | * |
| 1877 | * @param[in] gpu_target Type to output |
| 1878 | * |
| 1879 | * @return Formatted string. |
| 1880 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1881 | inline std::string to_string(const GPUTarget &gpu_target) |
| 1882 | { |
| 1883 | std::stringstream str; |
| 1884 | str << gpu_target; |
| 1885 | return str.str(); |
| 1886 | } |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 1887 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1888 | /** Formatted output of the DetectionWindow type. |
| 1889 | * |
| 1890 | * @param[out] os Output stream |
| 1891 | * @param[in] detection_window Type to output |
| 1892 | * |
| 1893 | * @return Modified output stream. |
| 1894 | */ |
John Richardson | 684cb0f | 2018-01-09 11:17:00 +0000 | [diff] [blame] | 1895 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window) |
| 1896 | { |
| 1897 | os << "{x=" << detection_window.x << "," |
| 1898 | << "y=" << detection_window.y << "," |
| 1899 | << "width=" << detection_window.width << "," |
| 1900 | << "height=" << detection_window.height << "," |
| 1901 | << "idx_class=" << detection_window.idx_class << "," |
| 1902 | << "score=" << detection_window.score << "}"; |
| 1903 | |
| 1904 | return os; |
| 1905 | } |
| 1906 | |
Isabella Gottardi | 05e5644 | 2018-11-16 11:26:52 +0000 | [diff] [blame] | 1907 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 1908 | * |
| 1909 | * @param[out] os Output stream |
| 1910 | * @param[in] detection_code Type to output |
| 1911 | * |
| 1912 | * @return Modified output stream. |
| 1913 | */ |
| 1914 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code) |
| 1915 | { |
| 1916 | switch(detection_code) |
| 1917 | { |
| 1918 | case DetectionOutputLayerCodeType::CENTER_SIZE: |
| 1919 | os << "CENTER_SIZE"; |
| 1920 | break; |
| 1921 | case DetectionOutputLayerCodeType::CORNER: |
| 1922 | os << "CORNER"; |
| 1923 | break; |
| 1924 | case DetectionOutputLayerCodeType::CORNER_SIZE: |
| 1925 | os << "CORNER_SIZE"; |
| 1926 | break; |
| 1927 | case DetectionOutputLayerCodeType::TF_CENTER: |
| 1928 | os << "TF_CENTER"; |
| 1929 | break; |
| 1930 | default: |
| 1931 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1932 | } |
| 1933 | |
| 1934 | return os; |
| 1935 | } |
| 1936 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 1937 | * |
| 1938 | * @param[in] detection_code Type to output |
| 1939 | * |
| 1940 | * @return Formatted string. |
| 1941 | */ |
| 1942 | inline std::string to_string(const DetectionOutputLayerCodeType &detection_code) |
| 1943 | { |
| 1944 | std::stringstream str; |
| 1945 | str << detection_code; |
| 1946 | return str.str(); |
| 1947 | } |
| 1948 | |
| 1949 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 1950 | * |
| 1951 | * @param[out] os Output stream |
| 1952 | * @param[in] detection_info Type to output |
| 1953 | * |
| 1954 | * @return Modified output stream. |
| 1955 | */ |
| 1956 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info) |
| 1957 | { |
| 1958 | os << "{Classes=" << detection_info.num_classes() << "," |
| 1959 | << "ShareLocation=" << detection_info.share_location() << "," |
| 1960 | << "CodeType=" << detection_info.code_type() << "," |
| 1961 | << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << "," |
| 1962 | << "KeepTopK=" << detection_info.keep_top_k() << "," |
| 1963 | << "NMSThreshold=" << detection_info.nms_threshold() << "," |
| 1964 | << "Eta=" << detection_info.eta() << "," |
| 1965 | << "BackgroundLabelId=" << detection_info.background_label_id() << "," |
| 1966 | << "ConfidenceThreshold=" << detection_info.confidence_threshold() << "," |
| 1967 | << "TopK=" << detection_info.top_k() << "," |
| 1968 | << "NumLocClasses=" << detection_info.num_loc_classes() |
| 1969 | << "}"; |
| 1970 | |
| 1971 | return os; |
| 1972 | } |
| 1973 | |
| 1974 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 1975 | * |
| 1976 | * @param[in] detection_info Type to output |
| 1977 | * |
| 1978 | * @return Formatted string. |
| 1979 | */ |
| 1980 | inline std::string to_string(const DetectionOutputLayerInfo &detection_info) |
| 1981 | { |
| 1982 | std::stringstream str; |
| 1983 | str << detection_info; |
| 1984 | return str.str(); |
| 1985 | } |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1986 | /** Formatted output of the DetectionWindow type. |
| 1987 | * |
| 1988 | * @param[in] detection_window Type to output |
| 1989 | * |
| 1990 | * @return Formatted string. |
| 1991 | */ |
| 1992 | inline std::string to_string(const DetectionWindow &detection_window) |
| 1993 | { |
| 1994 | std::stringstream str; |
| 1995 | str << detection_window; |
| 1996 | return str.str(); |
| 1997 | } |
| 1998 | |
| 1999 | /** Formatted output of the Termination type. |
| 2000 | * |
| 2001 | * @param[out] os Output stream |
| 2002 | * @param[in] termination Type to output |
| 2003 | * |
| 2004 | * @return Modified output stream. |
| 2005 | */ |
| 2006 | inline ::std::ostream &operator<<(::std::ostream &os, const Termination &termination) |
| 2007 | { |
| 2008 | switch(termination) |
| 2009 | { |
| 2010 | case Termination::TERM_CRITERIA_EPSILON: |
| 2011 | os << "TERM_CRITERIA_EPSILON"; |
| 2012 | break; |
| 2013 | case Termination::TERM_CRITERIA_ITERATIONS: |
| 2014 | os << "TERM_CRITERIA_ITERATIONS"; |
| 2015 | break; |
| 2016 | case Termination::TERM_CRITERIA_BOTH: |
| 2017 | os << "TERM_CRITERIA_BOTH"; |
| 2018 | break; |
| 2019 | default: |
| 2020 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2021 | } |
| 2022 | |
| 2023 | return os; |
| 2024 | } |
| 2025 | |
| 2026 | /** Formatted output of the Termination type. |
| 2027 | * |
| 2028 | * @param[in] termination Type to output |
| 2029 | * |
| 2030 | * @return Formatted string. |
| 2031 | */ |
| 2032 | inline std::string to_string(const Termination &termination) |
| 2033 | { |
| 2034 | std::stringstream str; |
| 2035 | str << termination; |
| 2036 | return str.str(); |
| 2037 | } |
| 2038 | |
Anthony Barbier | 8914e32 | 2018-08-10 15:28:25 +0100 | [diff] [blame] | 2039 | /** Formatted output of the CPUModel type. |
| 2040 | * |
| 2041 | * @param[out] os Output stream |
| 2042 | * @param[in] cpu_model Model to output |
| 2043 | * |
| 2044 | * @return Modified output stream. |
| 2045 | */ |
| 2046 | inline ::std::ostream &operator<<(::std::ostream &os, const CPUModel &cpu_model) |
| 2047 | { |
| 2048 | switch(cpu_model) |
| 2049 | { |
| 2050 | case CPUModel::GENERIC: |
| 2051 | os << "GENERIC"; |
| 2052 | break; |
| 2053 | case CPUModel::GENERIC_FP16: |
| 2054 | os << "GENERIC_FP16"; |
| 2055 | break; |
| 2056 | case CPUModel::GENERIC_FP16_DOT: |
| 2057 | os << "GENERIC_FP16_DOT"; |
| 2058 | break; |
| 2059 | case CPUModel::A53: |
| 2060 | os << "A53"; |
| 2061 | break; |
| 2062 | case CPUModel::A55r0: |
| 2063 | os << "A55r0"; |
| 2064 | break; |
| 2065 | case CPUModel::A55r1: |
| 2066 | os << "A55r1"; |
| 2067 | break; |
| 2068 | default: |
| 2069 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2070 | } |
| 2071 | |
| 2072 | return os; |
| 2073 | } |
| 2074 | |
| 2075 | /** Formatted output of the CPUModel type. |
| 2076 | * |
| 2077 | * @param[in] cpu_model Model to output |
| 2078 | * |
| 2079 | * @return Formatted string. |
| 2080 | */ |
| 2081 | inline std::string to_string(const CPUModel &cpu_model) |
| 2082 | { |
| 2083 | std::stringstream str; |
| 2084 | str << cpu_model; |
| 2085 | return str.str(); |
| 2086 | } |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2087 | /** Formatted output of a vector of objects. |
| 2088 | * |
| 2089 | * @param[out] os Output stream |
| 2090 | * @param[in] args Vector of objects to print |
| 2091 | * |
| 2092 | * @return Modified output stream. |
| 2093 | */ |
| 2094 | template <typename T> |
| 2095 | inline ::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args) |
| 2096 | { |
| 2097 | os << "["; |
| 2098 | bool first = true; |
| 2099 | for(auto &arg : args) |
| 2100 | { |
| 2101 | if(first) |
| 2102 | { |
| 2103 | first = false; |
| 2104 | } |
| 2105 | else |
| 2106 | { |
| 2107 | os << ", "; |
| 2108 | } |
| 2109 | os << arg; |
| 2110 | } |
| 2111 | os << "]"; |
| 2112 | return os; |
| 2113 | } |
| 2114 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 2115 | /** Formatted output of @ref PriorBoxLayerInfo. |
| 2116 | * |
| 2117 | * @param[out] os Output stream. |
| 2118 | * @param[in] info Type to output. |
| 2119 | * |
| 2120 | * @return Modified output stream. |
| 2121 | */ |
| 2122 | inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info) |
| 2123 | { |
| 2124 | os << "Clip:" << info.clip() |
| 2125 | << "Flip:" << info.flip() |
| 2126 | << "StepX:" << info.steps()[0] |
| 2127 | << "StepY:" << info.steps()[1] |
| 2128 | << "MinSizes:" << info.min_sizes() |
| 2129 | << "MaxSizes:" << info.max_sizes() |
| 2130 | << "ImgSizeX:" << info.img_size().x |
| 2131 | << "ImgSizeY:" << info.img_size().y |
| 2132 | << "Offset:" << info.offset() |
| 2133 | << "Variances:" << info.variances(); |
| 2134 | |
| 2135 | return os; |
| 2136 | } |
| 2137 | |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2138 | /** Formatted output of a vector of objects. |
| 2139 | * |
| 2140 | * @param[in] args Vector of objects to print |
| 2141 | * |
| 2142 | * @return String representing args. |
| 2143 | */ |
| 2144 | template <typename T> |
| 2145 | std::string to_string(const std::vector<T> &args) |
| 2146 | { |
| 2147 | std::stringstream str; |
| 2148 | str << args; |
| 2149 | return str.str(); |
| 2150 | } |
| 2151 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2152 | /** Formatted output of the WinogradInfo type. */ |
| 2153 | inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info) |
| 2154 | { |
| 2155 | os << "{OutputTileSize=" << info.output_tile_size << "," |
| 2156 | << "KernelSize=" << info.kernel_size << "," |
| 2157 | << "PadStride=" << info.convolution_info << "," |
| 2158 | << "OutputDataLayout=" << info.output_data_layout << "}"; |
| 2159 | |
| 2160 | return os; |
| 2161 | } |
| 2162 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2163 | inline std::string to_string(const WinogradInfo &type) |
| 2164 | { |
| 2165 | std::stringstream str; |
| 2166 | str << type; |
| 2167 | return str.str(); |
| 2168 | } |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2169 | |
| 2170 | /** Fallback method: try to use std::to_string: |
| 2171 | * |
| 2172 | * @param[in] val Value to convert to string |
| 2173 | * |
| 2174 | * @return String representing val. |
| 2175 | */ |
| 2176 | template <typename T> |
| 2177 | inline std::string to_string(const T &val) |
| 2178 | { |
| 2179 | return support::cpp11::to_string(val); |
| 2180 | } |
| 2181 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 2182 | } // namespace arm_compute |
Anthony Barbier | 4dbc0a9 | 2018-08-27 13:39:47 +0100 | [diff] [blame] | 2183 | |
| 2184 | #endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */ |