Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2020 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 | |
Anthony Barbier | 8914e32 | 2018-08-10 15:28:25 +0100 | [diff] [blame] | 27 | #include "arm_compute/core/CPP/CPPTypes.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 28 | #include "arm_compute/core/Dimensions.h" |
| 29 | #include "arm_compute/core/Error.h" |
Michele Di Giorgio | b8fc60f | 2018-04-25 11:58:07 +0100 | [diff] [blame] | 30 | #include "arm_compute/core/GPUTarget.h" |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 31 | #include "arm_compute/core/HOGInfo.h" |
| 32 | #include "arm_compute/core/Size2D.h" |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 33 | #include "arm_compute/core/Strides.h" |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 34 | #include "arm_compute/core/TensorInfo.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 35 | #include "arm_compute/core/Types.h" |
Vidhya Sudhan Loganathan | 050471e | 2019-04-25 09:27:24 +0100 | [diff] [blame] | 36 | #include "arm_compute/runtime/CL/CLTunerTypes.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 | |
Manuel Bottini | 5209be5 | 2019-02-13 16:34:56 +0000 | [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 | * |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 318 | * @param[out] os Output stream. |
| 319 | * @param[in] qinfo Type to output. |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 320 | * |
| 321 | * @return Modified output stream. |
| 322 | */ |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 323 | inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo) |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 324 | { |
Georgios Pinitas | 3d13af8 | 2019-06-04 13:04:16 +0100 | [diff] [blame] | 325 | const UniformQuantizationInfo uqinfo = qinfo.uniform(); |
| 326 | os << "Scale:" << uqinfo.scale << "~"; |
| 327 | os << "Offset:" << uqinfo.offset; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 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; |
Georgios Pinitas | fb0fdcd | 2019-08-22 17:10:04 +0100 | [diff] [blame] | 382 | case ActivationLayerInfo::ActivationFunction::ELU: |
| 383 | os << "ELU"; |
| 384 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 385 | case ActivationLayerInfo::ActivationFunction::SQUARE: |
| 386 | os << "SQUARE"; |
| 387 | break; |
| 388 | case ActivationLayerInfo::ActivationFunction::TANH: |
| 389 | os << "TANH"; |
| 390 | break; |
Usama Arif | 6a98a6e | 2019-05-10 17:07:27 +0100 | [diff] [blame] | 391 | case ActivationLayerInfo::ActivationFunction::IDENTITY: |
| 392 | os << "IDENTITY"; |
| 393 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 394 | default: |
| 395 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 396 | } |
| 397 | |
| 398 | return os; |
| 399 | } |
| 400 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 401 | /** Formatted output of the activation function info type. |
| 402 | * |
| 403 | * @param[in] info Type to output. |
| 404 | * |
| 405 | * @return Formatted string. |
| 406 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 407 | inline std::string to_string(const arm_compute::ActivationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 408 | { |
| 409 | std::stringstream str; |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 410 | if(info.enabled()) |
| 411 | { |
| 412 | str << info.activation(); |
| 413 | } |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 414 | return str.str(); |
| 415 | } |
| 416 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 417 | /** Formatted output of the activation function type. |
| 418 | * |
| 419 | * @param[in] function Type to output. |
| 420 | * |
| 421 | * @return Formatted string. |
| 422 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 423 | inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function) |
| 424 | { |
| 425 | std::stringstream str; |
| 426 | str << function; |
| 427 | return str.str(); |
| 428 | } |
| 429 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 430 | /** Formatted output of the NormType type. |
| 431 | * |
| 432 | * @param[out] os Output stream. |
| 433 | * @param[in] norm_type Type to output. |
| 434 | * |
| 435 | * @return Modified output stream. |
| 436 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 437 | inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type) |
| 438 | { |
| 439 | switch(norm_type) |
| 440 | { |
| 441 | case NormType::CROSS_MAP: |
| 442 | os << "CROSS_MAP"; |
| 443 | break; |
| 444 | case NormType::IN_MAP_1D: |
| 445 | os << "IN_MAP_1D"; |
| 446 | break; |
| 447 | case NormType::IN_MAP_2D: |
| 448 | os << "IN_MAP_2D"; |
| 449 | break; |
| 450 | default: |
| 451 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 452 | } |
| 453 | |
| 454 | return os; |
| 455 | } |
| 456 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 457 | /** Formatted output of @ref NormalizationLayerInfo. |
| 458 | * |
| 459 | * @param[in] info Type to output. |
| 460 | * |
| 461 | * @return Formatted string. |
| 462 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 463 | inline std::string to_string(const arm_compute::NormalizationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 464 | { |
| 465 | std::stringstream str; |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 466 | str << info.type() << ":NormSize=" << info.norm_size(); |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 467 | return str.str(); |
| 468 | } |
| 469 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 470 | /** Formatted output of @ref NormalizationLayerInfo. |
| 471 | * |
| 472 | * @param[out] os Output stream. |
| 473 | * @param[in] info Type to output. |
| 474 | * |
| 475 | * @return Modified output stream. |
| 476 | */ |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 477 | inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info) |
| 478 | { |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 479 | os << info.type() << ":NormSize=" << info.norm_size(); |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 480 | return os; |
| 481 | } |
| 482 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 483 | /** Formatted output of the PoolingType type. |
| 484 | * |
| 485 | * @param[out] os Output stream. |
| 486 | * @param[in] pool_type Type to output. |
| 487 | * |
| 488 | * @return Modified output stream. |
| 489 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 490 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type) |
| 491 | { |
| 492 | switch(pool_type) |
| 493 | { |
| 494 | case PoolingType::AVG: |
| 495 | os << "AVG"; |
| 496 | break; |
| 497 | case PoolingType::MAX: |
| 498 | os << "MAX"; |
| 499 | break; |
Georgios Pinitas | cdf5145 | 2017-08-31 14:21:36 +0100 | [diff] [blame] | 500 | case PoolingType::L2: |
| 501 | os << "L2"; |
| 502 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 503 | default: |
| 504 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 505 | } |
| 506 | |
| 507 | return os; |
| 508 | } |
| 509 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 510 | /** Formatted output of @ref PoolingLayerInfo. |
| 511 | * |
| 512 | * @param[out] os Output stream. |
| 513 | * @param[in] info Type to output. |
| 514 | * |
| 515 | * @return Modified output stream. |
| 516 | */ |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 517 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) |
| 518 | { |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 519 | os << info.pool_type; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 520 | |
| 521 | return os; |
| 522 | } |
| 523 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 524 | /** Formatted output of @ref RoundingPolicy. |
| 525 | * |
| 526 | * @param[in] rounding_policy Type to output. |
| 527 | * |
| 528 | * @return Formatted string. |
| 529 | */ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 530 | inline std::string to_string(const RoundingPolicy &rounding_policy) |
| 531 | { |
| 532 | std::stringstream str; |
| 533 | str << rounding_policy; |
| 534 | return str.str(); |
| 535 | } |
| 536 | |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 537 | /** [Print DataLayout type] **/ |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 538 | /** Formatted output of the DataLayout type. |
| 539 | * |
| 540 | * @param[out] os Output stream. |
| 541 | * @param[in] data_layout Type to output. |
| 542 | * |
| 543 | * @return Modified output stream. |
| 544 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 545 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout) |
| 546 | { |
| 547 | switch(data_layout) |
| 548 | { |
| 549 | case DataLayout::UNKNOWN: |
| 550 | os << "UNKNOWN"; |
| 551 | break; |
| 552 | case DataLayout::NHWC: |
| 553 | os << "NHWC"; |
| 554 | break; |
| 555 | case DataLayout::NCHW: |
| 556 | os << "NCHW"; |
| 557 | break; |
| 558 | default: |
| 559 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 560 | } |
| 561 | |
| 562 | return os; |
| 563 | } |
| 564 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 565 | /** Formatted output of the DataLayout type. |
| 566 | * |
| 567 | * @param[in] data_layout Type to output. |
| 568 | * |
| 569 | * @return Formatted string. |
| 570 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 571 | inline std::string to_string(const arm_compute::DataLayout &data_layout) |
| 572 | { |
| 573 | std::stringstream str; |
| 574 | str << data_layout; |
| 575 | return str.str(); |
| 576 | } |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 577 | /** [Print DataLayout type] **/ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 578 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 579 | /** Formatted output of the DataLayoutDimension type. |
| 580 | * |
| 581 | * @param[out] os Output stream. |
| 582 | * @param[in] data_layout_dim Data layout dimension to print. |
| 583 | * |
| 584 | * @return Modified output stream. |
| 585 | */ |
| 586 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim) |
| 587 | { |
| 588 | switch(data_layout_dim) |
| 589 | { |
| 590 | case DataLayoutDimension::WIDTH: |
| 591 | os << "WIDTH"; |
| 592 | break; |
| 593 | case DataLayoutDimension::HEIGHT: |
| 594 | os << "HEIGHT"; |
| 595 | break; |
| 596 | case DataLayoutDimension::CHANNEL: |
| 597 | os << "CHANNEL"; |
| 598 | break; |
| 599 | case DataLayoutDimension::BATCHES: |
| 600 | os << "BATCHES"; |
| 601 | break; |
| 602 | default: |
| 603 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 604 | } |
| 605 | return os; |
| 606 | } |
| 607 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 608 | /** Formatted output of the DataType type. |
| 609 | * |
| 610 | * @param[out] os Output stream. |
| 611 | * @param[in] data_type Type to output. |
| 612 | * |
| 613 | * @return Modified output stream. |
| 614 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 615 | inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) |
| 616 | { |
| 617 | switch(data_type) |
| 618 | { |
| 619 | case DataType::UNKNOWN: |
| 620 | os << "UNKNOWN"; |
| 621 | break; |
| 622 | case DataType::U8: |
| 623 | os << "U8"; |
| 624 | break; |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 625 | case DataType::QSYMM8: |
| 626 | os << "QSYMM8"; |
| 627 | break; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 628 | case DataType::QASYMM8: |
| 629 | os << "QASYMM8"; |
| 630 | break; |
Georgios Pinitas | 448a81f | 2019-11-21 14:10:25 +0000 | [diff] [blame] | 631 | case DataType::QASYMM8_SIGNED: |
| 632 | os << "QASYMM8_SIGNED"; |
| 633 | break; |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 634 | case DataType::QSYMM8_PER_CHANNEL: |
| 635 | os << "QSYMM8_PER_CHANNEL"; |
| 636 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 637 | case DataType::S8: |
| 638 | os << "S8"; |
| 639 | break; |
| 640 | case DataType::U16: |
| 641 | os << "U16"; |
| 642 | break; |
| 643 | case DataType::S16: |
| 644 | os << "S16"; |
| 645 | break; |
Manuel Bottini | 3689fcd | 2019-06-14 17:18:12 +0100 | [diff] [blame] | 646 | case DataType::QSYMM16: |
| 647 | os << "QSYMM16"; |
| 648 | break; |
Michele Di Giorgio | 35ea9a7 | 2019-08-23 12:02:06 +0100 | [diff] [blame] | 649 | case DataType::QASYMM16: |
| 650 | os << "QASYMM16"; |
| 651 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 652 | case DataType::U32: |
| 653 | os << "U32"; |
| 654 | break; |
| 655 | case DataType::S32: |
| 656 | os << "S32"; |
| 657 | break; |
| 658 | case DataType::U64: |
| 659 | os << "U64"; |
| 660 | break; |
| 661 | case DataType::S64: |
| 662 | os << "S64"; |
| 663 | break; |
| 664 | case DataType::F16: |
| 665 | os << "F16"; |
| 666 | break; |
| 667 | case DataType::F32: |
| 668 | os << "F32"; |
| 669 | break; |
| 670 | case DataType::F64: |
| 671 | os << "F64"; |
| 672 | break; |
| 673 | case DataType::SIZET: |
| 674 | os << "SIZET"; |
| 675 | break; |
| 676 | default: |
| 677 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 678 | } |
| 679 | |
| 680 | return os; |
| 681 | } |
| 682 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 683 | /** Formatted output of the DataType type. |
| 684 | * |
| 685 | * @param[in] data_type Type to output. |
| 686 | * |
| 687 | * @return Formatted string. |
| 688 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 689 | inline std::string to_string(const arm_compute::DataType &data_type) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 690 | { |
| 691 | std::stringstream str; |
| 692 | str << data_type; |
| 693 | return str.str(); |
| 694 | } |
| 695 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 696 | /** Formatted output of the Format type. |
| 697 | * |
| 698 | * @param[out] os Output stream. |
| 699 | * @param[in] format Type to output. |
| 700 | * |
| 701 | * @return Modified output stream. |
| 702 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 703 | inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) |
| 704 | { |
| 705 | switch(format) |
| 706 | { |
| 707 | case Format::UNKNOWN: |
| 708 | os << "UNKNOWN"; |
| 709 | break; |
| 710 | case Format::U8: |
| 711 | os << "U8"; |
| 712 | break; |
| 713 | case Format::S16: |
| 714 | os << "S16"; |
| 715 | break; |
| 716 | case Format::U16: |
| 717 | os << "U16"; |
| 718 | break; |
| 719 | case Format::S32: |
| 720 | os << "S32"; |
| 721 | break; |
| 722 | case Format::U32: |
| 723 | os << "U32"; |
| 724 | break; |
| 725 | case Format::F16: |
| 726 | os << "F16"; |
| 727 | break; |
| 728 | case Format::F32: |
| 729 | os << "F32"; |
| 730 | break; |
| 731 | case Format::UV88: |
| 732 | os << "UV88"; |
| 733 | break; |
| 734 | case Format::RGB888: |
| 735 | os << "RGB888"; |
| 736 | break; |
| 737 | case Format::RGBA8888: |
| 738 | os << "RGBA8888"; |
| 739 | break; |
| 740 | case Format::YUV444: |
| 741 | os << "YUV444"; |
| 742 | break; |
| 743 | case Format::YUYV422: |
| 744 | os << "YUYV422"; |
| 745 | break; |
| 746 | case Format::NV12: |
| 747 | os << "NV12"; |
| 748 | break; |
| 749 | case Format::NV21: |
| 750 | os << "NV21"; |
| 751 | break; |
| 752 | case Format::IYUV: |
| 753 | os << "IYUV"; |
| 754 | break; |
| 755 | case Format::UYVY422: |
| 756 | os << "UYVY422"; |
| 757 | break; |
| 758 | default: |
| 759 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 760 | } |
| 761 | |
| 762 | return os; |
| 763 | } |
| 764 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 765 | /** Formatted output of the Format type. |
| 766 | * |
| 767 | * @param[in] format Type to output. |
| 768 | * |
| 769 | * @return Formatted string. |
| 770 | */ |
Moritz Pflanzer | 7655a67 | 2017-09-23 11:57:33 +0100 | [diff] [blame] | 771 | inline std::string to_string(const Format &format) |
| 772 | { |
| 773 | std::stringstream str; |
| 774 | str << format; |
| 775 | return str.str(); |
| 776 | } |
| 777 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 778 | /** Formatted output of the Channel type. |
| 779 | * |
| 780 | * @param[out] os Output stream. |
| 781 | * @param[in] channel Type to output. |
| 782 | * |
| 783 | * @return Modified output stream. |
| 784 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 785 | inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) |
| 786 | { |
| 787 | switch(channel) |
| 788 | { |
| 789 | case Channel::UNKNOWN: |
| 790 | os << "UNKNOWN"; |
| 791 | break; |
| 792 | case Channel::C0: |
| 793 | os << "C0"; |
| 794 | break; |
| 795 | case Channel::C1: |
| 796 | os << "C1"; |
| 797 | break; |
| 798 | case Channel::C2: |
| 799 | os << "C2"; |
| 800 | break; |
| 801 | case Channel::C3: |
| 802 | os << "C3"; |
| 803 | break; |
| 804 | case Channel::R: |
| 805 | os << "R"; |
| 806 | break; |
| 807 | case Channel::G: |
| 808 | os << "G"; |
| 809 | break; |
| 810 | case Channel::B: |
| 811 | os << "B"; |
| 812 | break; |
| 813 | case Channel::A: |
| 814 | os << "A"; |
| 815 | break; |
| 816 | case Channel::Y: |
| 817 | os << "Y"; |
| 818 | break; |
| 819 | case Channel::U: |
| 820 | os << "U"; |
| 821 | break; |
| 822 | case Channel::V: |
| 823 | os << "V"; |
| 824 | break; |
| 825 | default: |
| 826 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 827 | } |
| 828 | |
| 829 | return os; |
| 830 | } |
| 831 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 832 | /** Formatted output of the Channel type. |
| 833 | * |
| 834 | * @param[in] channel Type to output. |
| 835 | * |
| 836 | * @return Formatted string. |
| 837 | */ |
Ioan-Cristian Szabo | 9414f64 | 2017-10-27 17:35:40 +0100 | [diff] [blame] | 838 | inline std::string to_string(const Channel &channel) |
| 839 | { |
| 840 | std::stringstream str; |
| 841 | str << channel; |
| 842 | return str.str(); |
| 843 | } |
| 844 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 845 | /** Formatted output of the BorderMode type. |
| 846 | * |
| 847 | * @param[out] os Output stream. |
| 848 | * @param[in] mode Type to output. |
| 849 | * |
| 850 | * @return Modified output stream. |
| 851 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 852 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) |
| 853 | { |
| 854 | switch(mode) |
| 855 | { |
| 856 | case BorderMode::UNDEFINED: |
| 857 | os << "UNDEFINED"; |
| 858 | break; |
| 859 | case BorderMode::CONSTANT: |
| 860 | os << "CONSTANT"; |
| 861 | break; |
| 862 | case BorderMode::REPLICATE: |
| 863 | os << "REPLICATE"; |
| 864 | break; |
| 865 | default: |
| 866 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 867 | } |
| 868 | |
| 869 | return os; |
| 870 | } |
| 871 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 872 | /** Formatted output of the BorderSize type. |
| 873 | * |
| 874 | * @param[out] os Output stream. |
| 875 | * @param[in] border Type to output. |
| 876 | * |
| 877 | * @return Modified output stream. |
| 878 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 879 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) |
| 880 | { |
Moritz Pflanzer | c87fbf8 | 2017-07-18 14:02:10 +0100 | [diff] [blame] | 881 | os << border.top << "," |
| 882 | << border.right << "," |
| 883 | << border.bottom << "," |
| 884 | << border.left; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 885 | |
| 886 | return os; |
| 887 | } |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 888 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 889 | /** Formatted output of the PaddingList type. |
| 890 | * |
| 891 | * @param[out] os Output stream. |
| 892 | * @param[in] padding Type to output. |
| 893 | * |
| 894 | * @return Modified output stream. |
| 895 | */ |
| 896 | inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding) |
| 897 | { |
| 898 | os << "{"; |
| 899 | for(auto const &p : padding) |
| 900 | { |
| 901 | os << "{" << p.first << "," << p.second << "}"; |
| 902 | } |
| 903 | os << "}"; |
| 904 | return os; |
| 905 | } |
| 906 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 907 | /** Formatted output of the Multiples type. |
| 908 | * |
| 909 | * @param[out] os Output stream. |
| 910 | * @param[in] multiples Type to output. |
| 911 | * |
| 912 | * @return Modified output stream. |
| 913 | */ |
| 914 | inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples) |
| 915 | { |
| 916 | os << "("; |
| 917 | for(size_t i = 0; i < multiples.size() - 1; i++) |
| 918 | { |
| 919 | os << multiples[i] << ", "; |
| 920 | } |
| 921 | os << multiples.back() << ")"; |
| 922 | return os; |
| 923 | } |
| 924 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 925 | /** Formatted output of the InterpolationPolicy type. |
| 926 | * |
| 927 | * @param[out] os Output stream. |
| 928 | * @param[in] policy Type to output. |
| 929 | * |
| 930 | * @return Modified output stream. |
| 931 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 932 | inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) |
| 933 | { |
| 934 | switch(policy) |
| 935 | { |
| 936 | case InterpolationPolicy::NEAREST_NEIGHBOR: |
| 937 | os << "NEAREST_NEIGHBOR"; |
| 938 | break; |
| 939 | case InterpolationPolicy::BILINEAR: |
| 940 | os << "BILINEAR"; |
| 941 | break; |
| 942 | case InterpolationPolicy::AREA: |
| 943 | os << "AREA"; |
| 944 | break; |
| 945 | default: |
| 946 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 947 | } |
| 948 | |
| 949 | return os; |
| 950 | } |
| 951 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 952 | /** Formatted output of the SamplingPolicy type. |
| 953 | * |
| 954 | * @param[out] os Output stream. |
| 955 | * @param[in] policy Type to output. |
| 956 | * |
| 957 | * @return Modified output stream. |
| 958 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 959 | inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy) |
| 960 | { |
| 961 | switch(policy) |
| 962 | { |
| 963 | case SamplingPolicy::CENTER: |
| 964 | os << "CENTER"; |
| 965 | break; |
| 966 | case SamplingPolicy::TOP_LEFT: |
| 967 | os << "TOP_LEFT"; |
| 968 | break; |
| 969 | default: |
| 970 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 971 | } |
| 972 | |
| 973 | return os; |
| 974 | } |
| 975 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 976 | /** Formatted output of the TensorInfo type. |
| 977 | * |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 978 | * @param[out] os Output stream. |
| 979 | * @param[in] info Type to output. |
| 980 | * |
| 981 | * @return Modified output stream. |
| 982 | */ |
| 983 | inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info) |
| 984 | { |
| 985 | os << "{Shape=" << info.tensor_shape() << "," |
| 986 | << "Type=" << info.data_type() << "," |
| 987 | << "Channels=" << info.num_channels() << "}"; |
| 988 | return os; |
| 989 | } |
| 990 | /** Formatted output of the TensorInfo type. |
| 991 | * |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 992 | * @param[in] info Type to output. |
| 993 | * |
| 994 | * @return Formatted string. |
| 995 | */ |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 996 | inline std::string to_string(const TensorInfo &info) |
| 997 | { |
| 998 | std::stringstream str; |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 999 | str << info; |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 1000 | return str.str(); |
| 1001 | } |
| 1002 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1003 | /** Formatted output of the Dimensions type. |
| 1004 | * |
| 1005 | * @param[in] dimensions Type to output. |
| 1006 | * |
| 1007 | * @return Formatted string. |
| 1008 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1009 | template <typename T> |
| 1010 | inline std::string to_string(const Dimensions<T> &dimensions) |
| 1011 | { |
| 1012 | std::stringstream str; |
| 1013 | str << dimensions; |
| 1014 | return str.str(); |
| 1015 | } |
| 1016 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1017 | /** Formatted output of the Strides type. |
| 1018 | * |
| 1019 | * @param[in] stride Type to output. |
| 1020 | * |
| 1021 | * @return Formatted string. |
| 1022 | */ |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 1023 | inline std::string to_string(const Strides &stride) |
| 1024 | { |
| 1025 | std::stringstream str; |
| 1026 | str << stride; |
| 1027 | return str.str(); |
| 1028 | } |
| 1029 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1030 | /** Formatted output of the TensorShape type. |
| 1031 | * |
| 1032 | * @param[in] shape Type to output. |
| 1033 | * |
| 1034 | * @return Formatted string. |
| 1035 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1036 | inline std::string to_string(const TensorShape &shape) |
| 1037 | { |
| 1038 | std::stringstream str; |
| 1039 | str << shape; |
| 1040 | return str.str(); |
| 1041 | } |
| 1042 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1043 | /** Formatted output of the Coordinates type. |
| 1044 | * |
| 1045 | * @param[in] coord Type to output. |
| 1046 | * |
| 1047 | * @return Formatted string. |
| 1048 | */ |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 1049 | inline std::string to_string(const Coordinates &coord) |
| 1050 | { |
| 1051 | std::stringstream str; |
| 1052 | str << coord; |
| 1053 | return str.str(); |
| 1054 | } |
| 1055 | |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1056 | /** Formatted output of the GEMMReshapeInfo type. |
| 1057 | * |
| 1058 | * @param[out] os Output stream. |
| 1059 | * @param[in] info Type to output. |
| 1060 | * |
| 1061 | * @return Modified output stream. |
| 1062 | */ |
| 1063 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info) |
| 1064 | { |
| 1065 | os << "{m=" << info.m() << ","; |
| 1066 | os << "n=" << info.n() << ","; |
| 1067 | os << "k=" << info.k() << ","; |
| 1068 | os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ","; |
| 1069 | os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height(); |
| 1070 | os << "}"; |
| 1071 | |
| 1072 | return os; |
| 1073 | } |
| 1074 | |
| 1075 | /** Formatted output of the GEMMInfo type. |
| 1076 | * |
| 1077 | * @param[out] os Output stream. |
| 1078 | * @param[in] info Type to output. |
| 1079 | * |
| 1080 | * @return Modified output stream. |
| 1081 | */ |
| 1082 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info) |
| 1083 | { |
| 1084 | os << "{is_a_reshaped=" << info.is_a_reshaped() << ","; |
| 1085 | os << "is_b_reshaped=" << info.is_b_reshaped() << ","; |
| 1086 | 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] | 1087 | os << "}"; |
| 1088 | |
| 1089 | return os; |
| 1090 | } |
| 1091 | |
| 1092 | /** Formatted output of the Window::Dimension type. |
| 1093 | * |
| 1094 | * @param[out] os Output stream. |
| 1095 | * @param[in] dim Type to output. |
| 1096 | * |
| 1097 | * @return Modified output stream. |
| 1098 | */ |
| 1099 | inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim) |
| 1100 | { |
| 1101 | os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}"; |
| 1102 | |
| 1103 | return os; |
| 1104 | } |
| 1105 | /** Formatted output of the Window type. |
| 1106 | * |
| 1107 | * @param[out] os Output stream. |
| 1108 | * @param[in] win Type to output. |
| 1109 | * |
| 1110 | * @return Modified output stream. |
| 1111 | */ |
| 1112 | inline ::std::ostream &operator<<(::std::ostream &os, const Window &win) |
| 1113 | { |
| 1114 | os << "{"; |
| 1115 | for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++) |
| 1116 | { |
| 1117 | if(i > 0) |
| 1118 | { |
| 1119 | os << ", "; |
| 1120 | } |
| 1121 | os << win[i]; |
| 1122 | } |
| 1123 | os << "}"; |
| 1124 | |
| 1125 | return os; |
| 1126 | } |
| 1127 | |
| 1128 | /** Formatted output of the WeightsInfo type. |
| 1129 | * |
| 1130 | * @param[in] info Type to output. |
| 1131 | * |
| 1132 | * @return Formatted string. |
| 1133 | */ |
| 1134 | inline std::string to_string(const WeightsInfo &info) |
| 1135 | { |
| 1136 | std::stringstream str; |
| 1137 | str << info; |
| 1138 | return str.str(); |
| 1139 | } |
| 1140 | |
| 1141 | /** Formatted output of the GEMMReshapeInfo type. |
| 1142 | * |
| 1143 | * @param[in] info Type to output. |
| 1144 | * |
| 1145 | * @return Formatted string. |
| 1146 | */ |
| 1147 | inline std::string to_string(const GEMMReshapeInfo &info) |
| 1148 | { |
| 1149 | std::stringstream str; |
| 1150 | str << info; |
| 1151 | return str.str(); |
| 1152 | } |
| 1153 | |
| 1154 | /** Formatted output of the GEMMInfo type. |
| 1155 | * |
| 1156 | * @param[in] info Type to output. |
| 1157 | * |
| 1158 | * @return Formatted string. |
| 1159 | */ |
| 1160 | inline std::string to_string(const GEMMInfo &info) |
| 1161 | { |
| 1162 | std::stringstream str; |
| 1163 | str << info; |
| 1164 | return str.str(); |
| 1165 | } |
| 1166 | |
| 1167 | /** Formatted output of the Window::Dimension type. |
| 1168 | * |
| 1169 | * @param[in] dim Type to output. |
| 1170 | * |
| 1171 | * @return Formatted string. |
| 1172 | */ |
| 1173 | inline std::string to_string(const Window::Dimension &dim) |
| 1174 | { |
| 1175 | std::stringstream str; |
| 1176 | str << dim; |
| 1177 | return str.str(); |
| 1178 | } |
| 1179 | /** Formatted output of the Window type. |
| 1180 | * |
| 1181 | * @param[in] win Type to output. |
| 1182 | * |
| 1183 | * @return Formatted string. |
| 1184 | */ |
| 1185 | inline std::string to_string(const Window &win) |
| 1186 | { |
| 1187 | std::stringstream str; |
| 1188 | str << win; |
| 1189 | return str.str(); |
| 1190 | } |
| 1191 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1192 | /** Formatted output of the Rectangle type. |
| 1193 | * |
| 1194 | * @param[out] os Output stream. |
| 1195 | * @param[in] rect Type to output. |
| 1196 | * |
| 1197 | * @return Modified output stream. |
| 1198 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1199 | inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) |
| 1200 | { |
| 1201 | os << rect.width << "x" << rect.height; |
| 1202 | os << "+" << rect.x << "+" << rect.y; |
| 1203 | |
| 1204 | return os; |
| 1205 | } |
| 1206 | |
Usama Arif | 8cf8c11 | 2019-03-14 15:36:54 +0000 | [diff] [blame] | 1207 | /** Formatted output of the PaddingMode type. |
| 1208 | * |
| 1209 | * @param[out] os Output stream. |
| 1210 | * @param[in] mode Type to output. |
| 1211 | * |
| 1212 | * @return Modified output stream. |
| 1213 | */ |
| 1214 | inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode) |
| 1215 | { |
| 1216 | switch(mode) |
| 1217 | { |
| 1218 | case PaddingMode::CONSTANT: |
| 1219 | os << "CONSTANT"; |
| 1220 | break; |
| 1221 | case PaddingMode::REFLECT: |
| 1222 | os << "REFLECT"; |
| 1223 | break; |
| 1224 | case PaddingMode::SYMMETRIC: |
| 1225 | os << "SYMMETRIC"; |
| 1226 | break; |
| 1227 | default: |
| 1228 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1229 | } |
| 1230 | |
| 1231 | return os; |
| 1232 | } |
| 1233 | |
| 1234 | /** Formatted output of the PaddingMode type. |
| 1235 | * |
| 1236 | * @param[in] mode Type to output. |
| 1237 | * |
| 1238 | * @return Formatted string. |
| 1239 | */ |
| 1240 | inline std::string to_string(const PaddingMode &mode) |
| 1241 | { |
| 1242 | std::stringstream str; |
| 1243 | str << mode; |
| 1244 | return str.str(); |
| 1245 | } |
| 1246 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1247 | /** Formatted output of the PadStrideInfo type. |
| 1248 | * |
| 1249 | * @param[out] os Output stream. |
| 1250 | * @param[in] pad_stride_info Type to output. |
| 1251 | * |
| 1252 | * @return Modified output stream. |
| 1253 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1254 | inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) |
| 1255 | { |
| 1256 | os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; |
| 1257 | os << ";"; |
Jaroslaw Rzepecki | a1ed41f | 2017-10-13 11:13:58 +0100 | [diff] [blame] | 1258 | os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," |
| 1259 | << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom(); |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1260 | |
| 1261 | return os; |
| 1262 | } |
| 1263 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1264 | /** Formatted output of the PadStrideInfo type. |
| 1265 | * |
| 1266 | * @param[in] pad_stride_info Type to output. |
| 1267 | * |
| 1268 | * @return Formatted string. |
| 1269 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1270 | inline std::string to_string(const PadStrideInfo &pad_stride_info) |
| 1271 | { |
| 1272 | std::stringstream str; |
| 1273 | str << pad_stride_info; |
| 1274 | return str.str(); |
| 1275 | } |
| 1276 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1277 | /** Formatted output of the BorderMode type. |
| 1278 | * |
| 1279 | * @param[in] mode Type to output. |
| 1280 | * |
| 1281 | * @return Formatted string. |
| 1282 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1283 | inline std::string to_string(const BorderMode &mode) |
| 1284 | { |
| 1285 | std::stringstream str; |
| 1286 | str << mode; |
| 1287 | return str.str(); |
| 1288 | } |
| 1289 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1290 | /** Formatted output of the BorderSize type. |
| 1291 | * |
| 1292 | * @param[in] border Type to output. |
| 1293 | * |
| 1294 | * @return Formatted string. |
| 1295 | */ |
John Richardson | b482ce1 | 2017-09-18 12:44:01 +0100 | [diff] [blame] | 1296 | inline std::string to_string(const BorderSize &border) |
| 1297 | { |
| 1298 | std::stringstream str; |
| 1299 | str << border; |
| 1300 | return str.str(); |
| 1301 | } |
| 1302 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 1303 | /** Formatted output of the PaddingList type. |
| 1304 | * |
| 1305 | * @param[in] padding Type to output. |
| 1306 | * |
| 1307 | * @return Formatted string. |
| 1308 | */ |
| 1309 | inline std::string to_string(const PaddingList &padding) |
| 1310 | { |
| 1311 | std::stringstream str; |
| 1312 | str << padding; |
| 1313 | return str.str(); |
| 1314 | } |
| 1315 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 1316 | /** Formatted output of the Multiples type. |
| 1317 | * |
| 1318 | * @param[in] multiples Type to output. |
| 1319 | * |
| 1320 | * @return Formatted string. |
| 1321 | */ |
| 1322 | inline std::string to_string(const Multiples &multiples) |
| 1323 | { |
| 1324 | std::stringstream str; |
| 1325 | str << multiples; |
| 1326 | return str.str(); |
| 1327 | } |
| 1328 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1329 | /** Formatted output of the InterpolationPolicy type. |
| 1330 | * |
| 1331 | * @param[in] policy Type to output. |
| 1332 | * |
| 1333 | * @return Formatted string. |
| 1334 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1335 | inline std::string to_string(const InterpolationPolicy &policy) |
| 1336 | { |
| 1337 | std::stringstream str; |
| 1338 | str << policy; |
| 1339 | return str.str(); |
| 1340 | } |
| 1341 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1342 | /** Formatted output of the SamplingPolicy type. |
| 1343 | * |
| 1344 | * @param[in] policy Type to output. |
| 1345 | * |
| 1346 | * @return Formatted string. |
| 1347 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 1348 | inline std::string to_string(const SamplingPolicy &policy) |
| 1349 | { |
| 1350 | std::stringstream str; |
| 1351 | str << policy; |
| 1352 | return str.str(); |
| 1353 | } |
| 1354 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1355 | /** Formatted output of the ConvertPolicy type. |
| 1356 | * |
| 1357 | * @param[out] os Output stream. |
| 1358 | * @param[in] policy Type to output. |
| 1359 | * |
| 1360 | * @return Modified output stream. |
| 1361 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1362 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) |
| 1363 | { |
| 1364 | switch(policy) |
| 1365 | { |
| 1366 | case ConvertPolicy::WRAP: |
| 1367 | os << "WRAP"; |
| 1368 | break; |
| 1369 | case ConvertPolicy::SATURATE: |
| 1370 | os << "SATURATE"; |
| 1371 | break; |
| 1372 | default: |
| 1373 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1374 | } |
| 1375 | |
| 1376 | return os; |
| 1377 | } |
| 1378 | |
| 1379 | inline std::string to_string(const ConvertPolicy &policy) |
| 1380 | { |
| 1381 | std::stringstream str; |
| 1382 | str << policy; |
| 1383 | return str.str(); |
| 1384 | } |
| 1385 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1386 | /** Formatted output of the ArithmeticOperation type. |
| 1387 | * |
| 1388 | * @param[out] os Output stream. |
| 1389 | * @param[in] op Operation to output. |
| 1390 | * |
| 1391 | * @return Modified output stream. |
| 1392 | */ |
| 1393 | inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op) |
| 1394 | { |
| 1395 | switch(op) |
| 1396 | { |
| 1397 | case ArithmeticOperation::ADD: |
| 1398 | os << "ADD"; |
| 1399 | break; |
| 1400 | case ArithmeticOperation::SUB: |
| 1401 | os << "SUB"; |
| 1402 | break; |
| 1403 | case ArithmeticOperation::DIV: |
| 1404 | os << "DIV"; |
| 1405 | break; |
| 1406 | case ArithmeticOperation::MAX: |
| 1407 | os << "MAX"; |
| 1408 | break; |
| 1409 | case ArithmeticOperation::MIN: |
| 1410 | os << "MIN"; |
| 1411 | break; |
| 1412 | case ArithmeticOperation::SQUARED_DIFF: |
| 1413 | os << "SQUARED_DIFF"; |
| 1414 | break; |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 1415 | case ArithmeticOperation::POWER: |
| 1416 | os << "POWER"; |
| 1417 | break; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1418 | default: |
| 1419 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1420 | } |
| 1421 | |
| 1422 | return os; |
| 1423 | } |
| 1424 | |
| 1425 | /** Formatted output of the Arithmetic Operation |
| 1426 | * |
| 1427 | * @param[in] op Type to output. |
| 1428 | * |
| 1429 | * @return Formatted string. |
| 1430 | */ |
| 1431 | inline std::string to_string(const ArithmeticOperation &op) |
| 1432 | { |
| 1433 | std::stringstream str; |
| 1434 | str << op; |
| 1435 | return str.str(); |
| 1436 | } |
| 1437 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1438 | /** Formatted output of the Reduction Operations. |
| 1439 | * |
| 1440 | * @param[out] os Output stream. |
| 1441 | * @param[in] op Type to output. |
| 1442 | * |
| 1443 | * @return Modified output stream. |
| 1444 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1445 | inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op) |
| 1446 | { |
| 1447 | switch(op) |
| 1448 | { |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1449 | case ReductionOperation::SUM: |
| 1450 | os << "SUM"; |
| 1451 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1452 | case ReductionOperation::SUM_SQUARE: |
| 1453 | os << "SUM_SQUARE"; |
| 1454 | break; |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1455 | case ReductionOperation::MEAN_SUM: |
| 1456 | os << "MEAN_SUM"; |
| 1457 | break; |
Michalis Spyrou | 7930db4 | 2018-11-22 17:36:28 +0000 | [diff] [blame] | 1458 | case ReductionOperation::ARG_IDX_MAX: |
| 1459 | os << "ARG_IDX_MAX"; |
| 1460 | break; |
| 1461 | case ReductionOperation::ARG_IDX_MIN: |
| 1462 | os << "ARG_IDX_MIN"; |
| 1463 | break; |
Manuel Bottini | b412fab | 2018-12-10 17:40:23 +0000 | [diff] [blame] | 1464 | case ReductionOperation::PROD: |
| 1465 | os << "PROD"; |
| 1466 | break; |
Usama Arif | a4a08ad | 2019-05-20 12:38:33 +0100 | [diff] [blame] | 1467 | case ReductionOperation::MIN: |
| 1468 | os << "MIN"; |
| 1469 | break; |
Usama Arif | 28f0dd9 | 2019-05-20 13:44:34 +0100 | [diff] [blame] | 1470 | case ReductionOperation::MAX: |
| 1471 | os << "MAX"; |
| 1472 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1473 | default: |
| 1474 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1475 | } |
| 1476 | |
| 1477 | return os; |
| 1478 | } |
| 1479 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1480 | /** Formatted output of the Reduction Operations. |
| 1481 | * |
| 1482 | * @param[in] op Type to output. |
| 1483 | * |
| 1484 | * @return Formatted string. |
| 1485 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1486 | inline std::string to_string(const ReductionOperation &op) |
| 1487 | { |
| 1488 | std::stringstream str; |
| 1489 | str << op; |
| 1490 | return str.str(); |
| 1491 | } |
| 1492 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1493 | /** Formatted output of the Comparison Operations. |
| 1494 | * |
| 1495 | * @param[out] os Output stream. |
| 1496 | * @param[in] op Type to output. |
| 1497 | * |
| 1498 | * @return Modified output stream. |
| 1499 | */ |
| 1500 | inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op) |
| 1501 | { |
| 1502 | switch(op) |
| 1503 | { |
| 1504 | case ComparisonOperation::Equal: |
| 1505 | os << "Equal"; |
| 1506 | break; |
| 1507 | case ComparisonOperation::NotEqual: |
| 1508 | os << "NotEqual"; |
| 1509 | break; |
| 1510 | case ComparisonOperation::Greater: |
| 1511 | os << "Greater"; |
| 1512 | break; |
| 1513 | case ComparisonOperation::GreaterEqual: |
| 1514 | os << "GreaterEqual"; |
| 1515 | break; |
| 1516 | case ComparisonOperation::Less: |
| 1517 | os << "Less"; |
| 1518 | break; |
| 1519 | case ComparisonOperation::LessEqual: |
| 1520 | os << "LessEqual"; |
| 1521 | break; |
| 1522 | default: |
| 1523 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1524 | } |
| 1525 | |
| 1526 | return os; |
| 1527 | } |
| 1528 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1529 | /** Formatted output of the Elementwise unary Operations. |
| 1530 | * |
| 1531 | * @param[out] os Output stream. |
| 1532 | * @param[in] op Type to output. |
| 1533 | * |
| 1534 | * @return Modified output stream. |
| 1535 | */ |
| 1536 | inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op) |
| 1537 | { |
| 1538 | switch(op) |
| 1539 | { |
| 1540 | case ElementWiseUnary::RSQRT: |
| 1541 | os << "RSQRT"; |
| 1542 | break; |
| 1543 | case ElementWiseUnary::EXP: |
| 1544 | os << "EXP"; |
| 1545 | break; |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 1546 | case ElementWiseUnary::NEG: |
| 1547 | os << "NEG"; |
| 1548 | break; |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 1549 | case ElementWiseUnary::LOG: |
| 1550 | os << "LOG"; |
| 1551 | break; |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 1552 | case ElementWiseUnary::ROUND: |
| 1553 | os << "ROUND"; |
| 1554 | break; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1555 | default: |
| 1556 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1557 | } |
| 1558 | |
| 1559 | return os; |
| 1560 | } |
| 1561 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1562 | /** Formatted output of the Comparison Operations. |
| 1563 | * |
| 1564 | * @param[in] op Type to output. |
| 1565 | * |
| 1566 | * @return Formatted string. |
| 1567 | */ |
| 1568 | inline std::string to_string(const ComparisonOperation &op) |
| 1569 | { |
| 1570 | std::stringstream str; |
| 1571 | str << op; |
| 1572 | return str.str(); |
| 1573 | } |
| 1574 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1575 | /** Formatted output of the Elementwise unary Operations. |
| 1576 | * |
| 1577 | * @param[in] op Type to output. |
| 1578 | * |
| 1579 | * @return Formatted string. |
| 1580 | */ |
| 1581 | inline std::string to_string(const ElementWiseUnary &op) |
| 1582 | { |
| 1583 | std::stringstream str; |
| 1584 | str << op; |
| 1585 | return str.str(); |
| 1586 | } |
| 1587 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1588 | /** Formatted output of the Norm Type. |
| 1589 | * |
| 1590 | * @param[in] type Type to output. |
| 1591 | * |
| 1592 | * @return Formatted string. |
| 1593 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1594 | inline std::string to_string(const NormType &type) |
| 1595 | { |
| 1596 | std::stringstream str; |
| 1597 | str << type; |
| 1598 | return str.str(); |
| 1599 | } |
| 1600 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1601 | /** Formatted output of the Pooling Type. |
| 1602 | * |
| 1603 | * @param[in] type Type to output. |
| 1604 | * |
| 1605 | * @return Formatted string. |
| 1606 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1607 | inline std::string to_string(const PoolingType &type) |
| 1608 | { |
| 1609 | std::stringstream str; |
| 1610 | str << type; |
| 1611 | return str.str(); |
| 1612 | } |
| 1613 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1614 | /** Formatted output of the Pooling Layer Info. |
| 1615 | * |
| 1616 | * @param[in] info Type to output. |
| 1617 | * |
| 1618 | * @return Formatted string. |
| 1619 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1620 | inline std::string to_string(const PoolingLayerInfo &info) |
| 1621 | { |
| 1622 | std::stringstream str; |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1623 | str << "{Type=" << info.pool_type << "," |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 1624 | << "DataLayout=" << info.data_layout << "," |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1625 | << "IsGlobalPooling=" << info.is_global_pooling; |
| 1626 | if(!info.is_global_pooling) |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1627 | { |
| 1628 | str << "," |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1629 | << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << "," |
| 1630 | << "PadStride=" << info.pad_stride_info; |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1631 | } |
| 1632 | str << "}"; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1633 | return str.str(); |
| 1634 | } |
| 1635 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 1636 | /** Formatted output of the PriorBoxLayerInfo. |
| 1637 | * |
| 1638 | * @param[in] info Type to output. |
| 1639 | * |
| 1640 | * @return Formatted string. |
| 1641 | */ |
| 1642 | inline std::string to_string(const PriorBoxLayerInfo &info) |
| 1643 | { |
| 1644 | std::stringstream str; |
| 1645 | str << "{"; |
| 1646 | str << "Clip:" << info.clip() |
| 1647 | << "Flip:" << info.flip() |
| 1648 | << "StepX:" << info.steps()[0] |
| 1649 | << "StepY:" << info.steps()[1] |
| 1650 | << "MinSizes:" << info.min_sizes().size() |
| 1651 | << "MaxSizes:" << info.max_sizes().size() |
| 1652 | << "ImgSizeX:" << info.img_size().x |
| 1653 | << "ImgSizeY:" << info.img_size().y |
| 1654 | << "Offset:" << info.offset() |
| 1655 | << "Variances:" << info.variances().size(); |
| 1656 | str << "}"; |
| 1657 | return str.str(); |
| 1658 | } |
| 1659 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1660 | /** Formatted output of the KeyPoint type. |
| 1661 | * |
| 1662 | * @param[out] os Output stream |
| 1663 | * @param[in] point Type to output. |
| 1664 | * |
| 1665 | * @return Modified output stream. |
| 1666 | */ |
Moritz Pflanzer | 6c6597c | 2017-09-24 12:09:41 +0100 | [diff] [blame] | 1667 | inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point) |
| 1668 | { |
| 1669 | os << "{x=" << point.x << "," |
| 1670 | << "y=" << point.y << "," |
| 1671 | << "strength=" << point.strength << "," |
| 1672 | << "scale=" << point.scale << "," |
| 1673 | << "orientation=" << point.orientation << "," |
| 1674 | << "tracking_status=" << point.tracking_status << "," |
| 1675 | << "error=" << point.error << "}"; |
| 1676 | |
| 1677 | return os; |
| 1678 | } |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1679 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1680 | /** Formatted output of the PhaseType type. |
| 1681 | * |
| 1682 | * @param[out] os Output stream |
| 1683 | * @param[in] phase_type Type to output. |
| 1684 | * |
| 1685 | * @return Modified output stream. |
| 1686 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1687 | inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type) |
| 1688 | { |
| 1689 | switch(phase_type) |
| 1690 | { |
| 1691 | case PhaseType::SIGNED: |
| 1692 | os << "SIGNED"; |
| 1693 | break; |
| 1694 | case PhaseType::UNSIGNED: |
| 1695 | os << "UNSIGNED"; |
| 1696 | break; |
| 1697 | default: |
| 1698 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1699 | } |
| 1700 | |
| 1701 | return os; |
| 1702 | } |
| 1703 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1704 | /** Formatted output of the PhaseType type. |
| 1705 | * |
| 1706 | * @param[in] type Type to output. |
| 1707 | * |
| 1708 | * @return Formatted string. |
| 1709 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1710 | inline std::string to_string(const arm_compute::PhaseType &type) |
| 1711 | { |
| 1712 | std::stringstream str; |
| 1713 | str << type; |
| 1714 | return str.str(); |
| 1715 | } |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1716 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1717 | /** Formatted output of the MagnitudeType type. |
| 1718 | * |
| 1719 | * @param[out] os Output stream |
| 1720 | * @param[in] magnitude_type Type to output. |
| 1721 | * |
| 1722 | * @return Modified output stream. |
| 1723 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1724 | inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type) |
| 1725 | { |
| 1726 | switch(magnitude_type) |
| 1727 | { |
| 1728 | case MagnitudeType::L1NORM: |
| 1729 | os << "L1NORM"; |
| 1730 | break; |
| 1731 | case MagnitudeType::L2NORM: |
| 1732 | os << "L2NORM"; |
| 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 MagnitudeType type. |
| 1742 | * |
| 1743 | * @param[in] type Type to output. |
| 1744 | * |
| 1745 | * @return Formatted string. |
| 1746 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1747 | inline std::string to_string(const arm_compute::MagnitudeType &type) |
| 1748 | { |
| 1749 | std::stringstream str; |
| 1750 | str << type; |
| 1751 | return str.str(); |
| 1752 | } |
John Richardson | 1c52992 | 2017-11-01 10:57:48 +0000 | [diff] [blame] | 1753 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1754 | /** Formatted output of the HOGNormType type. |
| 1755 | * |
| 1756 | * @param[out] os Output stream |
| 1757 | * @param[in] norm_type 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 HOGNormType &norm_type) |
| 1762 | { |
| 1763 | switch(norm_type) |
| 1764 | { |
| 1765 | case HOGNormType::L1_NORM: |
| 1766 | os << "L1_NORM"; |
| 1767 | break; |
| 1768 | case HOGNormType::L2_NORM: |
| 1769 | os << "L2_NORM"; |
| 1770 | break; |
| 1771 | case HOGNormType::L2HYS_NORM: |
| 1772 | os << "L2HYS_NORM"; |
| 1773 | break; |
| 1774 | default: |
| 1775 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1776 | } |
| 1777 | |
| 1778 | return os; |
| 1779 | } |
| 1780 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1781 | /** Formatted output of the HOGNormType type. |
| 1782 | * |
| 1783 | * @param[in] type Type to output |
| 1784 | * |
| 1785 | * @return Formatted string. |
| 1786 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1787 | inline std::string to_string(const HOGNormType &type) |
| 1788 | { |
| 1789 | std::stringstream str; |
| 1790 | str << type; |
| 1791 | return str.str(); |
| 1792 | } |
| 1793 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1794 | /** Formatted output of the Size2D type. |
| 1795 | * |
| 1796 | * @param[out] os Output stream |
| 1797 | * @param[in] size Type to output |
| 1798 | * |
| 1799 | * @return Modified output stream. |
| 1800 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1801 | inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size) |
| 1802 | { |
| 1803 | os << size.width << "x" << size.height; |
| 1804 | |
| 1805 | return os; |
| 1806 | } |
| 1807 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1808 | /** Formatted output of the Size2D type. |
| 1809 | * |
| 1810 | * @param[in] type Type to output |
| 1811 | * |
| 1812 | * @return Formatted string. |
| 1813 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1814 | inline std::string to_string(const Size2D &type) |
| 1815 | { |
| 1816 | std::stringstream str; |
| 1817 | str << type; |
| 1818 | return str.str(); |
| 1819 | } |
| 1820 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1821 | /** Formatted output of the HOGInfo type. |
| 1822 | * |
| 1823 | * @param[out] os Output stream |
| 1824 | * @param[in] hog_info Type to output |
| 1825 | * |
| 1826 | * @return Modified output stream. |
| 1827 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1828 | inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info) |
| 1829 | { |
| 1830 | os << "{CellSize=" << hog_info.cell_size() << "," |
| 1831 | << "BlockSize=" << hog_info.block_size() << "," |
| 1832 | << "DetectionWindowSize=" << hog_info.detection_window_size() << "," |
| 1833 | << "BlockStride=" << hog_info.block_stride() << "," |
| 1834 | << "NumBins=" << hog_info.num_bins() << "," |
| 1835 | << "NormType=" << hog_info.normalization_type() << "," |
| 1836 | << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << "," |
| 1837 | << "PhaseType=" << hog_info.phase_type() << "}"; |
| 1838 | |
| 1839 | return os; |
| 1840 | } |
| 1841 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1842 | /** Formatted output of the HOGInfo type. |
| 1843 | * |
| 1844 | * @param[in] type Type to output |
| 1845 | * |
| 1846 | * @return Formatted string. |
| 1847 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1848 | inline std::string to_string(const HOGInfo &type) |
| 1849 | { |
| 1850 | std::stringstream str; |
| 1851 | str << type; |
| 1852 | return str.str(); |
| 1853 | } |
| 1854 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1855 | /** Formatted output of the ConvolutionMethod type. |
| 1856 | * |
| 1857 | * @param[out] os Output stream |
| 1858 | * @param[in] conv_method 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 ConvolutionMethod &conv_method) |
| 1863 | { |
| 1864 | switch(conv_method) |
| 1865 | { |
| 1866 | case ConvolutionMethod::GEMM: |
| 1867 | os << "GEMM"; |
| 1868 | break; |
| 1869 | case ConvolutionMethod::DIRECT: |
| 1870 | os << "DIRECT"; |
| 1871 | break; |
| 1872 | case ConvolutionMethod::WINOGRAD: |
| 1873 | os << "WINOGRAD"; |
| 1874 | break; |
| 1875 | default: |
| 1876 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1877 | } |
| 1878 | |
| 1879 | return os; |
| 1880 | } |
| 1881 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1882 | /** Formatted output of the ConvolutionMethod type. |
| 1883 | * |
| 1884 | * @param[in] conv_method Type to output |
| 1885 | * |
| 1886 | * @return Formatted string. |
| 1887 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1888 | inline std::string to_string(const ConvolutionMethod &conv_method) |
| 1889 | { |
| 1890 | std::stringstream str; |
| 1891 | str << conv_method; |
| 1892 | return str.str(); |
| 1893 | } |
| 1894 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1895 | /** Formatted output of the GPUTarget type. |
| 1896 | * |
| 1897 | * @param[out] os Output stream |
| 1898 | * @param[in] gpu_target Type to output |
| 1899 | * |
| 1900 | * @return Modified output stream. |
| 1901 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1902 | inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target) |
| 1903 | { |
| 1904 | switch(gpu_target) |
| 1905 | { |
| 1906 | case GPUTarget::GPU_ARCH_MASK: |
| 1907 | os << "GPU_ARCH_MASK"; |
| 1908 | break; |
| 1909 | case GPUTarget::MIDGARD: |
| 1910 | os << "MIDGARD"; |
| 1911 | break; |
| 1912 | case GPUTarget::BIFROST: |
| 1913 | os << "BIFROST"; |
| 1914 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 1915 | case GPUTarget::VALHALL: |
| 1916 | os << "VALHALL"; |
| 1917 | break; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1918 | case GPUTarget::T600: |
| 1919 | os << "T600"; |
| 1920 | break; |
| 1921 | case GPUTarget::T700: |
| 1922 | os << "T700"; |
| 1923 | break; |
| 1924 | case GPUTarget::T800: |
| 1925 | os << "T800"; |
| 1926 | break; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1927 | case GPUTarget::G71: |
| 1928 | os << "G71"; |
| 1929 | break; |
| 1930 | case GPUTarget::G72: |
| 1931 | os << "G72"; |
| 1932 | break; |
| 1933 | case GPUTarget::G51: |
| 1934 | os << "G51"; |
| 1935 | break; |
| 1936 | case GPUTarget::G51BIG: |
| 1937 | os << "G51BIG"; |
| 1938 | break; |
| 1939 | case GPUTarget::G51LIT: |
| 1940 | os << "G51LIT"; |
| 1941 | break; |
Georgios Pinitas | b03f7c5 | 2018-07-12 10:49:53 +0100 | [diff] [blame] | 1942 | case GPUTarget::G76: |
| 1943 | os << "G76"; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1944 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 1945 | case GPUTarget::G77: |
| 1946 | os << "G77"; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1947 | break; |
| 1948 | case GPUTarget::TBOX: |
| 1949 | os << "TBOX"; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1950 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 1951 | case GPUTarget::TODX: |
| 1952 | os << "TODX"; |
| 1953 | break; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1954 | default: |
| 1955 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1956 | } |
| 1957 | |
| 1958 | return os; |
| 1959 | } |
| 1960 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1961 | /** Formatted output of the GPUTarget type. |
| 1962 | * |
| 1963 | * @param[in] gpu_target Type to output |
| 1964 | * |
| 1965 | * @return Formatted string. |
| 1966 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1967 | inline std::string to_string(const GPUTarget &gpu_target) |
| 1968 | { |
| 1969 | std::stringstream str; |
| 1970 | str << gpu_target; |
| 1971 | return str.str(); |
| 1972 | } |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 1973 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1974 | /** Formatted output of the DetectionWindow type. |
| 1975 | * |
| 1976 | * @param[out] os Output stream |
| 1977 | * @param[in] detection_window Type to output |
| 1978 | * |
| 1979 | * @return Modified output stream. |
| 1980 | */ |
John Richardson | 684cb0f | 2018-01-09 11:17:00 +0000 | [diff] [blame] | 1981 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window) |
| 1982 | { |
| 1983 | os << "{x=" << detection_window.x << "," |
| 1984 | << "y=" << detection_window.y << "," |
| 1985 | << "width=" << detection_window.width << "," |
| 1986 | << "height=" << detection_window.height << "," |
| 1987 | << "idx_class=" << detection_window.idx_class << "," |
| 1988 | << "score=" << detection_window.score << "}"; |
| 1989 | |
| 1990 | return os; |
| 1991 | } |
| 1992 | |
Isabella Gottardi | 05e5644 | 2018-11-16 11:26:52 +0000 | [diff] [blame] | 1993 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 1994 | * |
| 1995 | * @param[out] os Output stream |
| 1996 | * @param[in] detection_code Type to output |
| 1997 | * |
| 1998 | * @return Modified output stream. |
| 1999 | */ |
| 2000 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code) |
| 2001 | { |
| 2002 | switch(detection_code) |
| 2003 | { |
| 2004 | case DetectionOutputLayerCodeType::CENTER_SIZE: |
| 2005 | os << "CENTER_SIZE"; |
| 2006 | break; |
| 2007 | case DetectionOutputLayerCodeType::CORNER: |
| 2008 | os << "CORNER"; |
| 2009 | break; |
| 2010 | case DetectionOutputLayerCodeType::CORNER_SIZE: |
| 2011 | os << "CORNER_SIZE"; |
| 2012 | break; |
| 2013 | case DetectionOutputLayerCodeType::TF_CENTER: |
| 2014 | os << "TF_CENTER"; |
| 2015 | break; |
| 2016 | default: |
| 2017 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2018 | } |
| 2019 | |
| 2020 | return os; |
| 2021 | } |
| 2022 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 2023 | * |
| 2024 | * @param[in] detection_code Type to output |
| 2025 | * |
| 2026 | * @return Formatted string. |
| 2027 | */ |
| 2028 | inline std::string to_string(const DetectionOutputLayerCodeType &detection_code) |
| 2029 | { |
| 2030 | std::stringstream str; |
| 2031 | str << detection_code; |
| 2032 | return str.str(); |
| 2033 | } |
| 2034 | |
| 2035 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 2036 | * |
| 2037 | * @param[out] os Output stream |
| 2038 | * @param[in] detection_info Type to output |
| 2039 | * |
| 2040 | * @return Modified output stream. |
| 2041 | */ |
| 2042 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info) |
| 2043 | { |
| 2044 | os << "{Classes=" << detection_info.num_classes() << "," |
| 2045 | << "ShareLocation=" << detection_info.share_location() << "," |
| 2046 | << "CodeType=" << detection_info.code_type() << "," |
| 2047 | << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << "," |
| 2048 | << "KeepTopK=" << detection_info.keep_top_k() << "," |
| 2049 | << "NMSThreshold=" << detection_info.nms_threshold() << "," |
| 2050 | << "Eta=" << detection_info.eta() << "," |
| 2051 | << "BackgroundLabelId=" << detection_info.background_label_id() << "," |
| 2052 | << "ConfidenceThreshold=" << detection_info.confidence_threshold() << "," |
| 2053 | << "TopK=" << detection_info.top_k() << "," |
| 2054 | << "NumLocClasses=" << detection_info.num_loc_classes() |
| 2055 | << "}"; |
| 2056 | |
| 2057 | return os; |
| 2058 | } |
| 2059 | |
| 2060 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 2061 | * |
| 2062 | * @param[in] detection_info Type to output |
| 2063 | * |
| 2064 | * @return Formatted string. |
| 2065 | */ |
| 2066 | inline std::string to_string(const DetectionOutputLayerInfo &detection_info) |
| 2067 | { |
| 2068 | std::stringstream str; |
| 2069 | str << detection_info; |
| 2070 | return str.str(); |
| 2071 | } |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 2072 | /** Formatted output of the DetectionPostProcessLayerInfo type. |
| 2073 | * |
| 2074 | * @param[out] os Output stream |
| 2075 | * @param[in] detection_info Type to output |
| 2076 | * |
| 2077 | * @return Modified output stream. |
| 2078 | */ |
| 2079 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info) |
| 2080 | { |
| 2081 | os << "{MaxDetections=" << detection_info.max_detections() << "," |
| 2082 | << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << "," |
| 2083 | << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << "," |
| 2084 | << "NmsIouThreshold=" << detection_info.iou_threshold() << "," |
| 2085 | << "NumClasses=" << detection_info.num_classes() << "," |
| 2086 | << "ScaleValue_y=" << detection_info.scale_value_y() << "," |
| 2087 | << "ScaleValue_x=" << detection_info.scale_value_x() << "," |
| 2088 | << "ScaleValue_h=" << detection_info.scale_value_h() << "," |
| 2089 | << "ScaleValue_w=" << detection_info.scale_value_w() << "," |
| 2090 | << "UseRegularNms=" << detection_info.use_regular_nms() << "," |
| 2091 | << "DetectionPerClass=" << detection_info.detection_per_class() |
| 2092 | << "}"; |
| 2093 | |
| 2094 | return os; |
| 2095 | } |
| 2096 | |
| 2097 | /** Formatted output of the DetectionPostProcessLayerInfo type. |
| 2098 | * |
| 2099 | * @param[in] detection_info Type to output |
| 2100 | * |
| 2101 | * @return Formatted string. |
| 2102 | */ |
| 2103 | inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info) |
| 2104 | { |
| 2105 | std::stringstream str; |
| 2106 | str << detection_info; |
| 2107 | return str.str(); |
| 2108 | } |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 2109 | /** Formatted output of the DetectionWindow type. |
| 2110 | * |
| 2111 | * @param[in] detection_window Type to output |
| 2112 | * |
| 2113 | * @return Formatted string. |
| 2114 | */ |
| 2115 | inline std::string to_string(const DetectionWindow &detection_window) |
| 2116 | { |
| 2117 | std::stringstream str; |
| 2118 | str << detection_window; |
| 2119 | return str.str(); |
| 2120 | } |
| 2121 | |
| 2122 | /** Formatted output of the Termination type. |
| 2123 | * |
| 2124 | * @param[out] os Output stream |
| 2125 | * @param[in] termination Type to output |
| 2126 | * |
| 2127 | * @return Modified output stream. |
| 2128 | */ |
| 2129 | inline ::std::ostream &operator<<(::std::ostream &os, const Termination &termination) |
| 2130 | { |
| 2131 | switch(termination) |
| 2132 | { |
| 2133 | case Termination::TERM_CRITERIA_EPSILON: |
| 2134 | os << "TERM_CRITERIA_EPSILON"; |
| 2135 | break; |
| 2136 | case Termination::TERM_CRITERIA_ITERATIONS: |
| 2137 | os << "TERM_CRITERIA_ITERATIONS"; |
| 2138 | break; |
| 2139 | case Termination::TERM_CRITERIA_BOTH: |
| 2140 | os << "TERM_CRITERIA_BOTH"; |
| 2141 | break; |
| 2142 | default: |
| 2143 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2144 | } |
| 2145 | |
| 2146 | return os; |
| 2147 | } |
| 2148 | |
| 2149 | /** Formatted output of the Termination type. |
| 2150 | * |
| 2151 | * @param[in] termination Type to output |
| 2152 | * |
| 2153 | * @return Formatted string. |
| 2154 | */ |
| 2155 | inline std::string to_string(const Termination &termination) |
| 2156 | { |
| 2157 | std::stringstream str; |
| 2158 | str << termination; |
| 2159 | return str.str(); |
| 2160 | } |
| 2161 | |
Anthony Barbier | 8914e32 | 2018-08-10 15:28:25 +0100 | [diff] [blame] | 2162 | /** Formatted output of the CPUModel type. |
| 2163 | * |
| 2164 | * @param[out] os Output stream |
| 2165 | * @param[in] cpu_model Model to output |
| 2166 | * |
| 2167 | * @return Modified output stream. |
| 2168 | */ |
| 2169 | inline ::std::ostream &operator<<(::std::ostream &os, const CPUModel &cpu_model) |
| 2170 | { |
| 2171 | switch(cpu_model) |
| 2172 | { |
| 2173 | case CPUModel::GENERIC: |
| 2174 | os << "GENERIC"; |
| 2175 | break; |
| 2176 | case CPUModel::GENERIC_FP16: |
| 2177 | os << "GENERIC_FP16"; |
| 2178 | break; |
| 2179 | case CPUModel::GENERIC_FP16_DOT: |
| 2180 | os << "GENERIC_FP16_DOT"; |
| 2181 | break; |
| 2182 | case CPUModel::A53: |
| 2183 | os << "A53"; |
| 2184 | break; |
| 2185 | case CPUModel::A55r0: |
| 2186 | os << "A55r0"; |
| 2187 | break; |
| 2188 | case CPUModel::A55r1: |
| 2189 | os << "A55r1"; |
| 2190 | break; |
| 2191 | default: |
| 2192 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2193 | } |
| 2194 | |
| 2195 | return os; |
| 2196 | } |
| 2197 | |
| 2198 | /** Formatted output of the CPUModel type. |
| 2199 | * |
| 2200 | * @param[in] cpu_model Model to output |
| 2201 | * |
| 2202 | * @return Formatted string. |
| 2203 | */ |
| 2204 | inline std::string to_string(const CPUModel &cpu_model) |
| 2205 | { |
| 2206 | std::stringstream str; |
| 2207 | str << cpu_model; |
| 2208 | return str.str(); |
| 2209 | } |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2210 | /** Formatted output of a vector of objects. |
| 2211 | * |
| 2212 | * @param[out] os Output stream |
| 2213 | * @param[in] args Vector of objects to print |
| 2214 | * |
| 2215 | * @return Modified output stream. |
| 2216 | */ |
| 2217 | template <typename T> |
| 2218 | inline ::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args) |
| 2219 | { |
| 2220 | os << "["; |
| 2221 | bool first = true; |
| 2222 | for(auto &arg : args) |
| 2223 | { |
| 2224 | if(first) |
| 2225 | { |
| 2226 | first = false; |
| 2227 | } |
| 2228 | else |
| 2229 | { |
| 2230 | os << ", "; |
| 2231 | } |
| 2232 | os << arg; |
| 2233 | } |
| 2234 | os << "]"; |
| 2235 | return os; |
| 2236 | } |
| 2237 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 2238 | /** Formatted output of @ref PriorBoxLayerInfo. |
| 2239 | * |
| 2240 | * @param[out] os Output stream. |
| 2241 | * @param[in] info Type to output. |
| 2242 | * |
| 2243 | * @return Modified output stream. |
| 2244 | */ |
| 2245 | inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info) |
| 2246 | { |
| 2247 | os << "Clip:" << info.clip() |
| 2248 | << "Flip:" << info.flip() |
| 2249 | << "StepX:" << info.steps()[0] |
| 2250 | << "StepY:" << info.steps()[1] |
| 2251 | << "MinSizes:" << info.min_sizes() |
| 2252 | << "MaxSizes:" << info.max_sizes() |
| 2253 | << "ImgSizeX:" << info.img_size().x |
| 2254 | << "ImgSizeY:" << info.img_size().y |
| 2255 | << "Offset:" << info.offset() |
| 2256 | << "Variances:" << info.variances(); |
| 2257 | |
| 2258 | return os; |
| 2259 | } |
| 2260 | |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2261 | /** Formatted output of a vector of objects. |
| 2262 | * |
| 2263 | * @param[in] args Vector of objects to print |
| 2264 | * |
| 2265 | * @return String representing args. |
| 2266 | */ |
| 2267 | template <typename T> |
| 2268 | std::string to_string(const std::vector<T> &args) |
| 2269 | { |
| 2270 | std::stringstream str; |
| 2271 | str << args; |
| 2272 | return str.str(); |
| 2273 | } |
| 2274 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2275 | /** Formatted output of the WinogradInfo type. */ |
| 2276 | inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info) |
| 2277 | { |
| 2278 | os << "{OutputTileSize=" << info.output_tile_size << "," |
| 2279 | << "KernelSize=" << info.kernel_size << "," |
| 2280 | << "PadStride=" << info.convolution_info << "," |
| 2281 | << "OutputDataLayout=" << info.output_data_layout << "}"; |
| 2282 | |
| 2283 | return os; |
| 2284 | } |
| 2285 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2286 | inline std::string to_string(const WinogradInfo &type) |
| 2287 | { |
| 2288 | std::stringstream str; |
| 2289 | str << type; |
| 2290 | return str.str(); |
| 2291 | } |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2292 | |
| 2293 | /** Fallback method: try to use std::to_string: |
| 2294 | * |
| 2295 | * @param[in] val Value to convert to string |
| 2296 | * |
| 2297 | * @return String representing val. |
| 2298 | */ |
| 2299 | template <typename T> |
| 2300 | inline std::string to_string(const T &val) |
| 2301 | { |
| 2302 | return support::cpp11::to_string(val); |
| 2303 | } |
| 2304 | |
Vidhya Sudhan Loganathan | 050471e | 2019-04-25 09:27:24 +0100 | [diff] [blame] | 2305 | /** Convert a CLTunerMode value to a string |
| 2306 | * |
| 2307 | * @param val CLTunerMode value to be converted |
| 2308 | * |
| 2309 | * @return String representing the corresponding CLTunerMode. |
| 2310 | */ |
| 2311 | inline std::string to_string(const CLTunerMode val) |
| 2312 | { |
| 2313 | switch(val) |
| 2314 | { |
| 2315 | case CLTunerMode::EXHAUSTIVE: |
| 2316 | { |
| 2317 | return std::string("Exhaustive"); |
| 2318 | } |
| 2319 | case CLTunerMode::NORMAL: |
| 2320 | { |
| 2321 | return std::string("Normal"); |
| 2322 | } |
| 2323 | case CLTunerMode::RAPID: |
| 2324 | { |
| 2325 | return std::string("Rapid"); |
| 2326 | } |
| 2327 | default: |
| 2328 | { |
| 2329 | ARM_COMPUTE_ERROR("Invalid tuner mode."); |
| 2330 | return std::string("UNDEFINED"); |
| 2331 | } |
| 2332 | } |
| 2333 | } |
| 2334 | /** [Print CLTunerMode type] **/ |
| 2335 | /** Formatted output of the CLTunerMode type. |
| 2336 | * |
| 2337 | * @param[out] os Output stream. |
| 2338 | * @param[in] val CLTunerMode to output. |
| 2339 | * |
| 2340 | * @return Modified output stream. |
| 2341 | */ |
| 2342 | inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val) |
| 2343 | { |
| 2344 | os << to_string(val); |
| 2345 | return os; |
| 2346 | } |
| 2347 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 2348 | } // namespace arm_compute |
Anthony Barbier | 4dbc0a9 | 2018-08-27 13:39:47 +0100 | [diff] [blame] | 2349 | |
| 2350 | #endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */ |