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