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