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