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