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