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