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