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