Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 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 | */ |
| 24 | #ifndef __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ |
| 25 | #define __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ |
| 26 | |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/CL/CLTypes.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" |
| 36 | |
Abe Mbise | 4bd2cb8 | 2017-09-27 18:39:19 +0100 | [diff] [blame] | 37 | #include "tests/Types.h" |
| 38 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 | } |
| 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 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 225 | /** Formatted output of the QuantizationInfo type. |
| 226 | * |
| 227 | * @param[out] os Output stream. |
| 228 | * @param[in] quantization_info Type to output. |
| 229 | * |
| 230 | * @return Modified output stream. |
| 231 | */ |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 232 | inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info) |
| 233 | { |
| 234 | os << "Scale:" << quantization_info.scale << "~" |
| 235 | << "Offset:" << quantization_info.offset; |
| 236 | return os; |
| 237 | } |
| 238 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 239 | /** Formatted output of the QuantizationInfo type. |
| 240 | * |
| 241 | * @param[in] quantization_info Type to output. |
| 242 | * |
| 243 | * @return Formatted string. |
| 244 | */ |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 245 | inline std::string to_string(const QuantizationInfo &quantization_info) |
| 246 | { |
| 247 | std::stringstream str; |
| 248 | str << quantization_info; |
| 249 | return str.str(); |
| 250 | } |
| 251 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 252 | /** Formatted output of the FixedPointOp type. |
| 253 | * |
| 254 | * @param[out] os Output stream. |
| 255 | * @param[in] op Type to output. |
| 256 | * |
| 257 | * @return Modified output stream. |
| 258 | */ |
Abe Mbise | 4bd2cb8 | 2017-09-27 18:39:19 +0100 | [diff] [blame] | 259 | inline ::std::ostream &operator<<(::std::ostream &os, const FixedPointOp &op) |
| 260 | { |
| 261 | switch(op) |
| 262 | { |
John Richardson | 70f946b | 2017-10-02 16:52:16 +0100 | [diff] [blame] | 263 | case FixedPointOp::ADD: |
| 264 | os << "ADD"; |
| 265 | break; |
| 266 | case FixedPointOp::SUB: |
| 267 | os << "SUB"; |
| 268 | break; |
| 269 | case FixedPointOp::MUL: |
| 270 | os << "MUL"; |
| 271 | break; |
Abe Mbise | 4bd2cb8 | 2017-09-27 18:39:19 +0100 | [diff] [blame] | 272 | case FixedPointOp::EXP: |
| 273 | os << "EXP"; |
| 274 | break; |
| 275 | case FixedPointOp::LOG: |
| 276 | os << "LOG"; |
| 277 | break; |
| 278 | case FixedPointOp::INV_SQRT: |
| 279 | os << "INV_SQRT"; |
| 280 | break; |
| 281 | case FixedPointOp::RECIPROCAL: |
| 282 | os << "RECIPROCAL"; |
| 283 | break; |
| 284 | default: |
| 285 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 286 | } |
| 287 | |
| 288 | return os; |
| 289 | } |
John Richardson | 70f946b | 2017-10-02 16:52:16 +0100 | [diff] [blame] | 290 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 291 | /** Formatted output of the FixedPointOp type. |
| 292 | * |
| 293 | * @param[in] op Type to output. |
| 294 | * |
| 295 | * @return Formatted string. |
| 296 | */ |
Abe Mbise | 4bd2cb8 | 2017-09-27 18:39:19 +0100 | [diff] [blame] | 297 | inline std::string to_string(const FixedPointOp &op) |
| 298 | { |
| 299 | std::stringstream str; |
| 300 | str << op; |
| 301 | return str.str(); |
| 302 | } |
| 303 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 304 | /** Formatted output of the activation function type. |
| 305 | * |
| 306 | * @param[out] os Output stream. |
| 307 | * @param[in] act_function Type to output. |
| 308 | * |
| 309 | * @return Modified output stream. |
| 310 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 311 | inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function) |
| 312 | { |
| 313 | switch(act_function) |
| 314 | { |
| 315 | case ActivationLayerInfo::ActivationFunction::ABS: |
| 316 | os << "ABS"; |
| 317 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 318 | case ActivationLayerInfo::ActivationFunction::LINEAR: |
| 319 | os << "LINEAR"; |
| 320 | break; |
| 321 | case ActivationLayerInfo::ActivationFunction::LOGISTIC: |
| 322 | os << "LOGISTIC"; |
| 323 | break; |
| 324 | case ActivationLayerInfo::ActivationFunction::RELU: |
| 325 | os << "RELU"; |
| 326 | break; |
Georgios Pinitas | 579c049 | 2017-07-12 16:12:12 +0100 | [diff] [blame] | 327 | case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU: |
| 328 | os << "BOUNDED_RELU"; |
| 329 | break; |
| 330 | case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: |
| 331 | os << "LEAKY_RELU"; |
| 332 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 333 | case ActivationLayerInfo::ActivationFunction::SOFT_RELU: |
| 334 | os << "SOFT_RELU"; |
| 335 | break; |
| 336 | case ActivationLayerInfo::ActivationFunction::SQRT: |
| 337 | os << "SQRT"; |
| 338 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 339 | case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU: |
| 340 | os << "LU_BOUNDED_RELU"; |
Kevin Petit | d9f8071 | 2017-12-06 12:18:48 +0000 | [diff] [blame] | 341 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 342 | case ActivationLayerInfo::ActivationFunction::SQUARE: |
| 343 | os << "SQUARE"; |
| 344 | break; |
| 345 | case ActivationLayerInfo::ActivationFunction::TANH: |
| 346 | os << "TANH"; |
| 347 | break; |
| 348 | default: |
| 349 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 350 | } |
| 351 | |
| 352 | return os; |
| 353 | } |
| 354 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 355 | /** Formatted output of the activation function info type. |
| 356 | * |
| 357 | * @param[in] info Type to output. |
| 358 | * |
| 359 | * @return Formatted string. |
| 360 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 361 | inline std::string to_string(const arm_compute::ActivationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 362 | { |
| 363 | std::stringstream str; |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 364 | if(info.enabled()) |
| 365 | { |
| 366 | str << info.activation(); |
| 367 | } |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 368 | return str.str(); |
| 369 | } |
| 370 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 371 | /** Formatted output of the activation function type. |
| 372 | * |
| 373 | * @param[in] function Type to output. |
| 374 | * |
| 375 | * @return Formatted string. |
| 376 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 377 | inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function) |
| 378 | { |
| 379 | std::stringstream str; |
| 380 | str << function; |
| 381 | return str.str(); |
| 382 | } |
| 383 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 384 | /** Formatted output of the NormType type. |
| 385 | * |
| 386 | * @param[out] os Output stream. |
| 387 | * @param[in] norm_type Type to output. |
| 388 | * |
| 389 | * @return Modified output stream. |
| 390 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 391 | inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type) |
| 392 | { |
| 393 | switch(norm_type) |
| 394 | { |
| 395 | case NormType::CROSS_MAP: |
| 396 | os << "CROSS_MAP"; |
| 397 | break; |
| 398 | case NormType::IN_MAP_1D: |
| 399 | os << "IN_MAP_1D"; |
| 400 | break; |
| 401 | case NormType::IN_MAP_2D: |
| 402 | os << "IN_MAP_2D"; |
| 403 | break; |
| 404 | default: |
| 405 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 406 | } |
| 407 | |
| 408 | return os; |
| 409 | } |
| 410 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 411 | /** Formatted output of @ref NormalizationLayerInfo. |
| 412 | * |
| 413 | * @param[in] info Type to output. |
| 414 | * |
| 415 | * @return Formatted string. |
| 416 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 417 | inline std::string to_string(const arm_compute::NormalizationLayerInfo &info) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 418 | { |
| 419 | std::stringstream str; |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 420 | str << info.type() << ":NormSize=" << info.norm_size(); |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 421 | return str.str(); |
| 422 | } |
| 423 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 424 | /** Formatted output of @ref NormalizationLayerInfo. |
| 425 | * |
| 426 | * @param[out] os Output stream. |
| 427 | * @param[in] info Type to output. |
| 428 | * |
| 429 | * @return Modified output stream. |
| 430 | */ |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 431 | inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info) |
| 432 | { |
Michalis Spyrou | d466c2d | 2018-01-30 10:54:39 +0000 | [diff] [blame] | 433 | os << info.type() << ":NormSize=" << info.norm_size(); |
Georgios Pinitas | 6f669f0 | 2017-09-26 12:32:57 +0100 | [diff] [blame] | 434 | return os; |
| 435 | } |
| 436 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 437 | /** Formatted output of the PoolingType type. |
| 438 | * |
| 439 | * @param[out] os Output stream. |
| 440 | * @param[in] pool_type Type to output. |
| 441 | * |
| 442 | * @return Modified output stream. |
| 443 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 444 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type) |
| 445 | { |
| 446 | switch(pool_type) |
| 447 | { |
| 448 | case PoolingType::AVG: |
| 449 | os << "AVG"; |
| 450 | break; |
| 451 | case PoolingType::MAX: |
| 452 | os << "MAX"; |
| 453 | break; |
Georgios Pinitas | cdf5145 | 2017-08-31 14:21:36 +0100 | [diff] [blame] | 454 | case PoolingType::L2: |
| 455 | os << "L2"; |
| 456 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 457 | default: |
| 458 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 459 | } |
| 460 | |
| 461 | return os; |
| 462 | } |
| 463 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 464 | /** Formatted output of @ref PoolingLayerInfo. |
| 465 | * |
| 466 | * @param[out] os Output stream. |
| 467 | * @param[in] info Type to output. |
| 468 | * |
| 469 | * @return Modified output stream. |
| 470 | */ |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 471 | inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) |
| 472 | { |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 473 | os << info.pool_type(); |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 474 | |
| 475 | return os; |
| 476 | } |
| 477 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 478 | /** Formatted output of @ref RoundingPolicy. |
| 479 | * |
| 480 | * @param[in] rounding_policy Type to output. |
| 481 | * |
| 482 | * @return Formatted string. |
| 483 | */ |
John Richardson | dd715f2 | 2017-09-18 16:10:48 +0100 | [diff] [blame] | 484 | inline std::string to_string(const RoundingPolicy &rounding_policy) |
| 485 | { |
| 486 | std::stringstream str; |
| 487 | str << rounding_policy; |
| 488 | return str.str(); |
| 489 | } |
| 490 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 491 | /** Formatted output of the DataLayout type. |
| 492 | * |
| 493 | * @param[out] os Output stream. |
| 494 | * @param[in] data_layout Type to output. |
| 495 | * |
| 496 | * @return Modified output stream. |
| 497 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 498 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout) |
| 499 | { |
| 500 | switch(data_layout) |
| 501 | { |
| 502 | case DataLayout::UNKNOWN: |
| 503 | os << "UNKNOWN"; |
| 504 | break; |
| 505 | case DataLayout::NHWC: |
| 506 | os << "NHWC"; |
| 507 | break; |
| 508 | case DataLayout::NCHW: |
| 509 | os << "NCHW"; |
| 510 | break; |
| 511 | default: |
| 512 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 513 | } |
| 514 | |
| 515 | return os; |
| 516 | } |
| 517 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 518 | /** Formatted output of the DataLayout type. |
| 519 | * |
| 520 | * @param[in] data_layout Type to output. |
| 521 | * |
| 522 | * @return Formatted string. |
| 523 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 524 | inline std::string to_string(const arm_compute::DataLayout &data_layout) |
| 525 | { |
| 526 | std::stringstream str; |
| 527 | str << data_layout; |
| 528 | return str.str(); |
| 529 | } |
| 530 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 531 | /** Formatted output of the DataType type. |
| 532 | * |
| 533 | * @param[out] os Output stream. |
| 534 | * @param[in] data_type Type to output. |
| 535 | * |
| 536 | * @return Modified output stream. |
| 537 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 538 | inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) |
| 539 | { |
| 540 | switch(data_type) |
| 541 | { |
| 542 | case DataType::UNKNOWN: |
| 543 | os << "UNKNOWN"; |
| 544 | break; |
| 545 | case DataType::U8: |
| 546 | os << "U8"; |
| 547 | break; |
| 548 | case DataType::QS8: |
| 549 | os << "QS8"; |
| 550 | break; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 551 | case DataType::QASYMM8: |
| 552 | os << "QASYMM8"; |
| 553 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 554 | case DataType::S8: |
| 555 | os << "S8"; |
| 556 | break; |
| 557 | case DataType::U16: |
| 558 | os << "U16"; |
| 559 | break; |
| 560 | case DataType::S16: |
| 561 | os << "S16"; |
| 562 | break; |
Gian Marco Iodice | bdb6b0b | 2017-06-30 12:21:00 +0100 | [diff] [blame] | 563 | case DataType::QS16: |
| 564 | os << "QS16"; |
| 565 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 566 | case DataType::U32: |
| 567 | os << "U32"; |
| 568 | break; |
| 569 | case DataType::S32: |
| 570 | os << "S32"; |
| 571 | break; |
| 572 | case DataType::U64: |
| 573 | os << "U64"; |
| 574 | break; |
| 575 | case DataType::S64: |
| 576 | os << "S64"; |
| 577 | break; |
| 578 | case DataType::F16: |
| 579 | os << "F16"; |
| 580 | break; |
| 581 | case DataType::F32: |
| 582 | os << "F32"; |
| 583 | break; |
| 584 | case DataType::F64: |
| 585 | os << "F64"; |
| 586 | break; |
| 587 | case DataType::SIZET: |
| 588 | os << "SIZET"; |
| 589 | break; |
| 590 | default: |
| 591 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 592 | } |
| 593 | |
| 594 | return os; |
| 595 | } |
| 596 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 597 | /** Formatted output of the DataType type. |
| 598 | * |
| 599 | * @param[in] data_type Type to output. |
| 600 | * |
| 601 | * @return Formatted string. |
| 602 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 603 | inline std::string to_string(const arm_compute::DataType &data_type) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 604 | { |
| 605 | std::stringstream str; |
| 606 | str << data_type; |
| 607 | return str.str(); |
| 608 | } |
| 609 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 610 | /** Formatted output of the Format type. |
| 611 | * |
| 612 | * @param[out] os Output stream. |
| 613 | * @param[in] format Type to output. |
| 614 | * |
| 615 | * @return Modified output stream. |
| 616 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 617 | inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) |
| 618 | { |
| 619 | switch(format) |
| 620 | { |
| 621 | case Format::UNKNOWN: |
| 622 | os << "UNKNOWN"; |
| 623 | break; |
| 624 | case Format::U8: |
| 625 | os << "U8"; |
| 626 | break; |
| 627 | case Format::S16: |
| 628 | os << "S16"; |
| 629 | break; |
| 630 | case Format::U16: |
| 631 | os << "U16"; |
| 632 | break; |
| 633 | case Format::S32: |
| 634 | os << "S32"; |
| 635 | break; |
| 636 | case Format::U32: |
| 637 | os << "U32"; |
| 638 | break; |
| 639 | case Format::F16: |
| 640 | os << "F16"; |
| 641 | break; |
| 642 | case Format::F32: |
| 643 | os << "F32"; |
| 644 | break; |
| 645 | case Format::UV88: |
| 646 | os << "UV88"; |
| 647 | break; |
| 648 | case Format::RGB888: |
| 649 | os << "RGB888"; |
| 650 | break; |
| 651 | case Format::RGBA8888: |
| 652 | os << "RGBA8888"; |
| 653 | break; |
| 654 | case Format::YUV444: |
| 655 | os << "YUV444"; |
| 656 | break; |
| 657 | case Format::YUYV422: |
| 658 | os << "YUYV422"; |
| 659 | break; |
| 660 | case Format::NV12: |
| 661 | os << "NV12"; |
| 662 | break; |
| 663 | case Format::NV21: |
| 664 | os << "NV21"; |
| 665 | break; |
| 666 | case Format::IYUV: |
| 667 | os << "IYUV"; |
| 668 | break; |
| 669 | case Format::UYVY422: |
| 670 | os << "UYVY422"; |
| 671 | break; |
| 672 | default: |
| 673 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 674 | } |
| 675 | |
| 676 | return os; |
| 677 | } |
| 678 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 679 | /** Formatted output of the Format type. |
| 680 | * |
| 681 | * @param[in] format Type to output. |
| 682 | * |
| 683 | * @return Formatted string. |
| 684 | */ |
Moritz Pflanzer | 7655a67 | 2017-09-23 11:57:33 +0100 | [diff] [blame] | 685 | inline std::string to_string(const Format &format) |
| 686 | { |
| 687 | std::stringstream str; |
| 688 | str << format; |
| 689 | return str.str(); |
| 690 | } |
| 691 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 692 | /** Formatted output of the Channel type. |
| 693 | * |
| 694 | * @param[out] os Output stream. |
| 695 | * @param[in] channel Type to output. |
| 696 | * |
| 697 | * @return Modified output stream. |
| 698 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 699 | inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) |
| 700 | { |
| 701 | switch(channel) |
| 702 | { |
| 703 | case Channel::UNKNOWN: |
| 704 | os << "UNKNOWN"; |
| 705 | break; |
| 706 | case Channel::C0: |
| 707 | os << "C0"; |
| 708 | break; |
| 709 | case Channel::C1: |
| 710 | os << "C1"; |
| 711 | break; |
| 712 | case Channel::C2: |
| 713 | os << "C2"; |
| 714 | break; |
| 715 | case Channel::C3: |
| 716 | os << "C3"; |
| 717 | break; |
| 718 | case Channel::R: |
| 719 | os << "R"; |
| 720 | break; |
| 721 | case Channel::G: |
| 722 | os << "G"; |
| 723 | break; |
| 724 | case Channel::B: |
| 725 | os << "B"; |
| 726 | break; |
| 727 | case Channel::A: |
| 728 | os << "A"; |
| 729 | break; |
| 730 | case Channel::Y: |
| 731 | os << "Y"; |
| 732 | break; |
| 733 | case Channel::U: |
| 734 | os << "U"; |
| 735 | break; |
| 736 | case Channel::V: |
| 737 | os << "V"; |
| 738 | break; |
| 739 | default: |
| 740 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 741 | } |
| 742 | |
| 743 | return os; |
| 744 | } |
| 745 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 746 | /** Formatted output of the Channel type. |
| 747 | * |
| 748 | * @param[in] channel Type to output. |
| 749 | * |
| 750 | * @return Formatted string. |
| 751 | */ |
Ioan-Cristian Szabo | 9414f64 | 2017-10-27 17:35:40 +0100 | [diff] [blame] | 752 | inline std::string to_string(const Channel &channel) |
| 753 | { |
| 754 | std::stringstream str; |
| 755 | str << channel; |
| 756 | return str.str(); |
| 757 | } |
| 758 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 759 | /** Formatted output of the BorderMode type. |
| 760 | * |
| 761 | * @param[out] os Output stream. |
| 762 | * @param[in] mode Type to output. |
| 763 | * |
| 764 | * @return Modified output stream. |
| 765 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 766 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) |
| 767 | { |
| 768 | switch(mode) |
| 769 | { |
| 770 | case BorderMode::UNDEFINED: |
| 771 | os << "UNDEFINED"; |
| 772 | break; |
| 773 | case BorderMode::CONSTANT: |
| 774 | os << "CONSTANT"; |
| 775 | break; |
| 776 | case BorderMode::REPLICATE: |
| 777 | os << "REPLICATE"; |
| 778 | break; |
| 779 | default: |
| 780 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 781 | } |
| 782 | |
| 783 | return os; |
| 784 | } |
| 785 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 786 | /** Formatted output of the BorderSize type. |
| 787 | * |
| 788 | * @param[out] os Output stream. |
| 789 | * @param[in] border Type to output. |
| 790 | * |
| 791 | * @return Modified output stream. |
| 792 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 793 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) |
| 794 | { |
Moritz Pflanzer | c87fbf8 | 2017-07-18 14:02:10 +0100 | [diff] [blame] | 795 | os << border.top << "," |
| 796 | << border.right << "," |
| 797 | << border.bottom << "," |
| 798 | << border.left; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 799 | |
| 800 | return os; |
| 801 | } |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 802 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 803 | /** Formatted output of the InterpolationPolicy type. |
| 804 | * |
| 805 | * @param[out] os Output stream. |
| 806 | * @param[in] policy Type to output. |
| 807 | * |
| 808 | * @return Modified output stream. |
| 809 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 810 | inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) |
| 811 | { |
| 812 | switch(policy) |
| 813 | { |
| 814 | case InterpolationPolicy::NEAREST_NEIGHBOR: |
| 815 | os << "NEAREST_NEIGHBOR"; |
| 816 | break; |
| 817 | case InterpolationPolicy::BILINEAR: |
| 818 | os << "BILINEAR"; |
| 819 | break; |
| 820 | case InterpolationPolicy::AREA: |
| 821 | os << "AREA"; |
| 822 | break; |
| 823 | default: |
| 824 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 825 | } |
| 826 | |
| 827 | return os; |
| 828 | } |
| 829 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 830 | /** Formatted output of the SamplingPolicy type. |
| 831 | * |
| 832 | * @param[out] os Output stream. |
| 833 | * @param[in] policy Type to output. |
| 834 | * |
| 835 | * @return Modified output stream. |
| 836 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 837 | inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy) |
| 838 | { |
| 839 | switch(policy) |
| 840 | { |
| 841 | case SamplingPolicy::CENTER: |
| 842 | os << "CENTER"; |
| 843 | break; |
| 844 | case SamplingPolicy::TOP_LEFT: |
| 845 | os << "TOP_LEFT"; |
| 846 | break; |
| 847 | default: |
| 848 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 849 | } |
| 850 | |
| 851 | return os; |
| 852 | } |
| 853 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 854 | /** Formatted output of the TensorInfo type. |
| 855 | * |
| 856 | * @param[in] info Type to output. |
| 857 | * |
| 858 | * @return Formatted string. |
| 859 | */ |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 860 | inline std::string to_string(const TensorInfo &info) |
| 861 | { |
| 862 | std::stringstream str; |
| 863 | str << "{Shape=" << info.tensor_shape() << "," |
| 864 | << "Type=" << info.data_type() << "," |
| 865 | << "Channels=" << info.num_channels() << "," |
| 866 | << "FixedPointPos=" << info.fixed_point_position() << "}"; |
| 867 | return str.str(); |
| 868 | } |
| 869 | |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 870 | //FIXME: Check why this doesn't work and the TensorShape and Coordinates overload are needed |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 871 | /** Formatted output of the Dimensions type. |
| 872 | * |
| 873 | * @param[in] dimensions Type to output. |
| 874 | * |
| 875 | * @return Formatted string. |
| 876 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 877 | template <typename T> |
| 878 | inline std::string to_string(const Dimensions<T> &dimensions) |
| 879 | { |
| 880 | std::stringstream str; |
| 881 | str << dimensions; |
| 882 | return str.str(); |
| 883 | } |
| 884 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 885 | /** Formatted output of the Strides type. |
| 886 | * |
| 887 | * @param[in] stride Type to output. |
| 888 | * |
| 889 | * @return Formatted string. |
| 890 | */ |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 891 | inline std::string to_string(const Strides &stride) |
| 892 | { |
| 893 | std::stringstream str; |
| 894 | str << stride; |
| 895 | return str.str(); |
| 896 | } |
| 897 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 898 | /** Formatted output of the TensorShape type. |
| 899 | * |
| 900 | * @param[in] shape Type to output. |
| 901 | * |
| 902 | * @return Formatted string. |
| 903 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 904 | inline std::string to_string(const TensorShape &shape) |
| 905 | { |
| 906 | std::stringstream str; |
| 907 | str << shape; |
| 908 | return str.str(); |
| 909 | } |
| 910 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 911 | /** Formatted output of the Coordinates type. |
| 912 | * |
| 913 | * @param[in] coord Type to output. |
| 914 | * |
| 915 | * @return Formatted string. |
| 916 | */ |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 917 | inline std::string to_string(const Coordinates &coord) |
| 918 | { |
| 919 | std::stringstream str; |
| 920 | str << coord; |
| 921 | return str.str(); |
| 922 | } |
| 923 | |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame^] | 924 | /** Formatted output of the GEMMReshapeInfo type. |
| 925 | * |
| 926 | * @param[out] os Output stream. |
| 927 | * @param[in] info Type to output. |
| 928 | * |
| 929 | * @return Modified output stream. |
| 930 | */ |
| 931 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info) |
| 932 | { |
| 933 | os << "{m=" << info.m() << ","; |
| 934 | os << "n=" << info.n() << ","; |
| 935 | os << "k=" << info.k() << ","; |
| 936 | os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ","; |
| 937 | os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height(); |
| 938 | os << "}"; |
| 939 | |
| 940 | return os; |
| 941 | } |
| 942 | |
| 943 | /** Formatted output of the GEMMInfo type. |
| 944 | * |
| 945 | * @param[out] os Output stream. |
| 946 | * @param[in] info Type to output. |
| 947 | * |
| 948 | * @return Modified output stream. |
| 949 | */ |
| 950 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info) |
| 951 | { |
| 952 | os << "{is_a_reshaped=" << info.is_a_reshaped() << ","; |
| 953 | os << "is_b_reshaped=" << info.is_b_reshaped() << ","; |
| 954 | os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ","; |
| 955 | os << "reshape_info=" << info.reshape_info(); |
| 956 | os << "}"; |
| 957 | |
| 958 | return os; |
| 959 | } |
| 960 | |
| 961 | /** Formatted output of the Window::Dimension type. |
| 962 | * |
| 963 | * @param[out] os Output stream. |
| 964 | * @param[in] dim Type to output. |
| 965 | * |
| 966 | * @return Modified output stream. |
| 967 | */ |
| 968 | inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim) |
| 969 | { |
| 970 | os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}"; |
| 971 | |
| 972 | return os; |
| 973 | } |
| 974 | /** Formatted output of the Window type. |
| 975 | * |
| 976 | * @param[out] os Output stream. |
| 977 | * @param[in] win Type to output. |
| 978 | * |
| 979 | * @return Modified output stream. |
| 980 | */ |
| 981 | inline ::std::ostream &operator<<(::std::ostream &os, const Window &win) |
| 982 | { |
| 983 | os << "{"; |
| 984 | for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++) |
| 985 | { |
| 986 | if(i > 0) |
| 987 | { |
| 988 | os << ", "; |
| 989 | } |
| 990 | os << win[i]; |
| 991 | } |
| 992 | os << "}"; |
| 993 | |
| 994 | return os; |
| 995 | } |
| 996 | |
| 997 | /** Formatted output of the WeightsInfo type. |
| 998 | * |
| 999 | * @param[in] info Type to output. |
| 1000 | * |
| 1001 | * @return Formatted string. |
| 1002 | */ |
| 1003 | inline std::string to_string(const WeightsInfo &info) |
| 1004 | { |
| 1005 | std::stringstream str; |
| 1006 | str << info; |
| 1007 | return str.str(); |
| 1008 | } |
| 1009 | |
| 1010 | /** Formatted output of the GEMMReshapeInfo type. |
| 1011 | * |
| 1012 | * @param[in] info Type to output. |
| 1013 | * |
| 1014 | * @return Formatted string. |
| 1015 | */ |
| 1016 | inline std::string to_string(const GEMMReshapeInfo &info) |
| 1017 | { |
| 1018 | std::stringstream str; |
| 1019 | str << info; |
| 1020 | return str.str(); |
| 1021 | } |
| 1022 | |
| 1023 | /** Formatted output of the GEMMInfo type. |
| 1024 | * |
| 1025 | * @param[in] info Type to output. |
| 1026 | * |
| 1027 | * @return Formatted string. |
| 1028 | */ |
| 1029 | inline std::string to_string(const GEMMInfo &info) |
| 1030 | { |
| 1031 | std::stringstream str; |
| 1032 | str << info; |
| 1033 | return str.str(); |
| 1034 | } |
| 1035 | |
| 1036 | /** Formatted output of the Window::Dimension type. |
| 1037 | * |
| 1038 | * @param[in] dim Type to output. |
| 1039 | * |
| 1040 | * @return Formatted string. |
| 1041 | */ |
| 1042 | inline std::string to_string(const Window::Dimension &dim) |
| 1043 | { |
| 1044 | std::stringstream str; |
| 1045 | str << dim; |
| 1046 | return str.str(); |
| 1047 | } |
| 1048 | /** Formatted output of the Window type. |
| 1049 | * |
| 1050 | * @param[in] win Type to output. |
| 1051 | * |
| 1052 | * @return Formatted string. |
| 1053 | */ |
| 1054 | inline std::string to_string(const Window &win) |
| 1055 | { |
| 1056 | std::stringstream str; |
| 1057 | str << win; |
| 1058 | return str.str(); |
| 1059 | } |
| 1060 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1061 | /** Formatted output of the Rectangle type. |
| 1062 | * |
| 1063 | * @param[out] os Output stream. |
| 1064 | * @param[in] rect Type to output. |
| 1065 | * |
| 1066 | * @return Modified output stream. |
| 1067 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1068 | inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) |
| 1069 | { |
| 1070 | os << rect.width << "x" << rect.height; |
| 1071 | os << "+" << rect.x << "+" << rect.y; |
| 1072 | |
| 1073 | return os; |
| 1074 | } |
| 1075 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1076 | /** Formatted output of the PadStrideInfo type. |
| 1077 | * |
| 1078 | * @param[out] os Output stream. |
| 1079 | * @param[in] pad_stride_info Type to output. |
| 1080 | * |
| 1081 | * @return Modified output stream. |
| 1082 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1083 | inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) |
| 1084 | { |
| 1085 | os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; |
| 1086 | os << ";"; |
Jaroslaw Rzepecki | a1ed41f | 2017-10-13 11:13:58 +0100 | [diff] [blame] | 1087 | os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," |
| 1088 | << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom(); |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1089 | |
| 1090 | return os; |
| 1091 | } |
| 1092 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1093 | /** Formatted output of the PadStrideInfo type. |
| 1094 | * |
| 1095 | * @param[in] pad_stride_info Type to output. |
| 1096 | * |
| 1097 | * @return Formatted string. |
| 1098 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1099 | inline std::string to_string(const PadStrideInfo &pad_stride_info) |
| 1100 | { |
| 1101 | std::stringstream str; |
| 1102 | str << pad_stride_info; |
| 1103 | return str.str(); |
| 1104 | } |
| 1105 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1106 | /** Formatted output of the BorderMode type. |
| 1107 | * |
| 1108 | * @param[in] mode Type to output. |
| 1109 | * |
| 1110 | * @return Formatted string. |
| 1111 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1112 | inline std::string to_string(const BorderMode &mode) |
| 1113 | { |
| 1114 | std::stringstream str; |
| 1115 | str << mode; |
| 1116 | return str.str(); |
| 1117 | } |
| 1118 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1119 | /** Formatted output of the BorderSize type. |
| 1120 | * |
| 1121 | * @param[in] border Type to output. |
| 1122 | * |
| 1123 | * @return Formatted string. |
| 1124 | */ |
John Richardson | b482ce1 | 2017-09-18 12:44:01 +0100 | [diff] [blame] | 1125 | inline std::string to_string(const BorderSize &border) |
| 1126 | { |
| 1127 | std::stringstream str; |
| 1128 | str << border; |
| 1129 | return str.str(); |
| 1130 | } |
| 1131 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1132 | /** Formatted output of the InterpolationPolicy type. |
| 1133 | * |
| 1134 | * @param[in] policy Type to output. |
| 1135 | * |
| 1136 | * @return Formatted string. |
| 1137 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1138 | inline std::string to_string(const InterpolationPolicy &policy) |
| 1139 | { |
| 1140 | std::stringstream str; |
| 1141 | str << policy; |
| 1142 | return str.str(); |
| 1143 | } |
| 1144 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1145 | /** Formatted output of the SamplingPolicy type. |
| 1146 | * |
| 1147 | * @param[in] policy Type to output. |
| 1148 | * |
| 1149 | * @return Formatted string. |
| 1150 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 1151 | inline std::string to_string(const SamplingPolicy &policy) |
| 1152 | { |
| 1153 | std::stringstream str; |
| 1154 | str << policy; |
| 1155 | return str.str(); |
| 1156 | } |
| 1157 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1158 | /** Formatted output of the ConvertPolicy type. |
| 1159 | * |
| 1160 | * @param[out] os Output stream. |
| 1161 | * @param[in] policy Type to output. |
| 1162 | * |
| 1163 | * @return Modified output stream. |
| 1164 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1165 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) |
| 1166 | { |
| 1167 | switch(policy) |
| 1168 | { |
| 1169 | case ConvertPolicy::WRAP: |
| 1170 | os << "WRAP"; |
| 1171 | break; |
| 1172 | case ConvertPolicy::SATURATE: |
| 1173 | os << "SATURATE"; |
| 1174 | break; |
| 1175 | default: |
| 1176 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1177 | } |
| 1178 | |
| 1179 | return os; |
| 1180 | } |
| 1181 | |
| 1182 | inline std::string to_string(const ConvertPolicy &policy) |
| 1183 | { |
| 1184 | std::stringstream str; |
| 1185 | str << policy; |
| 1186 | return str.str(); |
| 1187 | } |
| 1188 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1189 | /** Formatted output of the Reduction Operations. |
| 1190 | * |
| 1191 | * @param[out] os Output stream. |
| 1192 | * @param[in] op 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 ReductionOperation &op) |
| 1197 | { |
| 1198 | switch(op) |
| 1199 | { |
| 1200 | case ReductionOperation::SUM_SQUARE: |
| 1201 | os << "SUM_SQUARE"; |
| 1202 | break; |
| 1203 | default: |
| 1204 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1205 | } |
| 1206 | |
| 1207 | return os; |
| 1208 | } |
| 1209 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1210 | /** Formatted output of the Reduction Operations. |
| 1211 | * |
| 1212 | * @param[in] op Type to output. |
| 1213 | * |
| 1214 | * @return Formatted string. |
| 1215 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1216 | inline std::string to_string(const ReductionOperation &op) |
| 1217 | { |
| 1218 | std::stringstream str; |
| 1219 | str << op; |
| 1220 | return str.str(); |
| 1221 | } |
| 1222 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1223 | /** Formatted output of the Norm Type. |
| 1224 | * |
| 1225 | * @param[in] type Type to output. |
| 1226 | * |
| 1227 | * @return Formatted string. |
| 1228 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1229 | inline std::string to_string(const NormType &type) |
| 1230 | { |
| 1231 | std::stringstream str; |
| 1232 | str << type; |
| 1233 | return str.str(); |
| 1234 | } |
| 1235 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1236 | /** Formatted output of the Pooling Type. |
| 1237 | * |
| 1238 | * @param[in] type Type to output. |
| 1239 | * |
| 1240 | * @return Formatted string. |
| 1241 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1242 | inline std::string to_string(const PoolingType &type) |
| 1243 | { |
| 1244 | std::stringstream str; |
| 1245 | str << type; |
| 1246 | return str.str(); |
| 1247 | } |
| 1248 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1249 | /** Formatted output of the Pooling Layer Info. |
| 1250 | * |
| 1251 | * @param[in] info Type to output. |
| 1252 | * |
| 1253 | * @return Formatted string. |
| 1254 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1255 | inline std::string to_string(const PoolingLayerInfo &info) |
| 1256 | { |
| 1257 | std::stringstream str; |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1258 | str << "{Type=" << info.pool_type() << "," |
| 1259 | << "IsGlobalPooling=" << info.is_global_pooling(); |
| 1260 | if(!info.is_global_pooling()) |
| 1261 | { |
| 1262 | str << "," |
Isabella Gottardi | 6e464c3 | 2018-01-26 12:32:45 +0000 | [diff] [blame] | 1263 | << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << "," |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1264 | << "PadStride=" << info.pad_stride_info(); |
| 1265 | } |
| 1266 | str << "}"; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1267 | return str.str(); |
| 1268 | } |
| 1269 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1270 | /** Formatted output of the KeyPoint type. |
| 1271 | * |
| 1272 | * @param[out] os Output stream |
| 1273 | * @param[in] point Type to output. |
| 1274 | * |
| 1275 | * @return Modified output stream. |
| 1276 | */ |
Moritz Pflanzer | 6c6597c | 2017-09-24 12:09:41 +0100 | [diff] [blame] | 1277 | inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point) |
| 1278 | { |
| 1279 | os << "{x=" << point.x << "," |
| 1280 | << "y=" << point.y << "," |
| 1281 | << "strength=" << point.strength << "," |
| 1282 | << "scale=" << point.scale << "," |
| 1283 | << "orientation=" << point.orientation << "," |
| 1284 | << "tracking_status=" << point.tracking_status << "," |
| 1285 | << "error=" << point.error << "}"; |
| 1286 | |
| 1287 | return os; |
| 1288 | } |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1289 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1290 | /** Formatted output of the PhaseType type. |
| 1291 | * |
| 1292 | * @param[out] os Output stream |
| 1293 | * @param[in] phase_type Type to output. |
| 1294 | * |
| 1295 | * @return Modified output stream. |
| 1296 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1297 | inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type) |
| 1298 | { |
| 1299 | switch(phase_type) |
| 1300 | { |
| 1301 | case PhaseType::SIGNED: |
| 1302 | os << "SIGNED"; |
| 1303 | break; |
| 1304 | case PhaseType::UNSIGNED: |
| 1305 | os << "UNSIGNED"; |
| 1306 | break; |
| 1307 | default: |
| 1308 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1309 | } |
| 1310 | |
| 1311 | return os; |
| 1312 | } |
| 1313 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1314 | /** Formatted output of the PhaseType type. |
| 1315 | * |
| 1316 | * @param[in] type Type to output. |
| 1317 | * |
| 1318 | * @return Formatted string. |
| 1319 | */ |
John Richardson | 63e5041 | 2017-10-13 20:51:42 +0100 | [diff] [blame] | 1320 | inline std::string to_string(const arm_compute::PhaseType &type) |
| 1321 | { |
| 1322 | std::stringstream str; |
| 1323 | str << type; |
| 1324 | return str.str(); |
| 1325 | } |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1326 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1327 | /** Formatted output of the MagnitudeType type. |
| 1328 | * |
| 1329 | * @param[out] os Output stream |
| 1330 | * @param[in] magnitude_type Type to output. |
| 1331 | * |
| 1332 | * @return Modified output stream. |
| 1333 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1334 | inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type) |
| 1335 | { |
| 1336 | switch(magnitude_type) |
| 1337 | { |
| 1338 | case MagnitudeType::L1NORM: |
| 1339 | os << "L1NORM"; |
| 1340 | break; |
| 1341 | case MagnitudeType::L2NORM: |
| 1342 | os << "L2NORM"; |
| 1343 | break; |
| 1344 | default: |
| 1345 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1346 | } |
| 1347 | |
| 1348 | return os; |
| 1349 | } |
| 1350 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1351 | /** Formatted output of the MagnitudeType type. |
| 1352 | * |
| 1353 | * @param[in] type Type to output. |
| 1354 | * |
| 1355 | * @return Formatted string. |
| 1356 | */ |
John Richardson | 3c5f949 | 2017-10-04 15:27:37 +0100 | [diff] [blame] | 1357 | inline std::string to_string(const arm_compute::MagnitudeType &type) |
| 1358 | { |
| 1359 | std::stringstream str; |
| 1360 | str << type; |
| 1361 | return str.str(); |
| 1362 | } |
John Richardson | 1c52992 | 2017-11-01 10:57:48 +0000 | [diff] [blame] | 1363 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1364 | /** Formatted output of the GradientDimension type. |
| 1365 | * |
| 1366 | * @param[out] os Output stream |
| 1367 | * @param[in] dim Type to output |
| 1368 | * |
| 1369 | * @return Modified output stream. |
| 1370 | */ |
John Richardson | 1c52992 | 2017-11-01 10:57:48 +0000 | [diff] [blame] | 1371 | inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim) |
| 1372 | { |
| 1373 | switch(dim) |
| 1374 | { |
| 1375 | case GradientDimension::GRAD_X: |
| 1376 | os << "GRAD_X"; |
| 1377 | break; |
| 1378 | case GradientDimension::GRAD_Y: |
| 1379 | os << "GRAD_Y"; |
| 1380 | break; |
| 1381 | case GradientDimension::GRAD_XY: |
| 1382 | os << "GRAD_XY"; |
| 1383 | break; |
| 1384 | default: |
| 1385 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1386 | } |
| 1387 | |
| 1388 | return os; |
| 1389 | } |
| 1390 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1391 | /** Formatted output of the GradientDimension type. |
| 1392 | * |
| 1393 | * @param[in] type Type to output |
| 1394 | * |
| 1395 | * @return Formatted string. |
| 1396 | */ |
John Richardson | 1c52992 | 2017-11-01 10:57:48 +0000 | [diff] [blame] | 1397 | inline std::string to_string(const arm_compute::GradientDimension &type) |
| 1398 | { |
| 1399 | std::stringstream str; |
| 1400 | str << type; |
| 1401 | return str.str(); |
| 1402 | } |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1403 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1404 | /** Formatted output of the HOGNormType type. |
| 1405 | * |
| 1406 | * @param[out] os Output stream |
| 1407 | * @param[in] norm_type Type to output |
| 1408 | * |
| 1409 | * @return Modified output stream. |
| 1410 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1411 | inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type) |
| 1412 | { |
| 1413 | switch(norm_type) |
| 1414 | { |
| 1415 | case HOGNormType::L1_NORM: |
| 1416 | os << "L1_NORM"; |
| 1417 | break; |
| 1418 | case HOGNormType::L2_NORM: |
| 1419 | os << "L2_NORM"; |
| 1420 | break; |
| 1421 | case HOGNormType::L2HYS_NORM: |
| 1422 | os << "L2HYS_NORM"; |
| 1423 | break; |
| 1424 | default: |
| 1425 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1426 | } |
| 1427 | |
| 1428 | return os; |
| 1429 | } |
| 1430 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1431 | /** Formatted output of the HOGNormType type. |
| 1432 | * |
| 1433 | * @param[in] type Type to output |
| 1434 | * |
| 1435 | * @return Formatted string. |
| 1436 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1437 | inline std::string to_string(const HOGNormType &type) |
| 1438 | { |
| 1439 | std::stringstream str; |
| 1440 | str << type; |
| 1441 | return str.str(); |
| 1442 | } |
| 1443 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1444 | /** Formatted output of the Size2D type. |
| 1445 | * |
| 1446 | * @param[out] os Output stream |
| 1447 | * @param[in] size Type to output |
| 1448 | * |
| 1449 | * @return Modified output stream. |
| 1450 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1451 | inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size) |
| 1452 | { |
| 1453 | os << size.width << "x" << size.height; |
| 1454 | |
| 1455 | return os; |
| 1456 | } |
| 1457 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1458 | /** Formatted output of the Size2D type. |
| 1459 | * |
| 1460 | * @param[in] type Type to output |
| 1461 | * |
| 1462 | * @return Formatted string. |
| 1463 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1464 | inline std::string to_string(const Size2D &type) |
| 1465 | { |
| 1466 | std::stringstream str; |
| 1467 | str << type; |
| 1468 | return str.str(); |
| 1469 | } |
| 1470 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1471 | /** Formatted output of the HOGInfo type. |
| 1472 | * |
| 1473 | * @param[out] os Output stream |
| 1474 | * @param[in] hog_info Type to output |
| 1475 | * |
| 1476 | * @return Modified output stream. |
| 1477 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1478 | inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info) |
| 1479 | { |
| 1480 | os << "{CellSize=" << hog_info.cell_size() << "," |
| 1481 | << "BlockSize=" << hog_info.block_size() << "," |
| 1482 | << "DetectionWindowSize=" << hog_info.detection_window_size() << "," |
| 1483 | << "BlockStride=" << hog_info.block_stride() << "," |
| 1484 | << "NumBins=" << hog_info.num_bins() << "," |
| 1485 | << "NormType=" << hog_info.normalization_type() << "," |
| 1486 | << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << "," |
| 1487 | << "PhaseType=" << hog_info.phase_type() << "}"; |
| 1488 | |
| 1489 | return os; |
| 1490 | } |
| 1491 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1492 | /** Formatted output of the HOGInfo type. |
| 1493 | * |
| 1494 | * @param[in] type Type to output |
| 1495 | * |
| 1496 | * @return Formatted string. |
| 1497 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1498 | inline std::string to_string(const HOGInfo &type) |
| 1499 | { |
| 1500 | std::stringstream str; |
| 1501 | str << type; |
| 1502 | return str.str(); |
| 1503 | } |
| 1504 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1505 | /** Formatted output of the ConvolutionMethod type. |
| 1506 | * |
| 1507 | * @param[out] os Output stream |
| 1508 | * @param[in] conv_method Type to output |
| 1509 | * |
| 1510 | * @return Modified output stream. |
| 1511 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1512 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method) |
| 1513 | { |
| 1514 | switch(conv_method) |
| 1515 | { |
| 1516 | case ConvolutionMethod::GEMM: |
| 1517 | os << "GEMM"; |
| 1518 | break; |
| 1519 | case ConvolutionMethod::DIRECT: |
| 1520 | os << "DIRECT"; |
| 1521 | break; |
| 1522 | case ConvolutionMethod::WINOGRAD: |
| 1523 | os << "WINOGRAD"; |
| 1524 | break; |
| 1525 | default: |
| 1526 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1527 | } |
| 1528 | |
| 1529 | return os; |
| 1530 | } |
| 1531 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1532 | /** Formatted output of the ConvolutionMethod type. |
| 1533 | * |
| 1534 | * @param[in] conv_method Type to output |
| 1535 | * |
| 1536 | * @return Formatted string. |
| 1537 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1538 | inline std::string to_string(const ConvolutionMethod &conv_method) |
| 1539 | { |
| 1540 | std::stringstream str; |
| 1541 | str << conv_method; |
| 1542 | return str.str(); |
| 1543 | } |
| 1544 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1545 | /** Formatted output of the GPUTarget type. |
| 1546 | * |
| 1547 | * @param[out] os Output stream |
| 1548 | * @param[in] gpu_target Type to output |
| 1549 | * |
| 1550 | * @return Modified output stream. |
| 1551 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1552 | inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target) |
| 1553 | { |
| 1554 | switch(gpu_target) |
| 1555 | { |
| 1556 | case GPUTarget::GPU_ARCH_MASK: |
| 1557 | os << "GPU_ARCH_MASK"; |
| 1558 | break; |
| 1559 | case GPUTarget::MIDGARD: |
| 1560 | os << "MIDGARD"; |
| 1561 | break; |
| 1562 | case GPUTarget::BIFROST: |
| 1563 | os << "BIFROST"; |
| 1564 | break; |
| 1565 | case GPUTarget::T600: |
| 1566 | os << "T600"; |
| 1567 | break; |
| 1568 | case GPUTarget::T700: |
| 1569 | os << "T700"; |
| 1570 | break; |
| 1571 | case GPUTarget::T800: |
| 1572 | os << "T800"; |
| 1573 | break; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1574 | case GPUTarget::G71: |
| 1575 | os << "G71"; |
| 1576 | break; |
| 1577 | case GPUTarget::G72: |
| 1578 | os << "G72"; |
| 1579 | break; |
| 1580 | case GPUTarget::G51: |
| 1581 | os << "G51"; |
| 1582 | break; |
| 1583 | case GPUTarget::G51BIG: |
| 1584 | os << "G51BIG"; |
| 1585 | break; |
| 1586 | case GPUTarget::G51LIT: |
| 1587 | os << "G51LIT"; |
| 1588 | break; |
| 1589 | case GPUTarget::TNOX: |
| 1590 | os << "TNOX"; |
| 1591 | break; |
| 1592 | case GPUTarget::TTRX: |
| 1593 | os << "TTRX"; |
| 1594 | break; |
| 1595 | case GPUTarget::TBOX: |
| 1596 | os << "TBOX"; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1597 | break; |
| 1598 | default: |
| 1599 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1600 | } |
| 1601 | |
| 1602 | return os; |
| 1603 | } |
| 1604 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1605 | /** Formatted output of the GPUTarget type. |
| 1606 | * |
| 1607 | * @param[in] gpu_target Type to output |
| 1608 | * |
| 1609 | * @return Formatted string. |
| 1610 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 1611 | inline std::string to_string(const GPUTarget &gpu_target) |
| 1612 | { |
| 1613 | std::stringstream str; |
| 1614 | str << gpu_target; |
| 1615 | return str.str(); |
| 1616 | } |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 1617 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1618 | /** Formatted output of the DetectionWindow type. |
| 1619 | * |
| 1620 | * @param[out] os Output stream |
| 1621 | * @param[in] detection_window Type to output |
| 1622 | * |
| 1623 | * @return Modified output stream. |
| 1624 | */ |
John Richardson | 684cb0f | 2018-01-09 11:17:00 +0000 | [diff] [blame] | 1625 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window) |
| 1626 | { |
| 1627 | os << "{x=" << detection_window.x << "," |
| 1628 | << "y=" << detection_window.y << "," |
| 1629 | << "width=" << detection_window.width << "," |
| 1630 | << "height=" << detection_window.height << "," |
| 1631 | << "idx_class=" << detection_window.idx_class << "," |
| 1632 | << "score=" << detection_window.score << "}"; |
| 1633 | |
| 1634 | return os; |
| 1635 | } |
| 1636 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1637 | /** Formatted output of the DetectionWindow type. |
| 1638 | * |
| 1639 | * @param[in] detection_window Type to output |
| 1640 | * |
| 1641 | * @return Formatted string. |
| 1642 | */ |
| 1643 | inline std::string to_string(const DetectionWindow &detection_window) |
| 1644 | { |
| 1645 | std::stringstream str; |
| 1646 | str << detection_window; |
| 1647 | return str.str(); |
| 1648 | } |
| 1649 | |
| 1650 | /** Formatted output of the Termination type. |
| 1651 | * |
| 1652 | * @param[out] os Output stream |
| 1653 | * @param[in] termination Type to output |
| 1654 | * |
| 1655 | * @return Modified output stream. |
| 1656 | */ |
| 1657 | inline ::std::ostream &operator<<(::std::ostream &os, const Termination &termination) |
| 1658 | { |
| 1659 | switch(termination) |
| 1660 | { |
| 1661 | case Termination::TERM_CRITERIA_EPSILON: |
| 1662 | os << "TERM_CRITERIA_EPSILON"; |
| 1663 | break; |
| 1664 | case Termination::TERM_CRITERIA_ITERATIONS: |
| 1665 | os << "TERM_CRITERIA_ITERATIONS"; |
| 1666 | break; |
| 1667 | case Termination::TERM_CRITERIA_BOTH: |
| 1668 | os << "TERM_CRITERIA_BOTH"; |
| 1669 | break; |
| 1670 | default: |
| 1671 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1672 | } |
| 1673 | |
| 1674 | return os; |
| 1675 | } |
| 1676 | |
| 1677 | /** Formatted output of the Termination type. |
| 1678 | * |
| 1679 | * @param[in] termination Type to output |
| 1680 | * |
| 1681 | * @return Formatted string. |
| 1682 | */ |
| 1683 | inline std::string to_string(const Termination &termination) |
| 1684 | { |
| 1685 | std::stringstream str; |
| 1686 | str << termination; |
| 1687 | return str.str(); |
| 1688 | } |
| 1689 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 1690 | /** Formatted output of the WinogradInfo type. */ |
| 1691 | inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info) |
| 1692 | { |
| 1693 | os << "{OutputTileSize=" << info.output_tile_size << "," |
| 1694 | << "KernelSize=" << info.kernel_size << "," |
| 1695 | << "PadStride=" << info.convolution_info << "," |
| 1696 | << "OutputDataLayout=" << info.output_data_layout << "}"; |
| 1697 | |
| 1698 | return os; |
| 1699 | } |
| 1700 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 1701 | inline std::string to_string(const WinogradInfo &type) |
| 1702 | { |
| 1703 | std::stringstream str; |
| 1704 | str << type; |
| 1705 | return str.str(); |
| 1706 | } |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1707 | } // namespace arm_compute |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 1708 | #endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */ |