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