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