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