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