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; |
Giorgio Arena | c9fe9fc | 2021-10-06 12:54:29 +0100 | [diff] [blame] | 669 | case DataLayout::NCDHW: |
| 670 | os << "NCDHW"; |
| 671 | break; |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 672 | default: |
| 673 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 674 | } |
| 675 | |
| 676 | return os; |
| 677 | } |
| 678 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 679 | /** Formatted output of the DataLayout type. |
| 680 | * |
| 681 | * @param[in] data_layout Type to output. |
| 682 | * |
| 683 | * @return Formatted string. |
| 684 | */ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 685 | inline std::string to_string(const arm_compute::DataLayout &data_layout) |
| 686 | { |
| 687 | std::stringstream str; |
| 688 | str << data_layout; |
| 689 | return str.str(); |
| 690 | } |
Vidhya Sudhan Loganathan | d646ae1 | 2018-11-19 15:18:20 +0000 | [diff] [blame] | 691 | /** [Print DataLayout type] **/ |
Michele Di Giorgio | 4a65b98 | 2018-03-02 11:21:38 +0000 | [diff] [blame] | 692 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 693 | /** Formatted output of the DataLayoutDimension type. |
| 694 | * |
| 695 | * @param[out] os Output stream. |
| 696 | * @param[in] data_layout_dim Data layout dimension to print. |
| 697 | * |
| 698 | * @return Modified output stream. |
| 699 | */ |
| 700 | inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim) |
| 701 | { |
| 702 | switch(data_layout_dim) |
| 703 | { |
| 704 | case DataLayoutDimension::WIDTH: |
| 705 | os << "WIDTH"; |
| 706 | break; |
| 707 | case DataLayoutDimension::HEIGHT: |
| 708 | os << "HEIGHT"; |
| 709 | break; |
| 710 | case DataLayoutDimension::CHANNEL: |
| 711 | os << "CHANNEL"; |
| 712 | break; |
Giorgio Arena | c9fe9fc | 2021-10-06 12:54:29 +0100 | [diff] [blame] | 713 | case DataLayoutDimension::DEPTH: |
| 714 | os << "DEPTH"; |
| 715 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 716 | case DataLayoutDimension::BATCHES: |
| 717 | os << "BATCHES"; |
| 718 | break; |
| 719 | default: |
| 720 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 721 | } |
| 722 | return os; |
| 723 | } |
| 724 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 725 | /** Formatted output of the DataType type. |
| 726 | * |
| 727 | * @param[out] os Output stream. |
| 728 | * @param[in] data_type Type to output. |
| 729 | * |
| 730 | * @return Modified output stream. |
| 731 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 732 | inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) |
| 733 | { |
| 734 | switch(data_type) |
| 735 | { |
| 736 | case DataType::UNKNOWN: |
| 737 | os << "UNKNOWN"; |
| 738 | break; |
| 739 | case DataType::U8: |
| 740 | os << "U8"; |
| 741 | break; |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 742 | case DataType::QSYMM8: |
| 743 | os << "QSYMM8"; |
| 744 | break; |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 745 | case DataType::QASYMM8: |
| 746 | os << "QASYMM8"; |
| 747 | break; |
Georgios Pinitas | 448a81f | 2019-11-21 14:10:25 +0000 | [diff] [blame] | 748 | case DataType::QASYMM8_SIGNED: |
| 749 | os << "QASYMM8_SIGNED"; |
| 750 | break; |
Georgios Pinitas | 4c5469b | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 751 | case DataType::QSYMM8_PER_CHANNEL: |
| 752 | os << "QSYMM8_PER_CHANNEL"; |
| 753 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 754 | case DataType::S8: |
| 755 | os << "S8"; |
| 756 | break; |
| 757 | case DataType::U16: |
| 758 | os << "U16"; |
| 759 | break; |
| 760 | case DataType::S16: |
| 761 | os << "S16"; |
| 762 | break; |
Manuel Bottini | 3689fcd | 2019-06-14 17:18:12 +0100 | [diff] [blame] | 763 | case DataType::QSYMM16: |
| 764 | os << "QSYMM16"; |
| 765 | break; |
Michele Di Giorgio | 35ea9a7 | 2019-08-23 12:02:06 +0100 | [diff] [blame] | 766 | case DataType::QASYMM16: |
| 767 | os << "QASYMM16"; |
| 768 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 769 | case DataType::U32: |
| 770 | os << "U32"; |
| 771 | break; |
| 772 | case DataType::S32: |
| 773 | os << "S32"; |
| 774 | break; |
| 775 | case DataType::U64: |
| 776 | os << "U64"; |
| 777 | break; |
| 778 | case DataType::S64: |
| 779 | os << "S64"; |
| 780 | break; |
Georgios Pinitas | e8291ac | 2020-02-26 09:58:13 +0000 | [diff] [blame] | 781 | case DataType::BFLOAT16: |
| 782 | os << "BFLOAT16"; |
| 783 | break; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 784 | case DataType::F16: |
| 785 | os << "F16"; |
| 786 | break; |
| 787 | case DataType::F32: |
| 788 | os << "F32"; |
| 789 | break; |
| 790 | case DataType::F64: |
| 791 | os << "F64"; |
| 792 | break; |
| 793 | case DataType::SIZET: |
| 794 | os << "SIZET"; |
| 795 | break; |
| 796 | default: |
| 797 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 798 | } |
| 799 | |
| 800 | return os; |
| 801 | } |
| 802 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 803 | /** Formatted output of the DataType type. |
| 804 | * |
| 805 | * @param[in] data_type Type to output. |
| 806 | * |
| 807 | * @return Formatted string. |
| 808 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 809 | inline std::string to_string(const arm_compute::DataType &data_type) |
Moritz Pflanzer | ee493ae | 2017-07-05 10:52:21 +0100 | [diff] [blame] | 810 | { |
| 811 | std::stringstream str; |
| 812 | str << data_type; |
| 813 | return str.str(); |
| 814 | } |
| 815 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 816 | /** Formatted output of the Format type. |
| 817 | * |
| 818 | * @param[out] os Output stream. |
| 819 | * @param[in] format Type to output. |
| 820 | * |
| 821 | * @return Modified output stream. |
| 822 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 823 | inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) |
| 824 | { |
| 825 | switch(format) |
| 826 | { |
| 827 | case Format::UNKNOWN: |
| 828 | os << "UNKNOWN"; |
| 829 | break; |
| 830 | case Format::U8: |
| 831 | os << "U8"; |
| 832 | break; |
| 833 | case Format::S16: |
| 834 | os << "S16"; |
| 835 | break; |
| 836 | case Format::U16: |
| 837 | os << "U16"; |
| 838 | break; |
| 839 | case Format::S32: |
| 840 | os << "S32"; |
| 841 | break; |
| 842 | case Format::U32: |
| 843 | os << "U32"; |
| 844 | break; |
| 845 | case Format::F16: |
| 846 | os << "F16"; |
| 847 | break; |
| 848 | case Format::F32: |
| 849 | os << "F32"; |
| 850 | break; |
| 851 | case Format::UV88: |
| 852 | os << "UV88"; |
| 853 | break; |
| 854 | case Format::RGB888: |
| 855 | os << "RGB888"; |
| 856 | break; |
| 857 | case Format::RGBA8888: |
| 858 | os << "RGBA8888"; |
| 859 | break; |
| 860 | case Format::YUV444: |
| 861 | os << "YUV444"; |
| 862 | break; |
| 863 | case Format::YUYV422: |
| 864 | os << "YUYV422"; |
| 865 | break; |
| 866 | case Format::NV12: |
| 867 | os << "NV12"; |
| 868 | break; |
| 869 | case Format::NV21: |
| 870 | os << "NV21"; |
| 871 | break; |
| 872 | case Format::IYUV: |
| 873 | os << "IYUV"; |
| 874 | break; |
| 875 | case Format::UYVY422: |
| 876 | os << "UYVY422"; |
| 877 | break; |
| 878 | default: |
| 879 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 880 | } |
| 881 | |
| 882 | return os; |
| 883 | } |
| 884 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 885 | /** Formatted output of the Format type. |
| 886 | * |
| 887 | * @param[in] format Type to output. |
| 888 | * |
| 889 | * @return Formatted string. |
| 890 | */ |
Moritz Pflanzer | 7655a67 | 2017-09-23 11:57:33 +0100 | [diff] [blame] | 891 | inline std::string to_string(const Format &format) |
| 892 | { |
| 893 | std::stringstream str; |
| 894 | str << format; |
| 895 | return str.str(); |
| 896 | } |
| 897 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 898 | /** Formatted output of the Channel type. |
| 899 | * |
| 900 | * @param[out] os Output stream. |
| 901 | * @param[in] channel Type to output. |
| 902 | * |
| 903 | * @return Modified output stream. |
| 904 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 905 | inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) |
| 906 | { |
| 907 | switch(channel) |
| 908 | { |
| 909 | case Channel::UNKNOWN: |
| 910 | os << "UNKNOWN"; |
| 911 | break; |
| 912 | case Channel::C0: |
| 913 | os << "C0"; |
| 914 | break; |
| 915 | case Channel::C1: |
| 916 | os << "C1"; |
| 917 | break; |
| 918 | case Channel::C2: |
| 919 | os << "C2"; |
| 920 | break; |
| 921 | case Channel::C3: |
| 922 | os << "C3"; |
| 923 | break; |
| 924 | case Channel::R: |
| 925 | os << "R"; |
| 926 | break; |
| 927 | case Channel::G: |
| 928 | os << "G"; |
| 929 | break; |
| 930 | case Channel::B: |
| 931 | os << "B"; |
| 932 | break; |
| 933 | case Channel::A: |
| 934 | os << "A"; |
| 935 | break; |
| 936 | case Channel::Y: |
| 937 | os << "Y"; |
| 938 | break; |
| 939 | case Channel::U: |
| 940 | os << "U"; |
| 941 | break; |
| 942 | case Channel::V: |
| 943 | os << "V"; |
| 944 | break; |
| 945 | default: |
| 946 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 947 | } |
| 948 | |
| 949 | return os; |
| 950 | } |
| 951 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 952 | /** Formatted output of the Channel type. |
| 953 | * |
| 954 | * @param[in] channel Type to output. |
| 955 | * |
| 956 | * @return Formatted string. |
| 957 | */ |
Ioan-Cristian Szabo | 9414f64 | 2017-10-27 17:35:40 +0100 | [diff] [blame] | 958 | inline std::string to_string(const Channel &channel) |
| 959 | { |
| 960 | std::stringstream str; |
| 961 | str << channel; |
| 962 | return str.str(); |
| 963 | } |
| 964 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 965 | /** Formatted output of the BorderMode type. |
| 966 | * |
| 967 | * @param[out] os Output stream. |
| 968 | * @param[in] mode Type to output. |
| 969 | * |
| 970 | * @return Modified output stream. |
| 971 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 972 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) |
| 973 | { |
| 974 | switch(mode) |
| 975 | { |
| 976 | case BorderMode::UNDEFINED: |
| 977 | os << "UNDEFINED"; |
| 978 | break; |
| 979 | case BorderMode::CONSTANT: |
| 980 | os << "CONSTANT"; |
| 981 | break; |
| 982 | case BorderMode::REPLICATE: |
| 983 | os << "REPLICATE"; |
| 984 | break; |
| 985 | default: |
| 986 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 987 | } |
| 988 | |
| 989 | return os; |
| 990 | } |
| 991 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 992 | /** Formatted output of the BorderSize type. |
| 993 | * |
| 994 | * @param[out] os Output stream. |
| 995 | * @param[in] border Type to output. |
| 996 | * |
| 997 | * @return Modified output stream. |
| 998 | */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 999 | inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) |
| 1000 | { |
Moritz Pflanzer | c87fbf8 | 2017-07-18 14:02:10 +0100 | [diff] [blame] | 1001 | os << border.top << "," |
| 1002 | << border.right << "," |
| 1003 | << border.bottom << "," |
| 1004 | << border.left; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1005 | |
| 1006 | return os; |
| 1007 | } |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1008 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 1009 | /** Formatted output of the PaddingList type. |
| 1010 | * |
| 1011 | * @param[out] os Output stream. |
| 1012 | * @param[in] padding Type to output. |
| 1013 | * |
| 1014 | * @return Modified output stream. |
| 1015 | */ |
| 1016 | inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding) |
| 1017 | { |
| 1018 | os << "{"; |
| 1019 | for(auto const &p : padding) |
| 1020 | { |
| 1021 | os << "{" << p.first << "," << p.second << "}"; |
| 1022 | } |
| 1023 | os << "}"; |
| 1024 | return os; |
| 1025 | } |
| 1026 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 1027 | /** Formatted output of the Multiples type. |
| 1028 | * |
| 1029 | * @param[out] os Output stream. |
| 1030 | * @param[in] multiples Type to output. |
| 1031 | * |
| 1032 | * @return Modified output stream. |
| 1033 | */ |
| 1034 | inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples) |
| 1035 | { |
| 1036 | os << "("; |
| 1037 | for(size_t i = 0; i < multiples.size() - 1; i++) |
| 1038 | { |
| 1039 | os << multiples[i] << ", "; |
| 1040 | } |
| 1041 | os << multiples.back() << ")"; |
| 1042 | return os; |
| 1043 | } |
| 1044 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1045 | /** Formatted output of the InterpolationPolicy type. |
| 1046 | * |
| 1047 | * @param[out] os Output stream. |
| 1048 | * @param[in] policy Type to output. |
| 1049 | * |
| 1050 | * @return Modified output stream. |
| 1051 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1052 | inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) |
| 1053 | { |
| 1054 | switch(policy) |
| 1055 | { |
| 1056 | case InterpolationPolicy::NEAREST_NEIGHBOR: |
| 1057 | os << "NEAREST_NEIGHBOR"; |
| 1058 | break; |
| 1059 | case InterpolationPolicy::BILINEAR: |
| 1060 | os << "BILINEAR"; |
| 1061 | break; |
| 1062 | case InterpolationPolicy::AREA: |
| 1063 | os << "AREA"; |
| 1064 | break; |
| 1065 | default: |
| 1066 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1067 | } |
| 1068 | |
| 1069 | return os; |
| 1070 | } |
| 1071 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1072 | /** Formatted output of the SamplingPolicy type. |
| 1073 | * |
| 1074 | * @param[out] os Output stream. |
| 1075 | * @param[in] policy Type to output. |
| 1076 | * |
| 1077 | * @return Modified output stream. |
| 1078 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 1079 | inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy) |
| 1080 | { |
| 1081 | switch(policy) |
| 1082 | { |
| 1083 | case SamplingPolicy::CENTER: |
| 1084 | os << "CENTER"; |
| 1085 | break; |
| 1086 | case SamplingPolicy::TOP_LEFT: |
| 1087 | os << "TOP_LEFT"; |
| 1088 | break; |
| 1089 | default: |
| 1090 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1091 | } |
| 1092 | |
| 1093 | return os; |
| 1094 | } |
| 1095 | |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1096 | /** Formatted output of the ITensorInfo type. |
| 1097 | * |
| 1098 | * @param[out] os Output stream. |
| 1099 | * @param[in] info Tensor information. |
| 1100 | * |
| 1101 | * @return Modified output stream. |
| 1102 | */ |
| 1103 | inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info) |
| 1104 | { |
Georgios Pinitas | c6f9510 | 2021-03-30 10:03:01 +0100 | [diff] [blame] | 1105 | const DataType data_type = info->data_type(); |
| 1106 | const DataLayout data_layout = info->data_layout(); |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1107 | |
| 1108 | os << "Shape=" << info->tensor_shape() << "," |
| 1109 | << "DataLayout=" << string_from_data_layout(data_layout) << "," |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 1110 | << "DataType=" << string_from_data_type(data_type); |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1111 | |
| 1112 | if(is_data_type_quantized(data_type)) |
| 1113 | { |
ramelg01 | b1ba1e3 | 2021-09-25 11:53:26 +0100 | [diff] [blame] | 1114 | const QuantizationInfo qinfo = info->quantization_info(); |
| 1115 | const auto scales = qinfo.scale(); |
| 1116 | const auto offsets = qinfo.offset(); |
| 1117 | |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 1118 | os << ", QuantizationInfo={" |
ramelg01 | b1ba1e3 | 2021-09-25 11:53:26 +0100 | [diff] [blame] | 1119 | << "scales.size=" << scales.size() |
| 1120 | << ", scale(s)=" << scales << ", "; |
| 1121 | |
| 1122 | os << "offsets.size=" << offsets.size() |
| 1123 | << ", offset(s)=" << offsets << "}"; |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1124 | } |
| 1125 | return os; |
| 1126 | } |
| 1127 | |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1128 | /** Formatted output of the const TensorInfo& type. |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1129 | * |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 1130 | * @param[out] os Output stream. |
| 1131 | * @param[in] info Type to output. |
| 1132 | * |
| 1133 | * @return Modified output stream. |
| 1134 | */ |
| 1135 | inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info) |
| 1136 | { |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1137 | os << &info; |
Georgios Pinitas | c6f9510 | 2021-03-30 10:03:01 +0100 | [diff] [blame] | 1138 | return os; |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 1139 | } |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1140 | |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1141 | /** Formatted output of the const TensorInfo& type. |
Anthony Barbier | 366628a | 2018-08-01 13:55:03 +0100 | [diff] [blame] | 1142 | * |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1143 | * @param[in] info Type to output. |
| 1144 | * |
| 1145 | * @return Formatted string. |
| 1146 | */ |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 1147 | inline std::string to_string(const TensorInfo &info) |
| 1148 | { |
| 1149 | std::stringstream str; |
Michele Di Giorgio | c22eb1b | 2021-02-01 10:39:06 +0000 | [diff] [blame] | 1150 | str << &info; |
Georgios Pinitas | 3faea25 | 2017-10-30 14:13:50 +0000 | [diff] [blame] | 1151 | return str.str(); |
| 1152 | } |
| 1153 | |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1154 | /** Formatted output of the const ITensorInfo& type. |
| 1155 | * |
| 1156 | * @param[in] info Type to output. |
| 1157 | * |
| 1158 | * @return Formatted string. |
| 1159 | */ |
| 1160 | inline std::string to_string(const ITensorInfo &info) |
| 1161 | { |
| 1162 | std::stringstream str; |
| 1163 | str << &info; |
| 1164 | return str.str(); |
| 1165 | } |
| 1166 | |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1167 | /** Formatted output of the const ITensorInfo* type. |
| 1168 | * |
| 1169 | * @param[in] info Type to output. |
| 1170 | * |
| 1171 | * @return Formatted string. |
| 1172 | */ |
Ramy Elgammal | e920d6a | 2021-08-19 22:10:30 +0100 | [diff] [blame] | 1173 | inline std::string to_string(const ITensorInfo *info) |
| 1174 | { |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1175 | std::string ret_str = "nullptr"; |
| 1176 | if(info != nullptr) |
| 1177 | { |
| 1178 | std::stringstream str; |
| 1179 | str << info; |
| 1180 | ret_str = str.str(); |
| 1181 | } |
| 1182 | return ret_str; |
| 1183 | } |
| 1184 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1185 | /** Formatted output of the ITensorInfo* type. |
| 1186 | * |
| 1187 | * @param[in] info Type to output. |
| 1188 | * |
| 1189 | * @return Formatted string. |
| 1190 | */ |
| 1191 | inline std::string to_string(ITensorInfo *info) |
| 1192 | { |
| 1193 | return to_string(static_cast<const ITensorInfo *>(info)); |
| 1194 | } |
| 1195 | |
| 1196 | /** Formatted output of the ITensorInfo type obtained from const ITensor* type. |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1197 | * |
| 1198 | * @param[in] tensor Type to output. |
| 1199 | * |
| 1200 | * @return Formatted string. |
| 1201 | */ |
| 1202 | inline std::string to_string(const ITensor *tensor) |
| 1203 | { |
| 1204 | std::string ret_str = "nullptr"; |
| 1205 | if(tensor != nullptr) |
| 1206 | { |
| 1207 | std::stringstream str; |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1208 | str << "ITensor->info(): " << tensor->info(); |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1209 | ret_str = str.str(); |
| 1210 | } |
| 1211 | return ret_str; |
| 1212 | } |
| 1213 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1214 | /** Formatted output of the ITensorInfo type obtained from the ITensor* type. |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1215 | * |
| 1216 | * @param[in] tensor Type to output. |
| 1217 | * |
| 1218 | * @return Formatted string. |
| 1219 | */ |
| 1220 | inline std::string to_string(ITensor *tensor) |
| 1221 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1222 | return to_string(static_cast<const ITensor *>(tensor)); |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1223 | } |
| 1224 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1225 | /** Formatted output of the ITensorInfo type obtained from the ITensor& type. |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 1226 | * |
| 1227 | * @param[in] tensor Type to output. |
| 1228 | * |
| 1229 | * @return Formatted string. |
| 1230 | */ |
| 1231 | inline std::string to_string(ITensor &tensor) |
| 1232 | { |
Ramy Elgammal | e920d6a | 2021-08-19 22:10:30 +0100 | [diff] [blame] | 1233 | std::stringstream str; |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1234 | str << "ITensor.info(): " << tensor.info(); |
Ramy Elgammal | e920d6a | 2021-08-19 22:10:30 +0100 | [diff] [blame] | 1235 | return str.str(); |
| 1236 | } |
| 1237 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1238 | #ifdef ARM_COMPUTE_OPENCL_ENABLED |
| 1239 | /** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type. |
| 1240 | * |
| 1241 | * @param[in] cl_tensor Type to output. |
| 1242 | * |
| 1243 | * @return Formatted string. |
| 1244 | */ |
| 1245 | inline std::string to_string(const ICLTensor *cl_tensor) |
| 1246 | { |
| 1247 | std::string ret_str = "nullptr"; |
| 1248 | if(cl_tensor != nullptr) |
| 1249 | { |
| 1250 | std::stringstream str; |
| 1251 | str << "ICLTensor->info(): " << cl_tensor->info(); |
| 1252 | ret_str = str.str(); |
| 1253 | } |
| 1254 | return ret_str; |
| 1255 | } |
| 1256 | |
| 1257 | /** Formatted output of the ITensorInfo type obtained from the ICLTensor& type. |
| 1258 | * |
| 1259 | * @param[in] cl_tensor Type to output. |
| 1260 | * |
| 1261 | * @return Formatted string. |
| 1262 | */ |
| 1263 | inline std::string to_string(ICLTensor *cl_tensor) |
| 1264 | { |
| 1265 | return to_string(static_cast<const ICLTensor *>(cl_tensor)); |
| 1266 | } |
| 1267 | #endif /* ARM_COMPUTE_OPENCL_ENABLED */ |
| 1268 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1269 | /** Formatted output of the Dimensions type. |
| 1270 | * |
| 1271 | * @param[in] dimensions Type to output. |
| 1272 | * |
| 1273 | * @return Formatted string. |
| 1274 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1275 | template <typename T> |
| 1276 | inline std::string to_string(const Dimensions<T> &dimensions) |
| 1277 | { |
| 1278 | std::stringstream str; |
| 1279 | str << dimensions; |
| 1280 | return str.str(); |
| 1281 | } |
| 1282 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1283 | /** Formatted output of the Strides type. |
| 1284 | * |
| 1285 | * @param[in] stride Type to output. |
| 1286 | * |
| 1287 | * @return Formatted string. |
| 1288 | */ |
John Richardson | a36eae1 | 2017-09-26 16:55:59 +0100 | [diff] [blame] | 1289 | inline std::string to_string(const Strides &stride) |
| 1290 | { |
| 1291 | std::stringstream str; |
| 1292 | str << stride; |
| 1293 | return str.str(); |
| 1294 | } |
| 1295 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1296 | /** Formatted output of the TensorShape type. |
| 1297 | * |
| 1298 | * @param[in] shape Type to output. |
| 1299 | * |
| 1300 | * @return Formatted string. |
| 1301 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1302 | inline std::string to_string(const TensorShape &shape) |
| 1303 | { |
| 1304 | std::stringstream str; |
| 1305 | str << shape; |
| 1306 | return str.str(); |
| 1307 | } |
| 1308 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1309 | /** Formatted output of the Coordinates type. |
| 1310 | * |
| 1311 | * @param[in] coord Type to output. |
| 1312 | * |
| 1313 | * @return Formatted string. |
| 1314 | */ |
Abe Mbise | 925ca0f | 2017-10-02 19:16:33 +0100 | [diff] [blame] | 1315 | inline std::string to_string(const Coordinates &coord) |
| 1316 | { |
| 1317 | std::stringstream str; |
| 1318 | str << coord; |
| 1319 | return str.str(); |
| 1320 | } |
| 1321 | |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1322 | /** Formatted output of the GEMMReshapeInfo type. |
| 1323 | * |
| 1324 | * @param[out] os Output stream. |
| 1325 | * @param[in] info Type to output. |
| 1326 | * |
| 1327 | * @return Modified output stream. |
| 1328 | */ |
| 1329 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info) |
| 1330 | { |
| 1331 | os << "{m=" << info.m() << ","; |
| 1332 | os << "n=" << info.n() << ","; |
| 1333 | os << "k=" << info.k() << ","; |
| 1334 | os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ","; |
| 1335 | os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height(); |
| 1336 | os << "}"; |
| 1337 | |
| 1338 | return os; |
| 1339 | } |
| 1340 | |
| 1341 | /** Formatted output of the GEMMInfo type. |
| 1342 | * |
| 1343 | * @param[out] os Output stream. |
| 1344 | * @param[in] info Type to output. |
| 1345 | * |
| 1346 | * @return Modified output stream. |
| 1347 | */ |
| 1348 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info) |
| 1349 | { |
| 1350 | os << "{is_a_reshaped=" << info.is_a_reshaped() << ","; |
| 1351 | os << "is_b_reshaped=" << info.is_b_reshaped() << ","; |
| 1352 | 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] | 1353 | os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ","; |
| 1354 | os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ","; |
| 1355 | os << "retain_internal_weights=" << info.retain_internal_weights() << ","; |
| 1356 | os << "fp_mixed_precision=" << info.fp_mixed_precision() << ","; |
| 1357 | os << "broadcast_bias=" << info.broadcast_bias() << ","; |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1358 | os << "pretranspose_B=" << info.pretranspose_B() << ","; |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1359 | |
| 1360 | return os; |
| 1361 | } |
| 1362 | |
| 1363 | /** Formatted output of the Window::Dimension type. |
| 1364 | * |
| 1365 | * @param[out] os Output stream. |
| 1366 | * @param[in] dim Type to output. |
| 1367 | * |
| 1368 | * @return Modified output stream. |
| 1369 | */ |
| 1370 | inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim) |
| 1371 | { |
| 1372 | os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}"; |
| 1373 | |
| 1374 | return os; |
| 1375 | } |
| 1376 | /** Formatted output of the Window type. |
| 1377 | * |
| 1378 | * @param[out] os Output stream. |
| 1379 | * @param[in] win Type to output. |
| 1380 | * |
| 1381 | * @return Modified output stream. |
| 1382 | */ |
| 1383 | inline ::std::ostream &operator<<(::std::ostream &os, const Window &win) |
| 1384 | { |
| 1385 | os << "{"; |
| 1386 | for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++) |
| 1387 | { |
| 1388 | if(i > 0) |
| 1389 | { |
| 1390 | os << ", "; |
| 1391 | } |
| 1392 | os << win[i]; |
| 1393 | } |
| 1394 | os << "}"; |
| 1395 | |
| 1396 | return os; |
| 1397 | } |
| 1398 | |
| 1399 | /** Formatted output of the WeightsInfo type. |
| 1400 | * |
| 1401 | * @param[in] info Type to output. |
| 1402 | * |
| 1403 | * @return Formatted string. |
| 1404 | */ |
| 1405 | inline std::string to_string(const WeightsInfo &info) |
| 1406 | { |
| 1407 | std::stringstream str; |
| 1408 | str << info; |
| 1409 | return str.str(); |
| 1410 | } |
| 1411 | |
| 1412 | /** Formatted output of the GEMMReshapeInfo type. |
| 1413 | * |
| 1414 | * @param[in] info Type to output. |
| 1415 | * |
| 1416 | * @return Formatted string. |
| 1417 | */ |
| 1418 | inline std::string to_string(const GEMMReshapeInfo &info) |
| 1419 | { |
| 1420 | std::stringstream str; |
| 1421 | str << info; |
| 1422 | return str.str(); |
| 1423 | } |
| 1424 | |
| 1425 | /** Formatted output of the GEMMInfo type. |
| 1426 | * |
| 1427 | * @param[in] info Type to output. |
| 1428 | * |
| 1429 | * @return Formatted string. |
| 1430 | */ |
| 1431 | inline std::string to_string(const GEMMInfo &info) |
| 1432 | { |
| 1433 | std::stringstream str; |
| 1434 | str << info; |
| 1435 | return str.str(); |
| 1436 | } |
| 1437 | |
| 1438 | /** Formatted output of the Window::Dimension type. |
| 1439 | * |
| 1440 | * @param[in] dim Type to output. |
| 1441 | * |
| 1442 | * @return Formatted string. |
| 1443 | */ |
| 1444 | inline std::string to_string(const Window::Dimension &dim) |
| 1445 | { |
| 1446 | std::stringstream str; |
| 1447 | str << dim; |
| 1448 | return str.str(); |
| 1449 | } |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1450 | /** Formatted output of the Window& type. |
Anthony Barbier | b940fd6 | 2018-06-04 14:14:32 +0100 | [diff] [blame] | 1451 | * |
| 1452 | * @param[in] win Type to output. |
| 1453 | * |
| 1454 | * @return Formatted string. |
| 1455 | */ |
| 1456 | inline std::string to_string(const Window &win) |
| 1457 | { |
| 1458 | std::stringstream str; |
| 1459 | str << win; |
| 1460 | return str.str(); |
| 1461 | } |
| 1462 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 1463 | /** Formatted output of the Window* type. |
| 1464 | * |
| 1465 | * @param[in] win Type to output. |
| 1466 | * |
| 1467 | * @return Formatted string. |
| 1468 | */ |
| 1469 | inline std::string to_string(Window *win) |
| 1470 | { |
| 1471 | std::string ret_str = "nullptr"; |
| 1472 | if(win != nullptr) |
| 1473 | { |
| 1474 | std::stringstream str; |
| 1475 | str << *win; |
| 1476 | ret_str = str.str(); |
| 1477 | } |
| 1478 | return ret_str; |
| 1479 | } |
| 1480 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1481 | /** Formatted output of the Rectangle type. |
| 1482 | * |
| 1483 | * @param[out] os Output stream. |
| 1484 | * @param[in] rect Type to output. |
| 1485 | * |
| 1486 | * @return Modified output stream. |
| 1487 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1488 | inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) |
| 1489 | { |
| 1490 | os << rect.width << "x" << rect.height; |
| 1491 | os << "+" << rect.x << "+" << rect.y; |
| 1492 | |
| 1493 | return os; |
| 1494 | } |
| 1495 | |
Usama Arif | 8cf8c11 | 2019-03-14 15:36:54 +0000 | [diff] [blame] | 1496 | /** Formatted output of the PaddingMode type. |
| 1497 | * |
| 1498 | * @param[out] os Output stream. |
| 1499 | * @param[in] mode Type to output. |
| 1500 | * |
| 1501 | * @return Modified output stream. |
| 1502 | */ |
| 1503 | inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode) |
| 1504 | { |
| 1505 | switch(mode) |
| 1506 | { |
| 1507 | case PaddingMode::CONSTANT: |
| 1508 | os << "CONSTANT"; |
| 1509 | break; |
| 1510 | case PaddingMode::REFLECT: |
| 1511 | os << "REFLECT"; |
| 1512 | break; |
| 1513 | case PaddingMode::SYMMETRIC: |
| 1514 | os << "SYMMETRIC"; |
| 1515 | break; |
| 1516 | default: |
| 1517 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1518 | } |
| 1519 | |
| 1520 | return os; |
| 1521 | } |
| 1522 | |
| 1523 | /** Formatted output of the PaddingMode type. |
| 1524 | * |
| 1525 | * @param[in] mode Type to output. |
| 1526 | * |
| 1527 | * @return Formatted string. |
| 1528 | */ |
| 1529 | inline std::string to_string(const PaddingMode &mode) |
| 1530 | { |
| 1531 | std::stringstream str; |
| 1532 | str << mode; |
| 1533 | return str.str(); |
| 1534 | } |
| 1535 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1536 | /** Formatted output of the PadStrideInfo type. |
| 1537 | * |
| 1538 | * @param[out] os Output stream. |
| 1539 | * @param[in] pad_stride_info Type to output. |
| 1540 | * |
| 1541 | * @return Modified output stream. |
| 1542 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1543 | inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) |
| 1544 | { |
| 1545 | os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; |
| 1546 | os << ";"; |
Jaroslaw Rzepecki | a1ed41f | 2017-10-13 11:13:58 +0100 | [diff] [blame] | 1547 | os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," |
| 1548 | << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom(); |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1549 | |
| 1550 | return os; |
| 1551 | } |
| 1552 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1553 | /** Formatted output of the PadStrideInfo type. |
| 1554 | * |
| 1555 | * @param[in] pad_stride_info Type to output. |
| 1556 | * |
| 1557 | * @return Formatted string. |
| 1558 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1559 | inline std::string to_string(const PadStrideInfo &pad_stride_info) |
| 1560 | { |
| 1561 | std::stringstream str; |
| 1562 | str << pad_stride_info; |
| 1563 | return str.str(); |
| 1564 | } |
| 1565 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1566 | /** Formatted output of the BorderMode type. |
| 1567 | * |
| 1568 | * @param[in] mode Type to output. |
| 1569 | * |
| 1570 | * @return Formatted string. |
| 1571 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1572 | inline std::string to_string(const BorderMode &mode) |
| 1573 | { |
| 1574 | std::stringstream str; |
| 1575 | str << mode; |
| 1576 | return str.str(); |
| 1577 | } |
| 1578 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1579 | /** Formatted output of the BorderSize type. |
| 1580 | * |
| 1581 | * @param[in] border Type to output. |
| 1582 | * |
| 1583 | * @return Formatted string. |
| 1584 | */ |
John Richardson | b482ce1 | 2017-09-18 12:44:01 +0100 | [diff] [blame] | 1585 | inline std::string to_string(const BorderSize &border) |
| 1586 | { |
| 1587 | std::stringstream str; |
| 1588 | str << border; |
| 1589 | return str.str(); |
| 1590 | } |
| 1591 | |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 1592 | /** Formatted output of the PaddingList type. |
| 1593 | * |
| 1594 | * @param[in] padding Type to output. |
| 1595 | * |
| 1596 | * @return Formatted string. |
| 1597 | */ |
| 1598 | inline std::string to_string(const PaddingList &padding) |
| 1599 | { |
| 1600 | std::stringstream str; |
| 1601 | str << padding; |
| 1602 | return str.str(); |
| 1603 | } |
| 1604 | |
giuros01 | 3175fcf | 2018-11-21 09:59:17 +0000 | [diff] [blame] | 1605 | /** Formatted output of the Multiples type. |
| 1606 | * |
| 1607 | * @param[in] multiples Type to output. |
| 1608 | * |
| 1609 | * @return Formatted string. |
| 1610 | */ |
| 1611 | inline std::string to_string(const Multiples &multiples) |
| 1612 | { |
| 1613 | std::stringstream str; |
| 1614 | str << multiples; |
| 1615 | return str.str(); |
| 1616 | } |
| 1617 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1618 | /** Formatted output of the InterpolationPolicy type. |
| 1619 | * |
| 1620 | * @param[in] policy Type to output. |
| 1621 | * |
| 1622 | * @return Formatted string. |
| 1623 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1624 | inline std::string to_string(const InterpolationPolicy &policy) |
| 1625 | { |
| 1626 | std::stringstream str; |
| 1627 | str << policy; |
| 1628 | return str.str(); |
| 1629 | } |
| 1630 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1631 | /** Formatted output of the SamplingPolicy type. |
| 1632 | * |
| 1633 | * @param[in] policy Type to output. |
| 1634 | * |
| 1635 | * @return Formatted string. |
| 1636 | */ |
Daniil Efremov | 02bf80d | 2017-11-22 00:26:51 +0700 | [diff] [blame] | 1637 | inline std::string to_string(const SamplingPolicy &policy) |
| 1638 | { |
| 1639 | std::stringstream str; |
| 1640 | str << policy; |
| 1641 | return str.str(); |
| 1642 | } |
| 1643 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1644 | /** Formatted output of the ConvertPolicy type. |
| 1645 | * |
| 1646 | * @param[out] os Output stream. |
| 1647 | * @param[in] policy Type to output. |
| 1648 | * |
| 1649 | * @return Modified output stream. |
| 1650 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1651 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) |
| 1652 | { |
| 1653 | switch(policy) |
| 1654 | { |
| 1655 | case ConvertPolicy::WRAP: |
| 1656 | os << "WRAP"; |
| 1657 | break; |
| 1658 | case ConvertPolicy::SATURATE: |
| 1659 | os << "SATURATE"; |
| 1660 | break; |
| 1661 | default: |
| 1662 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1663 | } |
| 1664 | |
| 1665 | return os; |
| 1666 | } |
| 1667 | |
| 1668 | inline std::string to_string(const ConvertPolicy &policy) |
| 1669 | { |
| 1670 | std::stringstream str; |
| 1671 | str << policy; |
| 1672 | return str.str(); |
| 1673 | } |
| 1674 | |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1675 | /** Formatted output of the ArithmeticOperation type. |
| 1676 | * |
| 1677 | * @param[out] os Output stream. |
| 1678 | * @param[in] op Operation to output. |
| 1679 | * |
| 1680 | * @return Modified output stream. |
| 1681 | */ |
| 1682 | inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op) |
| 1683 | { |
| 1684 | switch(op) |
| 1685 | { |
| 1686 | case ArithmeticOperation::ADD: |
| 1687 | os << "ADD"; |
| 1688 | break; |
| 1689 | case ArithmeticOperation::SUB: |
| 1690 | os << "SUB"; |
| 1691 | break; |
| 1692 | case ArithmeticOperation::DIV: |
| 1693 | os << "DIV"; |
| 1694 | break; |
| 1695 | case ArithmeticOperation::MAX: |
| 1696 | os << "MAX"; |
| 1697 | break; |
| 1698 | case ArithmeticOperation::MIN: |
| 1699 | os << "MIN"; |
| 1700 | break; |
| 1701 | case ArithmeticOperation::SQUARED_DIFF: |
| 1702 | os << "SQUARED_DIFF"; |
| 1703 | break; |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 1704 | case ArithmeticOperation::POWER: |
| 1705 | os << "POWER"; |
| 1706 | break; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1707 | default: |
| 1708 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1709 | } |
| 1710 | |
| 1711 | return os; |
| 1712 | } |
| 1713 | |
| 1714 | /** Formatted output of the Arithmetic Operation |
| 1715 | * |
| 1716 | * @param[in] op Type to output. |
| 1717 | * |
| 1718 | * @return Formatted string. |
| 1719 | */ |
| 1720 | inline std::string to_string(const ArithmeticOperation &op) |
| 1721 | { |
| 1722 | std::stringstream str; |
| 1723 | str << op; |
| 1724 | return str.str(); |
| 1725 | } |
| 1726 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1727 | /** Formatted output of the Reduction Operations. |
| 1728 | * |
| 1729 | * @param[out] os Output stream. |
| 1730 | * @param[in] op Type to output. |
| 1731 | * |
| 1732 | * @return Modified output stream. |
| 1733 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1734 | inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op) |
| 1735 | { |
| 1736 | switch(op) |
| 1737 | { |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1738 | case ReductionOperation::SUM: |
| 1739 | os << "SUM"; |
| 1740 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1741 | case ReductionOperation::SUM_SQUARE: |
| 1742 | os << "SUM_SQUARE"; |
| 1743 | break; |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 1744 | case ReductionOperation::MEAN_SUM: |
| 1745 | os << "MEAN_SUM"; |
| 1746 | break; |
Michalis Spyrou | 7930db4 | 2018-11-22 17:36:28 +0000 | [diff] [blame] | 1747 | case ReductionOperation::ARG_IDX_MAX: |
| 1748 | os << "ARG_IDX_MAX"; |
| 1749 | break; |
| 1750 | case ReductionOperation::ARG_IDX_MIN: |
| 1751 | os << "ARG_IDX_MIN"; |
| 1752 | break; |
Manuel Bottini | b412fab | 2018-12-10 17:40:23 +0000 | [diff] [blame] | 1753 | case ReductionOperation::PROD: |
| 1754 | os << "PROD"; |
| 1755 | break; |
Usama Arif | a4a08ad | 2019-05-20 12:38:33 +0100 | [diff] [blame] | 1756 | case ReductionOperation::MIN: |
| 1757 | os << "MIN"; |
| 1758 | break; |
Usama Arif | 28f0dd9 | 2019-05-20 13:44:34 +0100 | [diff] [blame] | 1759 | case ReductionOperation::MAX: |
| 1760 | os << "MAX"; |
| 1761 | break; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1762 | default: |
| 1763 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1764 | } |
| 1765 | |
| 1766 | return os; |
| 1767 | } |
| 1768 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1769 | /** Formatted output of the Reduction Operations. |
| 1770 | * |
| 1771 | * @param[in] op Type to output. |
| 1772 | * |
| 1773 | * @return Formatted string. |
| 1774 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1775 | inline std::string to_string(const ReductionOperation &op) |
| 1776 | { |
| 1777 | std::stringstream str; |
| 1778 | str << op; |
| 1779 | return str.str(); |
| 1780 | } |
| 1781 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1782 | /** Formatted output of the Comparison Operations. |
| 1783 | * |
| 1784 | * @param[out] os Output stream. |
| 1785 | * @param[in] op Type to output. |
| 1786 | * |
| 1787 | * @return Modified output stream. |
| 1788 | */ |
| 1789 | inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op) |
| 1790 | { |
| 1791 | switch(op) |
| 1792 | { |
| 1793 | case ComparisonOperation::Equal: |
| 1794 | os << "Equal"; |
| 1795 | break; |
| 1796 | case ComparisonOperation::NotEqual: |
| 1797 | os << "NotEqual"; |
| 1798 | break; |
| 1799 | case ComparisonOperation::Greater: |
| 1800 | os << "Greater"; |
| 1801 | break; |
| 1802 | case ComparisonOperation::GreaterEqual: |
| 1803 | os << "GreaterEqual"; |
| 1804 | break; |
| 1805 | case ComparisonOperation::Less: |
| 1806 | os << "Less"; |
| 1807 | break; |
| 1808 | case ComparisonOperation::LessEqual: |
| 1809 | os << "LessEqual"; |
| 1810 | break; |
| 1811 | default: |
| 1812 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1813 | } |
| 1814 | |
| 1815 | return os; |
| 1816 | } |
| 1817 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1818 | /** Formatted output of the Elementwise unary Operations. |
| 1819 | * |
| 1820 | * @param[out] os Output stream. |
| 1821 | * @param[in] op Type to output. |
| 1822 | * |
| 1823 | * @return Modified output stream. |
| 1824 | */ |
| 1825 | inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op) |
| 1826 | { |
| 1827 | switch(op) |
| 1828 | { |
| 1829 | case ElementWiseUnary::RSQRT: |
| 1830 | os << "RSQRT"; |
| 1831 | break; |
| 1832 | case ElementWiseUnary::EXP: |
| 1833 | os << "EXP"; |
| 1834 | break; |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 1835 | case ElementWiseUnary::NEG: |
| 1836 | os << "NEG"; |
| 1837 | break; |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 1838 | case ElementWiseUnary::LOG: |
| 1839 | os << "LOG"; |
| 1840 | break; |
ramelg01 | b1ba1e3 | 2021-09-25 11:53:26 +0100 | [diff] [blame] | 1841 | case ElementWiseUnary::SIN: |
| 1842 | os << "SIN"; |
| 1843 | break; |
| 1844 | case ElementWiseUnary::ABS: |
| 1845 | os << "ABS"; |
| 1846 | break; |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 1847 | case ElementWiseUnary::ROUND: |
| 1848 | os << "ROUND"; |
| 1849 | break; |
ramelg01 | b1ba1e3 | 2021-09-25 11:53:26 +0100 | [diff] [blame] | 1850 | case ElementWiseUnary::LOGICAL_NOT: |
| 1851 | os << "LOGICAL_NOT"; |
| 1852 | break; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1853 | default: |
| 1854 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 1855 | } |
| 1856 | |
| 1857 | return os; |
| 1858 | } |
| 1859 | |
Georgios Pinitas | 7900a9e | 2018-11-23 11:44:58 +0000 | [diff] [blame] | 1860 | /** Formatted output of the Comparison Operations. |
| 1861 | * |
| 1862 | * @param[in] op Type to output. |
| 1863 | * |
| 1864 | * @return Formatted string. |
| 1865 | */ |
| 1866 | inline std::string to_string(const ComparisonOperation &op) |
| 1867 | { |
| 1868 | std::stringstream str; |
| 1869 | str << op; |
| 1870 | return str.str(); |
| 1871 | } |
| 1872 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1873 | /** Formatted output of the Elementwise unary Operations. |
| 1874 | * |
| 1875 | * @param[in] op Type to output. |
| 1876 | * |
| 1877 | * @return Formatted string. |
| 1878 | */ |
| 1879 | inline std::string to_string(const ElementWiseUnary &op) |
| 1880 | { |
| 1881 | std::stringstream str; |
| 1882 | str << op; |
| 1883 | return str.str(); |
| 1884 | } |
| 1885 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1886 | /** Formatted output of the Norm Type. |
| 1887 | * |
| 1888 | * @param[in] type Type to output. |
| 1889 | * |
| 1890 | * @return Formatted string. |
| 1891 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1892 | inline std::string to_string(const NormType &type) |
| 1893 | { |
| 1894 | std::stringstream str; |
| 1895 | str << type; |
| 1896 | return str.str(); |
| 1897 | } |
| 1898 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1899 | /** Formatted output of the Pooling Type. |
| 1900 | * |
| 1901 | * @param[in] type Type to output. |
| 1902 | * |
| 1903 | * @return Formatted string. |
| 1904 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1905 | inline std::string to_string(const PoolingType &type) |
| 1906 | { |
| 1907 | std::stringstream str; |
| 1908 | str << type; |
| 1909 | return str.str(); |
| 1910 | } |
| 1911 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1912 | /** Formatted output of the Pooling Layer Info. |
| 1913 | * |
| 1914 | * @param[in] info Type to output. |
| 1915 | * |
| 1916 | * @return Formatted string. |
| 1917 | */ |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1918 | inline std::string to_string(const PoolingLayerInfo &info) |
| 1919 | { |
| 1920 | std::stringstream str; |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1921 | str << "{Type=" << info.pool_type << "," |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 1922 | << "DataLayout=" << info.data_layout << "," |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1923 | << "IsGlobalPooling=" << info.is_global_pooling; |
| 1924 | if(!info.is_global_pooling) |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1925 | { |
| 1926 | str << "," |
Sang-Hoon Park | 0cb3da6 | 2020-01-15 12:39:56 +0000 | [diff] [blame] | 1927 | << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << "," |
| 1928 | << "PadStride=" << info.pad_stride_info; |
Georgios Pinitas | 4c2dd54 | 2017-11-13 12:58:41 +0000 | [diff] [blame] | 1929 | } |
| 1930 | str << "}"; |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 1931 | return str.str(); |
| 1932 | } |
| 1933 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 1934 | /** Formatted output of the PriorBoxLayerInfo. |
| 1935 | * |
| 1936 | * @param[in] info Type to output. |
| 1937 | * |
| 1938 | * @return Formatted string. |
| 1939 | */ |
| 1940 | inline std::string to_string(const PriorBoxLayerInfo &info) |
| 1941 | { |
| 1942 | std::stringstream str; |
| 1943 | str << "{"; |
| 1944 | str << "Clip:" << info.clip() |
| 1945 | << "Flip:" << info.flip() |
| 1946 | << "StepX:" << info.steps()[0] |
| 1947 | << "StepY:" << info.steps()[1] |
| 1948 | << "MinSizes:" << info.min_sizes().size() |
| 1949 | << "MaxSizes:" << info.max_sizes().size() |
| 1950 | << "ImgSizeX:" << info.img_size().x |
| 1951 | << "ImgSizeY:" << info.img_size().y |
| 1952 | << "Offset:" << info.offset() |
| 1953 | << "Variances:" << info.variances().size(); |
| 1954 | str << "}"; |
| 1955 | return str.str(); |
| 1956 | } |
| 1957 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1958 | /** Formatted output of the Size2D type. |
| 1959 | * |
| 1960 | * @param[out] os Output stream |
| 1961 | * @param[in] size Type to output |
| 1962 | * |
| 1963 | * @return Modified output stream. |
| 1964 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1965 | inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size) |
| 1966 | { |
| 1967 | os << size.width << "x" << size.height; |
| 1968 | |
| 1969 | return os; |
| 1970 | } |
| 1971 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 1972 | /** Formatted output of the Size2D type. |
| 1973 | * |
| 1974 | * @param[in] type Type to output |
| 1975 | * |
| 1976 | * @return Formatted string. |
| 1977 | */ |
John Richardson | 25f2368 | 2017-11-27 14:35:09 +0000 | [diff] [blame] | 1978 | inline std::string to_string(const Size2D &type) |
| 1979 | { |
| 1980 | std::stringstream str; |
| 1981 | str << type; |
| 1982 | return str.str(); |
| 1983 | } |
| 1984 | |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 1985 | /** Formatted output of the Size3D type. |
| 1986 | * |
| 1987 | * @param[out] os Output stream |
| 1988 | * @param[in] size Type to output |
| 1989 | * |
| 1990 | * @return Modified output stream. |
| 1991 | */ |
| 1992 | inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size) |
| 1993 | { |
| 1994 | os << size.width << "x" << size.height << "x" << size.depth; |
| 1995 | |
| 1996 | return os; |
| 1997 | } |
| 1998 | |
| 1999 | /** Formatted output of the Size2D type. |
| 2000 | * |
| 2001 | * @param[in] type Type to output |
| 2002 | * |
| 2003 | * @return Formatted string. |
| 2004 | */ |
| 2005 | inline std::string to_string(const Size3D &type) |
| 2006 | { |
| 2007 | std::stringstream str; |
| 2008 | str << type; |
| 2009 | return str.str(); |
| 2010 | } |
| 2011 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 2012 | /** Formatted output of the ConvolutionMethod type. |
| 2013 | * |
| 2014 | * @param[out] os Output stream |
| 2015 | * @param[in] conv_method Type to output |
| 2016 | * |
| 2017 | * @return Modified output stream. |
| 2018 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2019 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method) |
| 2020 | { |
| 2021 | switch(conv_method) |
| 2022 | { |
| 2023 | case ConvolutionMethod::GEMM: |
| 2024 | os << "GEMM"; |
| 2025 | break; |
| 2026 | case ConvolutionMethod::DIRECT: |
| 2027 | os << "DIRECT"; |
| 2028 | break; |
| 2029 | case ConvolutionMethod::WINOGRAD: |
| 2030 | os << "WINOGRAD"; |
| 2031 | break; |
| 2032 | default: |
| 2033 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2034 | } |
| 2035 | |
| 2036 | return os; |
| 2037 | } |
| 2038 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 2039 | /** Formatted output of the ConvolutionMethod type. |
| 2040 | * |
| 2041 | * @param[in] conv_method Type to output |
| 2042 | * |
| 2043 | * @return Formatted string. |
| 2044 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2045 | inline std::string to_string(const ConvolutionMethod &conv_method) |
| 2046 | { |
| 2047 | std::stringstream str; |
| 2048 | str << conv_method; |
| 2049 | return str.str(); |
| 2050 | } |
| 2051 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 2052 | /** Formatted output of the GPUTarget type. |
| 2053 | * |
| 2054 | * @param[out] os Output stream |
| 2055 | * @param[in] gpu_target Type to output |
| 2056 | * |
| 2057 | * @return Modified output stream. |
| 2058 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2059 | inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target) |
| 2060 | { |
| 2061 | switch(gpu_target) |
| 2062 | { |
| 2063 | case GPUTarget::GPU_ARCH_MASK: |
| 2064 | os << "GPU_ARCH_MASK"; |
| 2065 | break; |
| 2066 | case GPUTarget::MIDGARD: |
| 2067 | os << "MIDGARD"; |
| 2068 | break; |
| 2069 | case GPUTarget::BIFROST: |
| 2070 | os << "BIFROST"; |
| 2071 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 2072 | case GPUTarget::VALHALL: |
| 2073 | os << "VALHALL"; |
| 2074 | break; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2075 | case GPUTarget::T600: |
| 2076 | os << "T600"; |
| 2077 | break; |
| 2078 | case GPUTarget::T700: |
| 2079 | os << "T700"; |
| 2080 | break; |
| 2081 | case GPUTarget::T800: |
| 2082 | os << "T800"; |
| 2083 | break; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 2084 | case GPUTarget::G71: |
| 2085 | os << "G71"; |
| 2086 | break; |
| 2087 | case GPUTarget::G72: |
| 2088 | os << "G72"; |
| 2089 | break; |
| 2090 | case GPUTarget::G51: |
| 2091 | os << "G51"; |
| 2092 | break; |
| 2093 | case GPUTarget::G51BIG: |
| 2094 | os << "G51BIG"; |
| 2095 | break; |
| 2096 | case GPUTarget::G51LIT: |
| 2097 | os << "G51LIT"; |
| 2098 | break; |
Georgios Pinitas | b03f7c5 | 2018-07-12 10:49:53 +0100 | [diff] [blame] | 2099 | case GPUTarget::G76: |
| 2100 | os << "G76"; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 2101 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 2102 | case GPUTarget::G77: |
| 2103 | os << "G77"; |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 2104 | break; |
Georgios Pinitas | 4ffc42a | 2020-12-01 16:28:24 +0000 | [diff] [blame] | 2105 | case GPUTarget::G78: |
| 2106 | os << "G78"; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2107 | break; |
Pablo Marquez Tello | b1496e6 | 2021-06-25 14:49:37 +0100 | [diff] [blame] | 2108 | case GPUTarget::G31: |
| 2109 | os << "G31"; |
| 2110 | break; |
Georgios Pinitas | d5462ff | 2019-07-03 19:33:57 +0100 | [diff] [blame] | 2111 | case GPUTarget::TODX: |
| 2112 | os << "TODX"; |
| 2113 | break; |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2114 | default: |
| 2115 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2116 | } |
| 2117 | |
| 2118 | return os; |
| 2119 | } |
| 2120 | |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 2121 | /** Formatted output of the GPUTarget type. |
| 2122 | * |
| 2123 | * @param[in] gpu_target Type to output |
| 2124 | * |
| 2125 | * @return Formatted string. |
| 2126 | */ |
Isabella Gottardi | f07d28d | 2018-02-06 14:52:43 +0000 | [diff] [blame] | 2127 | inline std::string to_string(const GPUTarget &gpu_target) |
| 2128 | { |
| 2129 | std::stringstream str; |
| 2130 | str << gpu_target; |
| 2131 | return str.str(); |
| 2132 | } |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2133 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 2134 | /** Formatted output of the DetectionWindow type. |
| 2135 | * |
| 2136 | * @param[out] os Output stream |
| 2137 | * @param[in] detection_window Type to output |
| 2138 | * |
| 2139 | * @return Modified output stream. |
| 2140 | */ |
John Richardson | 684cb0f | 2018-01-09 11:17:00 +0000 | [diff] [blame] | 2141 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window) |
| 2142 | { |
| 2143 | os << "{x=" << detection_window.x << "," |
| 2144 | << "y=" << detection_window.y << "," |
| 2145 | << "width=" << detection_window.width << "," |
| 2146 | << "height=" << detection_window.height << "," |
| 2147 | << "idx_class=" << detection_window.idx_class << "," |
| 2148 | << "score=" << detection_window.score << "}"; |
| 2149 | |
| 2150 | return os; |
| 2151 | } |
| 2152 | |
Isabella Gottardi | 05e5644 | 2018-11-16 11:26:52 +0000 | [diff] [blame] | 2153 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 2154 | * |
| 2155 | * @param[out] os Output stream |
| 2156 | * @param[in] detection_code Type to output |
| 2157 | * |
| 2158 | * @return Modified output stream. |
| 2159 | */ |
| 2160 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code) |
| 2161 | { |
| 2162 | switch(detection_code) |
| 2163 | { |
| 2164 | case DetectionOutputLayerCodeType::CENTER_SIZE: |
| 2165 | os << "CENTER_SIZE"; |
| 2166 | break; |
| 2167 | case DetectionOutputLayerCodeType::CORNER: |
| 2168 | os << "CORNER"; |
| 2169 | break; |
| 2170 | case DetectionOutputLayerCodeType::CORNER_SIZE: |
| 2171 | os << "CORNER_SIZE"; |
| 2172 | break; |
| 2173 | case DetectionOutputLayerCodeType::TF_CENTER: |
| 2174 | os << "TF_CENTER"; |
| 2175 | break; |
| 2176 | default: |
| 2177 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2178 | } |
| 2179 | |
| 2180 | return os; |
| 2181 | } |
| 2182 | /** Formatted output of the DetectionOutputLayerCodeType type. |
| 2183 | * |
| 2184 | * @param[in] detection_code Type to output |
| 2185 | * |
| 2186 | * @return Formatted string. |
| 2187 | */ |
| 2188 | inline std::string to_string(const DetectionOutputLayerCodeType &detection_code) |
| 2189 | { |
| 2190 | std::stringstream str; |
| 2191 | str << detection_code; |
| 2192 | return str.str(); |
| 2193 | } |
| 2194 | |
| 2195 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 2196 | * |
| 2197 | * @param[out] os Output stream |
| 2198 | * @param[in] detection_info Type to output |
| 2199 | * |
| 2200 | * @return Modified output stream. |
| 2201 | */ |
| 2202 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info) |
| 2203 | { |
| 2204 | os << "{Classes=" << detection_info.num_classes() << "," |
| 2205 | << "ShareLocation=" << detection_info.share_location() << "," |
| 2206 | << "CodeType=" << detection_info.code_type() << "," |
| 2207 | << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << "," |
| 2208 | << "KeepTopK=" << detection_info.keep_top_k() << "," |
| 2209 | << "NMSThreshold=" << detection_info.nms_threshold() << "," |
| 2210 | << "Eta=" << detection_info.eta() << "," |
| 2211 | << "BackgroundLabelId=" << detection_info.background_label_id() << "," |
| 2212 | << "ConfidenceThreshold=" << detection_info.confidence_threshold() << "," |
| 2213 | << "TopK=" << detection_info.top_k() << "," |
| 2214 | << "NumLocClasses=" << detection_info.num_loc_classes() |
| 2215 | << "}"; |
| 2216 | |
| 2217 | return os; |
| 2218 | } |
| 2219 | |
| 2220 | /** Formatted output of the DetectionOutputLayerInfo type. |
| 2221 | * |
| 2222 | * @param[in] detection_info Type to output |
| 2223 | * |
| 2224 | * @return Formatted string. |
| 2225 | */ |
| 2226 | inline std::string to_string(const DetectionOutputLayerInfo &detection_info) |
| 2227 | { |
| 2228 | std::stringstream str; |
| 2229 | str << detection_info; |
| 2230 | return str.str(); |
| 2231 | } |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 2232 | /** Formatted output of the DetectionPostProcessLayerInfo type. |
| 2233 | * |
| 2234 | * @param[out] os Output stream |
| 2235 | * @param[in] detection_info Type to output |
| 2236 | * |
| 2237 | * @return Modified output stream. |
| 2238 | */ |
| 2239 | inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info) |
| 2240 | { |
| 2241 | os << "{MaxDetections=" << detection_info.max_detections() << "," |
| 2242 | << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << "," |
| 2243 | << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << "," |
| 2244 | << "NmsIouThreshold=" << detection_info.iou_threshold() << "," |
| 2245 | << "NumClasses=" << detection_info.num_classes() << "," |
| 2246 | << "ScaleValue_y=" << detection_info.scale_value_y() << "," |
| 2247 | << "ScaleValue_x=" << detection_info.scale_value_x() << "," |
| 2248 | << "ScaleValue_h=" << detection_info.scale_value_h() << "," |
| 2249 | << "ScaleValue_w=" << detection_info.scale_value_w() << "," |
| 2250 | << "UseRegularNms=" << detection_info.use_regular_nms() << "," |
| 2251 | << "DetectionPerClass=" << detection_info.detection_per_class() |
| 2252 | << "}"; |
| 2253 | |
| 2254 | return os; |
| 2255 | } |
| 2256 | |
| 2257 | /** Formatted output of the DetectionPostProcessLayerInfo type. |
| 2258 | * |
| 2259 | * @param[in] detection_info Type to output |
| 2260 | * |
| 2261 | * @return Formatted string. |
| 2262 | */ |
| 2263 | inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info) |
| 2264 | { |
| 2265 | std::stringstream str; |
| 2266 | str << detection_info; |
| 2267 | return str.str(); |
| 2268 | } |
Georgios Pinitas | c6f9510 | 2021-03-30 10:03:01 +0100 | [diff] [blame] | 2269 | |
John Richardson | 8de9261 | 2018-02-22 14:09:31 +0000 | [diff] [blame] | 2270 | /** Formatted output of the DetectionWindow type. |
| 2271 | * |
| 2272 | * @param[in] detection_window Type to output |
| 2273 | * |
| 2274 | * @return Formatted string. |
| 2275 | */ |
| 2276 | inline std::string to_string(const DetectionWindow &detection_window) |
| 2277 | { |
| 2278 | std::stringstream str; |
| 2279 | str << detection_window; |
| 2280 | return str.str(); |
| 2281 | } |
| 2282 | |
Michalis Spyrou | 6c7c38e | 2018-08-29 16:28:11 +0100 | [diff] [blame] | 2283 | /** Formatted output of @ref PriorBoxLayerInfo. |
| 2284 | * |
| 2285 | * @param[out] os Output stream. |
| 2286 | * @param[in] info Type to output. |
| 2287 | * |
| 2288 | * @return Modified output stream. |
| 2289 | */ |
| 2290 | inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info) |
| 2291 | { |
| 2292 | os << "Clip:" << info.clip() |
| 2293 | << "Flip:" << info.flip() |
| 2294 | << "StepX:" << info.steps()[0] |
| 2295 | << "StepY:" << info.steps()[1] |
| 2296 | << "MinSizes:" << info.min_sizes() |
| 2297 | << "MaxSizes:" << info.max_sizes() |
| 2298 | << "ImgSizeX:" << info.img_size().x |
| 2299 | << "ImgSizeY:" << info.img_size().y |
| 2300 | << "Offset:" << info.offset() |
| 2301 | << "Variances:" << info.variances(); |
| 2302 | |
| 2303 | return os; |
| 2304 | } |
| 2305 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2306 | /** Formatted output of the WinogradInfo type. */ |
| 2307 | inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info) |
| 2308 | { |
| 2309 | os << "{OutputTileSize=" << info.output_tile_size << "," |
| 2310 | << "KernelSize=" << info.kernel_size << "," |
| 2311 | << "PadStride=" << info.convolution_info << "," |
| 2312 | << "OutputDataLayout=" << info.output_data_layout << "}"; |
| 2313 | |
| 2314 | return os; |
| 2315 | } |
| 2316 | |
Gian Marco Iodice | 247f52c | 2018-03-22 11:24:56 +0000 | [diff] [blame] | 2317 | inline std::string to_string(const WinogradInfo &type) |
| 2318 | { |
| 2319 | std::stringstream str; |
| 2320 | str << type; |
| 2321 | return str.str(); |
| 2322 | } |
Anthony Barbier | 671a11e | 2018-07-06 15:11:36 +0100 | [diff] [blame] | 2323 | |
Vidhya Sudhan Loganathan | 050471e | 2019-04-25 09:27:24 +0100 | [diff] [blame] | 2324 | /** Convert a CLTunerMode value to a string |
| 2325 | * |
| 2326 | * @param val CLTunerMode value to be converted |
| 2327 | * |
| 2328 | * @return String representing the corresponding CLTunerMode. |
| 2329 | */ |
| 2330 | inline std::string to_string(const CLTunerMode val) |
| 2331 | { |
| 2332 | switch(val) |
| 2333 | { |
| 2334 | case CLTunerMode::EXHAUSTIVE: |
| 2335 | { |
| 2336 | return std::string("Exhaustive"); |
| 2337 | } |
| 2338 | case CLTunerMode::NORMAL: |
| 2339 | { |
| 2340 | return std::string("Normal"); |
| 2341 | } |
| 2342 | case CLTunerMode::RAPID: |
| 2343 | { |
| 2344 | return std::string("Rapid"); |
| 2345 | } |
| 2346 | default: |
| 2347 | { |
| 2348 | ARM_COMPUTE_ERROR("Invalid tuner mode."); |
| 2349 | return std::string("UNDEFINED"); |
| 2350 | } |
| 2351 | } |
| 2352 | } |
SiCong Li | db4a6c1 | 2021-02-05 09:30:57 +0000 | [diff] [blame] | 2353 | /** Converts a @ref CLGEMMKernelType to string |
| 2354 | * |
| 2355 | * @param[in] val CLGEMMKernelType value to be converted |
| 2356 | * |
| 2357 | * @return String representing the corresponding CLGEMMKernelType |
| 2358 | */ |
| 2359 | inline std::string to_string(CLGEMMKernelType val) |
| 2360 | { |
| 2361 | switch(val) |
| 2362 | { |
SiCong Li | db4a6c1 | 2021-02-05 09:30:57 +0000 | [diff] [blame] | 2363 | case CLGEMMKernelType::NATIVE: |
| 2364 | { |
| 2365 | return "Native"; |
| 2366 | } |
| 2367 | case CLGEMMKernelType::RESHAPED_ONLY_RHS: |
| 2368 | { |
| 2369 | return "Reshaped_Only_RHS"; |
| 2370 | } |
| 2371 | case CLGEMMKernelType::RESHAPED: |
| 2372 | { |
| 2373 | return "Reshaped"; |
| 2374 | } |
| 2375 | default: |
| 2376 | { |
| 2377 | return "Unknown"; |
| 2378 | } |
| 2379 | } |
| 2380 | } |
Vidhya Sudhan Loganathan | 050471e | 2019-04-25 09:27:24 +0100 | [diff] [blame] | 2381 | /** [Print CLTunerMode type] **/ |
| 2382 | /** Formatted output of the CLTunerMode type. |
| 2383 | * |
| 2384 | * @param[out] os Output stream. |
| 2385 | * @param[in] val CLTunerMode to output. |
| 2386 | * |
| 2387 | * @return Modified output stream. |
| 2388 | */ |
| 2389 | inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val) |
| 2390 | { |
| 2391 | os << to_string(val); |
| 2392 | return os; |
| 2393 | } |
| 2394 | |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2395 | /** Formatted output of the ConvolutionInfo type. |
| 2396 | * |
| 2397 | * @param[out] os Output stream. |
| 2398 | * @param[in] conv_info ConvolutionInfo to output. |
| 2399 | * |
| 2400 | * @return Modified output stream. |
| 2401 | */ |
| 2402 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info) |
| 2403 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2404 | os << "{PadStrideInfo = " << conv_info.pad_stride_info << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2405 | << "depth_multiplier = " << conv_info.depth_multiplier << ", " |
| 2406 | << "act_info = " << to_string(conv_info.act_info) << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2407 | << "dilation = " << conv_info.dilation << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2408 | return os; |
| 2409 | } |
| 2410 | |
| 2411 | /** Converts a @ref ConvolutionInfo to string |
| 2412 | * |
| 2413 | * @param[in] info ConvolutionInfo value to be converted |
| 2414 | * |
| 2415 | * @return String representing the corresponding ConvolutionInfo |
| 2416 | */ |
| 2417 | inline std::string to_string(const ConvolutionInfo &info) |
| 2418 | { |
| 2419 | std::stringstream str; |
| 2420 | str << info; |
| 2421 | return str.str(); |
| 2422 | } |
| 2423 | |
| 2424 | /** Formatted output of the FullyConnectedLayerInfo type. |
| 2425 | * |
| 2426 | * @param[out] os Output stream. |
| 2427 | * @param[in] layer_info FullyConnectedLayerInfo to output. |
| 2428 | * |
| 2429 | * @return Modified output stream. |
| 2430 | */ |
| 2431 | inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info) |
| 2432 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2433 | os << "{activation_info = " << to_string(layer_info.activation_info) << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2434 | << "weights_trained_layout = " << layer_info.weights_trained_layout << ", " |
| 2435 | << "transpose_weights = " << layer_info.transpose_weights << ", " |
| 2436 | << "are_weights_reshaped = " << layer_info.are_weights_reshaped << ", " |
| 2437 | << "retain_internal_weights = " << layer_info.retain_internal_weights << ", " |
| 2438 | << "constant_weights = " << layer_info.transpose_weights << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2439 | << "fp_mixed_precision = " << layer_info.fp_mixed_precision << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2440 | return os; |
| 2441 | } |
| 2442 | |
| 2443 | /** Converts a @ref FullyConnectedLayerInfo to string |
| 2444 | * |
| 2445 | * @param[in] info FullyConnectedLayerInfo value to be converted |
| 2446 | * |
| 2447 | * @return String representing the corresponding FullyConnectedLayerInfo |
| 2448 | */ |
| 2449 | inline std::string to_string(const FullyConnectedLayerInfo &info) |
| 2450 | { |
| 2451 | std::stringstream str; |
| 2452 | str << info; |
| 2453 | return str.str(); |
| 2454 | } |
| 2455 | |
| 2456 | /** Formatted output of the GEMMLowpOutputStageType type. |
| 2457 | * |
| 2458 | * @param[out] os Output stream. |
| 2459 | * @param[in] gemm_type GEMMLowpOutputStageType to output. |
| 2460 | * |
| 2461 | * @return Modified output stream. |
| 2462 | */ |
| 2463 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type) |
| 2464 | { |
| 2465 | switch(gemm_type) |
| 2466 | { |
| 2467 | case GEMMLowpOutputStageType::NONE: |
| 2468 | os << "NONE"; |
| 2469 | break; |
| 2470 | case GEMMLowpOutputStageType::QUANTIZE_DOWN: |
| 2471 | os << "QUANTIZE_DOWN"; |
| 2472 | break; |
| 2473 | case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT: |
| 2474 | os << "QUANTIZE_DOWN_FIXEDPOINT"; |
| 2475 | break; |
| 2476 | case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT: |
| 2477 | os << "QUANTIZE_DOWN_FLOAT"; |
| 2478 | break; |
| 2479 | default: |
| 2480 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2481 | } |
| 2482 | return os; |
| 2483 | } |
| 2484 | |
| 2485 | /** Converts a @ref GEMMLowpOutputStageType to string |
| 2486 | * |
| 2487 | * @param[in] gemm_type GEMMLowpOutputStageType value to be converted |
| 2488 | * |
| 2489 | * @return String representing the corresponding GEMMLowpOutputStageType |
| 2490 | */ |
| 2491 | inline std::string to_string(const GEMMLowpOutputStageType &gemm_type) |
| 2492 | { |
| 2493 | std::stringstream str; |
| 2494 | str << gemm_type; |
| 2495 | return str.str(); |
| 2496 | } |
| 2497 | |
| 2498 | /** Formatted output of the GEMMLowpOutputStageInfo type. |
| 2499 | * |
| 2500 | * @param[out] os Output stream. |
| 2501 | * @param[in] gemm_info GEMMLowpOutputStageInfo to output. |
| 2502 | * |
| 2503 | * @return Modified output stream. |
| 2504 | */ |
| 2505 | inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info) |
| 2506 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2507 | os << "{type = " << gemm_info.type << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2508 | << "gemlowp_offset = " << gemm_info.gemmlowp_offset << ", " |
| 2509 | << "gemmlowp_multiplier" << gemm_info.gemmlowp_multiplier << ", " |
| 2510 | << "gemmlowp_shift = " << gemm_info.gemmlowp_shift << ", " |
| 2511 | << "gemmlowp_min_bound = " << gemm_info.gemmlowp_min_bound << ", " |
| 2512 | << "gemmlowp_max_bound = " << gemm_info.gemmlowp_max_bound << ", " |
| 2513 | << "gemmlowp_multipliers = " << gemm_info.gemmlowp_multiplier << ", " |
| 2514 | << "gemmlowp_shifts = " << gemm_info.gemmlowp_shift << ", " |
| 2515 | << "gemmlowp_real_multiplier = " << gemm_info.gemmlowp_real_multiplier << ", " |
| 2516 | << "is_quantized_per_channel = " << gemm_info.is_quantized_per_channel << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2517 | << "output_data_type = " << gemm_info.output_data_type << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2518 | return os; |
| 2519 | } |
| 2520 | |
| 2521 | /** Converts a @ref GEMMLowpOutputStageInfo to string |
| 2522 | * |
| 2523 | * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted |
| 2524 | * |
| 2525 | * @return String representing the corresponding GEMMLowpOutputStageInfo |
| 2526 | */ |
| 2527 | inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info) |
| 2528 | { |
| 2529 | std::stringstream str; |
| 2530 | str << gemm_info; |
| 2531 | return str.str(); |
| 2532 | } |
| 2533 | |
| 2534 | /** Formatted output of the Conv2dInfo type. |
| 2535 | * |
| 2536 | * @param[out] os Output stream. |
| 2537 | * @param[in] conv_info Conv2dInfo to output. |
| 2538 | * |
| 2539 | * @return Modified output stream. |
| 2540 | */ |
| 2541 | inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info) |
| 2542 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2543 | os << "{conv_info = " << conv_info.conv_info << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2544 | << "dilation = " << conv_info.dilation << ", " |
| 2545 | << "act_info = " << to_string(conv_info.act_info) << ", " |
| 2546 | << "enable_fast_math = " << conv_info.enable_fast_math << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2547 | << "num_groups = " << conv_info.num_groups << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2548 | return os; |
| 2549 | } |
| 2550 | |
| 2551 | /** Converts a @ref Conv2dInfo to string |
| 2552 | * |
| 2553 | * @param[in] conv_info Conv2dInfo value to be converted |
| 2554 | * |
| 2555 | * @return String representing the corresponding Conv2dInfo |
| 2556 | */ |
| 2557 | inline std::string to_string(const Conv2dInfo &conv_info) |
| 2558 | { |
| 2559 | std::stringstream str; |
| 2560 | str << conv_info; |
| 2561 | return str.str(); |
| 2562 | } |
| 2563 | |
| 2564 | /** Formatted output of the PixelValue type. |
| 2565 | * |
| 2566 | * @param[out] os Output stream. |
| 2567 | * @param[in] pixel_value PixelValue to output. |
| 2568 | * |
| 2569 | * @return Modified output stream. |
| 2570 | */ |
| 2571 | inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value) |
| 2572 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2573 | os << "{value.u64= " << pixel_value.get<uint64_t>() << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2574 | return os; |
| 2575 | } |
| 2576 | |
| 2577 | /** Converts a @ref PixelValue to string |
| 2578 | * |
| 2579 | * @param[in] pixel_value PixelValue value to be converted |
| 2580 | * |
| 2581 | * @return String representing the corresponding PixelValue |
| 2582 | */ |
| 2583 | inline std::string to_string(const PixelValue &pixel_value) |
| 2584 | { |
| 2585 | std::stringstream str; |
| 2586 | str << pixel_value; |
| 2587 | return str.str(); |
| 2588 | } |
| 2589 | |
| 2590 | /** Formatted output of the ScaleKernelInfo type. |
| 2591 | * |
| 2592 | * @param[out] os Output stream. |
| 2593 | * @param[in] scale_info ScaleKernelInfo to output. |
| 2594 | * |
| 2595 | * @return Modified output stream. |
| 2596 | */ |
| 2597 | inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info) |
| 2598 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2599 | os << "{interpolation_policy = " << scale_info.interpolation_policy << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2600 | << "BorderMode = " << scale_info.border_mode << ", " |
| 2601 | << "PixelValue = " << scale_info.constant_border_value << ", " |
| 2602 | << "SamplingPolicy = " << scale_info.sampling_policy << ", " |
| 2603 | << "use_padding = " << scale_info.use_padding << ", " |
| 2604 | << "align_corners = " << scale_info.align_corners << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2605 | << "data_layout = " << scale_info.data_layout << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2606 | return os; |
| 2607 | } |
| 2608 | |
| 2609 | /** Converts a @ref ScaleKernelInfo to string |
| 2610 | * |
| 2611 | * @param[in] scale_info ScaleKernelInfo value to be converted |
| 2612 | * |
| 2613 | * @return String representing the corresponding ScaleKernelInfo |
| 2614 | */ |
| 2615 | inline std::string to_string(const ScaleKernelInfo &scale_info) |
| 2616 | { |
| 2617 | std::stringstream str; |
| 2618 | str << scale_info; |
| 2619 | return str.str(); |
| 2620 | } |
| 2621 | |
| 2622 | /** Formatted output of the FFTDirection type. |
| 2623 | * |
| 2624 | * @param[out] os Output stream. |
| 2625 | * @param[in] fft_dir FFTDirection to output. |
| 2626 | * |
| 2627 | * @return Modified output stream. |
| 2628 | */ |
| 2629 | inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir) |
| 2630 | { |
| 2631 | switch(fft_dir) |
| 2632 | { |
| 2633 | case FFTDirection::Forward: |
| 2634 | os << "Forward"; |
| 2635 | break; |
| 2636 | case FFTDirection::Inverse: |
| 2637 | os << "Inverse"; |
| 2638 | break; |
| 2639 | default: |
| 2640 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2641 | } |
| 2642 | return os; |
| 2643 | } |
| 2644 | |
| 2645 | /** Converts a @ref FFT1DInfo to string |
| 2646 | * |
| 2647 | * @param[in] fft_dir FFT1DInfo value to be converted |
| 2648 | * |
| 2649 | * @return String representing the corresponding FFT1DInfo |
| 2650 | */ |
| 2651 | inline std::string to_string(const FFTDirection &fft_dir) |
| 2652 | { |
| 2653 | std::stringstream str; |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2654 | str << "{" << fft_dir << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2655 | return str.str(); |
| 2656 | } |
| 2657 | |
| 2658 | /** Formatted output of the FFT1DInfo type. |
| 2659 | * |
| 2660 | * @param[out] os Output stream. |
| 2661 | * @param[in] fft1d_info FFT1DInfo to output. |
| 2662 | * |
| 2663 | * @return Modified output stream. |
| 2664 | */ |
| 2665 | inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info) |
| 2666 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2667 | os << "{axis = " << fft1d_info.axis << ", " |
| 2668 | << "direction = " << fft1d_info.direction << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2669 | return os; |
| 2670 | } |
| 2671 | |
| 2672 | /** Converts a @ref FFT1DInfo to string |
| 2673 | * |
| 2674 | * @param[in] fft1d_info FFT1DInfo value to be converted |
| 2675 | * |
| 2676 | * @return String representing the corresponding FFT1DInfo |
| 2677 | */ |
| 2678 | inline std::string to_string(const FFT1DInfo &fft1d_info) |
| 2679 | { |
| 2680 | std::stringstream str; |
| 2681 | str << fft1d_info; |
| 2682 | return str.str(); |
| 2683 | } |
| 2684 | |
| 2685 | /** Formatted output of the FFT2DInfo type. |
| 2686 | * |
| 2687 | * @param[out] os Output stream. |
| 2688 | * @param[in] fft2d_info FFT2DInfo to output. |
| 2689 | * |
| 2690 | * @return Modified output stream. |
| 2691 | */ |
| 2692 | inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info) |
| 2693 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2694 | os << "{axis = " << fft2d_info.axis0 << ", " |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2695 | << "axis = " << fft2d_info.axis1 << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2696 | << "direction = " << fft2d_info.direction << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2697 | return os; |
| 2698 | } |
| 2699 | |
| 2700 | /** Converts a @ref FFT2DInfo to string |
| 2701 | * |
| 2702 | * @param[in] fft2d_info FFT2DInfo value to be converted |
| 2703 | * |
| 2704 | * @return String representing the corresponding FFT2DInfo |
| 2705 | */ |
| 2706 | inline std::string to_string(const FFT2DInfo &fft2d_info) |
| 2707 | { |
| 2708 | std::stringstream str; |
| 2709 | str << fft2d_info; |
| 2710 | return str.str(); |
| 2711 | } |
| 2712 | |
| 2713 | /** Formatted output of the Coordinates2D type. |
| 2714 | * |
| 2715 | * @param[out] os Output stream. |
| 2716 | * @param[in] coord_2d Coordinates2D to output. |
| 2717 | * |
| 2718 | * @return Modified output stream. |
| 2719 | */ |
| 2720 | inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d) |
| 2721 | { |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2722 | os << "{x = " << coord_2d.x << ", " |
| 2723 | << "y = " << coord_2d.y << "}"; |
ramelg01 | 3ae3d88 | 2021-09-12 23:07:47 +0100 | [diff] [blame] | 2724 | return os; |
| 2725 | } |
| 2726 | |
| 2727 | /** Converts a @ref Coordinates2D to string |
| 2728 | * |
| 2729 | * @param[in] coord_2d Coordinates2D value to be converted |
| 2730 | * |
| 2731 | * @return String representing the corresponding Coordinates2D |
| 2732 | */ |
| 2733 | inline std::string to_string(const Coordinates2D &coord_2d) |
| 2734 | { |
| 2735 | std::stringstream str; |
| 2736 | str << coord_2d; |
| 2737 | return str.str(); |
| 2738 | } |
| 2739 | |
| 2740 | /** Formatted output of the FuseBatchNormalizationType type. |
| 2741 | * |
| 2742 | * @param[out] os Output stream. |
| 2743 | * @param[in] fuse_type FuseBatchNormalizationType to output. |
| 2744 | * |
| 2745 | * @return Modified output stream. |
| 2746 | */ |
| 2747 | inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type) |
| 2748 | { |
| 2749 | switch(fuse_type) |
| 2750 | { |
| 2751 | case FuseBatchNormalizationType::CONVOLUTION: |
| 2752 | os << "CONVOLUTION"; |
| 2753 | break; |
| 2754 | case FuseBatchNormalizationType::DEPTHWISECONVOLUTION: |
| 2755 | os << "DEPTHWISECONVOLUTION"; |
| 2756 | break; |
| 2757 | default: |
| 2758 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2759 | } |
| 2760 | return os; |
| 2761 | } |
| 2762 | |
| 2763 | /** Converts a @ref FuseBatchNormalizationType to string |
| 2764 | * |
| 2765 | * @param[in] fuse_type FuseBatchNormalizationType value to be converted |
| 2766 | * |
| 2767 | * @return String representing the corresponding FuseBatchNormalizationType |
| 2768 | */ |
| 2769 | inline std::string to_string(const FuseBatchNormalizationType &fuse_type) |
| 2770 | { |
| 2771 | std::stringstream str; |
| 2772 | str << fuse_type; |
| 2773 | return str.str(); |
| 2774 | } |
| 2775 | |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2776 | /** Formatted output of the SoftmaxKernelInfo type. |
| 2777 | * |
| 2778 | * @param[out] os Output stream. |
| 2779 | * @param[in] info SoftmaxKernelInfo to output. |
| 2780 | * |
| 2781 | * @return Modified output stream. |
| 2782 | */ |
| 2783 | inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info) |
| 2784 | { |
| 2785 | os << "{beta = " << info.beta << ", " |
| 2786 | << "is_log = " << info.is_log << ", " |
| 2787 | << "input_data_type = " << info.input_data_type << ", " |
| 2788 | << "axis = " << info.axis << "}"; |
| 2789 | return os; |
| 2790 | } |
| 2791 | |
| 2792 | /** Converts a @ref SoftmaxKernelInfo to string |
| 2793 | * |
| 2794 | * @param[in] info SoftmaxKernelInfo value to be converted |
| 2795 | * |
| 2796 | * @return String representing the corresponding SoftmaxKernelInfo |
| 2797 | */ |
| 2798 | inline std::string to_string(const SoftmaxKernelInfo &info) |
| 2799 | { |
| 2800 | std::stringstream str; |
| 2801 | str << info; |
| 2802 | return str.str(); |
| 2803 | } |
| 2804 | |
| 2805 | /** Formatted output of the ScaleKernelInfo type. |
| 2806 | * |
| 2807 | * @param[out] os Output stream. |
| 2808 | * @param[in] lstm_params LSTMParams to output. |
| 2809 | * |
| 2810 | * @return Modified output stream. |
| 2811 | */ |
| 2812 | template <typename T> |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 2813 | ::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params) |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2814 | { |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 2815 | os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", " |
| 2816 | << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", " |
| 2817 | << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", " |
| 2818 | << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", " |
| 2819 | << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", " |
| 2820 | << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", " |
| 2821 | << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", " |
| 2822 | << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", " |
| 2823 | << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", " |
| 2824 | << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", " |
| 2825 | << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", " |
| 2826 | << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", " |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2827 | << "cell_clip=" << lstm_params.cell_clip() << ", " |
| 2828 | << "projection_clip=" << lstm_params.projection_clip() << ", " |
| 2829 | << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", " |
| 2830 | << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", " |
| 2831 | << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", " |
| 2832 | << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", " |
| 2833 | << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", " |
| 2834 | << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", " |
| 2835 | << "has_projection=" << lstm_params.has_projection() << ", " |
| 2836 | << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", " |
| 2837 | << "use_layer_norm=" << lstm_params.use_layer_norm() << "}"; |
| 2838 | return os; |
| 2839 | } |
| 2840 | |
| 2841 | /** Converts a @ref LSTMParams to string |
| 2842 | * |
| 2843 | * @param[in] lstm_params LSTMParams<T> value to be converted |
| 2844 | * |
| 2845 | * @return String representing the corresponding LSTMParams |
| 2846 | */ |
| 2847 | template <typename T> |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 2848 | std::string to_string(const LSTMParams<T> &lstm_params) |
ramelg01 | cbbb038 | 2021-09-17 17:36:57 +0100 | [diff] [blame] | 2849 | { |
| 2850 | std::stringstream str; |
| 2851 | str << lstm_params; |
| 2852 | return str.str(); |
| 2853 | } |
| 2854 | |
| 2855 | /** Converts a @ref LSTMParams to string |
| 2856 | * |
| 2857 | * @param[in] num uint8_t value to be converted |
| 2858 | * |
| 2859 | * @return String representing the corresponding uint8_t |
| 2860 | */ |
| 2861 | inline std::string to_string(const uint8_t num) |
| 2862 | { |
| 2863 | // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function. |
| 2864 | return ::std::to_string(static_cast<int>(num)); |
| 2865 | } |
| 2866 | |
ramelg01 | 4a6d9e8 | 2021-10-02 14:34:36 +0100 | [diff] [blame] | 2867 | /** Available non maxima suppression types */ |
| 2868 | /** Formatted output of the NMSType type. |
| 2869 | * |
| 2870 | * @param[out] os Output stream. |
| 2871 | * @param[in] nms_type NMSType to output. |
| 2872 | * |
| 2873 | * @return Modified output stream. |
| 2874 | */ |
| 2875 | inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type) |
| 2876 | { |
| 2877 | switch(nms_type) |
| 2878 | { |
| 2879 | case NMSType::LINEAR: |
| 2880 | os << "LINEAR"; |
| 2881 | break; |
| 2882 | case NMSType::GAUSSIAN: |
| 2883 | os << "GAUSSIAN"; |
| 2884 | break; |
| 2885 | case NMSType::ORIGINAL: |
| 2886 | os << "ORIGINAL"; |
| 2887 | break; |
| 2888 | default: |
| 2889 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2890 | } |
| 2891 | return os; |
| 2892 | } |
| 2893 | |
| 2894 | /** Converts a @ref NMSType to string |
| 2895 | * |
| 2896 | * @param[in] nms_type NMSType value to be converted |
| 2897 | * |
| 2898 | * @return String representing the corresponding NMSType |
| 2899 | */ |
| 2900 | inline std::string to_string(const NMSType nms_type) |
| 2901 | { |
| 2902 | std::stringstream str; |
| 2903 | str << nms_type; |
| 2904 | return str.str(); |
| 2905 | } |
| 2906 | |
| 2907 | /** Formatted output of the BoxNMSLimitInfo type. |
| 2908 | * |
| 2909 | * @param[out] os Output stream. |
| 2910 | * @param[in] info BoxNMSLimitInfo to output. |
| 2911 | * |
| 2912 | * @return Modified output stream. |
| 2913 | */ |
| 2914 | inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info) |
| 2915 | { |
| 2916 | os << "{score_thresh = " << info.score_thresh() << ", " |
| 2917 | << "nms = " << info.nms() << ", " |
| 2918 | << "detections_per_im = " << info.detections_per_im() << ", " |
| 2919 | << "soft_nms_enabled = " << info.soft_nms_enabled() << ", " |
| 2920 | << "soft_nms_min_score_thres = " << info.soft_nms_min_score_thres() << ", " |
| 2921 | << "suppress_size = " << info.suppress_size() << ", " |
| 2922 | << "min_size = " << info.min_size() << ", " |
| 2923 | << "im_width = " << info.im_width() << ", " |
| 2924 | << "im_height = " << info.im_height() << "}"; |
| 2925 | return os; |
| 2926 | } |
| 2927 | |
| 2928 | /** Converts a @ref BoxNMSLimitInfo to string |
| 2929 | * |
| 2930 | * @param[in] info BoxNMSLimitInfo value to be converted |
| 2931 | * |
| 2932 | * @return String representing the corresponding BoxNMSLimitInfo |
| 2933 | */ |
| 2934 | inline std::string to_string(const BoxNMSLimitInfo &info) |
| 2935 | { |
| 2936 | std::stringstream str; |
| 2937 | str << info; |
| 2938 | return str.str(); |
| 2939 | } |
| 2940 | |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 2941 | /** Formatted output of the DimensionRoundingType type. |
| 2942 | * |
| 2943 | * @param[out] os Output stream. |
| 2944 | * @param[in] rounding_type DimensionRoundingType to output. |
| 2945 | * |
| 2946 | * @return Modified output stream. |
| 2947 | */ |
| 2948 | inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type) |
| 2949 | { |
| 2950 | switch(rounding_type) |
| 2951 | { |
| 2952 | case DimensionRoundingType::CEIL: |
| 2953 | os << "CEIL"; |
| 2954 | break; |
| 2955 | case DimensionRoundingType::FLOOR: |
| 2956 | os << "FLOOR"; |
| 2957 | break; |
| 2958 | default: |
| 2959 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 2960 | } |
| 2961 | return os; |
| 2962 | } |
| 2963 | |
| 2964 | /** Converts a @ref DimensionRoundingType to string |
| 2965 | * |
| 2966 | * @param[in] rounding_type DimensionRoundingType value to be converted |
| 2967 | * |
| 2968 | * @return String representing the corresponding DimensionRoundingType |
| 2969 | */ |
| 2970 | inline std::string to_string(const DimensionRoundingType &rounding_type) |
| 2971 | { |
| 2972 | std::stringstream str; |
| 2973 | str << rounding_type; |
| 2974 | return str.str(); |
| 2975 | } |
| 2976 | |
| 2977 | /** Formatted output of the Padding3D type. |
| 2978 | * |
| 2979 | * @param[out] os Output stream. |
| 2980 | * @param[in] padding3d Padding3D to output. |
| 2981 | * |
| 2982 | * @return Modified output stream. |
| 2983 | */ |
| 2984 | inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d) |
| 2985 | { |
| 2986 | os << padding3d.left << "," << padding3d.right << "," |
| 2987 | << padding3d.top << "," << padding3d.bottom << "," |
| 2988 | << padding3d.front << "," << padding3d.back; |
| 2989 | return os; |
| 2990 | } |
| 2991 | |
| 2992 | /** Converts a @ref Padding3D to string |
| 2993 | * |
| 2994 | * @param[in] padding3d Padding3D value to be converted |
| 2995 | * |
| 2996 | * @return String representing the corresponding Padding3D |
| 2997 | */ |
| 2998 | inline std::string to_string(const Padding3D &padding3d) |
| 2999 | { |
| 3000 | std::stringstream str; |
| 3001 | str << padding3d; |
| 3002 | return str.str(); |
| 3003 | } |
| 3004 | |
| 3005 | /** Formatted output of the Conv3dInfo type. |
| 3006 | * |
| 3007 | * @param[out] os Output stream. |
| 3008 | * @param[in] conv3d_info Type to output. |
| 3009 | * |
| 3010 | * @return Modified output stream. |
| 3011 | */ |
| 3012 | inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info) |
| 3013 | { |
| 3014 | os << conv3d_info.stride; |
| 3015 | os << ";"; |
| 3016 | os << conv3d_info.padding; |
| 3017 | os << ";"; |
| 3018 | os << to_string(conv3d_info.act_info); |
| 3019 | os << ";"; |
| 3020 | os << conv3d_info.dilation; |
| 3021 | os << ";"; |
| 3022 | os << conv3d_info.round_type; |
| 3023 | os << ";"; |
| 3024 | os << conv3d_info.enable_fast_math; |
| 3025 | |
| 3026 | return os; |
| 3027 | } |
| 3028 | |
| 3029 | /** Formatted output of the Conv3dInfo type. |
| 3030 | * |
| 3031 | * @param[in] conv3d_info Type to output. |
| 3032 | * |
| 3033 | * @return Formatted string. |
| 3034 | */ |
| 3035 | inline std::string to_string(const Conv3dInfo &conv3d_info) |
| 3036 | { |
| 3037 | std::stringstream str; |
| 3038 | str << conv3d_info; |
| 3039 | return str.str(); |
| 3040 | } |
| 3041 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 3042 | } // namespace arm_compute |
Anthony Barbier | 4dbc0a9 | 2018-08-27 13:39:47 +0100 | [diff] [blame] | 3043 | |
| 3044 | #endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */ |