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