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