blob: 4f14d985aff740878d43b2a45f14ef3ea3c26d44 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Pablo Marquez Tello6bcdc572023-01-11 09:54:00 +00002 * Copyright (c) 2017-2023 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
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 Sujak0d27b2e2023-08-24 14:01:20 +010024
25#ifndef ACL_UTILS_TYPEPRINTER_H
26#define ACL_UTILS_TYPEPRINTER_H
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027
ramelg01cbbb0382021-09-17 17:36:57 +010028#ifdef ARM_COMPUTE_OPENCL_ENABLED
29#include "arm_compute/core/CL/ICLTensor.h"
30#endif /* ARM_COMPUTE_OPENCL_ENABLED */
31
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032#include "arm_compute/core/Dimensions.h"
33#include "arm_compute/core/Error.h"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010034#include "arm_compute/core/GPUTarget.h"
morgolockaba2f912020-05-05 16:28:19 +010035#include "arm_compute/core/KernelDescriptors.h"
John Richardson25f23682017-11-27 14:35:09 +000036#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010037#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000038#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010039#include "arm_compute/core/Types.h"
Gunes Bayir1dc6ff12022-12-06 20:48:31 +000040#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
Jakub Sujak32741722022-11-25 16:43:18 +000041#include "arm_compute/dynamic_fusion/sketch/attributes/ClampAttributes.h"
SiCong Li5a63d1e2023-01-06 16:28:57 +000042#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000043#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000044#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
Jakub Sujak8ae57142022-12-02 16:09:06 +000045#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Gunes Bayiraecb5d92022-12-18 21:31:29 +000046#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000047#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
SiCong Li91295492023-07-21 18:16:13 +010048#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 Loganathan050471e2019-04-25 09:27:24 +010052#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000053#include "arm_compute/runtime/CL/CLTypes.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010054#include "arm_compute/runtime/common/LSTMParams.h"
ramelg013ae3d882021-09-12 23:07:47 +010055#include "arm_compute/runtime/FunctionDescriptors.h"
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +000056#include "arm_compute/runtime/NEON/functions/NEMatMul.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010057
SiCongLi31778612021-11-12 17:33:45 +000058#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000059#include "support/StringSupport.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010060
Anthony Barbier6ff3b192017-09-04 18:44:23 +010061#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010062#include <sstream>
63#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010064
65namespace arm_compute
66{
Anthony Barbierb940fd62018-06-04 14:14:32 +010067/** Formatted output if arg is not null
68 *
69 * @param[in] arg Object to print
70 *
71 * @return String representing arg.
72 */
73template <typename T>
74std::string to_string_if_not_null(T *arg)
75{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010076 if (arg == nullptr)
Anthony Barbierb940fd62018-06-04 14:14:32 +010077 {
78 return "nullptr";
79 }
80 else
81 {
82 return to_string(*arg);
83 }
84}
Anthony Barbierb4670212018-05-18 16:55:39 +010085
ramelg014a6d9e82021-10-02 14:34:36 +010086/** 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 */
92template <typename T>
93inline std::string to_string(const T &val)
94{
95 return support::cpp11::to_string(val);
96}
97
ramelg01b1ba1e32021-09-25 11:53:26 +010098/** Formatted output of a vector of objects.
99 *
ramelg014a6d9e82021-10-02 14:34:36 +0100100 * @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 *
ramelg01b1ba1e32021-09-25 11:53:26 +0100103 * @param[out] os Output stream
104 * @param[in] args Vector of objects to print
105 *
106 * @return Modified output stream.
107 */
108template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100109::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100110{
111 const size_t max_print_size = 5U;
112
113 os << "[";
114 bool first = true;
115 size_t i;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100116 for (i = 0; i < args.size(); ++i)
ramelg01b1ba1e32021-09-25 11:53:26 +0100117 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100118 if (i == max_print_size)
ramelg01b1ba1e32021-09-25 11:53:26 +0100119 {
120 break;
121 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100122 if (first)
ramelg01b1ba1e32021-09-25 11:53:26 +0100123 {
124 first = false;
125 }
126 else
127 {
128 os << ", ";
129 }
ramelg014a6d9e82021-10-02 14:34:36 +0100130 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100131 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100132 if (i < args.size())
ramelg01b1ba1e32021-09-25 11:53:26 +0100133 {
134 os << ", ...";
135 }
136 os << "]";
137 return os;
138}
139
ramelg014a6d9e82021-10-02 14:34:36 +0100140/** Formatted output of a vector of objects.
141 *
142 * @param[in] args Vector of objects to print
143 *
144 * @return String representing args.
145 */
146template <typename T>
147std::string to_string(const std::vector<T> &args)
148{
149 std::stringstream str;
150 str << args;
151 return str.str();
152}
153
Alex Gildayc357c472018-03-21 13:54:09 +0000154/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100161template <typename T>
162inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
163{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100164 if (dimensions.num_dimensions() > 0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100165 {
166 os << dimensions[0];
167
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100168 for (unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100169 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100170 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100171 }
172 }
173
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100174 return os;
175}
176
Alex Gildayc357c472018-03-21 13:54:09 +0000177/** 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 Barbier2a07e182017-08-04 18:20:27 +0100184inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100185{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100186 switch (rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100187 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100188 case RoundingPolicy::TO_ZERO:
189 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100190 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100191 case RoundingPolicy::TO_NEAREST_UP:
192 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100193 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100194 case RoundingPolicy::TO_NEAREST_EVEN:
195 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196 break;
197 default:
198 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
199 }
200
201 return os;
202}
203
Alex Gildayc357c472018-03-21 13:54:09 +0000204/** 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 Barbier2a07e182017-08-04 18:20:27 +0100211inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100212{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100213 os << weights_info.are_reshaped() << ";";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100214 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << ","
215 << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100216
217 return os;
218}
219
Alex Gildayc357c472018-03-21 13:54:09 +0000220/** 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 Barbier2a07e182017-08-04 18:20:27 +0100227inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100228{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100229 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100230 return os;
231}
232
giuros0118870812018-09-13 09:31:40 +0100233/** Formatted output of the ROIPoolingInfo type.
234 *
235 * @param[in] pool_info Type to output.
236 *
237 * @return Formatted string.
238 */
239inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
240{
241 std::stringstream str;
242 str << pool_info;
243 return str.str();
244}
245
morgolockaba2f912020-05-05 16:28:19 +0100246/** 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 */
253inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
254{
SiCongLi579ca842021-10-18 09:38:33 +0100255 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;
morgolockaba2f912020-05-05 16:28:19 +0100266 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 */
277inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
278{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100279 os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0
280 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
morgolockaba2f912020-05-05 16:28:19 +0100281 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 */
291inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
292{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100293 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 << "})";
morgolockaba2f912020-05-05 16:28:19 +0100296 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 */
305inline 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 */
318inline 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 */
331inline std::string to_string(const GEMMKernelInfo &gemm_info)
332{
333 std::stringstream str;
334 str << gemm_info;
335 return str.str();
336}
337
giuros01c04a0e82018-10-03 12:44:35 +0100338/** 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 */
345inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
346{
347 auto weights = bbox_info.weights();
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100348 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={"
349 << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << "})";
giuros01c04a0e82018-10-03 12:44:35 +0100350 return os;
351}
352
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100353#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100354inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100355{
Matthew Benthamf66a7e82023-06-15 14:55:35 +0000356 return os << float(v);
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100357}
Ramy Elgammal91780022022-07-20 14:57:37 +0100358#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100359
giuros01c04a0e82018-10-03 12:44:35 +0100360/** Formatted output of the BoundingBoxTransformInfo type.
361 *
362 * @param[in] bbox_info Type to output.
363 *
364 * @return Formatted string.
365 */
366inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
367{
368 std::stringstream str;
369 str << bbox_info;
370 return str.str();
371}
372
Manuel Bottini5209be52019-02-13 16:34:56 +0000373/** 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 */
380inline ::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 */
392inline 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 */
406inline ::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 */
418inline std::string to_string(const GenerateProposalsInfo &proposals_info)
419{
420 std::stringstream str;
421 str << proposals_info;
422 return str.str();
423}
424
Alex Gildayc357c472018-03-21 13:54:09 +0000425/** Formatted output of the QuantizationInfo type.
426 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100427 * @param[out] os Output stream.
428 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000429 *
430 * @return Modified output stream.
431 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100432inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700433{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100434 const UniformQuantizationInfo uqinfo = qinfo.uniform();
435 os << "Scale:" << uqinfo.scale << "~";
436 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700437 return os;
438}
439
Alex Gildayc357c472018-03-21 13:54:09 +0000440/** Formatted output of the QuantizationInfo type.
441 *
442 * @param[in] quantization_info Type to output.
443 *
444 * @return Formatted string.
445 */
Chunosovd621bca2017-11-03 17:33:15 +0700446inline std::string to_string(const QuantizationInfo &quantization_info)
447{
448 std::stringstream str;
449 str << quantization_info;
450 return str.str();
451}
452
Alex Gildayc357c472018-03-21 13:54:09 +0000453/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100460inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
461{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100462 switch (act_function)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100463 {
464 case ActivationLayerInfo::ActivationFunction::ABS:
465 os << "ABS";
466 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100467 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 Pinitas579c0492017-07-12 16:12:12 +0100476 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
477 os << "BOUNDED_RELU";
478 break;
479 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
480 os << "LEAKY_RELU";
481 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100482 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
483 os << "SOFT_RELU";
484 break;
485 case ActivationLayerInfo::ActivationFunction::SQRT:
486 os << "SQRT";
487 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100488 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
489 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000490 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100491 case ActivationLayerInfo::ActivationFunction::ELU:
492 os << "ELU";
493 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100494 case ActivationLayerInfo::ActivationFunction::SQUARE:
495 os << "SQUARE";
496 break;
497 case ActivationLayerInfo::ActivationFunction::TANH:
498 os << "TANH";
499 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100500 case ActivationLayerInfo::ActivationFunction::IDENTITY:
501 os << "IDENTITY";
502 break;
morgolock07df3d42020-02-27 11:46:28 +0000503 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
504 os << "HARD_SWISH";
505 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100506 case ActivationLayerInfo::ActivationFunction::SWISH:
507 os << "SWISH";
508 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400509 case ActivationLayerInfo::ActivationFunction::GELU:
510 os << "GELU";
511 break;
morgolock07df3d42020-02-27 11:46:28 +0000512
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100513 default:
514 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
515 }
516
517 return os;
518}
519
Alex Gildayc357c472018-03-21 13:54:09 +0000520/** Formatted output of the activation function info type.
521 *
SiCongLi1af54162021-10-06 15:25:57 +0100522 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000523 *
524 * @return Formatted string.
525 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100526inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100527{
528 std::stringstream str;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100529 if (info.enabled())
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000530 {
531 str << info.activation();
532 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100533 return str.str();
534}
535
SiCongLi1af54162021-10-06 15:25:57 +0100536/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100537 *
SiCongLi1af54162021-10-06 15:25:57 +0100538 * @param[out] os Output stream.
539 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100540 *
541 * @return Formatted string.
542 */
SiCongLi1af54162021-10-06 15:25:57 +0100543inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100544{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100545 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +0100546 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100547 if (info->enabled())
ramelg013ae3d882021-09-12 23:07:47 +0100548 {
SiCongLi1af54162021-10-06 15:25:57 +0100549 os << info->activation();
550 os << "(";
551 os << "VAL_A=" << info->a() << ",";
552 os << "VAL_B=" << info->b();
553 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100554 }
SiCongLi1af54162021-10-06 15:25:57 +0100555 else
556 {
557 os << "disabled";
558 }
ramelg013ae3d882021-09-12 23:07:47 +0100559 }
SiCongLi1af54162021-10-06 15:25:57 +0100560 else
561 {
562 os << "nullptr";
563 }
564 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100565}
566
Alex Gildayc357c472018-03-21 13:54:09 +0000567/** Formatted output of the activation function type.
568 *
569 * @param[in] function Type to output.
570 *
571 * @return Formatted string.
572 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100573inline 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 Gildayc357c472018-03-21 13:54:09 +0000580/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100587inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
588{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100589 switch (norm_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100590 {
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 Gildayc357c472018-03-21 13:54:09 +0000607/** Formatted output of @ref NormalizationLayerInfo.
608 *
609 * @param[in] info Type to output.
610 *
611 * @return Formatted string.
612 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100613inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100614{
615 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000616 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100617 return str.str();
618}
619
Alex Gildayc357c472018-03-21 13:54:09 +0000620/** 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 Pinitas6f669f02017-09-26 12:32:57 +0100627inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
628{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000629 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100630 return os;
631}
632
Alex Gildayc357c472018-03-21 13:54:09 +0000633/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100640inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
641{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100642 switch (pool_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100643 {
644 case PoolingType::AVG:
645 os << "AVG";
646 break;
647 case PoolingType::MAX:
648 os << "MAX";
649 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100650 case PoolingType::L2:
651 os << "L2";
652 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100653 default:
654 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
655 }
656
657 return os;
658}
659
Alex Gildayc357c472018-03-21 13:54:09 +0000660/** 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 Pflanzeree493ae2017-07-05 10:52:21 +0100667inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
668{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000669 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100670
671 return os;
672}
673
Alex Gildayc357c472018-03-21 13:54:09 +0000674/** Formatted output of @ref RoundingPolicy.
675 *
676 * @param[in] rounding_policy Type to output.
677 *
678 * @return Formatted string.
679 */
John Richardsondd715f22017-09-18 16:10:48 +0100680inline 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 Loganathand646ae12018-11-19 15:18:20 +0000687/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000688/** 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 Giorgio4a65b982018-03-02 11:21:38 +0000695inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
696{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100697 switch (data_layout)
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000698 {
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 AlSinane4563a02021-09-01 15:32:03 +0100708 case DataLayout::NDHWC:
709 os << "NDHWC";
710 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100711 case DataLayout::NCDHW:
712 os << "NCDHW";
713 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000714 default:
715 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
716 }
717
718 return os;
719}
720
Alex Gildayc357c472018-03-21 13:54:09 +0000721/** Formatted output of the DataLayout type.
722 *
723 * @param[in] data_layout Type to output.
724 *
725 * @return Formatted string.
726 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000727inline 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 Loganathand646ae12018-11-19 15:18:20 +0000733/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000734
Georgios Pinitase2220552018-07-20 13:23:44 +0100735/** 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 */
742inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
743{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100744 switch (data_layout_dim)
Georgios Pinitase2220552018-07-20 13:23:44 +0100745 {
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 Arenac9fe9fc2021-10-06 12:54:29 +0100755 case DataLayoutDimension::DEPTH:
756 os << "DEPTH";
757 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100758 case DataLayoutDimension::BATCHES:
759 os << "BATCHES";
760 break;
761 default:
762 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
763 }
764 return os;
765}
766
Alex Gildayc357c472018-03-21 13:54:09 +0000767/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100774inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
775{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100776 switch (data_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100777 {
778 case DataType::UNKNOWN:
779 os << "UNKNOWN";
780 break;
781 case DataType::U8:
782 os << "U8";
783 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100784 case DataType::QSYMM8:
785 os << "QSYMM8";
786 break;
Chunosovd621bca2017-11-03 17:33:15 +0700787 case DataType::QASYMM8:
788 os << "QASYMM8";
789 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000790 case DataType::QASYMM8_SIGNED:
791 os << "QASYMM8_SIGNED";
792 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100793 case DataType::QSYMM8_PER_CHANNEL:
794 os << "QSYMM8_PER_CHANNEL";
795 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100796 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 Bottini3689fcd2019-06-14 17:18:12 +0100805 case DataType::QSYMM16:
806 os << "QSYMM16";
807 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100808 case DataType::QASYMM16:
809 os << "QASYMM16";
810 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100811 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 Pinitase8291ac2020-02-26 09:58:13 +0000823 case DataType::BFLOAT16:
824 os << "BFLOAT16";
825 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100826 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 Gildayc357c472018-03-21 13:54:09 +0000845/** Formatted output of the DataType type.
846 *
847 * @param[in] data_type Type to output.
848 *
849 * @return Formatted string.
850 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100851inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100852{
853 std::stringstream str;
854 str << data_type;
855 return str.str();
856}
857
Alex Gildayc357c472018-03-21 13:54:09 +0000858/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100865inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
866{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100867 switch (format)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100868 {
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 Gildayc357c472018-03-21 13:54:09 +0000927/** Formatted output of the Format type.
928 *
929 * @param[in] format Type to output.
930 *
931 * @return Formatted string.
932 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100933inline std::string to_string(const Format &format)
934{
935 std::stringstream str;
936 str << format;
937 return str.str();
938}
939
Alex Gildayc357c472018-03-21 13:54:09 +0000940/** 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 Barbier6ff3b192017-09-04 18:44:23 +0100947inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
948{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100949 switch (channel)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100950 {
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 Gildayc357c472018-03-21 13:54:09 +0000994/** Formatted output of the Channel type.
995 *
996 * @param[in] channel Type to output.
997 *
998 * @return Formatted string.
999 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001000inline std::string to_string(const Channel &channel)
1001{
1002 std::stringstream str;
1003 str << channel;
1004 return str.str();
1005}
1006
Alex Gildayc357c472018-03-21 13:54:09 +00001007/** 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 Barbier2a07e182017-08-04 18:20:27 +01001014inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1015{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001016 switch (mode)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001017 {
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 Gildayc357c472018-03-21 13:54:09 +00001034/** 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 Barbier6ff3b192017-09-04 18:44:23 +01001041inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1042{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001043 os << border.top << "," << border.right << "," << border.bottom << "," << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001044
1045 return os;
1046}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001047
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001048/** 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 */
1055inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1056{
1057 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001058 for (auto const &p : padding)
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001059 {
1060 os << "{" << p.first << "," << p.second << "}";
1061 }
1062 os << "}";
1063 return os;
1064}
1065
giuros013175fcf2018-11-21 09:59:17 +00001066/** 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 */
1073inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1074{
1075 os << "(";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001076 for (size_t i = 0; i < multiples.size() - 1; i++)
giuros013175fcf2018-11-21 09:59:17 +00001077 {
1078 os << multiples[i] << ", ";
1079 }
1080 os << multiples.back() << ")";
1081 return os;
1082}
1083
Alex Gildayc357c472018-03-21 13:54:09 +00001084/** 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 Barbier2a07e182017-08-04 18:20:27 +01001091inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1092{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001093 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001094 {
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 Gildayc357c472018-03-21 13:54:09 +00001111/** 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 Efremov02bf80d2017-11-22 00:26:51 +07001118inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1119{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001120 switch (policy)
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001121 {
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 Giorgioc22eb1b2021-02-01 10:39:06 +00001135/** 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 */
1142inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1143{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001144 const DataType data_type = info->data_type();
1145 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001146
1147 os << "Shape=" << info->tensor_shape() << ","
1148 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001149 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001150
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001151 if (is_data_type_quantized(data_type))
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001152 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001153 const QuantizationInfo qinfo = info->quantization_info();
1154 const auto scales = qinfo.scale();
1155 const auto offsets = qinfo.offset();
1156
ramelg014a6d9e82021-10-02 14:34:36 +01001157 os << ", QuantizationInfo={"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001158 << "scales.size=" << scales.size() << ", scale(s)=" << scales << ", ";
ramelg01b1ba1e32021-09-25 11:53:26 +01001159
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001160 os << "offsets.size=" << offsets.size() << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001161 }
1162 return os;
1163}
1164
ramelg013ae3d882021-09-12 23:07:47 +01001165/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001166 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001167 * @param[out] os Output stream.
1168 * @param[in] info Type to output.
1169 *
1170 * @return Modified output stream.
1171 */
1172inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1173{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001174 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001175 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001176}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001177
ramelg013ae3d882021-09-12 23:07:47 +01001178/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001179 *
Alex Gildayc357c472018-03-21 13:54:09 +00001180 * @param[in] info Type to output.
1181 *
1182 * @return Formatted string.
1183 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001184inline std::string to_string(const TensorInfo &info)
1185{
1186 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001187 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001188 return str.str();
1189}
1190
ramelg013ae3d882021-09-12 23:07:47 +01001191/** Formatted output of the const ITensorInfo& type.
1192 *
1193 * @param[in] info Type to output.
1194 *
1195 * @return Formatted string.
1196 */
1197inline std::string to_string(const ITensorInfo &info)
1198{
1199 std::stringstream str;
1200 str << &info;
1201 return str.str();
1202}
1203
ramelg013ae3d882021-09-12 23:07:47 +01001204/** Formatted output of the const ITensorInfo* type.
1205 *
1206 * @param[in] info Type to output.
1207 *
1208 * @return Formatted string.
1209 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001210inline std::string to_string(const ITensorInfo *info)
1211{
ramelg013ae3d882021-09-12 23:07:47 +01001212 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001213 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001214 {
1215 std::stringstream str;
1216 str << info;
1217 ret_str = str.str();
1218 }
1219 return ret_str;
1220}
1221
ramelg01cbbb0382021-09-17 17:36:57 +01001222/** Formatted output of the ITensorInfo* type.
1223 *
1224 * @param[in] info Type to output.
1225 *
1226 * @return Formatted string.
1227 */
1228inline 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.
ramelg013ae3d882021-09-12 23:07:47 +01001234 *
1235 * @param[in] tensor Type to output.
1236 *
1237 * @return Formatted string.
1238 */
1239inline std::string to_string(const ITensor *tensor)
1240{
1241 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001242 if (tensor != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001243 {
1244 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001245 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001246 ret_str = str.str();
1247 }
1248 return ret_str;
1249}
1250
ramelg01cbbb0382021-09-17 17:36:57 +01001251/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001252 *
1253 * @param[in] tensor Type to output.
1254 *
1255 * @return Formatted string.
1256 */
1257inline std::string to_string(ITensor *tensor)
1258{
ramelg01cbbb0382021-09-17 17:36:57 +01001259 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001260}
1261
ramelg01cbbb0382021-09-17 17:36:57 +01001262/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001263 *
1264 * @param[in] tensor Type to output.
1265 *
1266 * @return Formatted string.
1267 */
1268inline std::string to_string(ITensor &tensor)
1269{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001270 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001271 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001272 return str.str();
1273}
1274
ramelg01cbbb0382021-09-17 17:36:57 +01001275#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 */
1282inline std::string to_string(const ICLTensor *cl_tensor)
1283{
1284 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001285 if (cl_tensor != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001286 {
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 */
1300inline std::string to_string(ICLTensor *cl_tensor)
1301{
1302 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1303}
SiCong Li47f177e2023-02-22 17:24:09 +00001304
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 */
1312inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1313{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001314 os << "{" << nd_range[0] << "," << nd_range[1] << "," << nd_range[2] << "}";
SiCong Li47f177e2023-02-22 17:24:09 +00001315 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 */
1324inline std::string to_string(const cl::NDRange &nd_range)
1325{
1326 std::stringstream str;
1327 str << nd_range;
1328 return str.str();
1329}
ramelg01cbbb0382021-09-17 17:36:57 +01001330#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1331
Alex Gildayc357c472018-03-21 13:54:09 +00001332/** Formatted output of the Dimensions type.
1333 *
1334 * @param[in] dimensions Type to output.
1335 *
1336 * @return Formatted string.
1337 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001338template <typename T>
1339inline std::string to_string(const Dimensions<T> &dimensions)
1340{
1341 std::stringstream str;
1342 str << dimensions;
1343 return str.str();
1344}
1345
Alex Gildayc357c472018-03-21 13:54:09 +00001346/** Formatted output of the Strides type.
1347 *
1348 * @param[in] stride Type to output.
1349 *
1350 * @return Formatted string.
1351 */
John Richardsona36eae12017-09-26 16:55:59 +01001352inline std::string to_string(const Strides &stride)
1353{
1354 std::stringstream str;
1355 str << stride;
1356 return str.str();
1357}
1358
Alex Gildayc357c472018-03-21 13:54:09 +00001359/** Formatted output of the TensorShape type.
1360 *
1361 * @param[in] shape Type to output.
1362 *
1363 * @return Formatted string.
1364 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001365inline std::string to_string(const TensorShape &shape)
1366{
1367 std::stringstream str;
1368 str << shape;
1369 return str.str();
1370}
1371
Alex Gildayc357c472018-03-21 13:54:09 +00001372/** Formatted output of the Coordinates type.
1373 *
1374 * @param[in] coord Type to output.
1375 *
1376 * @return Formatted string.
1377 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001378inline std::string to_string(const Coordinates &coord)
1379{
1380 std::stringstream str;
1381 str << coord;
1382 return str.str();
1383}
1384
Anthony Barbierb940fd62018-06-04 14:14:32 +01001385/** 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 */
1392inline ::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 */
1411inline ::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 Barbierb4670212018-05-18 16:55:39 +01001416 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() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001421 os << "pretranspose_B=" << info.pretranspose_B() << ",";
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01001422 os << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001423
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 */
1434inline ::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 */
1447inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1448{
1449 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001450 for (unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001451 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001452 if (i > 0)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001453 {
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 */
1469inline 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 */
1482inline 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 */
1495inline 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 */
1508inline std::string to_string(const Window::Dimension &dim)
1509{
1510 std::stringstream str;
1511 str << dim;
1512 return str.str();
1513}
ramelg01cbbb0382021-09-17 17:36:57 +01001514/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001515 *
1516 * @param[in] win Type to output.
1517 *
1518 * @return Formatted string.
1519 */
1520inline std::string to_string(const Window &win)
1521{
1522 std::stringstream str;
1523 str << win;
1524 return str.str();
1525}
1526
ramelg01cbbb0382021-09-17 17:36:57 +01001527/** Formatted output of the Window* type.
1528 *
1529 * @param[in] win Type to output.
1530 *
1531 * @return Formatted string.
1532 */
1533inline std::string to_string(Window *win)
1534{
1535 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001536 if (win != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001537 {
1538 std::stringstream str;
1539 str << *win;
1540 ret_str = str.str();
1541 }
1542 return ret_str;
1543}
1544
Alex Gildayc357c472018-03-21 13:54:09 +00001545/** 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 Barbier2a07e182017-08-04 18:20:27 +01001552inline ::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 Arif8cf8c112019-03-14 15:36:54 +00001560/** 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 */
1567inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1568{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001569 switch (mode)
Usama Arif8cf8c112019-03-14 15:36:54 +00001570 {
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 */
1593inline std::string to_string(const PaddingMode &mode)
1594{
1595 std::stringstream str;
1596 str << mode;
1597 return str.str();
1598}
1599
Alex Gildayc357c472018-03-21 13:54:09 +00001600/** 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 Barbier2a07e182017-08-04 18:20:27 +01001607inline ::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 Thomasmathibalanafd38f02023-09-27 17:46:17 +01001611 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," << pad_stride_info.pad_top() << ","
1612 << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001613
1614 return os;
1615}
1616
Alex Gildayc357c472018-03-21 13:54:09 +00001617/** Formatted output of the PadStrideInfo type.
1618 *
1619 * @param[in] pad_stride_info Type to output.
1620 *
1621 * @return Formatted string.
1622 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001623inline 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 Gildayc357c472018-03-21 13:54:09 +00001630/** Formatted output of the BorderMode type.
1631 *
1632 * @param[in] mode Type to output.
1633 *
1634 * @return Formatted string.
1635 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001636inline std::string to_string(const BorderMode &mode)
1637{
1638 std::stringstream str;
1639 str << mode;
1640 return str.str();
1641}
1642
Alex Gildayc357c472018-03-21 13:54:09 +00001643/** Formatted output of the BorderSize type.
1644 *
1645 * @param[in] border Type to output.
1646 *
1647 * @return Formatted string.
1648 */
John Richardsonb482ce12017-09-18 12:44:01 +01001649inline std::string to_string(const BorderSize &border)
1650{
1651 std::stringstream str;
1652 str << border;
1653 return str.str();
1654}
1655
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001656/** Formatted output of the PaddingList type.
1657 *
1658 * @param[in] padding Type to output.
1659 *
1660 * @return Formatted string.
1661 */
1662inline std::string to_string(const PaddingList &padding)
1663{
1664 std::stringstream str;
1665 str << padding;
1666 return str.str();
1667}
1668
giuros013175fcf2018-11-21 09:59:17 +00001669/** Formatted output of the Multiples type.
1670 *
1671 * @param[in] multiples Type to output.
1672 *
1673 * @return Formatted string.
1674 */
1675inline std::string to_string(const Multiples &multiples)
1676{
1677 std::stringstream str;
1678 str << multiples;
1679 return str.str();
1680}
1681
Alex Gildayc357c472018-03-21 13:54:09 +00001682/** Formatted output of the InterpolationPolicy type.
1683 *
1684 * @param[in] policy Type to output.
1685 *
1686 * @return Formatted string.
1687 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001688inline std::string to_string(const InterpolationPolicy &policy)
1689{
1690 std::stringstream str;
1691 str << policy;
1692 return str.str();
1693}
1694
Alex Gildayc357c472018-03-21 13:54:09 +00001695/** Formatted output of the SamplingPolicy type.
1696 *
1697 * @param[in] policy Type to output.
1698 *
1699 * @return Formatted string.
1700 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001701inline std::string to_string(const SamplingPolicy &policy)
1702{
1703 std::stringstream str;
1704 str << policy;
1705 return str.str();
1706}
1707
Alex Gildayc357c472018-03-21 13:54:09 +00001708/** 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 Barbier2a07e182017-08-04 18:20:27 +01001715inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1716{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001717 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001718 {
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
1732inline std::string to_string(const ConvertPolicy &policy)
1733{
1734 std::stringstream str;
1735 str << policy;
1736 return str.str();
1737}
1738
giuros01164a2722018-11-20 18:34:46 +00001739/** 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 */
1746inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1747{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001748 switch (op)
giuros01164a2722018-11-20 18:34:46 +00001749 {
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 Arif52c54f62019-05-14 10:22:36 +01001768 case ArithmeticOperation::POWER:
1769 os << "POWER";
1770 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001771 case ArithmeticOperation::PRELU:
1772 os << "PRELU";
1773 break;
giuros01164a2722018-11-20 18:34:46 +00001774 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 */
1787inline std::string to_string(const ArithmeticOperation &op)
1788{
1789 std::stringstream str;
1790 str << op;
1791 return str.str();
1792}
1793
Alex Gildayc357c472018-03-21 13:54:09 +00001794/** 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 Barbier2a07e182017-08-04 18:20:27 +01001801inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1802{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001803 switch (op)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001804 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001805 case ReductionOperation::SUM:
1806 os << "SUM";
1807 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001808 case ReductionOperation::SUM_SQUARE:
1809 os << "SUM_SQUARE";
1810 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001811 case ReductionOperation::MEAN_SUM:
1812 os << "MEAN_SUM";
1813 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001814 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 Bottinib412fab2018-12-10 17:40:23 +00001820 case ReductionOperation::PROD:
1821 os << "PROD";
1822 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001823 case ReductionOperation::MIN:
1824 os << "MIN";
1825 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001826 case ReductionOperation::MAX:
1827 os << "MAX";
1828 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001829 default:
1830 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1831 }
1832
1833 return os;
1834}
1835
Alex Gildayc357c472018-03-21 13:54:09 +00001836/** Formatted output of the Reduction Operations.
1837 *
1838 * @param[in] op Type to output.
1839 *
1840 * @return Formatted string.
1841 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001842inline std::string to_string(const ReductionOperation &op)
1843{
1844 std::stringstream str;
1845 str << op;
1846 return str.str();
1847}
1848
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001849/** 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 */
1856inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1857{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001858 switch (op)
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001859 {
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 Spyroue9362622018-11-23 17:41:37 +00001885/** 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 */
1892inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1893{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001894 switch (op)
Michalis Spyroue9362622018-11-23 17:41:37 +00001895 {
1896 case ElementWiseUnary::RSQRT:
1897 os << "RSQRT";
1898 break;
1899 case ElementWiseUnary::EXP:
1900 os << "EXP";
1901 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001902 case ElementWiseUnary::NEG:
1903 os << "NEG";
1904 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01001905 case ElementWiseUnary::LOG:
1906 os << "LOG";
1907 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001908 case ElementWiseUnary::SIN:
1909 os << "SIN";
1910 break;
1911 case ElementWiseUnary::ABS:
1912 os << "ABS";
1913 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01001914 case ElementWiseUnary::ROUND:
1915 os << "ROUND";
1916 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001917 case ElementWiseUnary::LOGICAL_NOT:
1918 os << "LOGICAL_NOT";
1919 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00001920 default:
1921 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1922 }
1923
1924 return os;
1925}
1926
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001927/** Formatted output of the Comparison Operations.
1928 *
1929 * @param[in] op Type to output.
1930 *
1931 * @return Formatted string.
1932 */
1933inline std::string to_string(const ComparisonOperation &op)
1934{
1935 std::stringstream str;
1936 str << op;
1937 return str.str();
1938}
1939
Michalis Spyroue9362622018-11-23 17:41:37 +00001940/** Formatted output of the Elementwise unary Operations.
1941 *
1942 * @param[in] op Type to output.
1943 *
1944 * @return Formatted string.
1945 */
1946inline std::string to_string(const ElementWiseUnary &op)
1947{
1948 std::stringstream str;
1949 str << op;
1950 return str.str();
1951}
1952
Alex Gildayc357c472018-03-21 13:54:09 +00001953/** Formatted output of the Norm Type.
1954 *
1955 * @param[in] type Type to output.
1956 *
1957 * @return Formatted string.
1958 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001959inline std::string to_string(const NormType &type)
1960{
1961 std::stringstream str;
1962 str << type;
1963 return str.str();
1964}
1965
Alex Gildayc357c472018-03-21 13:54:09 +00001966/** Formatted output of the Pooling Type.
1967 *
1968 * @param[in] type Type to output.
1969 *
1970 * @return Formatted string.
1971 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001972inline std::string to_string(const PoolingType &type)
1973{
1974 std::stringstream str;
1975 str << type;
1976 return str.str();
1977}
1978
Alex Gildayc357c472018-03-21 13:54:09 +00001979/** Formatted output of the Pooling Layer Info.
1980 *
1981 * @param[in] info Type to output.
1982 *
1983 * @return Formatted string.
1984 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001985inline std::string to_string(const PoolingLayerInfo &info)
1986{
1987 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001988 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00001989 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001990 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001991 if (!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001992 {
1993 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001994 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
1995 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001996 }
1997 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001998 return str.str();
1999}
2000
ramelg0137515692022-02-26 22:06:20 +00002001/** 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 */
2008inline ::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 */
2021inline 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 */
2035inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2036{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002037 os << padding3d.left << "," << padding3d.right << "," << padding3d.top << "," << padding3d.bottom << ","
ramelg0137515692022-02-26 22:06:20 +00002038 << 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 */
2048inline 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 */
2062inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2063{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002064 switch (rounding_type)
ramelg0137515692022-02-26 22:06:20 +00002065 {
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 */
2085inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2086{
2087 os << "{Type=" << info.pool_type << ","
2088 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002089 if (!info.is_global_pooling)
ramelg0137515692022-02-26 22:06:20 +00002090 {
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 */
2109inline std::string to_string(const Pooling3dLayerInfo &info)
2110{
2111 std::stringstream str;
2112 str << info;
2113 return str.str();
2114}
2115
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002116/** Formatted output of the PriorBoxLayerInfo.
2117 *
2118 * @param[in] info Type to output.
2119 *
2120 * @return Formatted string.
2121 */
2122inline std::string to_string(const PriorBoxLayerInfo &info)
2123{
2124 std::stringstream str;
2125 str << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002126 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 Spyrou6c7c38e2018-08-29 16:28:11 +01002130 str << "}";
2131 return str.str();
2132}
2133
Alex Gildayc357c472018-03-21 13:54:09 +00002134/** 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 Richardson25f23682017-11-27 14:35:09 +00002141inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2142{
2143 os << size.width << "x" << size.height;
2144
2145 return os;
2146}
2147
Alex Gildayc357c472018-03-21 13:54:09 +00002148/** Formatted output of the Size2D type.
2149 *
2150 * @param[in] type Type to output
2151 *
2152 * @return Formatted string.
2153 */
John Richardson25f23682017-11-27 14:35:09 +00002154inline std::string to_string(const Size2D &type)
2155{
2156 std::stringstream str;
2157 str << type;
2158 return str.str();
2159}
2160
Alex Gildayc357c472018-03-21 13:54:09 +00002161/** 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 Gottardif07d28d2018-02-06 14:52:43 +00002168inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2169{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002170 switch (conv_method)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002171 {
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;
SiCongLid9287352021-11-03 19:01:22 +00002181 case ConvolutionMethod::FFT:
2182 os << "FFT";
2183 break;
2184 case ConvolutionMethod::GEMM_CONV2D:
2185 os << "GEMM_CONV2D";
2186 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002187 default:
2188 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2189 }
2190
2191 return os;
2192}
2193
Alex Gildayc357c472018-03-21 13:54:09 +00002194/** Formatted output of the ConvolutionMethod type.
2195 *
2196 * @param[in] conv_method Type to output
2197 *
2198 * @return Formatted string.
2199 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002200inline std::string to_string(const ConvolutionMethod &conv_method)
2201{
2202 std::stringstream str;
2203 str << conv_method;
2204 return str.str();
2205}
2206
Alex Gildayc357c472018-03-21 13:54:09 +00002207/** 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 Gottardif07d28d2018-02-06 14:52:43 +00002214inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2215{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002216 switch (gpu_target)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002217 {
2218 case GPUTarget::GPU_ARCH_MASK:
2219 os << "GPU_ARCH_MASK";
2220 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002221 case GPUTarget::GPU_GENERATION_MASK:
2222 os << "GPU_GENERATION_MASK";
2223 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002224 case GPUTarget::MIDGARD:
2225 os << "MIDGARD";
2226 break;
2227 case GPUTarget::BIFROST:
2228 os << "BIFROST";
2229 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002230 case GPUTarget::VALHALL:
2231 os << "VALHALL";
2232 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002233 case GPUTarget::T600:
2234 os << "T600";
2235 break;
2236 case GPUTarget::T700:
2237 os << "T700";
2238 break;
2239 case GPUTarget::T800:
2240 os << "T800";
2241 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002242 case GPUTarget::G71:
2243 os << "G71";
2244 break;
2245 case GPUTarget::G72:
2246 os << "G72";
2247 break;
2248 case GPUTarget::G51:
2249 os << "G51";
2250 break;
2251 case GPUTarget::G51BIG:
2252 os << "G51BIG";
2253 break;
2254 case GPUTarget::G51LIT:
2255 os << "G51LIT";
2256 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002257 case GPUTarget::G31:
2258 os << "G31";
2259 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002260 case GPUTarget::G76:
2261 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002262 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002263 case GPUTarget::G52:
2264 os << "G52";
2265 break;
2266 case GPUTarget::G52LIT:
2267 os << "G52LIT";
2268 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002269 case GPUTarget::G77:
2270 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002271 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002272 case GPUTarget::G57:
2273 os << "G57";
2274 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002275 case GPUTarget::G78:
2276 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002277 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002278 case GPUTarget::G68:
2279 os << "G68";
2280 break;
2281 case GPUTarget::G78AE:
2282 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002283 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002284 case GPUTarget::G710:
2285 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002286 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002287 case GPUTarget::G610:
2288 os << "G610";
2289 break;
2290 case GPUTarget::G510:
2291 os << "G510";
2292 break;
2293 case GPUTarget::G310:
2294 os << "G310";
2295 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002296 case GPUTarget::G715:
2297 os << "G715";
2298 break;
2299 case GPUTarget::G615:
2300 os << "G615";
2301 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002302 default:
2303 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2304 }
2305
2306 return os;
2307}
2308
Alex Gildayc357c472018-03-21 13:54:09 +00002309/** Formatted output of the GPUTarget type.
2310 *
2311 * @param[in] gpu_target Type to output
2312 *
2313 * @return Formatted string.
2314 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002315inline std::string to_string(const GPUTarget &gpu_target)
2316{
2317 std::stringstream str;
2318 str << gpu_target;
2319 return str.str();
2320}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002321
John Richardson8de92612018-02-22 14:09:31 +00002322/** Formatted output of the DetectionWindow type.
2323 *
2324 * @param[out] os Output stream
2325 * @param[in] detection_window Type to output
2326 *
2327 * @return Modified output stream.
2328 */
John Richardson684cb0f2018-01-09 11:17:00 +00002329inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2330{
2331 os << "{x=" << detection_window.x << ","
2332 << "y=" << detection_window.y << ","
2333 << "width=" << detection_window.width << ","
2334 << "height=" << detection_window.height << ","
2335 << "idx_class=" << detection_window.idx_class << ","
2336 << "score=" << detection_window.score << "}";
2337
2338 return os;
2339}
2340
Isabella Gottardi05e56442018-11-16 11:26:52 +00002341/** Formatted output of the DetectionOutputLayerCodeType type.
2342 *
2343 * @param[out] os Output stream
2344 * @param[in] detection_code Type to output
2345 *
2346 * @return Modified output stream.
2347 */
2348inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2349{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002350 switch (detection_code)
Isabella Gottardi05e56442018-11-16 11:26:52 +00002351 {
2352 case DetectionOutputLayerCodeType::CENTER_SIZE:
2353 os << "CENTER_SIZE";
2354 break;
2355 case DetectionOutputLayerCodeType::CORNER:
2356 os << "CORNER";
2357 break;
2358 case DetectionOutputLayerCodeType::CORNER_SIZE:
2359 os << "CORNER_SIZE";
2360 break;
2361 case DetectionOutputLayerCodeType::TF_CENTER:
2362 os << "TF_CENTER";
2363 break;
2364 default:
2365 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2366 }
2367
2368 return os;
2369}
2370/** Formatted output of the DetectionOutputLayerCodeType type.
2371 *
2372 * @param[in] detection_code Type to output
2373 *
2374 * @return Formatted string.
2375 */
2376inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2377{
2378 std::stringstream str;
2379 str << detection_code;
2380 return str.str();
2381}
2382
2383/** Formatted output of the DetectionOutputLayerInfo type.
2384 *
2385 * @param[out] os Output stream
2386 * @param[in] detection_info Type to output
2387 *
2388 * @return Modified output stream.
2389 */
2390inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2391{
2392 os << "{Classes=" << detection_info.num_classes() << ","
2393 << "ShareLocation=" << detection_info.share_location() << ","
2394 << "CodeType=" << detection_info.code_type() << ","
2395 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2396 << "KeepTopK=" << detection_info.keep_top_k() << ","
2397 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2398 << "Eta=" << detection_info.eta() << ","
2399 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2400 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2401 << "TopK=" << detection_info.top_k() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002402 << "NumLocClasses=" << detection_info.num_loc_classes() << "}";
Isabella Gottardi05e56442018-11-16 11:26:52 +00002403
2404 return os;
2405}
2406
2407/** Formatted output of the DetectionOutputLayerInfo type.
2408 *
2409 * @param[in] detection_info Type to output
2410 *
2411 * @return Formatted string.
2412 */
2413inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2414{
2415 std::stringstream str;
2416 str << detection_info;
2417 return str.str();
2418}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002419/** Formatted output of the DetectionPostProcessLayerInfo type.
2420 *
2421 * @param[out] os Output stream
2422 * @param[in] detection_info Type to output
2423 *
2424 * @return Modified output stream.
2425 */
2426inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2427{
2428 os << "{MaxDetections=" << detection_info.max_detections() << ","
2429 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2430 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2431 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2432 << "NumClasses=" << detection_info.num_classes() << ","
2433 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2434 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2435 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2436 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2437 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002438 << "DetectionPerClass=" << detection_info.detection_per_class() << "}";
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002439
2440 return os;
2441}
2442
2443/** Formatted output of the DetectionPostProcessLayerInfo type.
2444 *
2445 * @param[in] detection_info Type to output
2446 *
2447 * @return Formatted string.
2448 */
2449inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2450{
2451 std::stringstream str;
2452 str << detection_info;
2453 return str.str();
2454}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002455
John Richardson8de92612018-02-22 14:09:31 +00002456/** Formatted output of the DetectionWindow type.
2457 *
2458 * @param[in] detection_window Type to output
2459 *
2460 * @return Formatted string.
2461 */
2462inline std::string to_string(const DetectionWindow &detection_window)
2463{
2464 std::stringstream str;
2465 str << detection_window;
2466 return str.str();
2467}
2468
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002469/** Formatted output of @ref PriorBoxLayerInfo.
2470 *
2471 * @param[out] os Output stream.
2472 * @param[in] info Type to output.
2473 *
2474 * @return Modified output stream.
2475 */
2476inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2477{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002478 os << "Clip:" << info.clip() << "Flip:" << info.flip() << "StepX:" << info.steps()[0] << "StepY:" << info.steps()[1]
2479 << "MinSizes:" << info.min_sizes() << "MaxSizes:" << info.max_sizes() << "ImgSizeX:" << info.img_size().x
2480 << "ImgSizeY:" << info.img_size().y << "Offset:" << info.offset() << "Variances:" << info.variances();
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002481
2482 return os;
2483}
2484
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002485/** Formatted output of the WinogradInfo type. */
2486inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2487{
2488 os << "{OutputTileSize=" << info.output_tile_size << ","
2489 << "KernelSize=" << info.kernel_size << ","
2490 << "PadStride=" << info.convolution_info << ","
2491 << "OutputDataLayout=" << info.output_data_layout << "}";
2492
2493 return os;
2494}
2495
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002496inline std::string to_string(const WinogradInfo &type)
2497{
2498 std::stringstream str;
2499 str << type;
2500 return str.str();
2501}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002502
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002503/** Convert a CLTunerMode value to a string
2504 *
2505 * @param val CLTunerMode value to be converted
2506 *
2507 * @return String representing the corresponding CLTunerMode.
2508 */
2509inline std::string to_string(const CLTunerMode val)
2510{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002511 switch (val)
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002512 {
2513 case CLTunerMode::EXHAUSTIVE:
2514 {
2515 return std::string("Exhaustive");
2516 }
2517 case CLTunerMode::NORMAL:
2518 {
2519 return std::string("Normal");
2520 }
2521 case CLTunerMode::RAPID:
2522 {
2523 return std::string("Rapid");
2524 }
2525 default:
2526 {
2527 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2528 return std::string("UNDEFINED");
2529 }
2530 }
2531}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002532/** Converts a @ref CLGEMMKernelType to string
2533 *
2534 * @param[in] val CLGEMMKernelType value to be converted
2535 *
2536 * @return String representing the corresponding CLGEMMKernelType
2537 */
2538inline std::string to_string(CLGEMMKernelType val)
2539{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002540 switch (val)
SiCong Lidb4a6c12021-02-05 09:30:57 +00002541 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002542 case CLGEMMKernelType::NATIVE:
2543 {
2544 return "Native";
2545 }
2546 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2547 {
2548 return "Reshaped_Only_RHS";
2549 }
2550 case CLGEMMKernelType::RESHAPED:
2551 {
2552 return "Reshaped";
2553 }
2554 default:
2555 {
2556 return "Unknown";
2557 }
2558 }
2559}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002560/** [Print CLTunerMode type] **/
2561/** Formatted output of the CLTunerMode type.
2562 *
2563 * @param[out] os Output stream.
2564 * @param[in] val CLTunerMode to output.
2565 *
2566 * @return Modified output stream.
2567 */
2568inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2569{
2570 os << to_string(val);
2571 return os;
2572}
2573
ramelg013ae3d882021-09-12 23:07:47 +01002574/** Formatted output of the ConvolutionInfo type.
2575 *
2576 * @param[out] os Output stream.
2577 * @param[in] conv_info ConvolutionInfo to output.
2578 *
2579 * @return Modified output stream.
2580 */
2581inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2582{
SiCongLi579ca842021-10-18 09:38:33 +01002583 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2584 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2585 << "act_info=" << to_string(conv_info.act_info) << ", "
2586 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002587 return os;
2588}
2589
2590/** Converts a @ref ConvolutionInfo to string
2591 *
2592 * @param[in] info ConvolutionInfo value to be converted
2593 *
2594 * @return String representing the corresponding ConvolutionInfo
2595 */
2596inline std::string to_string(const ConvolutionInfo &info)
2597{
2598 std::stringstream str;
2599 str << info;
2600 return str.str();
2601}
2602
2603/** Formatted output of the FullyConnectedLayerInfo type.
2604 *
2605 * @param[out] os Output stream.
2606 * @param[in] layer_info FullyConnectedLayerInfo to output.
2607 *
2608 * @return Modified output stream.
2609 */
2610inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2611{
SiCongLi579ca842021-10-18 09:38:33 +01002612 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2613 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2614 << "transpose_weights=" << layer_info.transpose_weights << ", "
2615 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2616 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
SiCongLi579ca842021-10-18 09:38:33 +01002617 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002618 return os;
2619}
2620
2621/** Converts a @ref FullyConnectedLayerInfo to string
2622 *
2623 * @param[in] info FullyConnectedLayerInfo value to be converted
2624 *
2625 * @return String representing the corresponding FullyConnectedLayerInfo
2626 */
2627inline std::string to_string(const FullyConnectedLayerInfo &info)
2628{
2629 std::stringstream str;
2630 str << info;
2631 return str.str();
2632}
2633
2634/** Formatted output of the GEMMLowpOutputStageType type.
2635 *
2636 * @param[out] os Output stream.
2637 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2638 *
2639 * @return Modified output stream.
2640 */
2641inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2642{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002643 switch (gemm_type)
ramelg013ae3d882021-09-12 23:07:47 +01002644 {
2645 case GEMMLowpOutputStageType::NONE:
2646 os << "NONE";
2647 break;
2648 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2649 os << "QUANTIZE_DOWN";
2650 break;
2651 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2652 os << "QUANTIZE_DOWN_FIXEDPOINT";
2653 break;
2654 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2655 os << "QUANTIZE_DOWN_FLOAT";
2656 break;
2657 default:
2658 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2659 }
2660 return os;
2661}
2662
2663/** Converts a @ref GEMMLowpOutputStageType to string
2664 *
2665 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2666 *
2667 * @return String representing the corresponding GEMMLowpOutputStageType
2668 */
2669inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2670{
2671 std::stringstream str;
2672 str << gemm_type;
2673 return str.str();
2674}
2675
2676/** Formatted output of the GEMMLowpOutputStageInfo type.
2677 *
2678 * @param[out] os Output stream.
2679 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2680 *
2681 * @return Modified output stream.
2682 */
2683inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2684{
SiCongLi579ca842021-10-18 09:38:33 +01002685 os << "{type=" << gemm_info.type << ", "
2686 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2687 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2688 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2689 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2690 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2691 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2692 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2693 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2694 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2695 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002696 return os;
2697}
2698
2699/** Converts a @ref GEMMLowpOutputStageInfo to string
2700 *
2701 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2702 *
2703 * @return String representing the corresponding GEMMLowpOutputStageInfo
2704 */
2705inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2706{
2707 std::stringstream str;
2708 str << gemm_info;
2709 return str.str();
2710}
2711
2712/** Formatted output of the Conv2dInfo type.
2713 *
2714 * @param[out] os Output stream.
2715 * @param[in] conv_info Conv2dInfo to output.
2716 *
2717 * @return Modified output stream.
2718 */
2719inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2720{
SiCongLi579ca842021-10-18 09:38:33 +01002721 os << "{conv_info=" << conv_info.conv_info << ", "
2722 << "dilation=" << conv_info.dilation << ", "
2723 << "act_info=" << to_string(conv_info.act_info) << ", "
2724 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2725 << "num_groups=" << conv_info.num_groups << ","
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01002726 << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002727 return os;
2728}
2729
2730/** Converts a @ref Conv2dInfo to string
2731 *
2732 * @param[in] conv_info Conv2dInfo value to be converted
2733 *
2734 * @return String representing the corresponding Conv2dInfo
2735 */
2736inline std::string to_string(const Conv2dInfo &conv_info)
2737{
2738 std::stringstream str;
2739 str << conv_info;
2740 return str.str();
2741}
2742
2743/** Formatted output of the PixelValue type.
2744 *
2745 * @param[out] os Output stream.
2746 * @param[in] pixel_value PixelValue to output.
2747 *
2748 * @return Modified output stream.
2749 */
2750inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2751{
SiCongLi579ca842021-10-18 09:38:33 +01002752 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002753 return os;
2754}
2755
2756/** Converts a @ref PixelValue to string
2757 *
2758 * @param[in] pixel_value PixelValue value to be converted
2759 *
2760 * @return String representing the corresponding PixelValue
2761 */
2762inline std::string to_string(const PixelValue &pixel_value)
2763{
2764 std::stringstream str;
2765 str << pixel_value;
2766 return str.str();
2767}
2768
2769/** Formatted output of the ScaleKernelInfo type.
2770 *
2771 * @param[out] os Output stream.
2772 * @param[in] scale_info ScaleKernelInfo to output.
2773 *
2774 * @return Modified output stream.
2775 */
2776inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2777{
SiCongLi579ca842021-10-18 09:38:33 +01002778 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2779 << "BorderMode=" << scale_info.border_mode << ", "
2780 << "PixelValue=" << scale_info.constant_border_value << ", "
2781 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2782 << "use_padding=" << scale_info.use_padding << ", "
2783 << "align_corners=" << scale_info.align_corners << ", "
2784 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002785 return os;
2786}
2787
2788/** Converts a @ref ScaleKernelInfo to string
2789 *
2790 * @param[in] scale_info ScaleKernelInfo value to be converted
2791 *
2792 * @return String representing the corresponding ScaleKernelInfo
2793 */
2794inline std::string to_string(const ScaleKernelInfo &scale_info)
2795{
2796 std::stringstream str;
2797 str << scale_info;
2798 return str.str();
2799}
2800
2801/** Formatted output of the FFTDirection type.
2802 *
2803 * @param[out] os Output stream.
2804 * @param[in] fft_dir FFTDirection to output.
2805 *
2806 * @return Modified output stream.
2807 */
2808inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2809{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002810 switch (fft_dir)
ramelg013ae3d882021-09-12 23:07:47 +01002811 {
2812 case FFTDirection::Forward:
2813 os << "Forward";
2814 break;
2815 case FFTDirection::Inverse:
2816 os << "Inverse";
2817 break;
2818 default:
2819 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2820 }
2821 return os;
2822}
2823
2824/** Converts a @ref FFT1DInfo to string
2825 *
2826 * @param[in] fft_dir FFT1DInfo value to be converted
2827 *
2828 * @return String representing the corresponding FFT1DInfo
2829 */
2830inline std::string to_string(const FFTDirection &fft_dir)
2831{
2832 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002833 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002834 return str.str();
2835}
2836
2837/** Formatted output of the FFT1DInfo type.
2838 *
2839 * @param[out] os Output stream.
2840 * @param[in] fft1d_info FFT1DInfo to output.
2841 *
2842 * @return Modified output stream.
2843 */
2844inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2845{
SiCongLi579ca842021-10-18 09:38:33 +01002846 os << "{axis=" << fft1d_info.axis << ", "
2847 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002848 return os;
2849}
2850
2851/** Converts a @ref FFT1DInfo to string
2852 *
2853 * @param[in] fft1d_info FFT1DInfo value to be converted
2854 *
2855 * @return String representing the corresponding FFT1DInfo
2856 */
2857inline std::string to_string(const FFT1DInfo &fft1d_info)
2858{
2859 std::stringstream str;
2860 str << fft1d_info;
2861 return str.str();
2862}
2863
2864/** Formatted output of the FFT2DInfo type.
2865 *
2866 * @param[out] os Output stream.
2867 * @param[in] fft2d_info FFT2DInfo to output.
2868 *
2869 * @return Modified output stream.
2870 */
2871inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2872{
SiCongLi579ca842021-10-18 09:38:33 +01002873 os << "{axis=" << fft2d_info.axis0 << ", "
2874 << "axis=" << fft2d_info.axis1 << ", "
2875 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002876 return os;
2877}
2878
2879/** Converts a @ref FFT2DInfo to string
2880 *
2881 * @param[in] fft2d_info FFT2DInfo value to be converted
2882 *
2883 * @return String representing the corresponding FFT2DInfo
2884 */
2885inline std::string to_string(const FFT2DInfo &fft2d_info)
2886{
2887 std::stringstream str;
2888 str << fft2d_info;
2889 return str.str();
2890}
2891
2892/** Formatted output of the Coordinates2D type.
2893 *
2894 * @param[out] os Output stream.
2895 * @param[in] coord_2d Coordinates2D to output.
2896 *
2897 * @return Modified output stream.
2898 */
2899inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2900{
SiCongLi579ca842021-10-18 09:38:33 +01002901 os << "{x=" << coord_2d.x << ", "
2902 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002903 return os;
2904}
2905
2906/** Converts a @ref Coordinates2D to string
2907 *
2908 * @param[in] coord_2d Coordinates2D value to be converted
2909 *
2910 * @return String representing the corresponding Coordinates2D
2911 */
2912inline std::string to_string(const Coordinates2D &coord_2d)
2913{
2914 std::stringstream str;
2915 str << coord_2d;
2916 return str.str();
2917}
2918
2919/** Formatted output of the FuseBatchNormalizationType type.
2920 *
2921 * @param[out] os Output stream.
2922 * @param[in] fuse_type FuseBatchNormalizationType to output.
2923 *
2924 * @return Modified output stream.
2925 */
2926inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2927{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002928 switch (fuse_type)
ramelg013ae3d882021-09-12 23:07:47 +01002929 {
2930 case FuseBatchNormalizationType::CONVOLUTION:
2931 os << "CONVOLUTION";
2932 break;
2933 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
2934 os << "DEPTHWISECONVOLUTION";
2935 break;
2936 default:
2937 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2938 }
2939 return os;
2940}
2941
2942/** Converts a @ref FuseBatchNormalizationType to string
2943 *
2944 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
2945 *
2946 * @return String representing the corresponding FuseBatchNormalizationType
2947 */
2948inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
2949{
2950 std::stringstream str;
2951 str << fuse_type;
2952 return str.str();
2953}
2954
ramelg01cbbb0382021-09-17 17:36:57 +01002955/** Formatted output of the SoftmaxKernelInfo type.
2956 *
2957 * @param[out] os Output stream.
2958 * @param[in] info SoftmaxKernelInfo to output.
2959 *
2960 * @return Modified output stream.
2961 */
2962inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
2963{
SiCongLi579ca842021-10-18 09:38:33 +01002964 os << "{beta=" << info.beta << ", "
2965 << "is_log=" << info.is_log << ", "
2966 << "input_data_type=" << info.input_data_type << ", "
2967 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01002968 return os;
2969}
2970
2971/** Converts a @ref SoftmaxKernelInfo to string
2972 *
2973 * @param[in] info SoftmaxKernelInfo value to be converted
2974 *
2975 * @return String representing the corresponding SoftmaxKernelInfo
2976 */
2977inline std::string to_string(const SoftmaxKernelInfo &info)
2978{
2979 std::stringstream str;
2980 str << info;
2981 return str.str();
2982}
2983
2984/** Formatted output of the ScaleKernelInfo type.
2985 *
2986 * @param[out] os Output stream.
2987 * @param[in] lstm_params LSTMParams to output.
2988 *
2989 * @return Modified output stream.
2990 */
2991template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01002992::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01002993{
ramelg014a6d9e82021-10-02 14:34:36 +01002994 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
2995 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
2996 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
2997 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
2998 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
2999 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3000 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3001 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3002 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3003 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3004 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3005 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003006 << "cell_clip=" << lstm_params.cell_clip() << ", "
3007 << "projection_clip=" << lstm_params.projection_clip() << ", "
3008 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3009 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3010 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3011 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3012 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3013 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3014 << "has_projection=" << lstm_params.has_projection() << ", "
3015 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3016 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3017 return os;
3018}
3019
3020/** Converts a @ref LSTMParams to string
3021 *
3022 * @param[in] lstm_params LSTMParams<T> value to be converted
3023 *
3024 * @return String representing the corresponding LSTMParams
3025 */
3026template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003027std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003028{
3029 std::stringstream str;
3030 str << lstm_params;
3031 return str.str();
3032}
3033
3034/** Converts a @ref LSTMParams to string
3035 *
3036 * @param[in] num uint8_t value to be converted
3037 *
3038 * @return String representing the corresponding uint8_t
3039 */
3040inline std::string to_string(const uint8_t num)
3041{
3042 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3043 return ::std::to_string(static_cast<int>(num));
3044}
3045
ramelg014a6d9e82021-10-02 14:34:36 +01003046/** Available non maxima suppression types */
3047/** Formatted output of the NMSType type.
3048 *
3049 * @param[out] os Output stream.
3050 * @param[in] nms_type NMSType to output.
3051 *
3052 * @return Modified output stream.
3053 */
3054inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3055{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003056 switch (nms_type)
ramelg014a6d9e82021-10-02 14:34:36 +01003057 {
3058 case NMSType::LINEAR:
3059 os << "LINEAR";
3060 break;
3061 case NMSType::GAUSSIAN:
3062 os << "GAUSSIAN";
3063 break;
3064 case NMSType::ORIGINAL:
3065 os << "ORIGINAL";
3066 break;
3067 default:
3068 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3069 }
3070 return os;
3071}
3072
3073/** Converts a @ref NMSType to string
3074 *
3075 * @param[in] nms_type NMSType value to be converted
3076 *
3077 * @return String representing the corresponding NMSType
3078 */
3079inline std::string to_string(const NMSType nms_type)
3080{
3081 std::stringstream str;
3082 str << nms_type;
3083 return str.str();
3084}
3085
3086/** Formatted output of the BoxNMSLimitInfo type.
3087 *
3088 * @param[out] os Output stream.
3089 * @param[in] info BoxNMSLimitInfo to output.
3090 *
3091 * @return Modified output stream.
3092 */
3093inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3094{
SiCongLi579ca842021-10-18 09:38:33 +01003095 os << "{score_thresh=" << info.score_thresh() << ", "
3096 << "nms=" << info.nms() << ", "
3097 << "detections_per_im=" << info.detections_per_im() << ", "
3098 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3099 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3100 << "suppress_size=" << info.suppress_size() << ", "
3101 << "min_size=" << info.min_size() << ", "
3102 << "im_width=" << info.im_width() << ", "
3103 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003104 return os;
3105}
3106
3107/** Converts a @ref BoxNMSLimitInfo to string
3108 *
3109 * @param[in] info BoxNMSLimitInfo value to be converted
3110 *
3111 * @return String representing the corresponding BoxNMSLimitInfo
3112 */
3113inline std::string to_string(const BoxNMSLimitInfo &info)
3114{
3115 std::stringstream str;
3116 str << info;
3117 return str.str();
3118}
3119
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003120/** Converts a @ref DimensionRoundingType to string
3121 *
3122 * @param[in] rounding_type DimensionRoundingType value to be converted
3123 *
3124 * @return String representing the corresponding DimensionRoundingType
3125 */
3126inline std::string to_string(const DimensionRoundingType &rounding_type)
3127{
3128 std::stringstream str;
3129 str << rounding_type;
3130 return str.str();
3131}
3132
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003133/** Formatted output of the Conv3dInfo type.
3134 *
3135 * @param[out] os Output stream.
3136 * @param[in] conv3d_info Type to output.
3137 *
3138 * @return Modified output stream.
3139 */
3140inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3141{
3142 os << conv3d_info.stride;
3143 os << ";";
3144 os << conv3d_info.padding;
3145 os << ";";
3146 os << to_string(conv3d_info.act_info);
3147 os << ";";
3148 os << conv3d_info.dilation;
3149 os << ";";
3150 os << conv3d_info.round_type;
3151 os << ";";
3152 os << conv3d_info.enable_fast_math;
3153
3154 return os;
3155}
3156
3157/** Formatted output of the Conv3dInfo type.
3158 *
3159 * @param[in] conv3d_info Type to output.
3160 *
3161 * @return Formatted string.
3162 */
3163inline std::string to_string(const Conv3dInfo &conv3d_info)
3164{
3165 std::stringstream str;
3166 str << conv3d_info;
3167 return str.str();
3168}
3169
Ramy Elgammal91780022022-07-20 14:57:37 +01003170/** Formatted output of the arm_compute::WeightFormat type.
3171 *
3172 * @param[in] wf arm_compute::WeightFormat Type to output.
3173 *
3174 * @return Formatted string.
3175 */
3176inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003177{
Ramy Elgammal91780022022-07-20 14:57:37 +01003178#define __CASE_WEIGHT_FORMAT(wf) \
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003179 case WeightFormat::wf: \
3180 return #wf;
3181 switch (wf)
Ramy Elgammal91780022022-07-20 14:57:37 +01003182 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003183 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3184 __CASE_WEIGHT_FORMAT(ANY)
3185 __CASE_WEIGHT_FORMAT(OHWI)
3186 __CASE_WEIGHT_FORMAT(OHWIo2)
3187 __CASE_WEIGHT_FORMAT(OHWIo4)
3188 __CASE_WEIGHT_FORMAT(OHWIo8)
3189 __CASE_WEIGHT_FORMAT(OHWIo16)
3190 __CASE_WEIGHT_FORMAT(OHWIo32)
3191 __CASE_WEIGHT_FORMAT(OHWIo64)
3192 __CASE_WEIGHT_FORMAT(OHWIo128)
3193 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3194 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3195 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3196 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3197 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3198 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3199 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3200 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3201 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3202 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3203 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3204 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3205 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3206 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3207 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3208 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3209 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3210 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3211 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3212 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3213 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3214 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3215 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3216 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3217 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3218 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003219 default:
3220 return "invalid value";
3221 }
3222#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003223}
3224
Ramy Elgammal91780022022-07-20 14:57:37 +01003225/** Formatted output of the arm_compute::WeightFormat type.
3226 *
3227 * @param[out] os Output stream.
3228 * @param[in] wf WeightFormat to output.
3229 *
3230 * @return Modified output stream.
3231 */
3232inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3233{
3234 os << to_string(wf);
3235 return os;
3236}
3237
3238/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3239 *
3240 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3241 *
3242 * @return Formatted string.
3243 */
3244inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003245{
3246 std::stringstream str;
3247 str << "[Input shape = " << std::get<0>(values);
3248 str << ", ";
3249 str << "Expected output shape = " << std::get<1>(values);
3250
3251 str << ", ";
3252 str << "WeightFormat = " << std::get<2>(values) << "]";
3253 return str.str();
3254}
3255
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003256/** Formatted output of the Padding2D type.
3257 *
3258 * @param[out] os Output stream.
3259 * @param[in] padding2d Padding info for 2D dimension shape.
3260 *
3261 * @return Modified output stream.
3262 */
3263inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3264{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003265 os << padding2d.left << "," << padding2d.right << "," << padding2d.top << "," << padding2d.bottom;
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003266 return os;
3267}
3268
3269/** Converts a @ref Padding2D to string
3270 *
3271 * @param[in] padding2d Padding2D value to be converted
3272 *
3273 * @return String representing the corresponding Padding2D
3274 */
3275inline std::string to_string(const Padding2D &padding2d)
3276{
3277 std::stringstream str;
3278 str << padding2d;
3279 return str.str();
3280}
3281
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003282/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3283 *
3284 * @param[out] os Output stream.
3285 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3286 *
3287 * @return Modified output stream.
3288 */
3289inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3290{
3291 os << "Pool2dAttributes="
3292 << "["
3293 << "PoolingType=" << pool2d_attr.pool_type() << ","
3294 << "PoolSize=" << pool2d_attr.pool_size() << ","
3295 << "Padding=" << pool2d_attr.pad() << ","
3296 << "Stride=" << pool2d_attr.stride() << ","
3297 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3298
3299 return os;
3300}
3301
3302/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3303 *
3304 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3305 *
3306 * @return Formatted string.
3307 */
3308inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3309{
3310 std::stringstream str;
3311 str << pool2d_attr;
3312 return str.str();
3313}
3314
3315/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3316 *
3317 * @param[out] os Output stream
3318 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3319 */
3320inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3321{
3322 os << "Settings="
3323 << "["
3324 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3325 return os;
3326}
3327
3328/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3329 *
3330 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3331 *
3332 * @return Formatted string.
3333 */
3334inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3335{
3336 std::stringstream str;
3337 str << settings;
3338 return str.str();
3339}
3340
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003341/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3342 *
3343 * @param[out] os Output stream.
3344 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3345 *
3346 * @return Modified output stream.
3347 */
3348inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3349{
3350 os << "Conv2dAttributes="
3351 << "["
3352 << "Padding=" << conv2d_attr.pad() << ", "
3353 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003354 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003355
3356 return os;
3357}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003358
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003359/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3360 *
3361 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3362 *
3363 * @return Formatted string.
3364 */
3365inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3366{
3367 std::stringstream str;
3368 str << conv2d_attr;
3369 return str.str();
3370}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003371
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003372/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3373 *
3374 * @param[out] os Output stream.
3375 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3376 *
3377 * @return Modified output stream.
3378 */
3379inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3380{
3381 os << "CastAttributes="
3382 << "["
3383 << "Data Type=" << cast_attr.data_type() << ", "
3384 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3385
3386 return os;
3387}
3388/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3389 *
3390 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3391 *
3392 * @return Formatted string.
3393 */
3394inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3395{
3396 std::stringstream str;
3397 str << cast_attr;
3398 return str.str();
3399}
3400
Gunes Bayir7dc02342022-11-21 21:46:50 +00003401/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3402 *
3403 * @param[out] os Output stream.
3404 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3405 *
3406 * @return Modified output stream.
3407 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003408inline ::std::ostream &operator<<(::std::ostream &os,
3409 const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
Gunes Bayir7dc02342022-11-21 21:46:50 +00003410{
3411 os << "DepthwiseConv2dAttributes="
3412 << "["
3413 << "Padding=" << dw_conv2d_attr.pad() << ", "
3414 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3415 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3416 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3417 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3418
3419 return os;
3420}
3421/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3422 *
3423 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3424 *
3425 * @return Formatted string.
3426 */
3427inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3428{
3429 std::stringstream str;
3430 str << dw_conv2d_attr;
3431 return str.str();
3432}
3433
Jakub Sujak32741722022-11-25 16:43:18 +00003434/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3435 *
3436 * @param[out] os Output stream.
3437 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3438 *
3439 * @return Modified output stream.
3440 */
3441inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3442{
3443 os << "ClampAttributes="
3444 << "["
3445 << "Min value=" << clamp_attr.min_val() << ", "
3446 << "Max value=" << clamp_attr.max_val() << "]";
3447 return os;
3448}
3449/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3450 *
3451 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3452 *
3453 * @return Formatted string.
3454 */
3455inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3456{
3457 std::stringstream str;
3458 str << clamp_attr;
3459 return str.str();
3460}
3461
Jakub Sujak8ae57142022-12-02 16:09:06 +00003462/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3463 *
3464 * @param[out] os Output stream.
3465 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3466 *
3467 * @return Modified output stream.
3468 */
3469inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3470{
3471 os << "ResizeAttributes="
3472 << "["
3473 << "AlignCorners=" << resize_attr.align_corners() << ", "
3474 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3475 << "OutputHeight=" << resize_attr.output_height() << ", "
3476 << "OutputWidth=" << resize_attr.output_width() << ", "
3477 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3478 return os;
3479}
3480
3481/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3482 *
3483 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3484 *
3485 * @return Formatted string.
3486 */
3487inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3488{
3489 std::stringstream str;
3490 str << resize_attr;
3491 return str.str();
3492}
3493
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003494/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3495 *
3496 * @param[out] os Output stream.
3497 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3498 *
3499 * @return Modified output stream.
3500 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003501inline ::std::ostream &operator<<(::std::ostream &os,
3502 const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003503{
Jakub Sujak7359a872023-01-05 14:24:13 +00003504 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003505 << "["
3506 << "Beta=" << softmax_attr.beta() << ", "
3507 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3508 << "Axis=" << softmax_attr.axis() << "]";
3509 return os;
3510}
3511/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3512 *
3513 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3514 *
3515 * @return Formatted string.
3516 */
3517inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3518{
3519 std::stringstream str;
3520 str << softmax_attr;
3521 return str.str();
3522}
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003523/** Formatted output of the arm_compute::MatMulInfo type.
3524 *
3525 * @param[out] os Output stream.
3526 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3527 *
3528 * @return Modified output stream.
3529 */
3530inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulInfo &matmul_info)
3531{
3532 os << "MatMulKernelInfo="
3533 << "["
3534 << "adj_lhs=" << matmul_info.adj_lhs() << ", "
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +01003535 << "adj_rhs=" << matmul_info.adj_rhs() << "] ";
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003536 return os;
3537}
3538/** Formatted output of the arm_compute::MatMulInfo type.
3539 *
3540 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3541 *
3542 * @return Formatted string.
3543 */
3544inline std::string to_string(const arm_compute::MatMulInfo &matmul_info)
3545{
3546 std::stringstream str;
3547 str << matmul_info;
3548 return str.str();
3549}
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003550
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003551/** Formatted output of the arm_compute::MatMulKernelInfo type.
3552 *
3553 * @param[out] os Output stream.
3554 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3555 *
3556 * @return Modified output stream.
3557 */
3558inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulKernelInfo &matmul_info)
3559{
3560 os << "MatMulKernelInfo="
3561 << "["
3562 << "adj_lhs=" << matmul_info.adj_lhs << ", "
3563 << "adj_rhs=" << matmul_info.adj_rhs << ", "
3564 << "M0=" << matmul_info.m0 << ", "
3565 << "N0=" << matmul_info.n0 << ", "
3566 << "K0=" << matmul_info.k0 << ", "
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003567 << "export_rhs_to_cl_image=" << matmul_info.export_rhs_to_cl_image << "]";
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003568
3569 return os;
3570}
3571/** Formatted output of the arm_compute::MatMulKernelInfo type.
3572 *
3573 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3574 *
3575 * @return Formatted string.
3576 */
3577inline std::string to_string(const arm_compute::MatMulKernelInfo &matmul_info)
3578{
3579 std::stringstream str;
3580 str << matmul_info;
3581 return str.str();
3582}
3583
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003584/** Formatted output of the arm_compute::CpuMatMulSettings type.
3585 *
3586 * @param[out] os Output stream.
3587 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3588 *
3589 * @return Modified output stream.
3590 */
3591inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::CpuMatMulSettings &settings)
3592{
3593 os << "CpuMatMulSettings="
3594 << "["
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003595 << "fast_math=" << settings.fast_math() << "]";
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003596
3597 return os;
3598}
3599/** Formatted output of the arm_compute::CpuMatMulSettings type.
3600 *
3601 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3602 *
3603 * @return Formatted string.
3604 */
3605inline std::string to_string(const arm_compute::CpuMatMulSettings &settings)
3606{
3607 std::stringstream str;
3608 str << settings;
3609 return str.str();
3610}
3611
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003612} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003613
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01003614#endif // ACL_UTILS_TYPEPRINTER_H