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