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