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