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