blob: e8831a354ce3748de58c3ed1628efb9642feae27 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Pablo Marquez Tello6bcdc572023-01-11 09:54:00 +00002 * Copyright (c) 2017-2023 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Jakub Sujak0d27b2e2023-08-24 14:01:20 +010024
25#ifndef ACL_UTILS_TYPEPRINTER_H
26#define ACL_UTILS_TYPEPRINTER_H
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027
ramelg01cbbb0382021-09-17 17:36:57 +010028#ifdef ARM_COMPUTE_OPENCL_ENABLED
29#include "arm_compute/core/CL/ICLTensor.h"
30#endif /* ARM_COMPUTE_OPENCL_ENABLED */
31
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032#include "arm_compute/core/Dimensions.h"
33#include "arm_compute/core/Error.h"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010034#include "arm_compute/core/GPUTarget.h"
morgolockaba2f912020-05-05 16:28:19 +010035#include "arm_compute/core/KernelDescriptors.h"
John Richardson25f23682017-11-27 14:35:09 +000036#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010037#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000038#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010039#include "arm_compute/core/Types.h"
Gunes Bayir1dc6ff12022-12-06 20:48:31 +000040#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
Jakub Sujak32741722022-11-25 16:43:18 +000041#include "arm_compute/dynamic_fusion/sketch/attributes/ClampAttributes.h"
SiCong Li5a63d1e2023-01-06 16:28:57 +000042#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000043#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000044#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
Jakub Sujak8ae57142022-12-02 16:09:06 +000045#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Gunes Bayiraecb5d92022-12-18 21:31:29 +000046#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000047#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
SiCong Li91295492023-07-21 18:16:13 +010048#include "arm_compute/function_info/ConvolutionInfo.h"
49#include "arm_compute/function_info/FullyConnectedLayerInfo.h"
50#include "arm_compute/function_info/GEMMInfo.h"
51#include "arm_compute/function_info/MatMulInfo.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010052#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000053#include "arm_compute/runtime/CL/CLTypes.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010054#include "arm_compute/runtime/common/LSTMParams.h"
ramelg013ae3d882021-09-12 23:07:47 +010055#include "arm_compute/runtime/FunctionDescriptors.h"
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +000056#include "arm_compute/runtime/NEON/functions/NEMatMul.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010057
SiCongLi31778612021-11-12 17:33:45 +000058#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000059#include "support/StringSupport.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010060
Anthony Barbier6ff3b192017-09-04 18:44:23 +010061#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010062#include <sstream>
63#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010064
65namespace arm_compute
66{
Anthony Barbierb940fd62018-06-04 14:14:32 +010067/** Formatted output if arg is not null
68 *
69 * @param[in] arg Object to print
70 *
71 * @return String representing arg.
72 */
73template <typename T>
74std::string to_string_if_not_null(T *arg)
75{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010076 if (arg == nullptr)
Anthony Barbierb940fd62018-06-04 14:14:32 +010077 {
78 return "nullptr";
79 }
80 else
81 {
82 return to_string(*arg);
83 }
84}
Anthony Barbierb4670212018-05-18 16:55:39 +010085
ramelg014a6d9e82021-10-02 14:34:36 +010086/** Fallback method: try to use std::to_string:
87 *
88 * @param[in] val Value to convert to string
89 *
90 * @return String representing val.
91 */
92template <typename T>
93inline std::string to_string(const T &val)
94{
95 return support::cpp11::to_string(val);
96}
97
ramelg01b1ba1e32021-09-25 11:53:26 +010098/** Formatted output of a vector of objects.
99 *
ramelg014a6d9e82021-10-02 14:34:36 +0100100 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
101 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
102 *
ramelg01b1ba1e32021-09-25 11:53:26 +0100103 * @param[out] os Output stream
104 * @param[in] args Vector of objects to print
105 *
106 * @return Modified output stream.
107 */
108template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100109::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100110{
111 const size_t max_print_size = 5U;
112
113 os << "[";
114 bool first = true;
115 size_t i;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100116 for (i = 0; i < args.size(); ++i)
ramelg01b1ba1e32021-09-25 11:53:26 +0100117 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100118 if (i == max_print_size)
ramelg01b1ba1e32021-09-25 11:53:26 +0100119 {
120 break;
121 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100122 if (first)
ramelg01b1ba1e32021-09-25 11:53:26 +0100123 {
124 first = false;
125 }
126 else
127 {
128 os << ", ";
129 }
ramelg014a6d9e82021-10-02 14:34:36 +0100130 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100131 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100132 if (i < args.size())
ramelg01b1ba1e32021-09-25 11:53:26 +0100133 {
134 os << ", ...";
135 }
136 os << "]";
137 return os;
138}
139
ramelg014a6d9e82021-10-02 14:34:36 +0100140/** Formatted output of a vector of objects.
141 *
142 * @param[in] args Vector of objects to print
143 *
144 * @return String representing args.
145 */
146template <typename T>
147std::string to_string(const std::vector<T> &args)
148{
149 std::stringstream str;
150 str << args;
151 return str.str();
152}
153
Alex Gildayc357c472018-03-21 13:54:09 +0000154/** Formatted output of the Dimensions type.
155 *
156 * @param[out] os Output stream.
157 * @param[in] dimensions Type to output.
158 *
159 * @return Modified output stream.
160 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100161template <typename T>
162inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
163{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100164 if (dimensions.num_dimensions() > 0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100165 {
166 os << dimensions[0];
167
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100168 for (unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100169 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100170 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100171 }
172 }
173
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100174 return os;
175}
176
Alex Gildayc357c472018-03-21 13:54:09 +0000177/** Formatted output of the RoundingPolicy type.
178 *
179 * @param[out] os Output stream.
180 * @param[in] rounding_policy Type to output.
181 *
182 * @return Modified output stream.
183 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100184inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100185{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100186 switch (rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100187 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100188 case RoundingPolicy::TO_ZERO:
189 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100190 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100191 case RoundingPolicy::TO_NEAREST_UP:
192 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100193 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100194 case RoundingPolicy::TO_NEAREST_EVEN:
195 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196 break;
197 default:
198 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
199 }
200
201 return os;
202}
203
Alex Gildayc357c472018-03-21 13:54:09 +0000204/** Formatted output of the WeightsInfo type.
205 *
206 * @param[out] os Output stream.
207 * @param[in] weights_info Type to output.
208 *
209 * @return Modified output stream.
210 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100211inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100212{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100213 os << weights_info.are_reshaped() << ";";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100214 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << ","
215 << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100216
217 return os;
218}
219
Alex Gildayc357c472018-03-21 13:54:09 +0000220/** Formatted output of the ROIPoolingInfo type.
221 *
222 * @param[out] os Output stream.
223 * @param[in] pool_info Type to output.
224 *
225 * @return Modified output stream.
226 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100227inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100228{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100229 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100230 return os;
231}
232
giuros0118870812018-09-13 09:31:40 +0100233/** Formatted output of the ROIPoolingInfo type.
234 *
235 * @param[in] pool_info Type to output.
236 *
237 * @return Formatted string.
238 */
239inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
240{
241 std::stringstream str;
242 str << pool_info;
243 return str.str();
244}
245
morgolockaba2f912020-05-05 16:28:19 +0100246/** Formatted output of the GEMMKernelInfo type.
247 *
248 * @param[out] os Output stream.
249 * @param[in] gemm_info Type to output.
250 *
251 * @return Modified output stream.
252 */
253inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
254{
SiCongLi579ca842021-10-18 09:38:33 +0100255 os << "( m=" << gemm_info.m;
256 os << " n=" << gemm_info.n;
257 os << " k=" << gemm_info.k;
258 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
259 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
260 os << " broadcast_bias=" << gemm_info.broadcast_bias;
261 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
262 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
263 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
264 os << " a_offset=" << gemm_info.a_offset;
265 os << " b_offset=" << gemm_info.b_offset;
morgolockaba2f912020-05-05 16:28:19 +0100266 os << ")";
267 return os;
268}
269
270/** Formatted output of the GEMMLHSMatrixInfo type.
271 *
272 * @param[out] os Output stream.
273 * @param[in] gemm_info Type to output.
274 *
275 * @return Modified output stream.
276 */
277inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
278{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100279 os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0
280 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
morgolockaba2f912020-05-05 16:28:19 +0100281 return os;
282}
283
284/** Formatted output of the GEMMRHSMatrixInfo type.
285 *
286 * @param[out] os Output stream.
287 * @param[in] gemm_info Type to output.
288 *
289 * @return Modified output stream.
290 */
291inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
292{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100293 os << "( n0=" << (unsigned int)gemm_info.n0 << " k0=" << gemm_info.k0 << " h0=" << gemm_info.h0
294 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave
295 << " exp_img=" << gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100296 return os;
297}
298
299/** Formatted output of the GEMMRHSMatrixInfo type.
300 *
301 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
302 *
303 * @return Formatted string.
304 */
305inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
306{
307 std::stringstream str;
308 str << gemm_info;
309 return str.str();
310}
311
312/** Formatted output of the GEMMLHSMatrixInfo type.
313 *
314 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
315 *
316 * @return Formatted string.
317 */
318inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
319{
320 std::stringstream str;
321 str << gemm_info;
322 return str.str();
323}
324
325/** Formatted output of the GEMMKernelInfo type.
326 *
327 * @param[in] gemm_info GEMMKernelInfo Type to output.
328 *
329 * @return Formatted string.
330 */
331inline std::string to_string(const GEMMKernelInfo &gemm_info)
332{
333 std::stringstream str;
334 str << gemm_info;
335 return str.str();
336}
337
giuros01c04a0e82018-10-03 12:44:35 +0100338/** Formatted output of the BoundingBoxTransformInfo type.
339 *
340 * @param[out] os Output stream.
341 * @param[in] bbox_info Type to output.
342 *
343 * @return Modified output stream.
344 */
345inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
346{
347 auto weights = bbox_info.weights();
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100348 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={"
349 << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << "})";
giuros01c04a0e82018-10-03 12:44:35 +0100350 return os;
351}
352
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100353#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100354inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100355{
Matthew Benthamf66a7e82023-06-15 14:55:35 +0000356 return os << float(v);
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100357}
Ramy Elgammal91780022022-07-20 14:57:37 +0100358#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100359
giuros01c04a0e82018-10-03 12:44:35 +0100360/** Formatted output of the BoundingBoxTransformInfo type.
361 *
362 * @param[in] bbox_info Type to output.
363 *
364 * @return Formatted string.
365 */
366inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
367{
368 std::stringstream str;
369 str << bbox_info;
370 return str.str();
371}
372
Manuel Bottini5209be52019-02-13 16:34:56 +0000373/** Formatted output of the ComputeAnchorsInfo type.
374 *
375 * @param[out] os Output stream.
376 * @param[in] anchors_info Type to output.
377 *
378 * @return Modified output stream.
379 */
380inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
381{
382 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
383 return os;
384}
385
386/** Formatted output of the ComputeAnchorsInfo type.
387 *
388 * @param[in] anchors_info Type to output.
389 *
390 * @return Formatted string.
391 */
392inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
393{
394 std::stringstream str;
395 str << anchors_info;
396 return str.str();
397}
398
399/** Formatted output of the GenerateProposalsInfo type.
400 *
401 * @param[out] os Output stream.
402 * @param[in] proposals_info Type to output.
403 *
404 * @return Modified output stream.
405 */
406inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
407{
408 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
409 return os;
410}
411
412/** Formatted output of the GenerateProposalsInfo type.
413 *
414 * @param[in] proposals_info Type to output.
415 *
416 * @return Formatted string.
417 */
418inline std::string to_string(const GenerateProposalsInfo &proposals_info)
419{
420 std::stringstream str;
421 str << proposals_info;
422 return str.str();
423}
424
Alex Gildayc357c472018-03-21 13:54:09 +0000425/** Formatted output of the QuantizationInfo type.
426 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100427 * @param[out] os Output stream.
428 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000429 *
430 * @return Modified output stream.
431 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100432inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700433{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100434 const UniformQuantizationInfo uqinfo = qinfo.uniform();
435 os << "Scale:" << uqinfo.scale << "~";
436 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700437 return os;
438}
439
Alex Gildayc357c472018-03-21 13:54:09 +0000440/** Formatted output of the QuantizationInfo type.
441 *
442 * @param[in] quantization_info Type to output.
443 *
444 * @return Formatted string.
445 */
Chunosovd621bca2017-11-03 17:33:15 +0700446inline std::string to_string(const QuantizationInfo &quantization_info)
447{
448 std::stringstream str;
449 str << quantization_info;
450 return str.str();
451}
452
Alex Gildayc357c472018-03-21 13:54:09 +0000453/** Formatted output of the activation function type.
454 *
455 * @param[out] os Output stream.
456 * @param[in] act_function Type to output.
457 *
458 * @return Modified output stream.
459 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100460inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
461{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100462 switch (act_function)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100463 {
464 case ActivationLayerInfo::ActivationFunction::ABS:
465 os << "ABS";
466 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100467 case ActivationLayerInfo::ActivationFunction::LINEAR:
468 os << "LINEAR";
469 break;
470 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
471 os << "LOGISTIC";
472 break;
473 case ActivationLayerInfo::ActivationFunction::RELU:
474 os << "RELU";
475 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100476 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
477 os << "BOUNDED_RELU";
478 break;
479 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
480 os << "LEAKY_RELU";
481 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100482 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
483 os << "SOFT_RELU";
484 break;
485 case ActivationLayerInfo::ActivationFunction::SQRT:
486 os << "SQRT";
487 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100488 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
489 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000490 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100491 case ActivationLayerInfo::ActivationFunction::ELU:
492 os << "ELU";
493 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100494 case ActivationLayerInfo::ActivationFunction::SQUARE:
495 os << "SQUARE";
496 break;
497 case ActivationLayerInfo::ActivationFunction::TANH:
498 os << "TANH";
499 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100500 case ActivationLayerInfo::ActivationFunction::IDENTITY:
501 os << "IDENTITY";
502 break;
morgolock07df3d42020-02-27 11:46:28 +0000503 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
504 os << "HARD_SWISH";
505 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100506 case ActivationLayerInfo::ActivationFunction::SWISH:
507 os << "SWISH";
508 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400509 case ActivationLayerInfo::ActivationFunction::GELU:
510 os << "GELU";
511 break;
morgolock07df3d42020-02-27 11:46:28 +0000512
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100513 default:
514 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
515 }
516
517 return os;
518}
519
Alex Gildayc357c472018-03-21 13:54:09 +0000520/** Formatted output of the activation function info type.
521 *
SiCongLi1af54162021-10-06 15:25:57 +0100522 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000523 *
524 * @return Formatted string.
525 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100526inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100527{
528 std::stringstream str;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100529 if (info.enabled())
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000530 {
531 str << info.activation();
532 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100533 return str.str();
534}
535
SiCongLi1af54162021-10-06 15:25:57 +0100536/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100537 *
SiCongLi1af54162021-10-06 15:25:57 +0100538 * @param[out] os Output stream.
539 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100540 *
541 * @return Formatted string.
542 */
SiCongLi1af54162021-10-06 15:25:57 +0100543inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100544{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100545 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +0100546 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100547 if (info->enabled())
ramelg013ae3d882021-09-12 23:07:47 +0100548 {
SiCongLi1af54162021-10-06 15:25:57 +0100549 os << info->activation();
550 os << "(";
551 os << "VAL_A=" << info->a() << ",";
552 os << "VAL_B=" << info->b();
553 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100554 }
SiCongLi1af54162021-10-06 15:25:57 +0100555 else
556 {
557 os << "disabled";
558 }
ramelg013ae3d882021-09-12 23:07:47 +0100559 }
SiCongLi1af54162021-10-06 15:25:57 +0100560 else
561 {
562 os << "nullptr";
563 }
564 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100565}
566
Alex Gildayc357c472018-03-21 13:54:09 +0000567/** Formatted output of the activation function type.
568 *
569 * @param[in] function Type to output.
570 *
571 * @return Formatted string.
572 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100573inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
574{
575 std::stringstream str;
576 str << function;
577 return str.str();
578}
579
Alex Gildayc357c472018-03-21 13:54:09 +0000580/** Formatted output of the NormType type.
581 *
582 * @param[out] os Output stream.
583 * @param[in] norm_type Type to output.
584 *
585 * @return Modified output stream.
586 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100587inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
588{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100589 switch (norm_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100590 {
591 case NormType::CROSS_MAP:
592 os << "CROSS_MAP";
593 break;
594 case NormType::IN_MAP_1D:
595 os << "IN_MAP_1D";
596 break;
597 case NormType::IN_MAP_2D:
598 os << "IN_MAP_2D";
599 break;
600 default:
601 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
602 }
603
604 return os;
605}
606
Alex Gildayc357c472018-03-21 13:54:09 +0000607/** Formatted output of @ref NormalizationLayerInfo.
608 *
609 * @param[in] info Type to output.
610 *
611 * @return Formatted string.
612 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100613inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100614{
615 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000616 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100617 return str.str();
618}
619
Alex Gildayc357c472018-03-21 13:54:09 +0000620/** Formatted output of @ref NormalizationLayerInfo.
621 *
622 * @param[out] os Output stream.
623 * @param[in] info Type to output.
624 *
625 * @return Modified output stream.
626 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100627inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
628{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000629 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100630 return os;
631}
632
Alex Gildayc357c472018-03-21 13:54:09 +0000633/** Formatted output of the PoolingType type.
634 *
635 * @param[out] os Output stream.
636 * @param[in] pool_type Type to output.
637 *
638 * @return Modified output stream.
639 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100640inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
641{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100642 switch (pool_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100643 {
644 case PoolingType::AVG:
645 os << "AVG";
646 break;
647 case PoolingType::MAX:
648 os << "MAX";
649 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100650 case PoolingType::L2:
651 os << "L2";
652 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100653 default:
654 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
655 }
656
657 return os;
658}
659
Alex Gildayc357c472018-03-21 13:54:09 +0000660/** Formatted output of @ref PoolingLayerInfo.
661 *
662 * @param[out] os Output stream.
663 * @param[in] info Type to output.
664 *
665 * @return Modified output stream.
666 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100667inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
668{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000669 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100670
671 return os;
672}
673
Alex Gildayc357c472018-03-21 13:54:09 +0000674/** Formatted output of @ref RoundingPolicy.
675 *
676 * @param[in] rounding_policy Type to output.
677 *
678 * @return Formatted string.
679 */
John Richardsondd715f22017-09-18 16:10:48 +0100680inline std::string to_string(const RoundingPolicy &rounding_policy)
681{
682 std::stringstream str;
683 str << rounding_policy;
684 return str.str();
685}
686
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000687/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000688/** Formatted output of the DataLayout type.
689 *
690 * @param[out] os Output stream.
691 * @param[in] data_layout Type to output.
692 *
693 * @return Modified output stream.
694 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000695inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
696{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100697 switch (data_layout)
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000698 {
699 case DataLayout::UNKNOWN:
700 os << "UNKNOWN";
701 break;
702 case DataLayout::NHWC:
703 os << "NHWC";
704 break;
705 case DataLayout::NCHW:
706 os << "NCHW";
707 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100708 case DataLayout::NDHWC:
709 os << "NDHWC";
710 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100711 case DataLayout::NCDHW:
712 os << "NCDHW";
713 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000714 default:
715 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
716 }
717
718 return os;
719}
720
Alex Gildayc357c472018-03-21 13:54:09 +0000721/** Formatted output of the DataLayout type.
722 *
723 * @param[in] data_layout Type to output.
724 *
725 * @return Formatted string.
726 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000727inline std::string to_string(const arm_compute::DataLayout &data_layout)
728{
729 std::stringstream str;
730 str << data_layout;
731 return str.str();
732}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000733/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000734
Georgios Pinitase2220552018-07-20 13:23:44 +0100735/** Formatted output of the DataLayoutDimension type.
736 *
737 * @param[out] os Output stream.
738 * @param[in] data_layout_dim Data layout dimension to print.
739 *
740 * @return Modified output stream.
741 */
742inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
743{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100744 switch (data_layout_dim)
Georgios Pinitase2220552018-07-20 13:23:44 +0100745 {
746 case DataLayoutDimension::WIDTH:
747 os << "WIDTH";
748 break;
749 case DataLayoutDimension::HEIGHT:
750 os << "HEIGHT";
751 break;
752 case DataLayoutDimension::CHANNEL:
753 os << "CHANNEL";
754 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100755 case DataLayoutDimension::DEPTH:
756 os << "DEPTH";
757 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100758 case DataLayoutDimension::BATCHES:
759 os << "BATCHES";
760 break;
761 default:
762 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
763 }
764 return os;
765}
766
Alex Gildayc357c472018-03-21 13:54:09 +0000767/** Formatted output of the DataType type.
768 *
769 * @param[out] os Output stream.
770 * @param[in] data_type Type to output.
771 *
772 * @return Modified output stream.
773 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100774inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
775{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100776 switch (data_type)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100777 {
778 case DataType::UNKNOWN:
779 os << "UNKNOWN";
780 break;
781 case DataType::U8:
782 os << "U8";
783 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100784 case DataType::QSYMM8:
785 os << "QSYMM8";
786 break;
Chunosovd621bca2017-11-03 17:33:15 +0700787 case DataType::QASYMM8:
788 os << "QASYMM8";
789 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000790 case DataType::QASYMM8_SIGNED:
791 os << "QASYMM8_SIGNED";
792 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100793 case DataType::QSYMM8_PER_CHANNEL:
794 os << "QSYMM8_PER_CHANNEL";
795 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100796 case DataType::S8:
797 os << "S8";
798 break;
799 case DataType::U16:
800 os << "U16";
801 break;
802 case DataType::S16:
803 os << "S16";
804 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100805 case DataType::QSYMM16:
806 os << "QSYMM16";
807 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100808 case DataType::QASYMM16:
809 os << "QASYMM16";
810 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100811 case DataType::U32:
812 os << "U32";
813 break;
814 case DataType::S32:
815 os << "S32";
816 break;
817 case DataType::U64:
818 os << "U64";
819 break;
820 case DataType::S64:
821 os << "S64";
822 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000823 case DataType::BFLOAT16:
824 os << "BFLOAT16";
825 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100826 case DataType::F16:
827 os << "F16";
828 break;
829 case DataType::F32:
830 os << "F32";
831 break;
832 case DataType::F64:
833 os << "F64";
834 break;
835 case DataType::SIZET:
836 os << "SIZET";
837 break;
838 default:
839 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
840 }
841
842 return os;
843}
844
Alex Gildayc357c472018-03-21 13:54:09 +0000845/** Formatted output of the DataType type.
846 *
847 * @param[in] data_type Type to output.
848 *
849 * @return Formatted string.
850 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100851inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100852{
853 std::stringstream str;
854 str << data_type;
855 return str.str();
856}
857
Alex Gildayc357c472018-03-21 13:54:09 +0000858/** Formatted output of the Format type.
859 *
860 * @param[out] os Output stream.
861 * @param[in] format Type to output.
862 *
863 * @return Modified output stream.
864 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100865inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
866{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100867 switch (format)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100868 {
869 case Format::UNKNOWN:
870 os << "UNKNOWN";
871 break;
872 case Format::U8:
873 os << "U8";
874 break;
875 case Format::S16:
876 os << "S16";
877 break;
878 case Format::U16:
879 os << "U16";
880 break;
881 case Format::S32:
882 os << "S32";
883 break;
884 case Format::U32:
885 os << "U32";
886 break;
887 case Format::F16:
888 os << "F16";
889 break;
890 case Format::F32:
891 os << "F32";
892 break;
893 case Format::UV88:
894 os << "UV88";
895 break;
896 case Format::RGB888:
897 os << "RGB888";
898 break;
899 case Format::RGBA8888:
900 os << "RGBA8888";
901 break;
902 case Format::YUV444:
903 os << "YUV444";
904 break;
905 case Format::YUYV422:
906 os << "YUYV422";
907 break;
908 case Format::NV12:
909 os << "NV12";
910 break;
911 case Format::NV21:
912 os << "NV21";
913 break;
914 case Format::IYUV:
915 os << "IYUV";
916 break;
917 case Format::UYVY422:
918 os << "UYVY422";
919 break;
920 default:
921 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
922 }
923
924 return os;
925}
926
Alex Gildayc357c472018-03-21 13:54:09 +0000927/** Formatted output of the Format type.
928 *
929 * @param[in] format Type to output.
930 *
931 * @return Formatted string.
932 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100933inline std::string to_string(const Format &format)
934{
935 std::stringstream str;
936 str << format;
937 return str.str();
938}
939
Alex Gildayc357c472018-03-21 13:54:09 +0000940/** Formatted output of the Channel type.
941 *
942 * @param[out] os Output stream.
943 * @param[in] channel Type to output.
944 *
945 * @return Modified output stream.
946 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100947inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
948{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100949 switch (channel)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100950 {
951 case Channel::UNKNOWN:
952 os << "UNKNOWN";
953 break;
954 case Channel::C0:
955 os << "C0";
956 break;
957 case Channel::C1:
958 os << "C1";
959 break;
960 case Channel::C2:
961 os << "C2";
962 break;
963 case Channel::C3:
964 os << "C3";
965 break;
966 case Channel::R:
967 os << "R";
968 break;
969 case Channel::G:
970 os << "G";
971 break;
972 case Channel::B:
973 os << "B";
974 break;
975 case Channel::A:
976 os << "A";
977 break;
978 case Channel::Y:
979 os << "Y";
980 break;
981 case Channel::U:
982 os << "U";
983 break;
984 case Channel::V:
985 os << "V";
986 break;
987 default:
988 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
989 }
990
991 return os;
992}
993
Alex Gildayc357c472018-03-21 13:54:09 +0000994/** Formatted output of the Channel type.
995 *
996 * @param[in] channel Type to output.
997 *
998 * @return Formatted string.
999 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001000inline std::string to_string(const Channel &channel)
1001{
1002 std::stringstream str;
1003 str << channel;
1004 return str.str();
1005}
1006
Alex Gildayc357c472018-03-21 13:54:09 +00001007/** Formatted output of the BorderMode type.
1008 *
1009 * @param[out] os Output stream.
1010 * @param[in] mode Type to output.
1011 *
1012 * @return Modified output stream.
1013 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001014inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1015{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001016 switch (mode)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001017 {
1018 case BorderMode::UNDEFINED:
1019 os << "UNDEFINED";
1020 break;
1021 case BorderMode::CONSTANT:
1022 os << "CONSTANT";
1023 break;
1024 case BorderMode::REPLICATE:
1025 os << "REPLICATE";
1026 break;
1027 default:
1028 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1029 }
1030
1031 return os;
1032}
1033
Alex Gildayc357c472018-03-21 13:54:09 +00001034/** Formatted output of the BorderSize type.
1035 *
1036 * @param[out] os Output stream.
1037 * @param[in] border Type to output.
1038 *
1039 * @return Modified output stream.
1040 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001041inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1042{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001043 os << border.top << "," << border.right << "," << border.bottom << "," << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001044
1045 return os;
1046}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001047
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001048/** Formatted output of the PaddingList type.
1049 *
1050 * @param[out] os Output stream.
1051 * @param[in] padding Type to output.
1052 *
1053 * @return Modified output stream.
1054 */
1055inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1056{
1057 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001058 for (auto const &p : padding)
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001059 {
1060 os << "{" << p.first << "," << p.second << "}";
1061 }
1062 os << "}";
1063 return os;
1064}
1065
giuros013175fcf2018-11-21 09:59:17 +00001066/** Formatted output of the Multiples type.
1067 *
1068 * @param[out] os Output stream.
1069 * @param[in] multiples Type to output.
1070 *
1071 * @return Modified output stream.
1072 */
1073inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1074{
1075 os << "(";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001076 for (size_t i = 0; i < multiples.size() - 1; i++)
giuros013175fcf2018-11-21 09:59:17 +00001077 {
1078 os << multiples[i] << ", ";
1079 }
1080 os << multiples.back() << ")";
1081 return os;
1082}
1083
Alex Gildayc357c472018-03-21 13:54:09 +00001084/** Formatted output of the InterpolationPolicy type.
1085 *
1086 * @param[out] os Output stream.
1087 * @param[in] policy Type to output.
1088 *
1089 * @return Modified output stream.
1090 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001091inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1092{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001093 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001094 {
1095 case InterpolationPolicy::NEAREST_NEIGHBOR:
1096 os << "NEAREST_NEIGHBOR";
1097 break;
1098 case InterpolationPolicy::BILINEAR:
1099 os << "BILINEAR";
1100 break;
1101 case InterpolationPolicy::AREA:
1102 os << "AREA";
1103 break;
1104 default:
1105 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1106 }
1107
1108 return os;
1109}
1110
Alex Gildayc357c472018-03-21 13:54:09 +00001111/** Formatted output of the SamplingPolicy type.
1112 *
1113 * @param[out] os Output stream.
1114 * @param[in] policy Type to output.
1115 *
1116 * @return Modified output stream.
1117 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001118inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1119{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001120 switch (policy)
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001121 {
1122 case SamplingPolicy::CENTER:
1123 os << "CENTER";
1124 break;
1125 case SamplingPolicy::TOP_LEFT:
1126 os << "TOP_LEFT";
1127 break;
1128 default:
1129 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1130 }
1131
1132 return os;
1133}
1134
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001135/** Formatted output of the ITensorInfo type.
1136 *
1137 * @param[out] os Output stream.
1138 * @param[in] info Tensor information.
1139 *
1140 * @return Modified output stream.
1141 */
1142inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1143{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001144 const DataType data_type = info->data_type();
1145 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001146
1147 os << "Shape=" << info->tensor_shape() << ","
1148 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001149 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001150
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001151 if (is_data_type_quantized(data_type))
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001152 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001153 const QuantizationInfo qinfo = info->quantization_info();
1154 const auto scales = qinfo.scale();
1155 const auto offsets = qinfo.offset();
1156
ramelg014a6d9e82021-10-02 14:34:36 +01001157 os << ", QuantizationInfo={"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001158 << "scales.size=" << scales.size() << ", scale(s)=" << scales << ", ";
ramelg01b1ba1e32021-09-25 11:53:26 +01001159
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001160 os << "offsets.size=" << offsets.size() << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001161 }
1162 return os;
1163}
1164
ramelg013ae3d882021-09-12 23:07:47 +01001165/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001166 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001167 * @param[out] os Output stream.
1168 * @param[in] info Type to output.
1169 *
1170 * @return Modified output stream.
1171 */
1172inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1173{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001174 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001175 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001176}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001177
ramelg013ae3d882021-09-12 23:07:47 +01001178/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001179 *
Alex Gildayc357c472018-03-21 13:54:09 +00001180 * @param[in] info Type to output.
1181 *
1182 * @return Formatted string.
1183 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001184inline std::string to_string(const TensorInfo &info)
1185{
1186 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001187 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001188 return str.str();
1189}
1190
ramelg013ae3d882021-09-12 23:07:47 +01001191/** Formatted output of the const ITensorInfo& type.
1192 *
1193 * @param[in] info Type to output.
1194 *
1195 * @return Formatted string.
1196 */
1197inline std::string to_string(const ITensorInfo &info)
1198{
1199 std::stringstream str;
1200 str << &info;
1201 return str.str();
1202}
1203
ramelg013ae3d882021-09-12 23:07:47 +01001204/** Formatted output of the const ITensorInfo* type.
1205 *
1206 * @param[in] info Type to output.
1207 *
1208 * @return Formatted string.
1209 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001210inline std::string to_string(const ITensorInfo *info)
1211{
ramelg013ae3d882021-09-12 23:07:47 +01001212 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001213 if (info != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001214 {
1215 std::stringstream str;
1216 str << info;
1217 ret_str = str.str();
1218 }
1219 return ret_str;
1220}
1221
ramelg01cbbb0382021-09-17 17:36:57 +01001222/** Formatted output of the ITensorInfo* type.
1223 *
1224 * @param[in] info Type to output.
1225 *
1226 * @return Formatted string.
1227 */
1228inline std::string to_string(ITensorInfo *info)
1229{
1230 return to_string(static_cast<const ITensorInfo *>(info));
1231}
1232
1233/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001234 *
1235 * @param[in] tensor Type to output.
1236 *
1237 * @return Formatted string.
1238 */
1239inline std::string to_string(const ITensor *tensor)
1240{
1241 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001242 if (tensor != nullptr)
ramelg013ae3d882021-09-12 23:07:47 +01001243 {
1244 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001245 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001246 ret_str = str.str();
1247 }
1248 return ret_str;
1249}
1250
ramelg01cbbb0382021-09-17 17:36:57 +01001251/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001252 *
1253 * @param[in] tensor Type to output.
1254 *
1255 * @return Formatted string.
1256 */
1257inline std::string to_string(ITensor *tensor)
1258{
ramelg01cbbb0382021-09-17 17:36:57 +01001259 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001260}
1261
ramelg01cbbb0382021-09-17 17:36:57 +01001262/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001263 *
1264 * @param[in] tensor Type to output.
1265 *
1266 * @return Formatted string.
1267 */
1268inline std::string to_string(ITensor &tensor)
1269{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001270 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001271 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001272 return str.str();
1273}
1274
ramelg01cbbb0382021-09-17 17:36:57 +01001275#ifdef ARM_COMPUTE_OPENCL_ENABLED
1276/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1277 *
1278 * @param[in] cl_tensor Type to output.
1279 *
1280 * @return Formatted string.
1281 */
1282inline std::string to_string(const ICLTensor *cl_tensor)
1283{
1284 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001285 if (cl_tensor != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001286 {
1287 std::stringstream str;
1288 str << "ICLTensor->info(): " << cl_tensor->info();
1289 ret_str = str.str();
1290 }
1291 return ret_str;
1292}
1293
1294/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1295 *
1296 * @param[in] cl_tensor Type to output.
1297 *
1298 * @return Formatted string.
1299 */
1300inline std::string to_string(ICLTensor *cl_tensor)
1301{
1302 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1303}
SiCong Li47f177e2023-02-22 17:24:09 +00001304
1305/** Formatted output of the cl::NDRange type.
1306 *
1307 * @param[out] os Output stream.
1308 * @param[in] nd_range cl::NDRange to output.
1309 *
1310 * @return Modified output stream.
1311 */
1312inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1313{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001314 os << "{" << nd_range[0] << "," << nd_range[1] << "," << nd_range[2] << "}";
SiCong Li47f177e2023-02-22 17:24:09 +00001315 return os;
1316}
1317
1318/** Formatted output of the cl::NDRange type
1319 *
1320 * @param[in] nd_Range Type to output.
1321 *
1322 * @return Formatted string.
1323 */
1324inline std::string to_string(const cl::NDRange &nd_range)
1325{
1326 std::stringstream str;
1327 str << nd_range;
1328 return str.str();
1329}
ramelg01cbbb0382021-09-17 17:36:57 +01001330#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1331
Alex Gildayc357c472018-03-21 13:54:09 +00001332/** Formatted output of the Dimensions type.
1333 *
1334 * @param[in] dimensions Type to output.
1335 *
1336 * @return Formatted string.
1337 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001338template <typename T>
1339inline std::string to_string(const Dimensions<T> &dimensions)
1340{
1341 std::stringstream str;
1342 str << dimensions;
1343 return str.str();
1344}
1345
Alex Gildayc357c472018-03-21 13:54:09 +00001346/** Formatted output of the Strides type.
1347 *
1348 * @param[in] stride Type to output.
1349 *
1350 * @return Formatted string.
1351 */
John Richardsona36eae12017-09-26 16:55:59 +01001352inline std::string to_string(const Strides &stride)
1353{
1354 std::stringstream str;
1355 str << stride;
1356 return str.str();
1357}
1358
Alex Gildayc357c472018-03-21 13:54:09 +00001359/** Formatted output of the TensorShape type.
1360 *
1361 * @param[in] shape Type to output.
1362 *
1363 * @return Formatted string.
1364 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001365inline std::string to_string(const TensorShape &shape)
1366{
1367 std::stringstream str;
1368 str << shape;
1369 return str.str();
1370}
1371
Alex Gildayc357c472018-03-21 13:54:09 +00001372/** Formatted output of the Coordinates type.
1373 *
1374 * @param[in] coord Type to output.
1375 *
1376 * @return Formatted string.
1377 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001378inline std::string to_string(const Coordinates &coord)
1379{
1380 std::stringstream str;
1381 str << coord;
1382 return str.str();
1383}
1384
Anthony Barbierb940fd62018-06-04 14:14:32 +01001385/** Formatted output of the GEMMReshapeInfo type.
1386 *
1387 * @param[out] os Output stream.
1388 * @param[in] info Type to output.
1389 *
1390 * @return Modified output stream.
1391 */
1392inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1393{
1394 os << "{m=" << info.m() << ",";
1395 os << "n=" << info.n() << ",";
1396 os << "k=" << info.k() << ",";
1397 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1398 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1399 os << "}";
1400
1401 return os;
1402}
1403
1404/** Formatted output of the GEMMInfo type.
1405 *
1406 * @param[out] os Output stream.
1407 * @param[in] info Type to output.
1408 *
1409 * @return Modified output stream.
1410 */
1411inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1412{
1413 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1414 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1415 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001416 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1417 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1418 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1419 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1420 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001421 os << "pretranspose_B=" << info.pretranspose_B() << ",";
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01001422 os << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001423
1424 return os;
1425}
1426
1427/** Formatted output of the Window::Dimension type.
1428 *
1429 * @param[out] os Output stream.
1430 * @param[in] dim Type to output.
1431 *
1432 * @return Modified output stream.
1433 */
1434inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1435{
1436 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1437
1438 return os;
1439}
1440/** Formatted output of the Window type.
1441 *
1442 * @param[out] os Output stream.
1443 * @param[in] win Type to output.
1444 *
1445 * @return Modified output stream.
1446 */
1447inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1448{
1449 os << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001450 for (unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001451 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001452 if (i > 0)
Anthony Barbierb940fd62018-06-04 14:14:32 +01001453 {
1454 os << ", ";
1455 }
1456 os << win[i];
1457 }
1458 os << "}";
1459
1460 return os;
1461}
1462
1463/** Formatted output of the WeightsInfo type.
1464 *
1465 * @param[in] info Type to output.
1466 *
1467 * @return Formatted string.
1468 */
1469inline std::string to_string(const WeightsInfo &info)
1470{
1471 std::stringstream str;
1472 str << info;
1473 return str.str();
1474}
1475
1476/** Formatted output of the GEMMReshapeInfo type.
1477 *
1478 * @param[in] info Type to output.
1479 *
1480 * @return Formatted string.
1481 */
1482inline std::string to_string(const GEMMReshapeInfo &info)
1483{
1484 std::stringstream str;
1485 str << info;
1486 return str.str();
1487}
1488
1489/** Formatted output of the GEMMInfo type.
1490 *
1491 * @param[in] info Type to output.
1492 *
1493 * @return Formatted string.
1494 */
1495inline std::string to_string(const GEMMInfo &info)
1496{
1497 std::stringstream str;
1498 str << info;
1499 return str.str();
1500}
1501
1502/** Formatted output of the Window::Dimension type.
1503 *
1504 * @param[in] dim Type to output.
1505 *
1506 * @return Formatted string.
1507 */
1508inline std::string to_string(const Window::Dimension &dim)
1509{
1510 std::stringstream str;
1511 str << dim;
1512 return str.str();
1513}
ramelg01cbbb0382021-09-17 17:36:57 +01001514/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001515 *
1516 * @param[in] win Type to output.
1517 *
1518 * @return Formatted string.
1519 */
1520inline std::string to_string(const Window &win)
1521{
1522 std::stringstream str;
1523 str << win;
1524 return str.str();
1525}
1526
ramelg01cbbb0382021-09-17 17:36:57 +01001527/** Formatted output of the Window* type.
1528 *
1529 * @param[in] win Type to output.
1530 *
1531 * @return Formatted string.
1532 */
1533inline std::string to_string(Window *win)
1534{
1535 std::string ret_str = "nullptr";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001536 if (win != nullptr)
ramelg01cbbb0382021-09-17 17:36:57 +01001537 {
1538 std::stringstream str;
1539 str << *win;
1540 ret_str = str.str();
1541 }
1542 return ret_str;
1543}
1544
Alex Gildayc357c472018-03-21 13:54:09 +00001545/** Formatted output of the Rectangle type.
1546 *
1547 * @param[out] os Output stream.
1548 * @param[in] rect Type to output.
1549 *
1550 * @return Modified output stream.
1551 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001552inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1553{
1554 os << rect.width << "x" << rect.height;
1555 os << "+" << rect.x << "+" << rect.y;
1556
1557 return os;
1558}
1559
Usama Arif8cf8c112019-03-14 15:36:54 +00001560/** Formatted output of the PaddingMode type.
1561 *
1562 * @param[out] os Output stream.
1563 * @param[in] mode Type to output.
1564 *
1565 * @return Modified output stream.
1566 */
1567inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1568{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001569 switch (mode)
Usama Arif8cf8c112019-03-14 15:36:54 +00001570 {
1571 case PaddingMode::CONSTANT:
1572 os << "CONSTANT";
1573 break;
1574 case PaddingMode::REFLECT:
1575 os << "REFLECT";
1576 break;
1577 case PaddingMode::SYMMETRIC:
1578 os << "SYMMETRIC";
1579 break;
1580 default:
1581 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1582 }
1583
1584 return os;
1585}
1586
1587/** Formatted output of the PaddingMode type.
1588 *
1589 * @param[in] mode Type to output.
1590 *
1591 * @return Formatted string.
1592 */
1593inline std::string to_string(const PaddingMode &mode)
1594{
1595 std::stringstream str;
1596 str << mode;
1597 return str.str();
1598}
1599
Alex Gildayc357c472018-03-21 13:54:09 +00001600/** Formatted output of the PadStrideInfo type.
1601 *
1602 * @param[out] os Output stream.
1603 * @param[in] pad_stride_info Type to output.
1604 *
1605 * @return Modified output stream.
1606 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001607inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1608{
1609 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1610 os << ";";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001611 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << "," << pad_stride_info.pad_top() << ","
1612 << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001613
1614 return os;
1615}
1616
Alex Gildayc357c472018-03-21 13:54:09 +00001617/** Formatted output of the PadStrideInfo type.
1618 *
1619 * @param[in] pad_stride_info Type to output.
1620 *
1621 * @return Formatted string.
1622 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001623inline std::string to_string(const PadStrideInfo &pad_stride_info)
1624{
1625 std::stringstream str;
1626 str << pad_stride_info;
1627 return str.str();
1628}
1629
Alex Gildayc357c472018-03-21 13:54:09 +00001630/** Formatted output of the BorderMode type.
1631 *
1632 * @param[in] mode Type to output.
1633 *
1634 * @return Formatted string.
1635 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001636inline std::string to_string(const BorderMode &mode)
1637{
1638 std::stringstream str;
1639 str << mode;
1640 return str.str();
1641}
1642
Alex Gildayc357c472018-03-21 13:54:09 +00001643/** Formatted output of the BorderSize type.
1644 *
1645 * @param[in] border Type to output.
1646 *
1647 * @return Formatted string.
1648 */
John Richardsonb482ce12017-09-18 12:44:01 +01001649inline std::string to_string(const BorderSize &border)
1650{
1651 std::stringstream str;
1652 str << border;
1653 return str.str();
1654}
1655
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001656/** Formatted output of the PaddingList type.
1657 *
1658 * @param[in] padding Type to output.
1659 *
1660 * @return Formatted string.
1661 */
1662inline std::string to_string(const PaddingList &padding)
1663{
1664 std::stringstream str;
1665 str << padding;
1666 return str.str();
1667}
1668
giuros013175fcf2018-11-21 09:59:17 +00001669/** Formatted output of the Multiples type.
1670 *
1671 * @param[in] multiples Type to output.
1672 *
1673 * @return Formatted string.
1674 */
1675inline std::string to_string(const Multiples &multiples)
1676{
1677 std::stringstream str;
1678 str << multiples;
1679 return str.str();
1680}
1681
Alex Gildayc357c472018-03-21 13:54:09 +00001682/** Formatted output of the InterpolationPolicy type.
1683 *
1684 * @param[in] policy Type to output.
1685 *
1686 * @return Formatted string.
1687 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001688inline std::string to_string(const InterpolationPolicy &policy)
1689{
1690 std::stringstream str;
1691 str << policy;
1692 return str.str();
1693}
1694
Alex Gildayc357c472018-03-21 13:54:09 +00001695/** Formatted output of the SamplingPolicy type.
1696 *
1697 * @param[in] policy Type to output.
1698 *
1699 * @return Formatted string.
1700 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001701inline std::string to_string(const SamplingPolicy &policy)
1702{
1703 std::stringstream str;
1704 str << policy;
1705 return str.str();
1706}
1707
Alex Gildayc357c472018-03-21 13:54:09 +00001708/** Formatted output of the ConvertPolicy type.
1709 *
1710 * @param[out] os Output stream.
1711 * @param[in] policy Type to output.
1712 *
1713 * @return Modified output stream.
1714 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001715inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1716{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001717 switch (policy)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001718 {
1719 case ConvertPolicy::WRAP:
1720 os << "WRAP";
1721 break;
1722 case ConvertPolicy::SATURATE:
1723 os << "SATURATE";
1724 break;
1725 default:
1726 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1727 }
1728
1729 return os;
1730}
1731
1732inline std::string to_string(const ConvertPolicy &policy)
1733{
1734 std::stringstream str;
1735 str << policy;
1736 return str.str();
1737}
1738
giuros01164a2722018-11-20 18:34:46 +00001739/** Formatted output of the ArithmeticOperation type.
1740 *
1741 * @param[out] os Output stream.
1742 * @param[in] op Operation to output.
1743 *
1744 * @return Modified output stream.
1745 */
1746inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1747{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001748 switch (op)
giuros01164a2722018-11-20 18:34:46 +00001749 {
1750 case ArithmeticOperation::ADD:
1751 os << "ADD";
1752 break;
1753 case ArithmeticOperation::SUB:
1754 os << "SUB";
1755 break;
1756 case ArithmeticOperation::DIV:
1757 os << "DIV";
1758 break;
1759 case ArithmeticOperation::MAX:
1760 os << "MAX";
1761 break;
1762 case ArithmeticOperation::MIN:
1763 os << "MIN";
1764 break;
1765 case ArithmeticOperation::SQUARED_DIFF:
1766 os << "SQUARED_DIFF";
1767 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001768 case ArithmeticOperation::POWER:
1769 os << "POWER";
1770 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001771 case ArithmeticOperation::PRELU:
1772 os << "PRELU";
1773 break;
giuros01164a2722018-11-20 18:34:46 +00001774 default:
1775 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1776 }
1777
1778 return os;
1779}
1780
1781/** Formatted output of the Arithmetic Operation
1782 *
1783 * @param[in] op Type to output.
1784 *
1785 * @return Formatted string.
1786 */
1787inline std::string to_string(const ArithmeticOperation &op)
1788{
1789 std::stringstream str;
1790 str << op;
1791 return str.str();
1792}
1793
Alex Gildayc357c472018-03-21 13:54:09 +00001794/** Formatted output of the Reduction Operations.
1795 *
1796 * @param[out] os Output stream.
1797 * @param[in] op Type to output.
1798 *
1799 * @return Modified output stream.
1800 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001801inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1802{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001803 switch (op)
Anthony Barbier2a07e182017-08-04 18:20:27 +01001804 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001805 case ReductionOperation::SUM:
1806 os << "SUM";
1807 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001808 case ReductionOperation::SUM_SQUARE:
1809 os << "SUM_SQUARE";
1810 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001811 case ReductionOperation::MEAN_SUM:
1812 os << "MEAN_SUM";
1813 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001814 case ReductionOperation::ARG_IDX_MAX:
1815 os << "ARG_IDX_MAX";
1816 break;
1817 case ReductionOperation::ARG_IDX_MIN:
1818 os << "ARG_IDX_MIN";
1819 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001820 case ReductionOperation::PROD:
1821 os << "PROD";
1822 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001823 case ReductionOperation::MIN:
1824 os << "MIN";
1825 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001826 case ReductionOperation::MAX:
1827 os << "MAX";
1828 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001829 default:
1830 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1831 }
1832
1833 return os;
1834}
1835
Alex Gildayc357c472018-03-21 13:54:09 +00001836/** Formatted output of the Reduction Operations.
1837 *
1838 * @param[in] op Type to output.
1839 *
1840 * @return Formatted string.
1841 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001842inline std::string to_string(const ReductionOperation &op)
1843{
1844 std::stringstream str;
1845 str << op;
1846 return str.str();
1847}
1848
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001849/** Formatted output of the Comparison Operations.
1850 *
1851 * @param[out] os Output stream.
1852 * @param[in] op Type to output.
1853 *
1854 * @return Modified output stream.
1855 */
1856inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1857{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001858 switch (op)
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001859 {
1860 case ComparisonOperation::Equal:
1861 os << "Equal";
1862 break;
1863 case ComparisonOperation::NotEqual:
1864 os << "NotEqual";
1865 break;
1866 case ComparisonOperation::Greater:
1867 os << "Greater";
1868 break;
1869 case ComparisonOperation::GreaterEqual:
1870 os << "GreaterEqual";
1871 break;
1872 case ComparisonOperation::Less:
1873 os << "Less";
1874 break;
1875 case ComparisonOperation::LessEqual:
1876 os << "LessEqual";
1877 break;
1878 default:
1879 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1880 }
1881
1882 return os;
1883}
1884
Michalis Spyroue9362622018-11-23 17:41:37 +00001885/** Formatted output of the Elementwise unary Operations.
1886 *
1887 * @param[out] os Output stream.
1888 * @param[in] op Type to output.
1889 *
1890 * @return Modified output stream.
1891 */
1892inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1893{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001894 switch (op)
Michalis Spyroue9362622018-11-23 17:41:37 +00001895 {
1896 case ElementWiseUnary::RSQRT:
1897 os << "RSQRT";
1898 break;
1899 case ElementWiseUnary::EXP:
1900 os << "EXP";
1901 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001902 case ElementWiseUnary::NEG:
1903 os << "NEG";
1904 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01001905 case ElementWiseUnary::LOG:
1906 os << "LOG";
1907 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001908 case ElementWiseUnary::SIN:
1909 os << "SIN";
1910 break;
1911 case ElementWiseUnary::ABS:
1912 os << "ABS";
1913 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01001914 case ElementWiseUnary::ROUND:
1915 os << "ROUND";
1916 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001917 case ElementWiseUnary::LOGICAL_NOT:
1918 os << "LOGICAL_NOT";
1919 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00001920 default:
1921 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1922 }
1923
1924 return os;
1925}
1926
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001927/** Formatted output of the Comparison Operations.
1928 *
1929 * @param[in] op Type to output.
1930 *
1931 * @return Formatted string.
1932 */
1933inline std::string to_string(const ComparisonOperation &op)
1934{
1935 std::stringstream str;
1936 str << op;
1937 return str.str();
1938}
1939
Michalis Spyroue9362622018-11-23 17:41:37 +00001940/** Formatted output of the Elementwise unary Operations.
1941 *
1942 * @param[in] op Type to output.
1943 *
1944 * @return Formatted string.
1945 */
1946inline std::string to_string(const ElementWiseUnary &op)
1947{
1948 std::stringstream str;
1949 str << op;
1950 return str.str();
1951}
1952
Alex Gildayc357c472018-03-21 13:54:09 +00001953/** Formatted output of the Norm Type.
1954 *
1955 * @param[in] type Type to output.
1956 *
1957 * @return Formatted string.
1958 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001959inline std::string to_string(const NormType &type)
1960{
1961 std::stringstream str;
1962 str << type;
1963 return str.str();
1964}
1965
Alex Gildayc357c472018-03-21 13:54:09 +00001966/** Formatted output of the Pooling Type.
1967 *
1968 * @param[in] type Type to output.
1969 *
1970 * @return Formatted string.
1971 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001972inline std::string to_string(const PoolingType &type)
1973{
1974 std::stringstream str;
1975 str << type;
1976 return str.str();
1977}
1978
Alex Gildayc357c472018-03-21 13:54:09 +00001979/** Formatted output of the Pooling Layer Info.
1980 *
1981 * @param[in] info Type to output.
1982 *
1983 * @return Formatted string.
1984 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001985inline std::string to_string(const PoolingLayerInfo &info)
1986{
1987 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001988 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00001989 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001990 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01001991 if (!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001992 {
1993 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001994 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
1995 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001996 }
1997 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001998 return str.str();
1999}
2000
ramelg0137515692022-02-26 22:06:20 +00002001/** Formatted output of the Size3D type.
2002 *
2003 * @param[out] os Output stream
2004 * @param[in] size Type to output
2005 *
2006 * @return Modified output stream.
2007 */
2008inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2009{
2010 os << size.width << "x" << size.height << "x" << size.depth;
2011
2012 return os;
2013}
2014
2015/** Formatted output of the Size3D type.
2016 *
2017 * @param[in] type Type to output
2018 *
2019 * @return Formatted string.
2020 */
2021inline std::string to_string(const Size3D &type)
2022{
2023 std::stringstream str;
2024 str << type;
2025 return str.str();
2026}
2027
2028/** Formatted output of the Padding3D type.
2029 *
2030 * @param[out] os Output stream.
2031 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2032 *
2033 * @return Modified output stream.
2034 */
2035inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2036{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002037 os << padding3d.left << "," << padding3d.right << "," << padding3d.top << "," << padding3d.bottom << ","
ramelg0137515692022-02-26 22:06:20 +00002038 << padding3d.front << "," << padding3d.back;
2039 return os;
2040}
2041
2042/** Converts a @ref Padding3D to string
2043 *
2044 * @param[in] padding3d Padding3D value to be converted
2045 *
2046 * @return String representing the corresponding Padding3D
2047 */
2048inline std::string to_string(const Padding3D &padding3d)
2049{
2050 std::stringstream str;
2051 str << padding3d;
2052 return str.str();
2053}
2054
2055/** Formatted output of the DimensionRoundingType type.
2056 *
2057 * @param[out] os Output stream.
2058 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2059 *
2060 * @return Modified output stream.
2061 */
2062inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2063{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002064 switch (rounding_type)
ramelg0137515692022-02-26 22:06:20 +00002065 {
2066 case DimensionRoundingType::CEIL:
2067 os << "CEIL";
2068 break;
2069 case DimensionRoundingType::FLOOR:
2070 os << "FLOOR";
2071 break;
2072 default:
2073 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2074 }
2075 return os;
2076}
2077
2078/** Formatted output of the Pooling 3d Layer Info.
2079 *
2080 * @param[out] os Output stream.
2081 * @param[in] info Pooling 3D layer info to print to output stream.
2082 *
2083 * @return Modified output stream.
2084 */
2085inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2086{
2087 os << "{Type=" << info.pool_type << ","
2088 << "IsGlobalPooling=" << info.is_global_pooling;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002089 if (!info.is_global_pooling)
ramelg0137515692022-02-26 22:06:20 +00002090 {
2091 os << ","
2092 << "PoolSize=" << info.pool_size << ", "
2093 << "Stride=" << info.stride << ", "
2094 << "Padding=" << info.padding << ", "
2095 << "Exclude Padding=" << info.exclude_padding << ", "
2096 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2097 << "DimensionRoundingType=" << info.round_type;
2098 }
2099 os << "}";
2100 return os;
2101}
2102
2103/** Formatted output of the Pooling 3d Layer Info.
2104 *
2105 * @param[in] info Type to output.
2106 *
2107 * @return Formatted string.
2108 */
2109inline std::string to_string(const Pooling3dLayerInfo &info)
2110{
2111 std::stringstream str;
2112 str << info;
2113 return str.str();
2114}
2115
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002116/** Formatted output of the PriorBoxLayerInfo.
2117 *
2118 * @param[in] info Type to output.
2119 *
2120 * @return Formatted string.
2121 */
2122inline std::string to_string(const PriorBoxLayerInfo &info)
2123{
2124 std::stringstream str;
2125 str << "{";
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002126 str << "Clip:" << info.clip() << "Flip:" << info.flip() << "StepX:" << info.steps()[0]
2127 << "StepY:" << info.steps()[1] << "MinSizes:" << info.min_sizes().size()
2128 << "MaxSizes:" << info.max_sizes().size() << "ImgSizeX:" << info.img_size().x
2129 << "ImgSizeY:" << info.img_size().y << "Offset:" << info.offset() << "Variances:" << info.variances().size();
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002130 str << "}";
2131 return str.str();
2132}
2133
Alex Gildayc357c472018-03-21 13:54:09 +00002134/** Formatted output of the Size2D type.
2135 *
2136 * @param[out] os Output stream
2137 * @param[in] size Type to output
2138 *
2139 * @return Modified output stream.
2140 */
John Richardson25f23682017-11-27 14:35:09 +00002141inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2142{
2143 os << size.width << "x" << size.height;
2144
2145 return os;
2146}
2147
Alex Gildayc357c472018-03-21 13:54:09 +00002148/** Formatted output of the Size2D type.
2149 *
2150 * @param[in] type Type to output
2151 *
2152 * @return Formatted string.
2153 */
John Richardson25f23682017-11-27 14:35:09 +00002154inline std::string to_string(const Size2D &type)
2155{
2156 std::stringstream str;
2157 str << type;
2158 return str.str();
2159}
2160
Alex Gildayc357c472018-03-21 13:54:09 +00002161/** Formatted output of the ConvolutionMethod type.
2162 *
2163 * @param[out] os Output stream
2164 * @param[in] conv_method Type to output
2165 *
2166 * @return Modified output stream.
2167 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002168inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2169{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002170 switch (conv_method)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002171 {
2172 case ConvolutionMethod::GEMM:
2173 os << "GEMM";
2174 break;
2175 case ConvolutionMethod::DIRECT:
2176 os << "DIRECT";
2177 break;
2178 case ConvolutionMethod::WINOGRAD:
2179 os << "WINOGRAD";
2180 break;
SiCongLid9287352021-11-03 19:01:22 +00002181 case ConvolutionMethod::FFT:
2182 os << "FFT";
2183 break;
2184 case ConvolutionMethod::GEMM_CONV2D:
2185 os << "GEMM_CONV2D";
2186 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002187 default:
2188 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2189 }
2190
2191 return os;
2192}
2193
Alex Gildayc357c472018-03-21 13:54:09 +00002194/** Formatted output of the ConvolutionMethod type.
2195 *
2196 * @param[in] conv_method Type to output
2197 *
2198 * @return Formatted string.
2199 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002200inline std::string to_string(const ConvolutionMethod &conv_method)
2201{
2202 std::stringstream str;
2203 str << conv_method;
2204 return str.str();
2205}
2206
Alex Gildayc357c472018-03-21 13:54:09 +00002207/** Formatted output of the GPUTarget type.
2208 *
2209 * @param[out] os Output stream
2210 * @param[in] gpu_target Type to output
2211 *
2212 * @return Modified output stream.
2213 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002214inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2215{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002216 switch (gpu_target)
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002217 {
2218 case GPUTarget::GPU_ARCH_MASK:
2219 os << "GPU_ARCH_MASK";
2220 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002221 case GPUTarget::GPU_GENERATION_MASK:
2222 os << "GPU_GENERATION_MASK";
2223 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002224 case GPUTarget::MIDGARD:
2225 os << "MIDGARD";
2226 break;
2227 case GPUTarget::BIFROST:
2228 os << "BIFROST";
2229 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002230 case GPUTarget::VALHALL:
2231 os << "VALHALL";
2232 break;
Gunes Bayir85cafff2023-12-18 13:29:31 +00002233 case GPUTarget::FIFTHGEN:
2234 os << "FIFTHGEN";
2235 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002236 case GPUTarget::T600:
2237 os << "T600";
2238 break;
2239 case GPUTarget::T700:
2240 os << "T700";
2241 break;
2242 case GPUTarget::T800:
2243 os << "T800";
2244 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002245 case GPUTarget::G71:
2246 os << "G71";
2247 break;
2248 case GPUTarget::G72:
2249 os << "G72";
2250 break;
2251 case GPUTarget::G51:
2252 os << "G51";
2253 break;
2254 case GPUTarget::G51BIG:
2255 os << "G51BIG";
2256 break;
2257 case GPUTarget::G51LIT:
2258 os << "G51LIT";
2259 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002260 case GPUTarget::G31:
2261 os << "G31";
2262 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002263 case GPUTarget::G76:
2264 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002265 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002266 case GPUTarget::G52:
2267 os << "G52";
2268 break;
2269 case GPUTarget::G52LIT:
2270 os << "G52LIT";
2271 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002272 case GPUTarget::G77:
2273 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002274 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002275 case GPUTarget::G57:
2276 os << "G57";
2277 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002278 case GPUTarget::G78:
2279 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002280 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002281 case GPUTarget::G68:
2282 os << "G68";
2283 break;
2284 case GPUTarget::G78AE:
2285 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002286 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002287 case GPUTarget::G710:
2288 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002289 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002290 case GPUTarget::G610:
2291 os << "G610";
2292 break;
2293 case GPUTarget::G510:
2294 os << "G510";
2295 break;
2296 case GPUTarget::G310:
2297 os << "G310";
2298 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002299 case GPUTarget::G715:
2300 os << "G715";
2301 break;
2302 case GPUTarget::G615:
2303 os << "G615";
2304 break;
Gunes Bayir85cafff2023-12-18 13:29:31 +00002305 case GPUTarget::G720:
2306 os << "G720";
2307 break;
2308 case GPUTarget::G620:
2309 os << "G620";
2310 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002311 default:
2312 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2313 }
2314
2315 return os;
2316}
2317
Alex Gildayc357c472018-03-21 13:54:09 +00002318/** Formatted output of the GPUTarget type.
2319 *
2320 * @param[in] gpu_target Type to output
2321 *
2322 * @return Formatted string.
2323 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002324inline std::string to_string(const GPUTarget &gpu_target)
2325{
2326 std::stringstream str;
2327 str << gpu_target;
2328 return str.str();
2329}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002330
John Richardson8de92612018-02-22 14:09:31 +00002331/** Formatted output of the DetectionWindow type.
2332 *
2333 * @param[out] os Output stream
2334 * @param[in] detection_window Type to output
2335 *
2336 * @return Modified output stream.
2337 */
John Richardson684cb0f2018-01-09 11:17:00 +00002338inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2339{
2340 os << "{x=" << detection_window.x << ","
2341 << "y=" << detection_window.y << ","
2342 << "width=" << detection_window.width << ","
2343 << "height=" << detection_window.height << ","
2344 << "idx_class=" << detection_window.idx_class << ","
2345 << "score=" << detection_window.score << "}";
2346
2347 return os;
2348}
2349
Isabella Gottardi05e56442018-11-16 11:26:52 +00002350/** Formatted output of the DetectionOutputLayerCodeType type.
2351 *
2352 * @param[out] os Output stream
2353 * @param[in] detection_code Type to output
2354 *
2355 * @return Modified output stream.
2356 */
2357inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2358{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002359 switch (detection_code)
Isabella Gottardi05e56442018-11-16 11:26:52 +00002360 {
2361 case DetectionOutputLayerCodeType::CENTER_SIZE:
2362 os << "CENTER_SIZE";
2363 break;
2364 case DetectionOutputLayerCodeType::CORNER:
2365 os << "CORNER";
2366 break;
2367 case DetectionOutputLayerCodeType::CORNER_SIZE:
2368 os << "CORNER_SIZE";
2369 break;
2370 case DetectionOutputLayerCodeType::TF_CENTER:
2371 os << "TF_CENTER";
2372 break;
2373 default:
2374 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2375 }
2376
2377 return os;
2378}
2379/** Formatted output of the DetectionOutputLayerCodeType type.
2380 *
2381 * @param[in] detection_code Type to output
2382 *
2383 * @return Formatted string.
2384 */
2385inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2386{
2387 std::stringstream str;
2388 str << detection_code;
2389 return str.str();
2390}
2391
2392/** Formatted output of the DetectionOutputLayerInfo type.
2393 *
2394 * @param[out] os Output stream
2395 * @param[in] detection_info Type to output
2396 *
2397 * @return Modified output stream.
2398 */
2399inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2400{
2401 os << "{Classes=" << detection_info.num_classes() << ","
2402 << "ShareLocation=" << detection_info.share_location() << ","
2403 << "CodeType=" << detection_info.code_type() << ","
2404 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2405 << "KeepTopK=" << detection_info.keep_top_k() << ","
2406 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2407 << "Eta=" << detection_info.eta() << ","
2408 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2409 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2410 << "TopK=" << detection_info.top_k() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002411 << "NumLocClasses=" << detection_info.num_loc_classes() << "}";
Isabella Gottardi05e56442018-11-16 11:26:52 +00002412
2413 return os;
2414}
2415
2416/** Formatted output of the DetectionOutputLayerInfo type.
2417 *
2418 * @param[in] detection_info Type to output
2419 *
2420 * @return Formatted string.
2421 */
2422inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2423{
2424 std::stringstream str;
2425 str << detection_info;
2426 return str.str();
2427}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002428/** Formatted output of the DetectionPostProcessLayerInfo type.
2429 *
2430 * @param[out] os Output stream
2431 * @param[in] detection_info Type to output
2432 *
2433 * @return Modified output stream.
2434 */
2435inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2436{
2437 os << "{MaxDetections=" << detection_info.max_detections() << ","
2438 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2439 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2440 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2441 << "NumClasses=" << detection_info.num_classes() << ","
2442 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2443 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2444 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2445 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2446 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002447 << "DetectionPerClass=" << detection_info.detection_per_class() << "}";
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002448
2449 return os;
2450}
2451
2452/** Formatted output of the DetectionPostProcessLayerInfo type.
2453 *
2454 * @param[in] detection_info Type to output
2455 *
2456 * @return Formatted string.
2457 */
2458inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2459{
2460 std::stringstream str;
2461 str << detection_info;
2462 return str.str();
2463}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002464
John Richardson8de92612018-02-22 14:09:31 +00002465/** Formatted output of the DetectionWindow type.
2466 *
2467 * @param[in] detection_window Type to output
2468 *
2469 * @return Formatted string.
2470 */
2471inline std::string to_string(const DetectionWindow &detection_window)
2472{
2473 std::stringstream str;
2474 str << detection_window;
2475 return str.str();
2476}
2477
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002478/** Formatted output of @ref PriorBoxLayerInfo.
2479 *
2480 * @param[out] os Output stream.
2481 * @param[in] info Type to output.
2482 *
2483 * @return Modified output stream.
2484 */
2485inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2486{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002487 os << "Clip:" << info.clip() << "Flip:" << info.flip() << "StepX:" << info.steps()[0] << "StepY:" << info.steps()[1]
2488 << "MinSizes:" << info.min_sizes() << "MaxSizes:" << info.max_sizes() << "ImgSizeX:" << info.img_size().x
2489 << "ImgSizeY:" << info.img_size().y << "Offset:" << info.offset() << "Variances:" << info.variances();
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002490
2491 return os;
2492}
2493
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002494/** Formatted output of the WinogradInfo type. */
2495inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2496{
2497 os << "{OutputTileSize=" << info.output_tile_size << ","
2498 << "KernelSize=" << info.kernel_size << ","
2499 << "PadStride=" << info.convolution_info << ","
2500 << "OutputDataLayout=" << info.output_data_layout << "}";
2501
2502 return os;
2503}
2504
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002505inline std::string to_string(const WinogradInfo &type)
2506{
2507 std::stringstream str;
2508 str << type;
2509 return str.str();
2510}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002511
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002512/** Convert a CLTunerMode value to a string
2513 *
2514 * @param val CLTunerMode value to be converted
2515 *
2516 * @return String representing the corresponding CLTunerMode.
2517 */
2518inline std::string to_string(const CLTunerMode val)
2519{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002520 switch (val)
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002521 {
2522 case CLTunerMode::EXHAUSTIVE:
2523 {
2524 return std::string("Exhaustive");
2525 }
2526 case CLTunerMode::NORMAL:
2527 {
2528 return std::string("Normal");
2529 }
2530 case CLTunerMode::RAPID:
2531 {
2532 return std::string("Rapid");
2533 }
2534 default:
2535 {
2536 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2537 return std::string("UNDEFINED");
2538 }
2539 }
2540}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002541/** Converts a @ref CLGEMMKernelType to string
2542 *
2543 * @param[in] val CLGEMMKernelType value to be converted
2544 *
2545 * @return String representing the corresponding CLGEMMKernelType
2546 */
2547inline std::string to_string(CLGEMMKernelType val)
2548{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002549 switch (val)
SiCong Lidb4a6c12021-02-05 09:30:57 +00002550 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002551 case CLGEMMKernelType::NATIVE:
2552 {
2553 return "Native";
2554 }
2555 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2556 {
2557 return "Reshaped_Only_RHS";
2558 }
2559 case CLGEMMKernelType::RESHAPED:
2560 {
2561 return "Reshaped";
2562 }
2563 default:
2564 {
2565 return "Unknown";
2566 }
2567 }
2568}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002569/** [Print CLTunerMode type] **/
2570/** Formatted output of the CLTunerMode type.
2571 *
2572 * @param[out] os Output stream.
2573 * @param[in] val CLTunerMode to output.
2574 *
2575 * @return Modified output stream.
2576 */
2577inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2578{
2579 os << to_string(val);
2580 return os;
2581}
2582
ramelg013ae3d882021-09-12 23:07:47 +01002583/** Formatted output of the ConvolutionInfo type.
2584 *
2585 * @param[out] os Output stream.
2586 * @param[in] conv_info ConvolutionInfo to output.
2587 *
2588 * @return Modified output stream.
2589 */
2590inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2591{
SiCongLi579ca842021-10-18 09:38:33 +01002592 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2593 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2594 << "act_info=" << to_string(conv_info.act_info) << ", "
2595 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002596 return os;
2597}
2598
2599/** Converts a @ref ConvolutionInfo to string
2600 *
2601 * @param[in] info ConvolutionInfo value to be converted
2602 *
2603 * @return String representing the corresponding ConvolutionInfo
2604 */
2605inline std::string to_string(const ConvolutionInfo &info)
2606{
2607 std::stringstream str;
2608 str << info;
2609 return str.str();
2610}
2611
2612/** Formatted output of the FullyConnectedLayerInfo type.
2613 *
2614 * @param[out] os Output stream.
2615 * @param[in] layer_info FullyConnectedLayerInfo to output.
2616 *
2617 * @return Modified output stream.
2618 */
2619inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2620{
SiCongLi579ca842021-10-18 09:38:33 +01002621 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2622 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2623 << "transpose_weights=" << layer_info.transpose_weights << ", "
2624 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2625 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
SiCongLi579ca842021-10-18 09:38:33 +01002626 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002627 return os;
2628}
2629
2630/** Converts a @ref FullyConnectedLayerInfo to string
2631 *
2632 * @param[in] info FullyConnectedLayerInfo value to be converted
2633 *
2634 * @return String representing the corresponding FullyConnectedLayerInfo
2635 */
2636inline std::string to_string(const FullyConnectedLayerInfo &info)
2637{
2638 std::stringstream str;
2639 str << info;
2640 return str.str();
2641}
2642
2643/** Formatted output of the GEMMLowpOutputStageType type.
2644 *
2645 * @param[out] os Output stream.
2646 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2647 *
2648 * @return Modified output stream.
2649 */
2650inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2651{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002652 switch (gemm_type)
ramelg013ae3d882021-09-12 23:07:47 +01002653 {
2654 case GEMMLowpOutputStageType::NONE:
2655 os << "NONE";
2656 break;
2657 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2658 os << "QUANTIZE_DOWN";
2659 break;
2660 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2661 os << "QUANTIZE_DOWN_FIXEDPOINT";
2662 break;
2663 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2664 os << "QUANTIZE_DOWN_FLOAT";
2665 break;
2666 default:
2667 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2668 }
2669 return os;
2670}
2671
2672/** Converts a @ref GEMMLowpOutputStageType to string
2673 *
2674 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2675 *
2676 * @return String representing the corresponding GEMMLowpOutputStageType
2677 */
2678inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2679{
2680 std::stringstream str;
2681 str << gemm_type;
2682 return str.str();
2683}
2684
2685/** Formatted output of the GEMMLowpOutputStageInfo type.
2686 *
2687 * @param[out] os Output stream.
2688 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2689 *
2690 * @return Modified output stream.
2691 */
2692inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2693{
SiCongLi579ca842021-10-18 09:38:33 +01002694 os << "{type=" << gemm_info.type << ", "
2695 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2696 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2697 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2698 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2699 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2700 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2701 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2702 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2703 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2704 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002705 return os;
2706}
2707
2708/** Converts a @ref GEMMLowpOutputStageInfo to string
2709 *
2710 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2711 *
2712 * @return String representing the corresponding GEMMLowpOutputStageInfo
2713 */
2714inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2715{
2716 std::stringstream str;
2717 str << gemm_info;
2718 return str.str();
2719}
2720
2721/** Formatted output of the Conv2dInfo type.
2722 *
2723 * @param[out] os Output stream.
2724 * @param[in] conv_info Conv2dInfo to output.
2725 *
2726 * @return Modified output stream.
2727 */
2728inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2729{
SiCongLi579ca842021-10-18 09:38:33 +01002730 os << "{conv_info=" << conv_info.conv_info << ", "
2731 << "dilation=" << conv_info.dilation << ", "
2732 << "act_info=" << to_string(conv_info.act_info) << ", "
2733 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2734 << "num_groups=" << conv_info.num_groups << ","
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01002735 << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002736 return os;
2737}
2738
2739/** Converts a @ref Conv2dInfo to string
2740 *
2741 * @param[in] conv_info Conv2dInfo value to be converted
2742 *
2743 * @return String representing the corresponding Conv2dInfo
2744 */
2745inline std::string to_string(const Conv2dInfo &conv_info)
2746{
2747 std::stringstream str;
2748 str << conv_info;
2749 return str.str();
2750}
2751
2752/** Formatted output of the PixelValue type.
2753 *
2754 * @param[out] os Output stream.
2755 * @param[in] pixel_value PixelValue to output.
2756 *
2757 * @return Modified output stream.
2758 */
2759inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2760{
SiCongLi579ca842021-10-18 09:38:33 +01002761 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002762 return os;
2763}
2764
2765/** Converts a @ref PixelValue to string
2766 *
2767 * @param[in] pixel_value PixelValue value to be converted
2768 *
2769 * @return String representing the corresponding PixelValue
2770 */
2771inline std::string to_string(const PixelValue &pixel_value)
2772{
2773 std::stringstream str;
2774 str << pixel_value;
2775 return str.str();
2776}
2777
2778/** Formatted output of the ScaleKernelInfo type.
2779 *
2780 * @param[out] os Output stream.
2781 * @param[in] scale_info ScaleKernelInfo to output.
2782 *
2783 * @return Modified output stream.
2784 */
2785inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2786{
SiCongLi579ca842021-10-18 09:38:33 +01002787 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2788 << "BorderMode=" << scale_info.border_mode << ", "
2789 << "PixelValue=" << scale_info.constant_border_value << ", "
2790 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2791 << "use_padding=" << scale_info.use_padding << ", "
2792 << "align_corners=" << scale_info.align_corners << ", "
2793 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002794 return os;
2795}
2796
2797/** Converts a @ref ScaleKernelInfo to string
2798 *
2799 * @param[in] scale_info ScaleKernelInfo value to be converted
2800 *
2801 * @return String representing the corresponding ScaleKernelInfo
2802 */
2803inline std::string to_string(const ScaleKernelInfo &scale_info)
2804{
2805 std::stringstream str;
2806 str << scale_info;
2807 return str.str();
2808}
2809
2810/** Formatted output of the FFTDirection type.
2811 *
2812 * @param[out] os Output stream.
2813 * @param[in] fft_dir FFTDirection to output.
2814 *
2815 * @return Modified output stream.
2816 */
2817inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2818{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002819 switch (fft_dir)
ramelg013ae3d882021-09-12 23:07:47 +01002820 {
2821 case FFTDirection::Forward:
2822 os << "Forward";
2823 break;
2824 case FFTDirection::Inverse:
2825 os << "Inverse";
2826 break;
2827 default:
2828 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2829 }
2830 return os;
2831}
2832
2833/** Converts a @ref FFT1DInfo to string
2834 *
2835 * @param[in] fft_dir FFT1DInfo value to be converted
2836 *
2837 * @return String representing the corresponding FFT1DInfo
2838 */
2839inline std::string to_string(const FFTDirection &fft_dir)
2840{
2841 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002842 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002843 return str.str();
2844}
2845
2846/** Formatted output of the FFT1DInfo type.
2847 *
2848 * @param[out] os Output stream.
2849 * @param[in] fft1d_info FFT1DInfo to output.
2850 *
2851 * @return Modified output stream.
2852 */
2853inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2854{
SiCongLi579ca842021-10-18 09:38:33 +01002855 os << "{axis=" << fft1d_info.axis << ", "
2856 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002857 return os;
2858}
2859
2860/** Converts a @ref FFT1DInfo to string
2861 *
2862 * @param[in] fft1d_info FFT1DInfo value to be converted
2863 *
2864 * @return String representing the corresponding FFT1DInfo
2865 */
2866inline std::string to_string(const FFT1DInfo &fft1d_info)
2867{
2868 std::stringstream str;
2869 str << fft1d_info;
2870 return str.str();
2871}
2872
2873/** Formatted output of the FFT2DInfo type.
2874 *
2875 * @param[out] os Output stream.
2876 * @param[in] fft2d_info FFT2DInfo to output.
2877 *
2878 * @return Modified output stream.
2879 */
2880inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2881{
SiCongLi579ca842021-10-18 09:38:33 +01002882 os << "{axis=" << fft2d_info.axis0 << ", "
2883 << "axis=" << fft2d_info.axis1 << ", "
2884 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002885 return os;
2886}
2887
2888/** Converts a @ref FFT2DInfo to string
2889 *
2890 * @param[in] fft2d_info FFT2DInfo value to be converted
2891 *
2892 * @return String representing the corresponding FFT2DInfo
2893 */
2894inline std::string to_string(const FFT2DInfo &fft2d_info)
2895{
2896 std::stringstream str;
2897 str << fft2d_info;
2898 return str.str();
2899}
2900
2901/** Formatted output of the Coordinates2D type.
2902 *
2903 * @param[out] os Output stream.
2904 * @param[in] coord_2d Coordinates2D to output.
2905 *
2906 * @return Modified output stream.
2907 */
2908inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2909{
SiCongLi579ca842021-10-18 09:38:33 +01002910 os << "{x=" << coord_2d.x << ", "
2911 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002912 return os;
2913}
2914
2915/** Converts a @ref Coordinates2D to string
2916 *
2917 * @param[in] coord_2d Coordinates2D value to be converted
2918 *
2919 * @return String representing the corresponding Coordinates2D
2920 */
2921inline std::string to_string(const Coordinates2D &coord_2d)
2922{
2923 std::stringstream str;
2924 str << coord_2d;
2925 return str.str();
2926}
2927
2928/** Formatted output of the FuseBatchNormalizationType type.
2929 *
2930 * @param[out] os Output stream.
2931 * @param[in] fuse_type FuseBatchNormalizationType to output.
2932 *
2933 * @return Modified output stream.
2934 */
2935inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2936{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01002937 switch (fuse_type)
ramelg013ae3d882021-09-12 23:07:47 +01002938 {
2939 case FuseBatchNormalizationType::CONVOLUTION:
2940 os << "CONVOLUTION";
2941 break;
2942 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
2943 os << "DEPTHWISECONVOLUTION";
2944 break;
2945 default:
2946 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2947 }
2948 return os;
2949}
2950
2951/** Converts a @ref FuseBatchNormalizationType to string
2952 *
2953 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
2954 *
2955 * @return String representing the corresponding FuseBatchNormalizationType
2956 */
2957inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
2958{
2959 std::stringstream str;
2960 str << fuse_type;
2961 return str.str();
2962}
2963
ramelg01cbbb0382021-09-17 17:36:57 +01002964/** Formatted output of the SoftmaxKernelInfo type.
2965 *
2966 * @param[out] os Output stream.
2967 * @param[in] info SoftmaxKernelInfo to output.
2968 *
2969 * @return Modified output stream.
2970 */
2971inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
2972{
SiCongLi579ca842021-10-18 09:38:33 +01002973 os << "{beta=" << info.beta << ", "
2974 << "is_log=" << info.is_log << ", "
2975 << "input_data_type=" << info.input_data_type << ", "
2976 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01002977 return os;
2978}
2979
2980/** Converts a @ref SoftmaxKernelInfo to string
2981 *
2982 * @param[in] info SoftmaxKernelInfo value to be converted
2983 *
2984 * @return String representing the corresponding SoftmaxKernelInfo
2985 */
2986inline std::string to_string(const SoftmaxKernelInfo &info)
2987{
2988 std::stringstream str;
2989 str << info;
2990 return str.str();
2991}
2992
2993/** Formatted output of the ScaleKernelInfo type.
2994 *
2995 * @param[out] os Output stream.
2996 * @param[in] lstm_params LSTMParams to output.
2997 *
2998 * @return Modified output stream.
2999 */
3000template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003001::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003002{
ramelg014a6d9e82021-10-02 14:34:36 +01003003 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3004 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3005 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3006 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3007 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3008 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3009 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3010 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3011 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3012 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3013 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3014 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003015 << "cell_clip=" << lstm_params.cell_clip() << ", "
3016 << "projection_clip=" << lstm_params.projection_clip() << ", "
3017 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3018 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3019 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3020 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3021 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3022 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3023 << "has_projection=" << lstm_params.has_projection() << ", "
3024 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3025 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3026 return os;
3027}
3028
3029/** Converts a @ref LSTMParams to string
3030 *
3031 * @param[in] lstm_params LSTMParams<T> value to be converted
3032 *
3033 * @return String representing the corresponding LSTMParams
3034 */
3035template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003036std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003037{
3038 std::stringstream str;
3039 str << lstm_params;
3040 return str.str();
3041}
3042
3043/** Converts a @ref LSTMParams to string
3044 *
3045 * @param[in] num uint8_t value to be converted
3046 *
3047 * @return String representing the corresponding uint8_t
3048 */
3049inline std::string to_string(const uint8_t num)
3050{
3051 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3052 return ::std::to_string(static_cast<int>(num));
3053}
3054
ramelg014a6d9e82021-10-02 14:34:36 +01003055/** Available non maxima suppression types */
3056/** Formatted output of the NMSType type.
3057 *
3058 * @param[out] os Output stream.
3059 * @param[in] nms_type NMSType to output.
3060 *
3061 * @return Modified output stream.
3062 */
3063inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3064{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003065 switch (nms_type)
ramelg014a6d9e82021-10-02 14:34:36 +01003066 {
3067 case NMSType::LINEAR:
3068 os << "LINEAR";
3069 break;
3070 case NMSType::GAUSSIAN:
3071 os << "GAUSSIAN";
3072 break;
3073 case NMSType::ORIGINAL:
3074 os << "ORIGINAL";
3075 break;
3076 default:
3077 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3078 }
3079 return os;
3080}
3081
3082/** Converts a @ref NMSType to string
3083 *
3084 * @param[in] nms_type NMSType value to be converted
3085 *
3086 * @return String representing the corresponding NMSType
3087 */
3088inline std::string to_string(const NMSType nms_type)
3089{
3090 std::stringstream str;
3091 str << nms_type;
3092 return str.str();
3093}
3094
3095/** Formatted output of the BoxNMSLimitInfo type.
3096 *
3097 * @param[out] os Output stream.
3098 * @param[in] info BoxNMSLimitInfo to output.
3099 *
3100 * @return Modified output stream.
3101 */
3102inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3103{
SiCongLi579ca842021-10-18 09:38:33 +01003104 os << "{score_thresh=" << info.score_thresh() << ", "
3105 << "nms=" << info.nms() << ", "
3106 << "detections_per_im=" << info.detections_per_im() << ", "
3107 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3108 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3109 << "suppress_size=" << info.suppress_size() << ", "
3110 << "min_size=" << info.min_size() << ", "
3111 << "im_width=" << info.im_width() << ", "
3112 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003113 return os;
3114}
3115
3116/** Converts a @ref BoxNMSLimitInfo to string
3117 *
3118 * @param[in] info BoxNMSLimitInfo value to be converted
3119 *
3120 * @return String representing the corresponding BoxNMSLimitInfo
3121 */
3122inline std::string to_string(const BoxNMSLimitInfo &info)
3123{
3124 std::stringstream str;
3125 str << info;
3126 return str.str();
3127}
3128
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003129/** Converts a @ref DimensionRoundingType to string
3130 *
3131 * @param[in] rounding_type DimensionRoundingType value to be converted
3132 *
3133 * @return String representing the corresponding DimensionRoundingType
3134 */
3135inline std::string to_string(const DimensionRoundingType &rounding_type)
3136{
3137 std::stringstream str;
3138 str << rounding_type;
3139 return str.str();
3140}
3141
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003142/** Formatted output of the Conv3dInfo type.
3143 *
3144 * @param[out] os Output stream.
3145 * @param[in] conv3d_info Type to output.
3146 *
3147 * @return Modified output stream.
3148 */
3149inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3150{
3151 os << conv3d_info.stride;
3152 os << ";";
3153 os << conv3d_info.padding;
3154 os << ";";
3155 os << to_string(conv3d_info.act_info);
3156 os << ";";
3157 os << conv3d_info.dilation;
3158 os << ";";
3159 os << conv3d_info.round_type;
3160 os << ";";
3161 os << conv3d_info.enable_fast_math;
3162
3163 return os;
3164}
3165
3166/** Formatted output of the Conv3dInfo type.
3167 *
3168 * @param[in] conv3d_info Type to output.
3169 *
3170 * @return Formatted string.
3171 */
3172inline std::string to_string(const Conv3dInfo &conv3d_info)
3173{
3174 std::stringstream str;
3175 str << conv3d_info;
3176 return str.str();
3177}
3178
Ramy Elgammal91780022022-07-20 14:57:37 +01003179/** Formatted output of the arm_compute::WeightFormat type.
3180 *
3181 * @param[in] wf arm_compute::WeightFormat Type to output.
3182 *
3183 * @return Formatted string.
3184 */
3185inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003186{
Ramy Elgammal91780022022-07-20 14:57:37 +01003187#define __CASE_WEIGHT_FORMAT(wf) \
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003188 case WeightFormat::wf: \
3189 return #wf;
3190 switch (wf)
Ramy Elgammal91780022022-07-20 14:57:37 +01003191 {
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003192 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3193 __CASE_WEIGHT_FORMAT(ANY)
3194 __CASE_WEIGHT_FORMAT(OHWI)
3195 __CASE_WEIGHT_FORMAT(OHWIo2)
3196 __CASE_WEIGHT_FORMAT(OHWIo4)
3197 __CASE_WEIGHT_FORMAT(OHWIo8)
3198 __CASE_WEIGHT_FORMAT(OHWIo16)
3199 __CASE_WEIGHT_FORMAT(OHWIo32)
3200 __CASE_WEIGHT_FORMAT(OHWIo64)
3201 __CASE_WEIGHT_FORMAT(OHWIo128)
3202 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3203 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3204 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3205 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3206 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3207 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3208 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3209 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3210 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3211 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3212 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3213 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3214 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3215 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3216 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3217 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3218 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3219 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3220 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3221 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3222 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3223 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3224 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3225 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3226 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3227 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003228 default:
3229 return "invalid value";
3230 }
3231#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003232}
3233
Ramy Elgammal91780022022-07-20 14:57:37 +01003234/** Formatted output of the arm_compute::WeightFormat type.
3235 *
3236 * @param[out] os Output stream.
3237 * @param[in] wf WeightFormat to output.
3238 *
3239 * @return Modified output stream.
3240 */
3241inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3242{
3243 os << to_string(wf);
3244 return os;
3245}
3246
3247/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3248 *
3249 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3250 *
3251 * @return Formatted string.
3252 */
3253inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003254{
3255 std::stringstream str;
3256 str << "[Input shape = " << std::get<0>(values);
3257 str << ", ";
3258 str << "Expected output shape = " << std::get<1>(values);
3259
3260 str << ", ";
3261 str << "WeightFormat = " << std::get<2>(values) << "]";
3262 return str.str();
3263}
3264
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003265/** Formatted output of the Padding2D type.
3266 *
3267 * @param[out] os Output stream.
3268 * @param[in] padding2d Padding info for 2D dimension shape.
3269 *
3270 * @return Modified output stream.
3271 */
3272inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3273{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003274 os << padding2d.left << "," << padding2d.right << "," << padding2d.top << "," << padding2d.bottom;
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003275 return os;
3276}
3277
3278/** Converts a @ref Padding2D to string
3279 *
3280 * @param[in] padding2d Padding2D value to be converted
3281 *
3282 * @return String representing the corresponding Padding2D
3283 */
3284inline std::string to_string(const Padding2D &padding2d)
3285{
3286 std::stringstream str;
3287 str << padding2d;
3288 return str.str();
3289}
3290
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003291/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3292 *
3293 * @param[out] os Output stream.
3294 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3295 *
3296 * @return Modified output stream.
3297 */
3298inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3299{
3300 os << "Pool2dAttributes="
3301 << "["
3302 << "PoolingType=" << pool2d_attr.pool_type() << ","
3303 << "PoolSize=" << pool2d_attr.pool_size() << ","
3304 << "Padding=" << pool2d_attr.pad() << ","
3305 << "Stride=" << pool2d_attr.stride() << ","
3306 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3307
3308 return os;
3309}
3310
3311/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3312 *
3313 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3314 *
3315 * @return Formatted string.
3316 */
3317inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3318{
3319 std::stringstream str;
3320 str << pool2d_attr;
3321 return str.str();
3322}
3323
3324/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3325 *
3326 * @param[out] os Output stream
3327 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3328 */
3329inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3330{
3331 os << "Settings="
3332 << "["
3333 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3334 return os;
3335}
3336
3337/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3338 *
3339 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3340 *
3341 * @return Formatted string.
3342 */
3343inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3344{
3345 std::stringstream str;
3346 str << settings;
3347 return str.str();
3348}
3349
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003350/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3351 *
3352 * @param[out] os Output stream.
3353 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3354 *
3355 * @return Modified output stream.
3356 */
3357inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3358{
3359 os << "Conv2dAttributes="
3360 << "["
3361 << "Padding=" << conv2d_attr.pad() << ", "
3362 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003363 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003364
3365 return os;
3366}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003367
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003368/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3369 *
3370 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3371 *
3372 * @return Formatted string.
3373 */
3374inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3375{
3376 std::stringstream str;
3377 str << conv2d_attr;
3378 return str.str();
3379}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003380
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003381/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3382 *
3383 * @param[out] os Output stream.
3384 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3385 *
3386 * @return Modified output stream.
3387 */
3388inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3389{
3390 os << "CastAttributes="
3391 << "["
3392 << "Data Type=" << cast_attr.data_type() << ", "
3393 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3394
3395 return os;
3396}
3397/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3398 *
3399 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3400 *
3401 * @return Formatted string.
3402 */
3403inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3404{
3405 std::stringstream str;
3406 str << cast_attr;
3407 return str.str();
3408}
3409
Gunes Bayir7dc02342022-11-21 21:46:50 +00003410/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3411 *
3412 * @param[out] os Output stream.
3413 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3414 *
3415 * @return Modified output stream.
3416 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003417inline ::std::ostream &operator<<(::std::ostream &os,
3418 const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
Gunes Bayir7dc02342022-11-21 21:46:50 +00003419{
3420 os << "DepthwiseConv2dAttributes="
3421 << "["
3422 << "Padding=" << dw_conv2d_attr.pad() << ", "
3423 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3424 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3425 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3426 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3427
3428 return os;
3429}
3430/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3431 *
3432 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3433 *
3434 * @return Formatted string.
3435 */
3436inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3437{
3438 std::stringstream str;
3439 str << dw_conv2d_attr;
3440 return str.str();
3441}
3442
Jakub Sujak32741722022-11-25 16:43:18 +00003443/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3444 *
3445 * @param[out] os Output stream.
3446 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3447 *
3448 * @return Modified output stream.
3449 */
3450inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3451{
3452 os << "ClampAttributes="
3453 << "["
3454 << "Min value=" << clamp_attr.min_val() << ", "
3455 << "Max value=" << clamp_attr.max_val() << "]";
3456 return os;
3457}
3458/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3459 *
3460 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3461 *
3462 * @return Formatted string.
3463 */
3464inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3465{
3466 std::stringstream str;
3467 str << clamp_attr;
3468 return str.str();
3469}
3470
Jakub Sujak8ae57142022-12-02 16:09:06 +00003471/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3472 *
3473 * @param[out] os Output stream.
3474 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3475 *
3476 * @return Modified output stream.
3477 */
3478inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3479{
3480 os << "ResizeAttributes="
3481 << "["
3482 << "AlignCorners=" << resize_attr.align_corners() << ", "
3483 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3484 << "OutputHeight=" << resize_attr.output_height() << ", "
3485 << "OutputWidth=" << resize_attr.output_width() << ", "
3486 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3487 return os;
3488}
3489
3490/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3491 *
3492 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3493 *
3494 * @return Formatted string.
3495 */
3496inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3497{
3498 std::stringstream str;
3499 str << resize_attr;
3500 return str.str();
3501}
3502
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003503/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3504 *
3505 * @param[out] os Output stream.
3506 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3507 *
3508 * @return Modified output stream.
3509 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003510inline ::std::ostream &operator<<(::std::ostream &os,
3511 const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003512{
Jakub Sujak7359a872023-01-05 14:24:13 +00003513 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003514 << "["
3515 << "Beta=" << softmax_attr.beta() << ", "
3516 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3517 << "Axis=" << softmax_attr.axis() << "]";
3518 return os;
3519}
3520/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3521 *
3522 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3523 *
3524 * @return Formatted string.
3525 */
3526inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3527{
3528 std::stringstream str;
3529 str << softmax_attr;
3530 return str.str();
3531}
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003532/** Formatted output of the arm_compute::MatMulInfo type.
3533 *
3534 * @param[out] os Output stream.
3535 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3536 *
3537 * @return Modified output stream.
3538 */
3539inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulInfo &matmul_info)
3540{
3541 os << "MatMulKernelInfo="
3542 << "["
3543 << "adj_lhs=" << matmul_info.adj_lhs() << ", "
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +01003544 << "adj_rhs=" << matmul_info.adj_rhs() << "] ";
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003545 return os;
3546}
3547/** Formatted output of the arm_compute::MatMulInfo type.
3548 *
3549 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3550 *
3551 * @return Formatted string.
3552 */
3553inline std::string to_string(const arm_compute::MatMulInfo &matmul_info)
3554{
3555 std::stringstream str;
3556 str << matmul_info;
3557 return str.str();
3558}
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003559
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003560/** Formatted output of the arm_compute::MatMulKernelInfo type.
3561 *
3562 * @param[out] os Output stream.
3563 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3564 *
3565 * @return Modified output stream.
3566 */
3567inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulKernelInfo &matmul_info)
3568{
3569 os << "MatMulKernelInfo="
3570 << "["
3571 << "adj_lhs=" << matmul_info.adj_lhs << ", "
3572 << "adj_rhs=" << matmul_info.adj_rhs << ", "
3573 << "M0=" << matmul_info.m0 << ", "
3574 << "N0=" << matmul_info.n0 << ", "
3575 << "K0=" << matmul_info.k0 << ", "
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003576 << "export_rhs_to_cl_image=" << matmul_info.export_rhs_to_cl_image << "]";
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003577
3578 return os;
3579}
3580/** Formatted output of the arm_compute::MatMulKernelInfo type.
3581 *
3582 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3583 *
3584 * @return Formatted string.
3585 */
3586inline std::string to_string(const arm_compute::MatMulKernelInfo &matmul_info)
3587{
3588 std::stringstream str;
3589 str << matmul_info;
3590 return str.str();
3591}
3592
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003593/** Formatted output of the arm_compute::CpuMatMulSettings type.
3594 *
3595 * @param[out] os Output stream.
3596 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3597 *
3598 * @return Modified output stream.
3599 */
3600inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::CpuMatMulSettings &settings)
3601{
3602 os << "CpuMatMulSettings="
3603 << "["
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +01003604 << "fast_math=" << settings.fast_math() << "]";
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003605
3606 return os;
3607}
3608/** Formatted output of the arm_compute::CpuMatMulSettings type.
3609 *
3610 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3611 *
3612 * @return Formatted string.
3613 */
3614inline std::string to_string(const arm_compute::CpuMatMulSettings &settings)
3615{
3616 std::stringstream str;
3617 str << settings;
3618 return str.str();
3619}
3620
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003621} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003622
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01003623#endif // ACL_UTILS_TYPEPRINTER_H