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