blob: 2d106d849a826afb44ea07d0a176f9844877d427 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Gunes Bayir2b9fa592024-01-17 16:07:03 +00002 * Copyright (c) 2017-2024 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"
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000052#include "arm_compute/function_info/ScatterInfo.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010053#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000054#include "arm_compute/runtime/CL/CLTypes.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010055#include "arm_compute/runtime/common/LSTMParams.h"
ramelg013ae3d882021-09-12 23:07:47 +010056#include "arm_compute/runtime/FunctionDescriptors.h"
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +000057#include "arm_compute/runtime/NEON/functions/NEMatMul.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010058
SiCongLi31778612021-11-12 17:33:45 +000059#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000060#include "support/StringSupport.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010061
Anthony Barbier6ff3b192017-09-04 18:44:23 +010062#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010063#include <sstream>
64#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010065
66namespace arm_compute
67{
Anthony Barbierb940fd62018-06-04 14:14:32 +010068/** Formatted output if arg is not null
69 *
70 * @param[in] arg Object to print
71 *
72 * @return String representing arg.
73 */
74template <typename T>
75std::string to_string_if_not_null(T *arg)
76{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010077 if (arg == nullptr)
Anthony Barbierb940fd62018-06-04 14:14:32 +010078 {
79 return "nullptr";
80 }
81 else
82 {
83 return to_string(*arg);
84 }
85}
Anthony Barbierb4670212018-05-18 16:55:39 +010086
ramelg014a6d9e82021-10-02 14:34:36 +010087/** Fallback method: try to use std::to_string:
88 *
89 * @param[in] val Value to convert to string
90 *
91 * @return String representing val.
92 */
93template <typename T>
94inline std::string to_string(const T &val)
95{
96 return support::cpp11::to_string(val);
97}
98
ramelg01b1ba1e32021-09-25 11:53:26 +010099/** Formatted output of a vector of objects.
100 *
ramelg014a6d9e82021-10-02 14:34:36 +0100101 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
102 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
103 *
ramelg01b1ba1e32021-09-25 11:53:26 +0100104 * @param[out] os Output stream
105 * @param[in] args Vector of objects to print
106 *
107 * @return Modified output stream.
108 */
109template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100110::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100111{
112 const size_t max_print_size = 5U;
113
114 os << "[";
115 bool first = true;
116 size_t i;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100117 for (i = 0; i < args.size(); ++i)
ramelg01b1ba1e32021-09-25 11:53:26 +0100118 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100119 if (i == max_print_size)
ramelg01b1ba1e32021-09-25 11:53:26 +0100120 {
121 break;
122 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100123 if (first)
ramelg01b1ba1e32021-09-25 11:53:26 +0100124 {
125 first = false;
126 }
127 else
128 {
129 os << ", ";
130 }
ramelg014a6d9e82021-10-02 14:34:36 +0100131 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100132 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100133 if (i < args.size())
ramelg01b1ba1e32021-09-25 11:53:26 +0100134 {
135 os << ", ...";
136 }
137 os << "]";
138 return os;
139}
140
ramelg014a6d9e82021-10-02 14:34:36 +0100141/** Formatted output of a vector of objects.
142 *
143 * @param[in] args Vector of objects to print
144 *
145 * @return String representing args.
146 */
147template <typename T>
148std::string to_string(const std::vector<T> &args)
149{
150 std::stringstream str;
151 str << args;
152 return str.str();
153}
154
Alex Gildayc357c472018-03-21 13:54:09 +0000155/** Formatted output of the Dimensions type.
156 *
157 * @param[out] os Output stream.
158 * @param[in] dimensions Type to output.
159 *
160 * @return Modified output stream.
161 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100162template <typename T>
163inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
164{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100165 if (dimensions.num_dimensions() > 0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100166 {
167 os << dimensions[0];
168
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100169 for (unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100170 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100171 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100172 }
173 }
174
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100175 return os;
176}
177
Alex Gildayc357c472018-03-21 13:54:09 +0000178/** Formatted output of the RoundingPolicy type.
179 *
180 * @param[out] os Output stream.
181 * @param[in] rounding_policy Type to output.
182 *
183 * @return Modified output stream.
184 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100185inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100186{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100187 switch (rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100188 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100189 case RoundingPolicy::TO_ZERO:
190 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100191 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100192 case RoundingPolicy::TO_NEAREST_UP:
193 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100194 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100195 case RoundingPolicy::TO_NEAREST_EVEN:
196 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100197 break;
198 default:
199 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
200 }
201
202 return os;
203}
204
Alex Gildayc357c472018-03-21 13:54:09 +0000205/** Formatted output of the WeightsInfo type.
206 *
207 * @param[out] os Output stream.
208 * @param[in] weights_info Type to output.
209 *
210 * @return Modified output stream.
211 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100212inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100213{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100214 os << weights_info.are_reshaped() << ";";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100215 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << ","
216 << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100217
218 return os;
219}
220
Alex Gildayc357c472018-03-21 13:54:09 +0000221/** Formatted output of the ROIPoolingInfo type.
222 *
223 * @param[out] os Output stream.
224 * @param[in] pool_info Type to output.
225 *
226 * @return Modified output stream.
227 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100228inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100229{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100230 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100231 return os;
232}
233
giuros0118870812018-09-13 09:31:40 +0100234/** Formatted output of the ROIPoolingInfo type.
235 *
236 * @param[in] pool_info Type to output.
237 *
238 * @return Formatted string.
239 */
240inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
241{
242 std::stringstream str;
243 str << pool_info;
244 return str.str();
245}
246
morgolockaba2f912020-05-05 16:28:19 +0100247/** Formatted output of the GEMMKernelInfo type.
248 *
249 * @param[out] os Output stream.
250 * @param[in] gemm_info Type to output.
251 *
252 * @return Modified output stream.
253 */
254inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
255{
SiCongLi579ca842021-10-18 09:38:33 +0100256 os << "( m=" << gemm_info.m;
257 os << " n=" << gemm_info.n;
258 os << " k=" << gemm_info.k;
259 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
260 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
261 os << " broadcast_bias=" << gemm_info.broadcast_bias;
262 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
263 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
264 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
265 os << " a_offset=" << gemm_info.a_offset;
266 os << " b_offset=" << gemm_info.b_offset;
morgolockaba2f912020-05-05 16:28:19 +0100267 os << ")";
268 return os;
269}
270
271/** Formatted output of the GEMMLHSMatrixInfo type.
272 *
273 * @param[out] os Output stream.
274 * @param[in] gemm_info Type to output.
275 *
276 * @return Modified output stream.
277 */
278inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
279{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100280 os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0
281 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
morgolockaba2f912020-05-05 16:28:19 +0100282 return os;
283}
284
285/** Formatted output of the GEMMRHSMatrixInfo type.
286 *
287 * @param[out] os Output stream.
288 * @param[in] gemm_info Type to output.
289 *
290 * @return Modified output stream.
291 */
292inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
293{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100294 os << "( n0=" << (unsigned int)gemm_info.n0 << " k0=" << gemm_info.k0 << " h0=" << gemm_info.h0
295 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave
296 << " exp_img=" << gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100297 return os;
298}
299
300/** Formatted output of the GEMMRHSMatrixInfo type.
301 *
302 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
303 *
304 * @return Formatted string.
305 */
306inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
307{
308 std::stringstream str;
309 str << gemm_info;
310 return str.str();
311}
312
313/** Formatted output of the GEMMLHSMatrixInfo type.
314 *
315 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
316 *
317 * @return Formatted string.
318 */
319inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
320{
321 std::stringstream str;
322 str << gemm_info;
323 return str.str();
324}
325
326/** Formatted output of the GEMMKernelInfo type.
327 *
328 * @param[in] gemm_info GEMMKernelInfo Type to output.
329 *
330 * @return Formatted string.
331 */
332inline std::string to_string(const GEMMKernelInfo &gemm_info)
333{
334 std::stringstream str;
335 str << gemm_info;
336 return str.str();
337}
338
giuros01c04a0e82018-10-03 12:44:35 +0100339/** Formatted output of the BoundingBoxTransformInfo type.
340 *
341 * @param[out] os Output stream.
342 * @param[in] bbox_info Type to output.
343 *
344 * @return Modified output stream.
345 */
346inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
347{
348 auto weights = bbox_info.weights();
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100349 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={"
350 << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << "})";
giuros01c04a0e82018-10-03 12:44:35 +0100351 return os;
352}
353
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100354#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100355inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100356{
Matthew Benthamf66a7e82023-06-15 14:55:35 +0000357 return os << float(v);
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100358}
Ramy Elgammal91780022022-07-20 14:57:37 +0100359#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100360
giuros01c04a0e82018-10-03 12:44:35 +0100361/** Formatted output of the BoundingBoxTransformInfo type.
362 *
363 * @param[in] bbox_info Type to output.
364 *
365 * @return Formatted string.
366 */
367inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
368{
369 std::stringstream str;
370 str << bbox_info;
371 return str.str();
372}
373
Manuel Bottini5209be52019-02-13 16:34:56 +0000374/** Formatted output of the ComputeAnchorsInfo type.
375 *
376 * @param[out] os Output stream.
377 * @param[in] anchors_info Type to output.
378 *
379 * @return Modified output stream.
380 */
381inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
382{
383 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
384 return os;
385}
386
387/** Formatted output of the ComputeAnchorsInfo type.
388 *
389 * @param[in] anchors_info Type to output.
390 *
391 * @return Formatted string.
392 */
393inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
394{
395 std::stringstream str;
396 str << anchors_info;
397 return str.str();
398}
399
400/** Formatted output of the GenerateProposalsInfo type.
401 *
402 * @param[out] os Output stream.
403 * @param[in] proposals_info Type to output.
404 *
405 * @return Modified output stream.
406 */
407inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
408{
409 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
410 return os;
411}
412
413/** Formatted output of the GenerateProposalsInfo type.
414 *
415 * @param[in] proposals_info Type to output.
416 *
417 * @return Formatted string.
418 */
419inline std::string to_string(const GenerateProposalsInfo &proposals_info)
420{
421 std::stringstream str;
422 str << proposals_info;
423 return str.str();
424}
425
Alex Gildayc357c472018-03-21 13:54:09 +0000426/** Formatted output of the QuantizationInfo type.
427 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100428 * @param[out] os Output stream.
429 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000430 *
431 * @return Modified output stream.
432 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100433inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700434{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100435 const UniformQuantizationInfo uqinfo = qinfo.uniform();
436 os << "Scale:" << uqinfo.scale << "~";
437 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700438 return os;
439}
440
Alex Gildayc357c472018-03-21 13:54:09 +0000441/** Formatted output of the QuantizationInfo type.
442 *
443 * @param[in] quantization_info Type to output.
444 *
445 * @return Formatted string.
446 */
Chunosovd621bca2017-11-03 17:33:15 +0700447inline std::string to_string(const QuantizationInfo &quantization_info)
448{
449 std::stringstream str;
450 str << quantization_info;
451 return str.str();
452}
453
Alex Gildayc357c472018-03-21 13:54:09 +0000454/** Formatted output of the activation function type.
455 *
456 * @param[out] os Output stream.
457 * @param[in] act_function Type to output.
458 *
459 * @return Modified output stream.
460 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100461inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
462{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100463 switch (act_function)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100464 {
465 case ActivationLayerInfo::ActivationFunction::ABS:
466 os << "ABS";
467 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100468 case ActivationLayerInfo::ActivationFunction::LINEAR:
469 os << "LINEAR";
470 break;
471 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
472 os << "LOGISTIC";
473 break;
474 case ActivationLayerInfo::ActivationFunction::RELU:
475 os << "RELU";
476 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100477 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
478 os << "BOUNDED_RELU";
479 break;
480 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
481 os << "LEAKY_RELU";
482 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100483 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
484 os << "SOFT_RELU";
485 break;
486 case ActivationLayerInfo::ActivationFunction::SQRT:
487 os << "SQRT";
488 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100489 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
490 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000491 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100492 case ActivationLayerInfo::ActivationFunction::ELU:
493 os << "ELU";
494 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100495 case ActivationLayerInfo::ActivationFunction::SQUARE:
496 os << "SQUARE";
497 break;
498 case ActivationLayerInfo::ActivationFunction::TANH:
499 os << "TANH";
500 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100501 case ActivationLayerInfo::ActivationFunction::IDENTITY:
502 os << "IDENTITY";
503 break;
morgolock07df3d42020-02-27 11:46:28 +0000504 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
505 os << "HARD_SWISH";
506 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100507 case ActivationLayerInfo::ActivationFunction::SWISH:
508 os << "SWISH";
509 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400510 case ActivationLayerInfo::ActivationFunction::GELU:
511 os << "GELU";
512 break;
morgolock07df3d42020-02-27 11:46:28 +0000513
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100514 default:
515 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
516 }
517
518 return os;
519}
520
Alex Gildayc357c472018-03-21 13:54:09 +0000521/** Formatted output of the activation function info type.
522 *
SiCongLi1af54162021-10-06 15:25:57 +0100523 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000524 *
525 * @return Formatted string.
526 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100527inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100528{
529 std::stringstream str;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100530 if (info.enabled())
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000531 {
532 str << info.activation();
533 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100534 return str.str();
535}
536
SiCongLi1af54162021-10-06 15:25:57 +0100537/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100538 *
SiCongLi1af54162021-10-06 15:25:57 +0100539 * @param[out] os Output stream.
540 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100541 *
542 * @return Formatted string.
543 */
SiCongLi1af54162021-10-06 15:25:57 +0100544inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100545{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100546 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +0100547 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100548 if (info->enabled())
ramelg013ae3d882021-09-12 23:07:47 +0100549 {
SiCongLi1af54162021-10-06 15:25:57 +0100550 os << info->activation();
551 os << "(";
552 os << "VAL_A=" << info->a() << ",";
553 os << "VAL_B=" << info->b();
554 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100555 }
SiCongLi1af54162021-10-06 15:25:57 +0100556 else
557 {
558 os << "disabled";
559 }
ramelg013ae3d882021-09-12 23:07:47 +0100560 }
SiCongLi1af54162021-10-06 15:25:57 +0100561 else
562 {
563 os << "nullptr";
564 }
565 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100566}
567
Alex Gildayc357c472018-03-21 13:54:09 +0000568/** Formatted output of the activation function type.
569 *
570 * @param[in] function Type to output.
571 *
572 * @return Formatted string.
573 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100574inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
575{
576 std::stringstream str;
577 str << function;
578 return str.str();
579}
580
Alex Gildayc357c472018-03-21 13:54:09 +0000581/** Formatted output of the NormType type.
582 *
583 * @param[out] os Output stream.
584 * @param[in] norm_type Type to output.
585 *
586 * @return Modified output stream.
587 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100588inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
589{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100590 switch (norm_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100591 {
592 case NormType::CROSS_MAP:
593 os << "CROSS_MAP";
594 break;
595 case NormType::IN_MAP_1D:
596 os << "IN_MAP_1D";
597 break;
598 case NormType::IN_MAP_2D:
599 os << "IN_MAP_2D";
600 break;
601 default:
602 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
603 }
604
605 return os;
606}
607
Alex Gildayc357c472018-03-21 13:54:09 +0000608/** Formatted output of @ref NormalizationLayerInfo.
609 *
610 * @param[in] info Type to output.
611 *
612 * @return Formatted string.
613 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100614inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100615{
616 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000617 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100618 return str.str();
619}
620
Alex Gildayc357c472018-03-21 13:54:09 +0000621/** Formatted output of @ref NormalizationLayerInfo.
622 *
623 * @param[out] os Output stream.
624 * @param[in] info Type to output.
625 *
626 * @return Modified output stream.
627 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100628inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
629{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000630 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100631 return os;
632}
633
Alex Gildayc357c472018-03-21 13:54:09 +0000634/** Formatted output of the PoolingType type.
635 *
636 * @param[out] os Output stream.
637 * @param[in] pool_type Type to output.
638 *
639 * @return Modified output stream.
640 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100641inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
642{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100643 switch (pool_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100644 {
645 case PoolingType::AVG:
646 os << "AVG";
647 break;
648 case PoolingType::MAX:
649 os << "MAX";
650 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100651 case PoolingType::L2:
652 os << "L2";
653 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100654 default:
655 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
656 }
657
658 return os;
659}
660
Alex Gildayc357c472018-03-21 13:54:09 +0000661/** Formatted output of @ref PoolingLayerInfo.
662 *
663 * @param[out] os Output stream.
664 * @param[in] info Type to output.
665 *
666 * @return Modified output stream.
667 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100668inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
669{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000670 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100671
672 return os;
673}
674
Alex Gildayc357c472018-03-21 13:54:09 +0000675/** Formatted output of @ref RoundingPolicy.
676 *
677 * @param[in] rounding_policy Type to output.
678 *
679 * @return Formatted string.
680 */
John Richardsondd715f22017-09-18 16:10:48 +0100681inline std::string to_string(const RoundingPolicy &rounding_policy)
682{
683 std::stringstream str;
684 str << rounding_policy;
685 return str.str();
686}
687
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000688/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000689/** Formatted output of the DataLayout type.
690 *
691 * @param[out] os Output stream.
692 * @param[in] data_layout Type to output.
693 *
694 * @return Modified output stream.
695 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000696inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
697{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100698 switch (data_layout)
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000699 {
700 case DataLayout::UNKNOWN:
701 os << "UNKNOWN";
702 break;
703 case DataLayout::NHWC:
704 os << "NHWC";
705 break;
706 case DataLayout::NCHW:
707 os << "NCHW";
708 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100709 case DataLayout::NDHWC:
710 os << "NDHWC";
711 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100712 case DataLayout::NCDHW:
713 os << "NCDHW";
714 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000715 default:
716 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
717 }
718
719 return os;
720}
721
Alex Gildayc357c472018-03-21 13:54:09 +0000722/** Formatted output of the DataLayout type.
723 *
724 * @param[in] data_layout Type to output.
725 *
726 * @return Formatted string.
727 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000728inline std::string to_string(const arm_compute::DataLayout &data_layout)
729{
730 std::stringstream str;
731 str << data_layout;
732 return str.str();
733}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000734/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000735
Georgios Pinitase2220552018-07-20 13:23:44 +0100736/** Formatted output of the DataLayoutDimension type.
737 *
738 * @param[out] os Output stream.
739 * @param[in] data_layout_dim Data layout dimension to print.
740 *
741 * @return Modified output stream.
742 */
743inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
744{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100745 switch (data_layout_dim)
Georgios Pinitase2220552018-07-20 13:23:44 +0100746 {
747 case DataLayoutDimension::WIDTH:
748 os << "WIDTH";
749 break;
750 case DataLayoutDimension::HEIGHT:
751 os << "HEIGHT";
752 break;
753 case DataLayoutDimension::CHANNEL:
754 os << "CHANNEL";
755 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100756 case DataLayoutDimension::DEPTH:
757 os << "DEPTH";
758 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100759 case DataLayoutDimension::BATCHES:
760 os << "BATCHES";
761 break;
762 default:
763 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
764 }
765 return os;
766}
767
Alex Gildayc357c472018-03-21 13:54:09 +0000768/** Formatted output of the DataType type.
769 *
770 * @param[out] os Output stream.
771 * @param[in] data_type Type to output.
772 *
773 * @return Modified output stream.
774 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100775inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
776{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100777 switch (data_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100778 {
779 case DataType::UNKNOWN:
780 os << "UNKNOWN";
781 break;
782 case DataType::U8:
783 os << "U8";
784 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100785 case DataType::QSYMM8:
786 os << "QSYMM8";
787 break;
Chunosovd621bca2017-11-03 17:33:15 +0700788 case DataType::QASYMM8:
789 os << "QASYMM8";
790 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000791 case DataType::QASYMM8_SIGNED:
792 os << "QASYMM8_SIGNED";
793 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100794 case DataType::QSYMM8_PER_CHANNEL:
795 os << "QSYMM8_PER_CHANNEL";
796 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100797 case DataType::S8:
798 os << "S8";
799 break;
800 case DataType::U16:
801 os << "U16";
802 break;
803 case DataType::S16:
804 os << "S16";
805 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100806 case DataType::QSYMM16:
807 os << "QSYMM16";
808 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100809 case DataType::QASYMM16:
810 os << "QASYMM16";
811 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100812 case DataType::U32:
813 os << "U32";
814 break;
815 case DataType::S32:
816 os << "S32";
817 break;
818 case DataType::U64:
819 os << "U64";
820 break;
821 case DataType::S64:
822 os << "S64";
823 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000824 case DataType::BFLOAT16:
825 os << "BFLOAT16";
826 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100827 case DataType::F16:
828 os << "F16";
829 break;
830 case DataType::F32:
831 os << "F32";
832 break;
833 case DataType::F64:
834 os << "F64";
835 break;
836 case DataType::SIZET:
837 os << "SIZET";
838 break;
839 default:
840 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
841 }
842
843 return os;
844}
845
Alex Gildayc357c472018-03-21 13:54:09 +0000846/** Formatted output of the DataType type.
847 *
848 * @param[in] data_type Type to output.
849 *
850 * @return Formatted string.
851 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100852inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100853{
854 std::stringstream str;
855 str << data_type;
856 return str.str();
857}
858
Alex Gildayc357c472018-03-21 13:54:09 +0000859/** Formatted output of the Format type.
860 *
861 * @param[out] os Output stream.
862 * @param[in] format Type to output.
863 *
864 * @return Modified output stream.
865 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100866inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
867{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100868 switch (format)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100869 {
870 case Format::UNKNOWN:
871 os << "UNKNOWN";
872 break;
873 case Format::U8:
874 os << "U8";
875 break;
876 case Format::S16:
877 os << "S16";
878 break;
879 case Format::U16:
880 os << "U16";
881 break;
882 case Format::S32:
883 os << "S32";
884 break;
885 case Format::U32:
886 os << "U32";
887 break;
888 case Format::F16:
889 os << "F16";
890 break;
891 case Format::F32:
892 os << "F32";
893 break;
894 case Format::UV88:
895 os << "UV88";
896 break;
897 case Format::RGB888:
898 os << "RGB888";
899 break;
900 case Format::RGBA8888:
901 os << "RGBA8888";
902 break;
903 case Format::YUV444:
904 os << "YUV444";
905 break;
906 case Format::YUYV422:
907 os << "YUYV422";
908 break;
909 case Format::NV12:
910 os << "NV12";
911 break;
912 case Format::NV21:
913 os << "NV21";
914 break;
915 case Format::IYUV:
916 os << "IYUV";
917 break;
918 case Format::UYVY422:
919 os << "UYVY422";
920 break;
921 default:
922 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
923 }
924
925 return os;
926}
927
Alex Gildayc357c472018-03-21 13:54:09 +0000928/** Formatted output of the Format type.
929 *
930 * @param[in] format Type to output.
931 *
932 * @return Formatted string.
933 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100934inline std::string to_string(const Format &format)
935{
936 std::stringstream str;
937 str << format;
938 return str.str();
939}
940
Alex Gildayc357c472018-03-21 13:54:09 +0000941/** Formatted output of the Channel type.
942 *
943 * @param[out] os Output stream.
944 * @param[in] channel Type to output.
945 *
946 * @return Modified output stream.
947 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100948inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
949{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100950 switch (channel)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100951 {
952 case Channel::UNKNOWN:
953 os << "UNKNOWN";
954 break;
955 case Channel::C0:
956 os << "C0";
957 break;
958 case Channel::C1:
959 os << "C1";
960 break;
961 case Channel::C2:
962 os << "C2";
963 break;
964 case Channel::C3:
965 os << "C3";
966 break;
967 case Channel::R:
968 os << "R";
969 break;
970 case Channel::G:
971 os << "G";
972 break;
973 case Channel::B:
974 os << "B";
975 break;
976 case Channel::A:
977 os << "A";
978 break;
979 case Channel::Y:
980 os << "Y";
981 break;
982 case Channel::U:
983 os << "U";
984 break;
985 case Channel::V:
986 os << "V";
987 break;
988 default:
989 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
990 }
991
992 return os;
993}
994
Alex Gildayc357c472018-03-21 13:54:09 +0000995/** Formatted output of the Channel type.
996 *
997 * @param[in] channel Type to output.
998 *
999 * @return Formatted string.
1000 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001001inline std::string to_string(const Channel &channel)
1002{
1003 std::stringstream str;
1004 str << channel;
1005 return str.str();
1006}
1007
Alex Gildayc357c472018-03-21 13:54:09 +00001008/** Formatted output of the BorderMode type.
1009 *
1010 * @param[out] os Output stream.
1011 * @param[in] mode Type to output.
1012 *
1013 * @return Modified output stream.
1014 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001015inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1016{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001017 switch (mode)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001018 {
1019 case BorderMode::UNDEFINED:
1020 os << "UNDEFINED";
1021 break;
1022 case BorderMode::CONSTANT:
1023 os << "CONSTANT";
1024 break;
1025 case BorderMode::REPLICATE:
1026 os << "REPLICATE";
1027 break;
1028 default:
1029 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1030 }
1031
1032 return os;
1033}
1034
Alex Gildayc357c472018-03-21 13:54:09 +00001035/** Formatted output of the BorderSize type.
1036 *
1037 * @param[out] os Output stream.
1038 * @param[in] border Type to output.
1039 *
1040 * @return Modified output stream.
1041 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001042inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1043{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001044 os << border.top << "," << border.right << "," << border.bottom << "," << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001045
1046 return os;
1047}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001048
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001049/** Formatted output of the PaddingList type.
1050 *
1051 * @param[out] os Output stream.
1052 * @param[in] padding Type to output.
1053 *
1054 * @return Modified output stream.
1055 */
1056inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1057{
1058 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001059 for (auto const &p : padding)
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001060 {
1061 os << "{" << p.first << "," << p.second << "}";
1062 }
1063 os << "}";
1064 return os;
1065}
1066
giuros013175fcf2018-11-21 09:59:17 +00001067/** Formatted output of the Multiples type.
1068 *
1069 * @param[out] os Output stream.
1070 * @param[in] multiples Type to output.
1071 *
1072 * @return Modified output stream.
1073 */
1074inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1075{
1076 os << "(";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001077 for (size_t i = 0; i < multiples.size() - 1; i++)
giuros013175fcf2018-11-21 09:59:17 +00001078 {
1079 os << multiples[i] << ", ";
1080 }
1081 os << multiples.back() << ")";
1082 return os;
1083}
1084
Alex Gildayc357c472018-03-21 13:54:09 +00001085/** Formatted output of the InterpolationPolicy type.
1086 *
1087 * @param[out] os Output stream.
1088 * @param[in] policy Type to output.
1089 *
1090 * @return Modified output stream.
1091 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001092inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1093{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001094 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001095 {
1096 case InterpolationPolicy::NEAREST_NEIGHBOR:
1097 os << "NEAREST_NEIGHBOR";
1098 break;
1099 case InterpolationPolicy::BILINEAR:
1100 os << "BILINEAR";
1101 break;
1102 case InterpolationPolicy::AREA:
1103 os << "AREA";
1104 break;
1105 default:
1106 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1107 }
1108
1109 return os;
1110}
1111
Alex Gildayc357c472018-03-21 13:54:09 +00001112/** Formatted output of the SamplingPolicy type.
1113 *
1114 * @param[out] os Output stream.
1115 * @param[in] policy Type to output.
1116 *
1117 * @return Modified output stream.
1118 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001119inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1120{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001121 switch (policy)
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001122 {
1123 case SamplingPolicy::CENTER:
1124 os << "CENTER";
1125 break;
1126 case SamplingPolicy::TOP_LEFT:
1127 os << "TOP_LEFT";
1128 break;
1129 default:
1130 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1131 }
1132
1133 return os;
1134}
1135
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001136/** Formatted output of the ITensorInfo type.
1137 *
1138 * @param[out] os Output stream.
1139 * @param[in] info Tensor information.
1140 *
1141 * @return Modified output stream.
1142 */
1143inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1144{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001145 const DataType data_type = info->data_type();
1146 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001147
1148 os << "Shape=" << info->tensor_shape() << ","
1149 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001150 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001151
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001152 if (is_data_type_quantized(data_type))
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001153 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001154 const QuantizationInfo qinfo = info->quantization_info();
1155 const auto scales = qinfo.scale();
1156 const auto offsets = qinfo.offset();
1157
ramelg014a6d9e82021-10-02 14:34:36 +01001158 os << ", QuantizationInfo={"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001159 << "scales.size=" << scales.size() << ", scale(s)=" << scales << ", ";
ramelg01b1ba1e32021-09-25 11:53:26 +01001160
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001161 os << "offsets.size=" << offsets.size() << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001162 }
1163 return os;
1164}
1165
ramelg013ae3d882021-09-12 23:07:47 +01001166/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001167 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001168 * @param[out] os Output stream.
1169 * @param[in] info Type to output.
1170 *
1171 * @return Modified output stream.
1172 */
1173inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1174{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001175 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001176 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001177}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001178
ramelg013ae3d882021-09-12 23:07:47 +01001179/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001180 *
Alex Gildayc357c472018-03-21 13:54:09 +00001181 * @param[in] info Type to output.
1182 *
1183 * @return Formatted string.
1184 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001185inline std::string to_string(const TensorInfo &info)
1186{
1187 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001188 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001189 return str.str();
1190}
1191
ramelg013ae3d882021-09-12 23:07:47 +01001192/** Formatted output of the const ITensorInfo& type.
1193 *
1194 * @param[in] info Type to output.
1195 *
1196 * @return Formatted string.
1197 */
1198inline std::string to_string(const ITensorInfo &info)
1199{
1200 std::stringstream str;
1201 str << &info;
1202 return str.str();
1203}
1204
ramelg013ae3d882021-09-12 23:07:47 +01001205/** Formatted output of the const ITensorInfo* type.
1206 *
1207 * @param[in] info Type to output.
1208 *
1209 * @return Formatted string.
1210 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001211inline std::string to_string(const ITensorInfo *info)
1212{
ramelg013ae3d882021-09-12 23:07:47 +01001213 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001214 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001215 {
1216 std::stringstream str;
1217 str << info;
1218 ret_str = str.str();
1219 }
1220 return ret_str;
1221}
1222
ramelg01cbbb0382021-09-17 17:36:57 +01001223/** Formatted output of the ITensorInfo* type.
1224 *
1225 * @param[in] info Type to output.
1226 *
1227 * @return Formatted string.
1228 */
1229inline std::string to_string(ITensorInfo *info)
1230{
1231 return to_string(static_cast<const ITensorInfo *>(info));
1232}
1233
1234/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001235 *
1236 * @param[in] tensor Type to output.
1237 *
1238 * @return Formatted string.
1239 */
1240inline std::string to_string(const ITensor *tensor)
1241{
1242 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001243 if (tensor != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001244 {
1245 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001246 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001247 ret_str = str.str();
1248 }
1249 return ret_str;
1250}
1251
ramelg01cbbb0382021-09-17 17:36:57 +01001252/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001253 *
1254 * @param[in] tensor Type to output.
1255 *
1256 * @return Formatted string.
1257 */
1258inline std::string to_string(ITensor *tensor)
1259{
ramelg01cbbb0382021-09-17 17:36:57 +01001260 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001261}
1262
ramelg01cbbb0382021-09-17 17:36:57 +01001263/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001264 *
1265 * @param[in] tensor Type to output.
1266 *
1267 * @return Formatted string.
1268 */
1269inline std::string to_string(ITensor &tensor)
1270{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001271 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001272 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001273 return str.str();
1274}
1275
ramelg01cbbb0382021-09-17 17:36:57 +01001276#ifdef ARM_COMPUTE_OPENCL_ENABLED
1277/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1278 *
1279 * @param[in] cl_tensor Type to output.
1280 *
1281 * @return Formatted string.
1282 */
1283inline std::string to_string(const ICLTensor *cl_tensor)
1284{
1285 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001286 if (cl_tensor != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001287 {
1288 std::stringstream str;
1289 str << "ICLTensor->info(): " << cl_tensor->info();
1290 ret_str = str.str();
1291 }
1292 return ret_str;
1293}
1294
1295/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1296 *
1297 * @param[in] cl_tensor Type to output.
1298 *
1299 * @return Formatted string.
1300 */
1301inline std::string to_string(ICLTensor *cl_tensor)
1302{
1303 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1304}
SiCong Li47f177e2023-02-22 17:24:09 +00001305
1306/** Formatted output of the cl::NDRange type.
1307 *
1308 * @param[out] os Output stream.
1309 * @param[in] nd_range cl::NDRange to output.
1310 *
1311 * @return Modified output stream.
1312 */
1313inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1314{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001315 os << "{" << nd_range[0] << "," << nd_range[1] << "," << nd_range[2] << "}";
SiCong Li47f177e2023-02-22 17:24:09 +00001316 return os;
1317}
1318
1319/** Formatted output of the cl::NDRange type
1320 *
1321 * @param[in] nd_Range Type to output.
1322 *
1323 * @return Formatted string.
1324 */
1325inline std::string to_string(const cl::NDRange &nd_range)
1326{
1327 std::stringstream str;
1328 str << nd_range;
1329 return str.str();
1330}
ramelg01cbbb0382021-09-17 17:36:57 +01001331#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1332
Alex Gildayc357c472018-03-21 13:54:09 +00001333/** Formatted output of the Dimensions type.
1334 *
1335 * @param[in] dimensions Type to output.
1336 *
1337 * @return Formatted string.
1338 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001339template <typename T>
1340inline std::string to_string(const Dimensions<T> &dimensions)
1341{
1342 std::stringstream str;
1343 str << dimensions;
1344 return str.str();
1345}
1346
Alex Gildayc357c472018-03-21 13:54:09 +00001347/** Formatted output of the Strides type.
1348 *
1349 * @param[in] stride Type to output.
1350 *
1351 * @return Formatted string.
1352 */
John Richardsona36eae12017-09-26 16:55:59 +01001353inline std::string to_string(const Strides &stride)
1354{
1355 std::stringstream str;
1356 str << stride;
1357 return str.str();
1358}
1359
Alex Gildayc357c472018-03-21 13:54:09 +00001360/** Formatted output of the TensorShape type.
1361 *
1362 * @param[in] shape Type to output.
1363 *
1364 * @return Formatted string.
1365 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001366inline std::string to_string(const TensorShape &shape)
1367{
1368 std::stringstream str;
1369 str << shape;
1370 return str.str();
1371}
1372
Alex Gildayc357c472018-03-21 13:54:09 +00001373/** Formatted output of the Coordinates type.
1374 *
1375 * @param[in] coord Type to output.
1376 *
1377 * @return Formatted string.
1378 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001379inline std::string to_string(const Coordinates &coord)
1380{
1381 std::stringstream str;
1382 str << coord;
1383 return str.str();
1384}
1385
Anthony Barbierb940fd62018-06-04 14:14:32 +01001386/** Formatted output of the GEMMReshapeInfo type.
1387 *
1388 * @param[out] os Output stream.
1389 * @param[in] info Type to output.
1390 *
1391 * @return Modified output stream.
1392 */
1393inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1394{
1395 os << "{m=" << info.m() << ",";
1396 os << "n=" << info.n() << ",";
1397 os << "k=" << info.k() << ",";
1398 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1399 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1400 os << "}";
1401
1402 return os;
1403}
1404
1405/** Formatted output of the GEMMInfo type.
1406 *
1407 * @param[out] os Output stream.
1408 * @param[in] info Type to output.
1409 *
1410 * @return Modified output stream.
1411 */
1412inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1413{
1414 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1415 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1416 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001417 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1418 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1419 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1420 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1421 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001422 os << "pretranspose_B=" << info.pretranspose_B() << ",";
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01001423 os << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001424
1425 return os;
1426}
1427
1428/** Formatted output of the Window::Dimension type.
1429 *
1430 * @param[out] os Output stream.
1431 * @param[in] dim Type to output.
1432 *
1433 * @return Modified output stream.
1434 */
1435inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1436{
1437 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1438
1439 return os;
1440}
1441/** Formatted output of the Window type.
1442 *
1443 * @param[out] os Output stream.
1444 * @param[in] win Type to output.
1445 *
1446 * @return Modified output stream.
1447 */
1448inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1449{
1450 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001451 for (unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001452 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001453 if (i > 0)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001454 {
1455 os << ", ";
1456 }
1457 os << win[i];
1458 }
1459 os << "}";
1460
1461 return os;
1462}
1463
1464/** Formatted output of the WeightsInfo type.
1465 *
1466 * @param[in] info Type to output.
1467 *
1468 * @return Formatted string.
1469 */
1470inline std::string to_string(const WeightsInfo &info)
1471{
1472 std::stringstream str;
1473 str << info;
1474 return str.str();
1475}
1476
1477/** Formatted output of the GEMMReshapeInfo type.
1478 *
1479 * @param[in] info Type to output.
1480 *
1481 * @return Formatted string.
1482 */
1483inline std::string to_string(const GEMMReshapeInfo &info)
1484{
1485 std::stringstream str;
1486 str << info;
1487 return str.str();
1488}
1489
1490/** Formatted output of the GEMMInfo type.
1491 *
1492 * @param[in] info Type to output.
1493 *
1494 * @return Formatted string.
1495 */
1496inline std::string to_string(const GEMMInfo &info)
1497{
1498 std::stringstream str;
1499 str << info;
1500 return str.str();
1501}
1502
1503/** Formatted output of the Window::Dimension type.
1504 *
1505 * @param[in] dim Type to output.
1506 *
1507 * @return Formatted string.
1508 */
1509inline std::string to_string(const Window::Dimension &dim)
1510{
1511 std::stringstream str;
1512 str << dim;
1513 return str.str();
1514}
ramelg01cbbb0382021-09-17 17:36:57 +01001515/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001516 *
1517 * @param[in] win Type to output.
1518 *
1519 * @return Formatted string.
1520 */
1521inline std::string to_string(const Window &win)
1522{
1523 std::stringstream str;
1524 str << win;
1525 return str.str();
1526}
1527
ramelg01cbbb0382021-09-17 17:36:57 +01001528/** Formatted output of the Window* type.
1529 *
1530 * @param[in] win Type to output.
1531 *
1532 * @return Formatted string.
1533 */
1534inline std::string to_string(Window *win)
1535{
1536 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001537 if (win != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001538 {
1539 std::stringstream str;
1540 str << *win;
1541 ret_str = str.str();
1542 }
1543 return ret_str;
1544}
1545
Alex Gildayc357c472018-03-21 13:54:09 +00001546/** Formatted output of the Rectangle type.
1547 *
1548 * @param[out] os Output stream.
1549 * @param[in] rect Type to output.
1550 *
1551 * @return Modified output stream.
1552 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001553inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1554{
1555 os << rect.width << "x" << rect.height;
1556 os << "+" << rect.x << "+" << rect.y;
1557
1558 return os;
1559}
1560
Usama Arif8cf8c112019-03-14 15:36:54 +00001561/** Formatted output of the PaddingMode type.
1562 *
1563 * @param[out] os Output stream.
1564 * @param[in] mode Type to output.
1565 *
1566 * @return Modified output stream.
1567 */
1568inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1569{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001570 switch (mode)
Usama Arif8cf8c112019-03-14 15:36:54 +00001571 {
1572 case PaddingMode::CONSTANT:
1573 os << "CONSTANT";
1574 break;
1575 case PaddingMode::REFLECT:
1576 os << "REFLECT";
1577 break;
1578 case PaddingMode::SYMMETRIC:
1579 os << "SYMMETRIC";
1580 break;
1581 default:
1582 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1583 }
1584
1585 return os;
1586}
1587
1588/** Formatted output of the PaddingMode type.
1589 *
1590 * @param[in] mode Type to output.
1591 *
1592 * @return Formatted string.
1593 */
1594inline std::string to_string(const PaddingMode &mode)
1595{
1596 std::stringstream str;
1597 str << mode;
1598 return str.str();
1599}
1600
Alex Gildayc357c472018-03-21 13:54:09 +00001601/** Formatted output of the PadStrideInfo type.
1602 *
1603 * @param[out] os Output stream.
1604 * @param[in] pad_stride_info Type to output.
1605 *
1606 * @return Modified output stream.
1607 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001608inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1609{
1610 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1611 os << ";";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001612 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," << pad_stride_info.pad_top() << ","
1613 << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001614
1615 return os;
1616}
1617
Alex Gildayc357c472018-03-21 13:54:09 +00001618/** Formatted output of the PadStrideInfo type.
1619 *
1620 * @param[in] pad_stride_info Type to output.
1621 *
1622 * @return Formatted string.
1623 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001624inline std::string to_string(const PadStrideInfo &pad_stride_info)
1625{
1626 std::stringstream str;
1627 str << pad_stride_info;
1628 return str.str();
1629}
1630
Alex Gildayc357c472018-03-21 13:54:09 +00001631/** Formatted output of the BorderMode type.
1632 *
1633 * @param[in] mode Type to output.
1634 *
1635 * @return Formatted string.
1636 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001637inline std::string to_string(const BorderMode &mode)
1638{
1639 std::stringstream str;
1640 str << mode;
1641 return str.str();
1642}
1643
Alex Gildayc357c472018-03-21 13:54:09 +00001644/** Formatted output of the BorderSize type.
1645 *
1646 * @param[in] border Type to output.
1647 *
1648 * @return Formatted string.
1649 */
John Richardsonb482ce12017-09-18 12:44:01 +01001650inline std::string to_string(const BorderSize &border)
1651{
1652 std::stringstream str;
1653 str << border;
1654 return str.str();
1655}
1656
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001657/** Formatted output of the PaddingList type.
1658 *
1659 * @param[in] padding Type to output.
1660 *
1661 * @return Formatted string.
1662 */
1663inline std::string to_string(const PaddingList &padding)
1664{
1665 std::stringstream str;
1666 str << padding;
1667 return str.str();
1668}
1669
giuros013175fcf2018-11-21 09:59:17 +00001670/** Formatted output of the Multiples type.
1671 *
1672 * @param[in] multiples Type to output.
1673 *
1674 * @return Formatted string.
1675 */
1676inline std::string to_string(const Multiples &multiples)
1677{
1678 std::stringstream str;
1679 str << multiples;
1680 return str.str();
1681}
1682
Alex Gildayc357c472018-03-21 13:54:09 +00001683/** Formatted output of the InterpolationPolicy type.
1684 *
1685 * @param[in] policy Type to output.
1686 *
1687 * @return Formatted string.
1688 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001689inline std::string to_string(const InterpolationPolicy &policy)
1690{
1691 std::stringstream str;
1692 str << policy;
1693 return str.str();
1694}
1695
Alex Gildayc357c472018-03-21 13:54:09 +00001696/** Formatted output of the SamplingPolicy type.
1697 *
1698 * @param[in] policy Type to output.
1699 *
1700 * @return Formatted string.
1701 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001702inline std::string to_string(const SamplingPolicy &policy)
1703{
1704 std::stringstream str;
1705 str << policy;
1706 return str.str();
1707}
1708
Alex Gildayc357c472018-03-21 13:54:09 +00001709/** Formatted output of the ConvertPolicy type.
1710 *
1711 * @param[out] os Output stream.
1712 * @param[in] policy Type to output.
1713 *
1714 * @return Modified output stream.
1715 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001716inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1717{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001718 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001719 {
1720 case ConvertPolicy::WRAP:
1721 os << "WRAP";
1722 break;
1723 case ConvertPolicy::SATURATE:
1724 os << "SATURATE";
1725 break;
1726 default:
1727 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1728 }
1729
1730 return os;
1731}
1732
1733inline std::string to_string(const ConvertPolicy &policy)
1734{
1735 std::stringstream str;
1736 str << policy;
1737 return str.str();
1738}
1739
giuros01164a2722018-11-20 18:34:46 +00001740/** Formatted output of the ArithmeticOperation type.
1741 *
1742 * @param[out] os Output stream.
1743 * @param[in] op Operation to output.
1744 *
1745 * @return Modified output stream.
1746 */
1747inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1748{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001749 switch (op)
giuros01164a2722018-11-20 18:34:46 +00001750 {
1751 case ArithmeticOperation::ADD:
1752 os << "ADD";
1753 break;
1754 case ArithmeticOperation::SUB:
1755 os << "SUB";
1756 break;
1757 case ArithmeticOperation::DIV:
1758 os << "DIV";
1759 break;
1760 case ArithmeticOperation::MAX:
1761 os << "MAX";
1762 break;
1763 case ArithmeticOperation::MIN:
1764 os << "MIN";
1765 break;
1766 case ArithmeticOperation::SQUARED_DIFF:
1767 os << "SQUARED_DIFF";
1768 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001769 case ArithmeticOperation::POWER:
1770 os << "POWER";
1771 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001772 case ArithmeticOperation::PRELU:
1773 os << "PRELU";
1774 break;
giuros01164a2722018-11-20 18:34:46 +00001775 default:
1776 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1777 }
1778
1779 return os;
1780}
1781
1782/** Formatted output of the Arithmetic Operation
1783 *
1784 * @param[in] op Type to output.
1785 *
1786 * @return Formatted string.
1787 */
1788inline std::string to_string(const ArithmeticOperation &op)
1789{
1790 std::stringstream str;
1791 str << op;
1792 return str.str();
1793}
1794
Alex Gildayc357c472018-03-21 13:54:09 +00001795/** Formatted output of the Reduction Operations.
1796 *
1797 * @param[out] os Output stream.
1798 * @param[in] op Type to output.
1799 *
1800 * @return Modified output stream.
1801 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001802inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1803{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001804 switch (op)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001805 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001806 case ReductionOperation::SUM:
1807 os << "SUM";
1808 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001809 case ReductionOperation::SUM_SQUARE:
1810 os << "SUM_SQUARE";
1811 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001812 case ReductionOperation::MEAN_SUM:
1813 os << "MEAN_SUM";
1814 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001815 case ReductionOperation::ARG_IDX_MAX:
1816 os << "ARG_IDX_MAX";
1817 break;
1818 case ReductionOperation::ARG_IDX_MIN:
1819 os << "ARG_IDX_MIN";
1820 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001821 case ReductionOperation::PROD:
1822 os << "PROD";
1823 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001824 case ReductionOperation::MIN:
1825 os << "MIN";
1826 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001827 case ReductionOperation::MAX:
1828 os << "MAX";
1829 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001830 default:
1831 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1832 }
1833
1834 return os;
1835}
1836
Alex Gildayc357c472018-03-21 13:54:09 +00001837/** Formatted output of the Reduction Operations.
1838 *
1839 * @param[in] op Type to output.
1840 *
1841 * @return Formatted string.
1842 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001843inline std::string to_string(const ReductionOperation &op)
1844{
1845 std::stringstream str;
1846 str << op;
1847 return str.str();
1848}
1849
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001850/** Formatted output of the Comparison Operations.
1851 *
1852 * @param[out] os Output stream.
1853 * @param[in] op Type to output.
1854 *
1855 * @return Modified output stream.
1856 */
1857inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1858{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001859 switch (op)
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001860 {
1861 case ComparisonOperation::Equal:
1862 os << "Equal";
1863 break;
1864 case ComparisonOperation::NotEqual:
1865 os << "NotEqual";
1866 break;
1867 case ComparisonOperation::Greater:
1868 os << "Greater";
1869 break;
1870 case ComparisonOperation::GreaterEqual:
1871 os << "GreaterEqual";
1872 break;
1873 case ComparisonOperation::Less:
1874 os << "Less";
1875 break;
1876 case ComparisonOperation::LessEqual:
1877 os << "LessEqual";
1878 break;
1879 default:
1880 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1881 }
1882
1883 return os;
1884}
1885
Michalis Spyroue9362622018-11-23 17:41:37 +00001886/** Formatted output of the Elementwise unary Operations.
1887 *
1888 * @param[out] os Output stream.
1889 * @param[in] op Type to output.
1890 *
1891 * @return Modified output stream.
1892 */
1893inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1894{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001895 switch (op)
Michalis Spyroue9362622018-11-23 17:41:37 +00001896 {
1897 case ElementWiseUnary::RSQRT:
1898 os << "RSQRT";
1899 break;
1900 case ElementWiseUnary::EXP:
1901 os << "EXP";
1902 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001903 case ElementWiseUnary::NEG:
1904 os << "NEG";
1905 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01001906 case ElementWiseUnary::LOG:
1907 os << "LOG";
1908 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001909 case ElementWiseUnary::SIN:
1910 os << "SIN";
1911 break;
1912 case ElementWiseUnary::ABS:
1913 os << "ABS";
1914 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01001915 case ElementWiseUnary::ROUND:
1916 os << "ROUND";
1917 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001918 case ElementWiseUnary::LOGICAL_NOT:
1919 os << "LOGICAL_NOT";
1920 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00001921 default:
1922 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1923 }
1924
1925 return os;
1926}
1927
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001928/** Formatted output of the Comparison Operations.
1929 *
1930 * @param[in] op Type to output.
1931 *
1932 * @return Formatted string.
1933 */
1934inline std::string to_string(const ComparisonOperation &op)
1935{
1936 std::stringstream str;
1937 str << op;
1938 return str.str();
1939}
1940
Michalis Spyroue9362622018-11-23 17:41:37 +00001941/** Formatted output of the Elementwise unary Operations.
1942 *
1943 * @param[in] op Type to output.
1944 *
1945 * @return Formatted string.
1946 */
1947inline std::string to_string(const ElementWiseUnary &op)
1948{
1949 std::stringstream str;
1950 str << op;
1951 return str.str();
1952}
1953
Alex Gildayc357c472018-03-21 13:54:09 +00001954/** Formatted output of the Norm Type.
1955 *
1956 * @param[in] type Type to output.
1957 *
1958 * @return Formatted string.
1959 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001960inline std::string to_string(const NormType &type)
1961{
1962 std::stringstream str;
1963 str << type;
1964 return str.str();
1965}
1966
Alex Gildayc357c472018-03-21 13:54:09 +00001967/** Formatted output of the Pooling Type.
1968 *
1969 * @param[in] type Type to output.
1970 *
1971 * @return Formatted string.
1972 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001973inline std::string to_string(const PoolingType &type)
1974{
1975 std::stringstream str;
1976 str << type;
1977 return str.str();
1978}
1979
Alex Gildayc357c472018-03-21 13:54:09 +00001980/** Formatted output of the Pooling Layer Info.
1981 *
1982 * @param[in] info Type to output.
1983 *
1984 * @return Formatted string.
1985 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001986inline std::string to_string(const PoolingLayerInfo &info)
1987{
1988 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001989 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00001990 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001991 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001992 if (!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001993 {
1994 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001995 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
1996 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001997 }
1998 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001999 return str.str();
2000}
2001
ramelg0137515692022-02-26 22:06:20 +00002002/** Formatted output of the Size3D type.
2003 *
2004 * @param[out] os Output stream
2005 * @param[in] size Type to output
2006 *
2007 * @return Modified output stream.
2008 */
2009inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2010{
2011 os << size.width << "x" << size.height << "x" << size.depth;
2012
2013 return os;
2014}
2015
2016/** Formatted output of the Size3D type.
2017 *
2018 * @param[in] type Type to output
2019 *
2020 * @return Formatted string.
2021 */
2022inline std::string to_string(const Size3D &type)
2023{
2024 std::stringstream str;
2025 str << type;
2026 return str.str();
2027}
2028
2029/** Formatted output of the Padding3D type.
2030 *
2031 * @param[out] os Output stream.
2032 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2033 *
2034 * @return Modified output stream.
2035 */
2036inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2037{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002038 os << padding3d.left << "," << padding3d.right << "," << padding3d.top << "," << padding3d.bottom << ","
ramelg0137515692022-02-26 22:06:20 +00002039 << padding3d.front << "," << padding3d.back;
2040 return os;
2041}
2042
2043/** Converts a @ref Padding3D to string
2044 *
2045 * @param[in] padding3d Padding3D value to be converted
2046 *
2047 * @return String representing the corresponding Padding3D
2048 */
2049inline std::string to_string(const Padding3D &padding3d)
2050{
2051 std::stringstream str;
2052 str << padding3d;
2053 return str.str();
2054}
2055
2056/** Formatted output of the DimensionRoundingType type.
2057 *
2058 * @param[out] os Output stream.
2059 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2060 *
2061 * @return Modified output stream.
2062 */
2063inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2064{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002065 switch (rounding_type)
ramelg0137515692022-02-26 22:06:20 +00002066 {
2067 case DimensionRoundingType::CEIL:
2068 os << "CEIL";
2069 break;
2070 case DimensionRoundingType::FLOOR:
2071 os << "FLOOR";
2072 break;
2073 default:
2074 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2075 }
2076 return os;
2077}
2078
2079/** Formatted output of the Pooling 3d Layer Info.
2080 *
2081 * @param[out] os Output stream.
2082 * @param[in] info Pooling 3D layer info to print to output stream.
2083 *
2084 * @return Modified output stream.
2085 */
2086inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2087{
2088 os << "{Type=" << info.pool_type << ","
2089 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002090 if (!info.is_global_pooling)
ramelg0137515692022-02-26 22:06:20 +00002091 {
2092 os << ","
2093 << "PoolSize=" << info.pool_size << ", "
2094 << "Stride=" << info.stride << ", "
2095 << "Padding=" << info.padding << ", "
2096 << "Exclude Padding=" << info.exclude_padding << ", "
2097 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2098 << "DimensionRoundingType=" << info.round_type;
2099 }
2100 os << "}";
2101 return os;
2102}
2103
2104/** Formatted output of the Pooling 3d Layer Info.
2105 *
2106 * @param[in] info Type to output.
2107 *
2108 * @return Formatted string.
2109 */
2110inline std::string to_string(const Pooling3dLayerInfo &info)
2111{
2112 std::stringstream str;
2113 str << info;
2114 return str.str();
2115}
2116
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002117/** Formatted output of the PriorBoxLayerInfo.
2118 *
2119 * @param[in] info Type to output.
2120 *
2121 * @return Formatted string.
2122 */
2123inline std::string to_string(const PriorBoxLayerInfo &info)
2124{
2125 std::stringstream str;
2126 str << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002127 str << "Clip:" << info.clip() << "Flip:" << info.flip() << "StepX:" << info.steps()[0]
2128 << "StepY:" << info.steps()[1] << "MinSizes:" << info.min_sizes().size()
2129 << "MaxSizes:" << info.max_sizes().size() << "ImgSizeX:" << info.img_size().x
2130 << "ImgSizeY:" << info.img_size().y << "Offset:" << info.offset() << "Variances:" << info.variances().size();
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002131 str << "}";
2132 return str.str();
2133}
2134
Alex Gildayc357c472018-03-21 13:54:09 +00002135/** Formatted output of the Size2D type.
2136 *
2137 * @param[out] os Output stream
2138 * @param[in] size Type to output
2139 *
2140 * @return Modified output stream.
2141 */
John Richardson25f23682017-11-27 14:35:09 +00002142inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2143{
2144 os << size.width << "x" << size.height;
2145
2146 return os;
2147}
2148
Alex Gildayc357c472018-03-21 13:54:09 +00002149/** Formatted output of the Size2D type.
2150 *
2151 * @param[in] type Type to output
2152 *
2153 * @return Formatted string.
2154 */
John Richardson25f23682017-11-27 14:35:09 +00002155inline std::string to_string(const Size2D &type)
2156{
2157 std::stringstream str;
2158 str << type;
2159 return str.str();
2160}
2161
Alex Gildayc357c472018-03-21 13:54:09 +00002162/** Formatted output of the ConvolutionMethod type.
2163 *
2164 * @param[out] os Output stream
2165 * @param[in] conv_method Type to output
2166 *
2167 * @return Modified output stream.
2168 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002169inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2170{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002171 switch (conv_method)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002172 {
2173 case ConvolutionMethod::GEMM:
2174 os << "GEMM";
2175 break;
2176 case ConvolutionMethod::DIRECT:
2177 os << "DIRECT";
2178 break;
2179 case ConvolutionMethod::WINOGRAD:
2180 os << "WINOGRAD";
2181 break;
SiCongLid9287352021-11-03 19:01:22 +00002182 case ConvolutionMethod::FFT:
2183 os << "FFT";
2184 break;
2185 case ConvolutionMethod::GEMM_CONV2D:
2186 os << "GEMM_CONV2D";
2187 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002188 default:
2189 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2190 }
2191
2192 return os;
2193}
2194
Alex Gildayc357c472018-03-21 13:54:09 +00002195/** Formatted output of the ConvolutionMethod type.
2196 *
2197 * @param[in] conv_method Type to output
2198 *
2199 * @return Formatted string.
2200 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002201inline std::string to_string(const ConvolutionMethod &conv_method)
2202{
2203 std::stringstream str;
2204 str << conv_method;
2205 return str.str();
2206}
2207
Alex Gildayc357c472018-03-21 13:54:09 +00002208/** Formatted output of the GPUTarget type.
2209 *
2210 * @param[out] os Output stream
2211 * @param[in] gpu_target Type to output
2212 *
2213 * @return Modified output stream.
2214 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002215inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2216{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002217 switch (gpu_target)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002218 {
2219 case GPUTarget::GPU_ARCH_MASK:
2220 os << "GPU_ARCH_MASK";
2221 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002222 case GPUTarget::GPU_GENERATION_MASK:
2223 os << "GPU_GENERATION_MASK";
2224 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002225 case GPUTarget::MIDGARD:
2226 os << "MIDGARD";
2227 break;
2228 case GPUTarget::BIFROST:
2229 os << "BIFROST";
2230 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002231 case GPUTarget::VALHALL:
2232 os << "VALHALL";
2233 break;
Gunes Bayir85cafff2023-12-18 13:29:31 +00002234 case GPUTarget::FIFTHGEN:
2235 os << "FIFTHGEN";
2236 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002237 case GPUTarget::T600:
2238 os << "T600";
2239 break;
2240 case GPUTarget::T700:
2241 os << "T700";
2242 break;
2243 case GPUTarget::T800:
2244 os << "T800";
2245 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002246 case GPUTarget::G71:
2247 os << "G71";
2248 break;
2249 case GPUTarget::G72:
2250 os << "G72";
2251 break;
2252 case GPUTarget::G51:
2253 os << "G51";
2254 break;
2255 case GPUTarget::G51BIG:
2256 os << "G51BIG";
2257 break;
2258 case GPUTarget::G51LIT:
2259 os << "G51LIT";
2260 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002261 case GPUTarget::G31:
2262 os << "G31";
2263 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002264 case GPUTarget::G76:
2265 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002266 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002267 case GPUTarget::G52:
2268 os << "G52";
2269 break;
2270 case GPUTarget::G52LIT:
2271 os << "G52LIT";
2272 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002273 case GPUTarget::G77:
2274 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002275 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002276 case GPUTarget::G57:
2277 os << "G57";
2278 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002279 case GPUTarget::G78:
2280 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002281 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002282 case GPUTarget::G68:
2283 os << "G68";
2284 break;
2285 case GPUTarget::G78AE:
2286 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002287 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002288 case GPUTarget::G710:
2289 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002290 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002291 case GPUTarget::G610:
2292 os << "G610";
2293 break;
2294 case GPUTarget::G510:
2295 os << "G510";
2296 break;
2297 case GPUTarget::G310:
2298 os << "G310";
2299 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002300 case GPUTarget::G715:
2301 os << "G715";
2302 break;
2303 case GPUTarget::G615:
2304 os << "G615";
2305 break;
Gunes Bayir85cafff2023-12-18 13:29:31 +00002306 case GPUTarget::G720:
2307 os << "G720";
2308 break;
2309 case GPUTarget::G620:
2310 os << "G620";
2311 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002312 default:
2313 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2314 }
2315
2316 return os;
2317}
2318
Alex Gildayc357c472018-03-21 13:54:09 +00002319/** Formatted output of the GPUTarget type.
2320 *
2321 * @param[in] gpu_target Type to output
2322 *
2323 * @return Formatted string.
2324 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002325inline std::string to_string(const GPUTarget &gpu_target)
2326{
2327 std::stringstream str;
2328 str << gpu_target;
2329 return str.str();
2330}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002331
John Richardson8de92612018-02-22 14:09:31 +00002332/** Formatted output of the DetectionWindow type.
2333 *
2334 * @param[out] os Output stream
2335 * @param[in] detection_window Type to output
2336 *
2337 * @return Modified output stream.
2338 */
John Richardson684cb0f2018-01-09 11:17:00 +00002339inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2340{
2341 os << "{x=" << detection_window.x << ","
2342 << "y=" << detection_window.y << ","
2343 << "width=" << detection_window.width << ","
2344 << "height=" << detection_window.height << ","
2345 << "idx_class=" << detection_window.idx_class << ","
2346 << "score=" << detection_window.score << "}";
2347
2348 return os;
2349}
2350
Isabella Gottardi05e56442018-11-16 11:26:52 +00002351/** Formatted output of the DetectionOutputLayerCodeType type.
2352 *
2353 * @param[out] os Output stream
2354 * @param[in] detection_code Type to output
2355 *
2356 * @return Modified output stream.
2357 */
2358inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2359{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002360 switch (detection_code)
Isabella Gottardi05e56442018-11-16 11:26:52 +00002361 {
2362 case DetectionOutputLayerCodeType::CENTER_SIZE:
2363 os << "CENTER_SIZE";
2364 break;
2365 case DetectionOutputLayerCodeType::CORNER:
2366 os << "CORNER";
2367 break;
2368 case DetectionOutputLayerCodeType::CORNER_SIZE:
2369 os << "CORNER_SIZE";
2370 break;
2371 case DetectionOutputLayerCodeType::TF_CENTER:
2372 os << "TF_CENTER";
2373 break;
2374 default:
2375 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2376 }
2377
2378 return os;
2379}
2380/** Formatted output of the DetectionOutputLayerCodeType type.
2381 *
2382 * @param[in] detection_code Type to output
2383 *
2384 * @return Formatted string.
2385 */
2386inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2387{
2388 std::stringstream str;
2389 str << detection_code;
2390 return str.str();
2391}
2392
2393/** Formatted output of the DetectionOutputLayerInfo type.
2394 *
2395 * @param[out] os Output stream
2396 * @param[in] detection_info Type to output
2397 *
2398 * @return Modified output stream.
2399 */
2400inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2401{
2402 os << "{Classes=" << detection_info.num_classes() << ","
2403 << "ShareLocation=" << detection_info.share_location() << ","
2404 << "CodeType=" << detection_info.code_type() << ","
2405 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2406 << "KeepTopK=" << detection_info.keep_top_k() << ","
2407 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2408 << "Eta=" << detection_info.eta() << ","
2409 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2410 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2411 << "TopK=" << detection_info.top_k() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002412 << "NumLocClasses=" << detection_info.num_loc_classes() << "}";
Isabella Gottardi05e56442018-11-16 11:26:52 +00002413
2414 return os;
2415}
2416
2417/** Formatted output of the DetectionOutputLayerInfo type.
2418 *
2419 * @param[in] detection_info Type to output
2420 *
2421 * @return Formatted string.
2422 */
2423inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2424{
2425 std::stringstream str;
2426 str << detection_info;
2427 return str.str();
2428}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002429/** Formatted output of the DetectionPostProcessLayerInfo type.
2430 *
2431 * @param[out] os Output stream
2432 * @param[in] detection_info Type to output
2433 *
2434 * @return Modified output stream.
2435 */
2436inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2437{
2438 os << "{MaxDetections=" << detection_info.max_detections() << ","
2439 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2440 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2441 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2442 << "NumClasses=" << detection_info.num_classes() << ","
2443 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2444 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2445 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2446 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2447 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002448 << "DetectionPerClass=" << detection_info.detection_per_class() << "}";
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002449
2450 return os;
2451}
2452
2453/** Formatted output of the DetectionPostProcessLayerInfo type.
2454 *
2455 * @param[in] detection_info Type to output
2456 *
2457 * @return Formatted string.
2458 */
2459inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2460{
2461 std::stringstream str;
2462 str << detection_info;
2463 return str.str();
2464}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002465
John Richardson8de92612018-02-22 14:09:31 +00002466/** Formatted output of the DetectionWindow type.
2467 *
2468 * @param[in] detection_window Type to output
2469 *
2470 * @return Formatted string.
2471 */
2472inline std::string to_string(const DetectionWindow &detection_window)
2473{
2474 std::stringstream str;
2475 str << detection_window;
2476 return str.str();
2477}
2478
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002479/** Formatted output of @ref PriorBoxLayerInfo.
2480 *
2481 * @param[out] os Output stream.
2482 * @param[in] info Type to output.
2483 *
2484 * @return Modified output stream.
2485 */
2486inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2487{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002488 os << "Clip:" << info.clip() << "Flip:" << info.flip() << "StepX:" << info.steps()[0] << "StepY:" << info.steps()[1]
2489 << "MinSizes:" << info.min_sizes() << "MaxSizes:" << info.max_sizes() << "ImgSizeX:" << info.img_size().x
2490 << "ImgSizeY:" << info.img_size().y << "Offset:" << info.offset() << "Variances:" << info.variances();
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002491
2492 return os;
2493}
2494
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002495/** Formatted output of the WinogradInfo type. */
2496inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2497{
2498 os << "{OutputTileSize=" << info.output_tile_size << ","
2499 << "KernelSize=" << info.kernel_size << ","
2500 << "PadStride=" << info.convolution_info << ","
2501 << "OutputDataLayout=" << info.output_data_layout << "}";
2502
2503 return os;
2504}
2505
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002506inline std::string to_string(const WinogradInfo &type)
2507{
2508 std::stringstream str;
2509 str << type;
2510 return str.str();
2511}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002512
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002513/** Convert a CLTunerMode value to a string
2514 *
2515 * @param val CLTunerMode value to be converted
2516 *
2517 * @return String representing the corresponding CLTunerMode.
2518 */
2519inline std::string to_string(const CLTunerMode val)
2520{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002521 switch (val)
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002522 {
2523 case CLTunerMode::EXHAUSTIVE:
2524 {
2525 return std::string("Exhaustive");
2526 }
2527 case CLTunerMode::NORMAL:
2528 {
2529 return std::string("Normal");
2530 }
2531 case CLTunerMode::RAPID:
2532 {
2533 return std::string("Rapid");
2534 }
2535 default:
2536 {
2537 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2538 return std::string("UNDEFINED");
2539 }
2540 }
2541}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002542/** Converts a @ref CLGEMMKernelType to string
2543 *
2544 * @param[in] val CLGEMMKernelType value to be converted
2545 *
2546 * @return String representing the corresponding CLGEMMKernelType
2547 */
2548inline std::string to_string(CLGEMMKernelType val)
2549{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002550 switch (val)
SiCong Lidb4a6c12021-02-05 09:30:57 +00002551 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002552 case CLGEMMKernelType::NATIVE:
2553 {
2554 return "Native";
2555 }
2556 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2557 {
2558 return "Reshaped_Only_RHS";
2559 }
2560 case CLGEMMKernelType::RESHAPED:
2561 {
2562 return "Reshaped";
2563 }
2564 default:
2565 {
2566 return "Unknown";
2567 }
2568 }
2569}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002570/** [Print CLTunerMode type] **/
2571/** Formatted output of the CLTunerMode type.
2572 *
2573 * @param[out] os Output stream.
2574 * @param[in] val CLTunerMode to output.
2575 *
2576 * @return Modified output stream.
2577 */
2578inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2579{
2580 os << to_string(val);
2581 return os;
2582}
2583
ramelg013ae3d882021-09-12 23:07:47 +01002584/** Formatted output of the ConvolutionInfo type.
2585 *
2586 * @param[out] os Output stream.
2587 * @param[in] conv_info ConvolutionInfo to output.
2588 *
2589 * @return Modified output stream.
2590 */
2591inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2592{
SiCongLi579ca842021-10-18 09:38:33 +01002593 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2594 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2595 << "act_info=" << to_string(conv_info.act_info) << ", "
2596 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002597 return os;
2598}
2599
2600/** Converts a @ref ConvolutionInfo to string
2601 *
2602 * @param[in] info ConvolutionInfo value to be converted
2603 *
2604 * @return String representing the corresponding ConvolutionInfo
2605 */
2606inline std::string to_string(const ConvolutionInfo &info)
2607{
2608 std::stringstream str;
2609 str << info;
2610 return str.str();
2611}
2612
2613/** Formatted output of the FullyConnectedLayerInfo type.
2614 *
2615 * @param[out] os Output stream.
2616 * @param[in] layer_info FullyConnectedLayerInfo to output.
2617 *
2618 * @return Modified output stream.
2619 */
2620inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2621{
SiCongLi579ca842021-10-18 09:38:33 +01002622 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2623 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2624 << "transpose_weights=" << layer_info.transpose_weights << ", "
2625 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2626 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
SiCongLi579ca842021-10-18 09:38:33 +01002627 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002628 return os;
2629}
2630
2631/** Converts a @ref FullyConnectedLayerInfo to string
2632 *
2633 * @param[in] info FullyConnectedLayerInfo value to be converted
2634 *
2635 * @return String representing the corresponding FullyConnectedLayerInfo
2636 */
2637inline std::string to_string(const FullyConnectedLayerInfo &info)
2638{
2639 std::stringstream str;
2640 str << info;
2641 return str.str();
2642}
2643
2644/** Formatted output of the GEMMLowpOutputStageType type.
2645 *
2646 * @param[out] os Output stream.
2647 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2648 *
2649 * @return Modified output stream.
2650 */
2651inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2652{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002653 switch (gemm_type)
ramelg013ae3d882021-09-12 23:07:47 +01002654 {
2655 case GEMMLowpOutputStageType::NONE:
2656 os << "NONE";
2657 break;
2658 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2659 os << "QUANTIZE_DOWN";
2660 break;
2661 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2662 os << "QUANTIZE_DOWN_FIXEDPOINT";
2663 break;
2664 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2665 os << "QUANTIZE_DOWN_FLOAT";
2666 break;
2667 default:
2668 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2669 }
2670 return os;
2671}
2672
2673/** Converts a @ref GEMMLowpOutputStageType to string
2674 *
2675 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2676 *
2677 * @return String representing the corresponding GEMMLowpOutputStageType
2678 */
2679inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2680{
2681 std::stringstream str;
2682 str << gemm_type;
2683 return str.str();
2684}
2685
2686/** Formatted output of the GEMMLowpOutputStageInfo type.
2687 *
2688 * @param[out] os Output stream.
2689 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2690 *
2691 * @return Modified output stream.
2692 */
2693inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2694{
SiCongLi579ca842021-10-18 09:38:33 +01002695 os << "{type=" << gemm_info.type << ", "
2696 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2697 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2698 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2699 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2700 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2701 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2702 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2703 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2704 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2705 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002706 return os;
2707}
2708
2709/** Converts a @ref GEMMLowpOutputStageInfo to string
2710 *
2711 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2712 *
2713 * @return String representing the corresponding GEMMLowpOutputStageInfo
2714 */
2715inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2716{
2717 std::stringstream str;
2718 str << gemm_info;
2719 return str.str();
2720}
2721
2722/** Formatted output of the Conv2dInfo type.
2723 *
2724 * @param[out] os Output stream.
2725 * @param[in] conv_info Conv2dInfo to output.
2726 *
2727 * @return Modified output stream.
2728 */
2729inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2730{
SiCongLi579ca842021-10-18 09:38:33 +01002731 os << "{conv_info=" << conv_info.conv_info << ", "
2732 << "dilation=" << conv_info.dilation << ", "
2733 << "act_info=" << to_string(conv_info.act_info) << ", "
2734 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2735 << "num_groups=" << conv_info.num_groups << ","
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01002736 << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002737 return os;
2738}
2739
2740/** Converts a @ref Conv2dInfo to string
2741 *
2742 * @param[in] conv_info Conv2dInfo value to be converted
2743 *
2744 * @return String representing the corresponding Conv2dInfo
2745 */
2746inline std::string to_string(const Conv2dInfo &conv_info)
2747{
2748 std::stringstream str;
2749 str << conv_info;
2750 return str.str();
2751}
2752
2753/** Formatted output of the PixelValue type.
2754 *
2755 * @param[out] os Output stream.
2756 * @param[in] pixel_value PixelValue to output.
2757 *
2758 * @return Modified output stream.
2759 */
2760inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2761{
SiCongLi579ca842021-10-18 09:38:33 +01002762 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002763 return os;
2764}
2765
2766/** Converts a @ref PixelValue to string
2767 *
2768 * @param[in] pixel_value PixelValue value to be converted
2769 *
2770 * @return String representing the corresponding PixelValue
2771 */
2772inline std::string to_string(const PixelValue &pixel_value)
2773{
2774 std::stringstream str;
2775 str << pixel_value;
2776 return str.str();
2777}
2778
2779/** Formatted output of the ScaleKernelInfo type.
2780 *
2781 * @param[out] os Output stream.
2782 * @param[in] scale_info ScaleKernelInfo to output.
2783 *
2784 * @return Modified output stream.
2785 */
2786inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2787{
SiCongLi579ca842021-10-18 09:38:33 +01002788 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2789 << "BorderMode=" << scale_info.border_mode << ", "
2790 << "PixelValue=" << scale_info.constant_border_value << ", "
2791 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2792 << "use_padding=" << scale_info.use_padding << ", "
2793 << "align_corners=" << scale_info.align_corners << ", "
2794 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002795 return os;
2796}
2797
2798/** Converts a @ref ScaleKernelInfo to string
2799 *
2800 * @param[in] scale_info ScaleKernelInfo value to be converted
2801 *
2802 * @return String representing the corresponding ScaleKernelInfo
2803 */
2804inline std::string to_string(const ScaleKernelInfo &scale_info)
2805{
2806 std::stringstream str;
2807 str << scale_info;
2808 return str.str();
2809}
2810
2811/** Formatted output of the FFTDirection type.
2812 *
2813 * @param[out] os Output stream.
2814 * @param[in] fft_dir FFTDirection to output.
2815 *
2816 * @return Modified output stream.
2817 */
2818inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2819{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002820 switch (fft_dir)
ramelg013ae3d882021-09-12 23:07:47 +01002821 {
2822 case FFTDirection::Forward:
2823 os << "Forward";
2824 break;
2825 case FFTDirection::Inverse:
2826 os << "Inverse";
2827 break;
2828 default:
2829 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2830 }
2831 return os;
2832}
2833
2834/** Converts a @ref FFT1DInfo to string
2835 *
2836 * @param[in] fft_dir FFT1DInfo value to be converted
2837 *
2838 * @return String representing the corresponding FFT1DInfo
2839 */
2840inline std::string to_string(const FFTDirection &fft_dir)
2841{
2842 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002843 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002844 return str.str();
2845}
2846
2847/** Formatted output of the FFT1DInfo type.
2848 *
2849 * @param[out] os Output stream.
2850 * @param[in] fft1d_info FFT1DInfo to output.
2851 *
2852 * @return Modified output stream.
2853 */
2854inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2855{
SiCongLi579ca842021-10-18 09:38:33 +01002856 os << "{axis=" << fft1d_info.axis << ", "
2857 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002858 return os;
2859}
2860
2861/** Converts a @ref FFT1DInfo to string
2862 *
2863 * @param[in] fft1d_info FFT1DInfo value to be converted
2864 *
2865 * @return String representing the corresponding FFT1DInfo
2866 */
2867inline std::string to_string(const FFT1DInfo &fft1d_info)
2868{
2869 std::stringstream str;
2870 str << fft1d_info;
2871 return str.str();
2872}
2873
2874/** Formatted output of the FFT2DInfo type.
2875 *
2876 * @param[out] os Output stream.
2877 * @param[in] fft2d_info FFT2DInfo to output.
2878 *
2879 * @return Modified output stream.
2880 */
2881inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2882{
SiCongLi579ca842021-10-18 09:38:33 +01002883 os << "{axis=" << fft2d_info.axis0 << ", "
2884 << "axis=" << fft2d_info.axis1 << ", "
2885 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002886 return os;
2887}
2888
2889/** Converts a @ref FFT2DInfo to string
2890 *
2891 * @param[in] fft2d_info FFT2DInfo value to be converted
2892 *
2893 * @return String representing the corresponding FFT2DInfo
2894 */
2895inline std::string to_string(const FFT2DInfo &fft2d_info)
2896{
2897 std::stringstream str;
2898 str << fft2d_info;
2899 return str.str();
2900}
2901
2902/** Formatted output of the Coordinates2D type.
2903 *
2904 * @param[out] os Output stream.
2905 * @param[in] coord_2d Coordinates2D to output.
2906 *
2907 * @return Modified output stream.
2908 */
2909inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2910{
SiCongLi579ca842021-10-18 09:38:33 +01002911 os << "{x=" << coord_2d.x << ", "
2912 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002913 return os;
2914}
2915
2916/** Converts a @ref Coordinates2D to string
2917 *
2918 * @param[in] coord_2d Coordinates2D value to be converted
2919 *
2920 * @return String representing the corresponding Coordinates2D
2921 */
2922inline std::string to_string(const Coordinates2D &coord_2d)
2923{
2924 std::stringstream str;
2925 str << coord_2d;
2926 return str.str();
2927}
2928
2929/** Formatted output of the FuseBatchNormalizationType type.
2930 *
2931 * @param[out] os Output stream.
2932 * @param[in] fuse_type FuseBatchNormalizationType to output.
2933 *
2934 * @return Modified output stream.
2935 */
2936inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2937{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002938 switch (fuse_type)
ramelg013ae3d882021-09-12 23:07:47 +01002939 {
2940 case FuseBatchNormalizationType::CONVOLUTION:
2941 os << "CONVOLUTION";
2942 break;
2943 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
2944 os << "DEPTHWISECONVOLUTION";
2945 break;
2946 default:
2947 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2948 }
2949 return os;
2950}
2951
2952/** Converts a @ref FuseBatchNormalizationType to string
2953 *
2954 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
2955 *
2956 * @return String representing the corresponding FuseBatchNormalizationType
2957 */
2958inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
2959{
2960 std::stringstream str;
2961 str << fuse_type;
2962 return str.str();
2963}
2964
ramelg01cbbb0382021-09-17 17:36:57 +01002965/** Formatted output of the SoftmaxKernelInfo type.
2966 *
2967 * @param[out] os Output stream.
2968 * @param[in] info SoftmaxKernelInfo to output.
2969 *
2970 * @return Modified output stream.
2971 */
2972inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
2973{
SiCongLi579ca842021-10-18 09:38:33 +01002974 os << "{beta=" << info.beta << ", "
2975 << "is_log=" << info.is_log << ", "
2976 << "input_data_type=" << info.input_data_type << ", "
2977 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01002978 return os;
2979}
2980
2981/** Converts a @ref SoftmaxKernelInfo to string
2982 *
2983 * @param[in] info SoftmaxKernelInfo value to be converted
2984 *
2985 * @return String representing the corresponding SoftmaxKernelInfo
2986 */
2987inline std::string to_string(const SoftmaxKernelInfo &info)
2988{
2989 std::stringstream str;
2990 str << info;
2991 return str.str();
2992}
2993
2994/** Formatted output of the ScaleKernelInfo type.
2995 *
2996 * @param[out] os Output stream.
2997 * @param[in] lstm_params LSTMParams to output.
2998 *
2999 * @return Modified output stream.
3000 */
3001template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003002::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003003{
ramelg014a6d9e82021-10-02 14:34:36 +01003004 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3005 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3006 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3007 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3008 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3009 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3010 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3011 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3012 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3013 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3014 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3015 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003016 << "cell_clip=" << lstm_params.cell_clip() << ", "
3017 << "projection_clip=" << lstm_params.projection_clip() << ", "
3018 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3019 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3020 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3021 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3022 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3023 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3024 << "has_projection=" << lstm_params.has_projection() << ", "
3025 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3026 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3027 return os;
3028}
3029
3030/** Converts a @ref LSTMParams to string
3031 *
3032 * @param[in] lstm_params LSTMParams<T> value to be converted
3033 *
3034 * @return String representing the corresponding LSTMParams
3035 */
3036template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003037std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003038{
3039 std::stringstream str;
3040 str << lstm_params;
3041 return str.str();
3042}
3043
3044/** Converts a @ref LSTMParams to string
3045 *
3046 * @param[in] num uint8_t value to be converted
3047 *
3048 * @return String representing the corresponding uint8_t
3049 */
3050inline std::string to_string(const uint8_t num)
3051{
3052 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3053 return ::std::to_string(static_cast<int>(num));
3054}
3055
ramelg014a6d9e82021-10-02 14:34:36 +01003056/** Available non maxima suppression types */
3057/** Formatted output of the NMSType type.
3058 *
3059 * @param[out] os Output stream.
3060 * @param[in] nms_type NMSType to output.
3061 *
3062 * @return Modified output stream.
3063 */
3064inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3065{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003066 switch (nms_type)
ramelg014a6d9e82021-10-02 14:34:36 +01003067 {
3068 case NMSType::LINEAR:
3069 os << "LINEAR";
3070 break;
3071 case NMSType::GAUSSIAN:
3072 os << "GAUSSIAN";
3073 break;
3074 case NMSType::ORIGINAL:
3075 os << "ORIGINAL";
3076 break;
3077 default:
3078 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3079 }
3080 return os;
3081}
3082
3083/** Converts a @ref NMSType to string
3084 *
3085 * @param[in] nms_type NMSType value to be converted
3086 *
3087 * @return String representing the corresponding NMSType
3088 */
3089inline std::string to_string(const NMSType nms_type)
3090{
3091 std::stringstream str;
3092 str << nms_type;
3093 return str.str();
3094}
3095
3096/** Formatted output of the BoxNMSLimitInfo type.
3097 *
3098 * @param[out] os Output stream.
3099 * @param[in] info BoxNMSLimitInfo to output.
3100 *
3101 * @return Modified output stream.
3102 */
3103inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3104{
SiCongLi579ca842021-10-18 09:38:33 +01003105 os << "{score_thresh=" << info.score_thresh() << ", "
3106 << "nms=" << info.nms() << ", "
3107 << "detections_per_im=" << info.detections_per_im() << ", "
3108 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3109 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3110 << "suppress_size=" << info.suppress_size() << ", "
3111 << "min_size=" << info.min_size() << ", "
3112 << "im_width=" << info.im_width() << ", "
3113 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003114 return os;
3115}
3116
3117/** Converts a @ref BoxNMSLimitInfo to string
3118 *
3119 * @param[in] info BoxNMSLimitInfo value to be converted
3120 *
3121 * @return String representing the corresponding BoxNMSLimitInfo
3122 */
3123inline std::string to_string(const BoxNMSLimitInfo &info)
3124{
3125 std::stringstream str;
3126 str << info;
3127 return str.str();
3128}
3129
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003130/** Converts a @ref DimensionRoundingType to string
3131 *
3132 * @param[in] rounding_type DimensionRoundingType value to be converted
3133 *
3134 * @return String representing the corresponding DimensionRoundingType
3135 */
3136inline std::string to_string(const DimensionRoundingType &rounding_type)
3137{
3138 std::stringstream str;
3139 str << rounding_type;
3140 return str.str();
3141}
3142
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003143/** Formatted output of the Conv3dInfo type.
3144 *
3145 * @param[out] os Output stream.
3146 * @param[in] conv3d_info Type to output.
3147 *
3148 * @return Modified output stream.
3149 */
3150inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3151{
3152 os << conv3d_info.stride;
3153 os << ";";
3154 os << conv3d_info.padding;
3155 os << ";";
3156 os << to_string(conv3d_info.act_info);
3157 os << ";";
3158 os << conv3d_info.dilation;
3159 os << ";";
3160 os << conv3d_info.round_type;
3161 os << ";";
3162 os << conv3d_info.enable_fast_math;
3163
3164 return os;
3165}
3166
3167/** Formatted output of the Conv3dInfo type.
3168 *
3169 * @param[in] conv3d_info Type to output.
3170 *
3171 * @return Formatted string.
3172 */
3173inline std::string to_string(const Conv3dInfo &conv3d_info)
3174{
3175 std::stringstream str;
3176 str << conv3d_info;
3177 return str.str();
3178}
3179
Ramy Elgammal91780022022-07-20 14:57:37 +01003180/** Formatted output of the arm_compute::WeightFormat type.
3181 *
3182 * @param[in] wf arm_compute::WeightFormat Type to output.
3183 *
3184 * @return Formatted string.
3185 */
3186inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003187{
Ramy Elgammal91780022022-07-20 14:57:37 +01003188#define __CASE_WEIGHT_FORMAT(wf) \
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003189 case WeightFormat::wf: \
3190 return #wf;
3191 switch (wf)
Ramy Elgammal91780022022-07-20 14:57:37 +01003192 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003193 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3194 __CASE_WEIGHT_FORMAT(ANY)
3195 __CASE_WEIGHT_FORMAT(OHWI)
3196 __CASE_WEIGHT_FORMAT(OHWIo2)
3197 __CASE_WEIGHT_FORMAT(OHWIo4)
3198 __CASE_WEIGHT_FORMAT(OHWIo8)
3199 __CASE_WEIGHT_FORMAT(OHWIo16)
3200 __CASE_WEIGHT_FORMAT(OHWIo32)
3201 __CASE_WEIGHT_FORMAT(OHWIo64)
3202 __CASE_WEIGHT_FORMAT(OHWIo128)
3203 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3204 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3205 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3206 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3207 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3208 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3209 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3210 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3211 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3212 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3213 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3214 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3215 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3216 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3217 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3218 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3219 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3220 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3221 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3222 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3223 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3224 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3225 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3226 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3227 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3228 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003229 default:
3230 return "invalid value";
3231 }
3232#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003233}
3234
Ramy Elgammal91780022022-07-20 14:57:37 +01003235/** Formatted output of the arm_compute::WeightFormat type.
3236 *
3237 * @param[out] os Output stream.
3238 * @param[in] wf WeightFormat to output.
3239 *
3240 * @return Modified output stream.
3241 */
3242inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3243{
3244 os << to_string(wf);
3245 return os;
3246}
3247
3248/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3249 *
3250 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3251 *
3252 * @return Formatted string.
3253 */
3254inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003255{
3256 std::stringstream str;
3257 str << "[Input shape = " << std::get<0>(values);
3258 str << ", ";
3259 str << "Expected output shape = " << std::get<1>(values);
3260
3261 str << ", ";
3262 str << "WeightFormat = " << std::get<2>(values) << "]";
3263 return str.str();
3264}
3265
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003266/** Formatted output of the Padding2D type.
3267 *
3268 * @param[out] os Output stream.
3269 * @param[in] padding2d Padding info for 2D dimension shape.
3270 *
3271 * @return Modified output stream.
3272 */
3273inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3274{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003275 os << padding2d.left << "," << padding2d.right << "," << padding2d.top << "," << padding2d.bottom;
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003276 return os;
3277}
3278
3279/** Converts a @ref Padding2D to string
3280 *
3281 * @param[in] padding2d Padding2D value to be converted
3282 *
3283 * @return String representing the corresponding Padding2D
3284 */
3285inline std::string to_string(const Padding2D &padding2d)
3286{
3287 std::stringstream str;
3288 str << padding2d;
3289 return str.str();
3290}
3291
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003292/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3293 *
3294 * @param[out] os Output stream.
3295 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3296 *
3297 * @return Modified output stream.
3298 */
3299inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3300{
3301 os << "Pool2dAttributes="
3302 << "["
3303 << "PoolingType=" << pool2d_attr.pool_type() << ","
3304 << "PoolSize=" << pool2d_attr.pool_size() << ","
3305 << "Padding=" << pool2d_attr.pad() << ","
3306 << "Stride=" << pool2d_attr.stride() << ","
3307 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3308
3309 return os;
3310}
3311
3312/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3313 *
3314 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3315 *
3316 * @return Formatted string.
3317 */
3318inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3319{
3320 std::stringstream str;
3321 str << pool2d_attr;
3322 return str.str();
3323}
3324
3325/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3326 *
3327 * @param[out] os Output stream
3328 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3329 */
3330inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3331{
3332 os << "Settings="
3333 << "["
Gunes Bayir2b9fa592024-01-17 16:07:03 +00003334 << "UseInfAsLimit=" << settings.use_inf_as_limit() << "]";
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003335 return os;
3336}
3337
3338/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3339 *
3340 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3341 *
3342 * @return Formatted string.
3343 */
3344inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3345{
3346 std::stringstream str;
3347 str << settings;
3348 return str.str();
3349}
3350
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003351/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3352 *
3353 * @param[out] os Output stream.
3354 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3355 *
3356 * @return Modified output stream.
3357 */
3358inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3359{
3360 os << "Conv2dAttributes="
3361 << "["
3362 << "Padding=" << conv2d_attr.pad() << ", "
3363 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003364 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003365
3366 return os;
3367}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003368
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003369/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3370 *
3371 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3372 *
3373 * @return Formatted string.
3374 */
3375inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3376{
3377 std::stringstream str;
3378 str << conv2d_attr;
3379 return str.str();
3380}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003381
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003382/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3383 *
3384 * @param[out] os Output stream.
3385 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3386 *
3387 * @return Modified output stream.
3388 */
3389inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3390{
3391 os << "CastAttributes="
3392 << "["
3393 << "Data Type=" << cast_attr.data_type() << ", "
3394 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3395
3396 return os;
3397}
3398/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3399 *
3400 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3401 *
3402 * @return Formatted string.
3403 */
3404inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3405{
3406 std::stringstream str;
3407 str << cast_attr;
3408 return str.str();
3409}
3410
Gunes Bayir7dc02342022-11-21 21:46:50 +00003411/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3412 *
3413 * @param[out] os Output stream.
3414 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3415 *
3416 * @return Modified output stream.
3417 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003418inline ::std::ostream &operator<<(::std::ostream &os,
3419 const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
Gunes Bayir7dc02342022-11-21 21:46:50 +00003420{
3421 os << "DepthwiseConv2dAttributes="
3422 << "["
3423 << "Padding=" << dw_conv2d_attr.pad() << ", "
3424 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3425 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3426 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3427 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3428
3429 return os;
3430}
3431/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3432 *
3433 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3434 *
3435 * @return Formatted string.
3436 */
3437inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3438{
3439 std::stringstream str;
3440 str << dw_conv2d_attr;
3441 return str.str();
3442}
3443
Jakub Sujak32741722022-11-25 16:43:18 +00003444/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3445 *
3446 * @param[out] os Output stream.
3447 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3448 *
3449 * @return Modified output stream.
3450 */
3451inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3452{
3453 os << "ClampAttributes="
3454 << "["
3455 << "Min value=" << clamp_attr.min_val() << ", "
3456 << "Max value=" << clamp_attr.max_val() << "]";
3457 return os;
3458}
3459/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3460 *
3461 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3462 *
3463 * @return Formatted string.
3464 */
3465inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3466{
3467 std::stringstream str;
3468 str << clamp_attr;
3469 return str.str();
3470}
3471
Jakub Sujak8ae57142022-12-02 16:09:06 +00003472/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3473 *
3474 * @param[out] os Output stream.
3475 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3476 *
3477 * @return Modified output stream.
3478 */
3479inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3480{
3481 os << "ResizeAttributes="
3482 << "["
3483 << "AlignCorners=" << resize_attr.align_corners() << ", "
3484 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3485 << "OutputHeight=" << resize_attr.output_height() << ", "
3486 << "OutputWidth=" << resize_attr.output_width() << ", "
3487 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3488 return os;
3489}
3490
3491/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3492 *
3493 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3494 *
3495 * @return Formatted string.
3496 */
3497inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3498{
3499 std::stringstream str;
3500 str << resize_attr;
3501 return str.str();
3502}
3503
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003504/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3505 *
3506 * @param[out] os Output stream.
3507 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3508 *
3509 * @return Modified output stream.
3510 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003511inline ::std::ostream &operator<<(::std::ostream &os,
3512 const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003513{
Jakub Sujak7359a872023-01-05 14:24:13 +00003514 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003515 << "["
3516 << "Beta=" << softmax_attr.beta() << ", "
3517 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3518 << "Axis=" << softmax_attr.axis() << "]";
3519 return os;
3520}
3521/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3522 *
3523 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3524 *
3525 * @return Formatted string.
3526 */
3527inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3528{
3529 std::stringstream str;
3530 str << softmax_attr;
3531 return str.str();
3532}
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003533/** Formatted output of the arm_compute::MatMulInfo type.
3534 *
3535 * @param[out] os Output stream.
3536 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3537 *
3538 * @return Modified output stream.
3539 */
3540inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulInfo &matmul_info)
3541{
3542 os << "MatMulKernelInfo="
3543 << "["
3544 << "adj_lhs=" << matmul_info.adj_lhs() << ", "
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +01003545 << "adj_rhs=" << matmul_info.adj_rhs() << "] ";
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003546 return os;
3547}
3548/** Formatted output of the arm_compute::MatMulInfo type.
3549 *
3550 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3551 *
3552 * @return Formatted string.
3553 */
3554inline std::string to_string(const arm_compute::MatMulInfo &matmul_info)
3555{
3556 std::stringstream str;
3557 str << matmul_info;
3558 return str.str();
3559}
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003560
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003561/** Formatted output of the arm_compute::MatMulKernelInfo type.
3562 *
3563 * @param[out] os Output stream.
3564 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3565 *
3566 * @return Modified output stream.
3567 */
3568inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulKernelInfo &matmul_info)
3569{
3570 os << "MatMulKernelInfo="
3571 << "["
3572 << "adj_lhs=" << matmul_info.adj_lhs << ", "
3573 << "adj_rhs=" << matmul_info.adj_rhs << ", "
3574 << "M0=" << matmul_info.m0 << ", "
3575 << "N0=" << matmul_info.n0 << ", "
3576 << "K0=" << matmul_info.k0 << ", "
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003577 << "export_rhs_to_cl_image=" << matmul_info.export_rhs_to_cl_image << "]";
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003578
3579 return os;
3580}
3581/** Formatted output of the arm_compute::MatMulKernelInfo type.
3582 *
3583 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3584 *
3585 * @return Formatted string.
3586 */
3587inline std::string to_string(const arm_compute::MatMulKernelInfo &matmul_info)
3588{
3589 std::stringstream str;
3590 str << matmul_info;
3591 return str.str();
3592}
3593
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003594/** Formatted output of the arm_compute::CpuMatMulSettings type.
3595 *
3596 * @param[out] os Output stream.
3597 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3598 *
3599 * @return Modified output stream.
3600 */
3601inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::CpuMatMulSettings &settings)
3602{
3603 os << "CpuMatMulSettings="
3604 << "["
Renato Arantes36a75da2024-01-26 17:31:18 +00003605 << "fast_math=" << settings.fast_math() << ",fixed_format=" << settings.fixed_format() << "]";
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003606
3607 return os;
3608}
3609/** Formatted output of the arm_compute::CpuMatMulSettings type.
3610 *
3611 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3612 *
3613 * @return Formatted string.
3614 */
3615inline std::string to_string(const arm_compute::CpuMatMulSettings &settings)
3616{
3617 std::stringstream str;
3618 str << settings;
3619 return str.str();
3620}
3621
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +00003622/** Formatted output of the scatter function type.
3623 *
3624 * @param[out] os Output stream.
3625 * @param[in] function arm_compute::ScatterFunction type to output.
3626 *
3627 * @return Modified output stream.
3628 */
3629inline ::std::ostream &operator<<(::std::ostream &os, const ScatterFunction &function)
3630{
3631 switch (function)
3632 {
3633 case ScatterFunction::Update:
3634 os << "UPDATE";
3635 break;
3636 case ScatterFunction::Add:
3637 os << "ADD";
3638 break;
3639 case ScatterFunction::Sub:
3640 os << "SUB";
3641 break;
3642 case ScatterFunction::Max:
3643 os << "MAX";
3644 break;
3645 case ScatterFunction::Min:
3646 os << "MIN";
3647 break;
3648 default:
3649 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3650 }
3651 return os;
3652}
3653/** Formatted output of the arm_compute::ScatterFunction type.
3654 *
3655 * @param[in] func arm_compute::ScatterFunction type to output.
3656 *
3657 * @return Formatted string.
3658 */
3659inline std::string to_string(const arm_compute::ScatterFunction &func)
3660{
3661 std::stringstream str;
3662 str << func;
3663 return str.str();
3664}
3665/** Formatted output of the arm_compute::ScatterInfo type.
3666 *
3667 * @param[out] os Output stream.
3668 * @param[in] info arm_compute::ScatterInfo type to output.
3669 *
3670 * @return Modified output stream.
3671 */
3672inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::ScatterInfo &info)
3673{
3674 os << "ScatterInfo="
3675 << "["
3676 << "Function=" << info.func << ", "
3677 << "InitialiseZero=" << info.zero_initialization << "] ";
3678 return os;
3679}
3680/** Formatted output of the arm_compute::ScatterInfo type.
3681 *
3682 * @param[in] info arm_compute::ScatterInfo type to output.
3683 *
3684 * @return Formatted string.
3685 */
3686inline std::string to_string(const arm_compute::ScatterInfo &info)
3687{
3688 std::stringstream str;
3689 str << info;
3690 return str.str();
3691}
3692
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003693} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003694
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01003695#endif // ACL_UTILS_TYPEPRINTER_H