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