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