blob: 0df320d7e07769189cc0d70df27fa4b1cecd2064 [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 */
Anthony Barbier4dbc0a92018-08-27 13:39:47 +010024#ifndef __ARM_COMPUTE_TYPE_PRINTER_H__
25#define __ARM_COMPUTE_TYPE_PRINTER_H__
Anthony Barbier6ff3b192017-09-04 18:44:23 +010026
ramelg01cbbb0382021-09-17 17:36:57 +010027#ifdef ARM_COMPUTE_OPENCL_ENABLED
28#include "arm_compute/core/CL/ICLTensor.h"
29#endif /* ARM_COMPUTE_OPENCL_ENABLED */
30
Matthew Benthamf1aeab92023-05-30 13:35:34 +000031#include "arm_compute/core/ConvolutionInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032#include "arm_compute/core/Dimensions.h"
33#include "arm_compute/core/Error.h"
Matthew Benthamf1aeab92023-05-30 13:35:34 +000034#include "arm_compute/core/FullyConnectedLayerInfo.h"
35#include "arm_compute/core/GEMMInfo.h"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010036#include "arm_compute/core/GPUTarget.h"
morgolockaba2f912020-05-05 16:28:19 +010037#include "arm_compute/core/KernelDescriptors.h"
John Richardson25f23682017-11-27 14:35:09 +000038#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010039#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000040#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010041#include "arm_compute/core/Types.h"
Matthew Benthamf1aeab92023-05-30 13:35:34 +000042#include "arm_compute/core/MatMulInfo.h"
SiCongLi1af54162021-10-06 15:25:57 +010043#include "arm_compute/core/experimental/IPostOp.h"
SiCongLi31778612021-11-12 17:33:45 +000044#include "arm_compute/core/experimental/PostOps.h"
Gunes Bayir1dc6ff12022-12-06 20:48:31 +000045#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
Jakub Sujak32741722022-11-25 16:43:18 +000046#include "arm_compute/dynamic_fusion/sketch/attributes/ClampAttributes.h"
SiCong Li5a63d1e2023-01-06 16:28:57 +000047#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000048#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000049#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
Jakub Sujak8ae57142022-12-02 16:09:06 +000050#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Gunes Bayiraecb5d92022-12-18 21:31:29 +000051#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000052#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010053#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000054#include "arm_compute/runtime/CL/CLTypes.h"
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"
ramelg01cbbb0382021-09-17 17:36:57 +010057#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000058#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000059#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010060#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010061#include <sstream>
62#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063
64namespace arm_compute
65{
Anthony Barbierb940fd62018-06-04 14:14:32 +010066/** Formatted output if arg is not null
67 *
68 * @param[in] arg Object to print
69 *
70 * @return String representing arg.
71 */
72template <typename T>
73std::string to_string_if_not_null(T *arg)
74{
75 if(arg == nullptr)
76 {
77 return "nullptr";
78 }
79 else
80 {
81 return to_string(*arg);
82 }
83}
Anthony Barbierb4670212018-05-18 16:55:39 +010084
ramelg014a6d9e82021-10-02 14:34:36 +010085/** Fallback method: try to use std::to_string:
86 *
87 * @param[in] val Value to convert to string
88 *
89 * @return String representing val.
90 */
91template <typename T>
92inline std::string to_string(const T &val)
93{
94 return support::cpp11::to_string(val);
95}
96
ramelg01b1ba1e32021-09-25 11:53:26 +010097/** Formatted output of a vector of objects.
98 *
ramelg014a6d9e82021-10-02 14:34:36 +010099 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
100 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
101 *
ramelg01b1ba1e32021-09-25 11:53:26 +0100102 * @param[out] os Output stream
103 * @param[in] args Vector of objects to print
104 *
105 * @return Modified output stream.
106 */
107template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100108::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100109{
110 const size_t max_print_size = 5U;
111
112 os << "[";
113 bool first = true;
114 size_t i;
115 for(i = 0; i < args.size(); ++i)
116 {
117 if(i == max_print_size)
118 {
119 break;
120 }
121 if(first)
122 {
123 first = false;
124 }
125 else
126 {
127 os << ", ";
128 }
ramelg014a6d9e82021-10-02 14:34:36 +0100129 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100130 }
131 if(i < args.size())
132 {
133 os << ", ...";
134 }
135 os << "]";
136 return os;
137}
138
ramelg014a6d9e82021-10-02 14:34:36 +0100139/** Formatted output of a vector of objects.
140 *
141 * @param[in] args Vector of objects to print
142 *
143 * @return String representing args.
144 */
145template <typename T>
146std::string to_string(const std::vector<T> &args)
147{
148 std::stringstream str;
149 str << args;
150 return str.str();
151}
152
SiCongLi1af54162021-10-06 15:25:57 +0100153/** @name (EXPERIMENTAL_POST_OPS)
154 * @{
155 */
156/** Formmated output of the @ref experimental::PostOpType type
157 *
158 * @param[out] os Output stream.
159 * @param[in] post_op_type Type to output.
160 *
161 * @return Modified output stream.
162 */
163inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
164{
165 os << "type=";
166 switch(post_op_type)
167 {
168 case experimental::PostOpType::Activation:
169 {
170 os << "Activation";
171 break;
172 }
173 case experimental::PostOpType::Eltwise_Add:
174 {
175 os << "Eltwise_Add";
176 break;
177 }
ramelg016049eda2021-10-29 10:52:53 +0100178 case experimental::PostOpType::Eltwise_PRelu:
179 {
180 os << "Eltwise_PRelu";
181 break;
182 }
SiCongLi1af54162021-10-06 15:25:57 +0100183 default:
184 {
185 ARM_COMPUTE_ERROR("Unsupported PostOpType");
186 break;
187 }
188 }
189 return os;
190}
191/** Converts a @ref experimental::PostOpType to string
192 *
193 * @param[in] post_op_type PostOpType value to be converted
194 *
195 * @return String representing the corresponding PostOpType
196 */
197inline std::string to_string(experimental::PostOpType post_op_type)
198{
199 std::stringstream str;
200 str << post_op_type;
201 return str.str();
202}
203/** Formatted output of the @ref experimental::IPostOp type.
204 *
205 * @param[out] os Output stream.
206 * @param[in] post_op Type to output.
207 *
208 * @return Modified output stream.
209 */
210template <typename T>
211inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
212{
213 os << "<";
214 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100215 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100216 switch(post_op.type())
217 {
218 case experimental::PostOpType::Activation:
219 {
220 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
221 os << "act_info=" << &(_post_op->_act_info);
222 break;
223 }
224 case experimental::PostOpType::Eltwise_Add:
225 {
226 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
227 os << "convert_policy=" << _post_op->_policy;
228 break;
229 }
ramelg016049eda2021-10-29 10:52:53 +0100230 case experimental::PostOpType::Eltwise_PRelu:
231 {
232 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
233 os << "convert_policy=" << _post_op->_policy;
234 break;
235 }
SiCongLi1af54162021-10-06 15:25:57 +0100236 default:
237 {
238 ARM_COMPUTE_ERROR("Unsupported PostOpType");
239 break;
240 }
241 }
242 os << ">";
243 return os;
244}
245/** Converts an @ref experimental::IPostOp to string
246 *
247 * @param[in] post_op IPostOp value to be converted
248 *
249 * @return String representing the corresponding IPostOp
250 */
251template <typename T>
252inline std::string to_string(const experimental::IPostOp<T> &post_op)
253{
254 std::stringstream str;
255 str << post_op;
256 return str.str();
257}
258/** Formatted output of the @ref experimental::PostOpList type.
259 *
260 * @param[out] os Output stream.
261 * @param[in] post_ops Type to output.
262 *
263 * @return Modified output stream.
264 */
265template <typename T>
266inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
267{
268 os << "[";
269 for(const auto &post_op : post_ops.get_list())
270 {
271 os << *post_op << ",";
272 }
273 os << "]";
274 return os;
275}
276/** Converts a @ref experimental::PostOpList to string
277 *
278 * @param[in] post_ops PostOpList value to be converted
279 *
280 * @return String representing the corresponding PostOpList
281 */
282template <typename T>
283inline std::string to_string(const experimental::PostOpList<T> &post_ops)
284{
285 std::stringstream str;
286 str << post_ops;
287 return str.str();
288}
289/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
290
Alex Gildayc357c472018-03-21 13:54:09 +0000291/** Formatted output of the Dimensions type.
292 *
293 * @param[out] os Output stream.
294 * @param[in] dimensions Type to output.
295 *
296 * @return Modified output stream.
297 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298template <typename T>
299inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
300{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100301 if(dimensions.num_dimensions() > 0)
302 {
303 os << dimensions[0];
304
305 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
306 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100307 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100308 }
309 }
310
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100311 return os;
312}
313
Alex Gildayc357c472018-03-21 13:54:09 +0000314/** Formatted output of the RoundingPolicy type.
315 *
316 * @param[out] os Output stream.
317 * @param[in] rounding_policy Type to output.
318 *
319 * @return Modified output stream.
320 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100321inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100322{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100323 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100324 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100325 case RoundingPolicy::TO_ZERO:
326 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100327 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100328 case RoundingPolicy::TO_NEAREST_UP:
329 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100330 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100331 case RoundingPolicy::TO_NEAREST_EVEN:
332 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100333 break;
334 default:
335 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
336 }
337
338 return os;
339}
340
Alex Gildayc357c472018-03-21 13:54:09 +0000341/** Formatted output of the WeightsInfo type.
342 *
343 * @param[out] os Output stream.
344 * @param[in] weights_info Type to output.
345 *
346 * @return Modified output stream.
347 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100348inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100349{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100350 os << weights_info.are_reshaped() << ";";
351 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100352
353 return os;
354}
355
Alex Gildayc357c472018-03-21 13:54:09 +0000356/** Formatted output of the ROIPoolingInfo type.
357 *
358 * @param[out] os Output stream.
359 * @param[in] pool_info Type to output.
360 *
361 * @return Modified output stream.
362 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100363inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100364{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100365 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100366 return os;
367}
368
giuros0118870812018-09-13 09:31:40 +0100369/** Formatted output of the ROIPoolingInfo type.
370 *
371 * @param[in] pool_info Type to output.
372 *
373 * @return Formatted string.
374 */
375inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
376{
377 std::stringstream str;
378 str << pool_info;
379 return str.str();
380}
381
morgolockaba2f912020-05-05 16:28:19 +0100382/** Formatted output of the GEMMKernelInfo type.
383 *
384 * @param[out] os Output stream.
385 * @param[in] gemm_info Type to output.
386 *
387 * @return Modified output stream.
388 */
389inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
390{
SiCongLi579ca842021-10-18 09:38:33 +0100391 os << "( m=" << gemm_info.m;
392 os << " n=" << gemm_info.n;
393 os << " k=" << gemm_info.k;
394 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
395 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
396 os << " broadcast_bias=" << gemm_info.broadcast_bias;
397 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
398 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
399 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
400 os << " a_offset=" << gemm_info.a_offset;
401 os << " b_offset=" << gemm_info.b_offset;
402 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100403 os << ")";
404 return os;
405}
406
407/** Formatted output of the GEMMLHSMatrixInfo type.
408 *
409 * @param[out] os Output stream.
410 * @param[in] gemm_info Type to output.
411 *
412 * @return Modified output stream.
413 */
414inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
415{
SiCongLi579ca842021-10-18 09:38:33 +0100416 os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
morgolockaba2f912020-05-05 16:28:19 +0100417 return os;
418}
419
420/** Formatted output of the GEMMRHSMatrixInfo type.
421 *
422 * @param[out] os Output stream.
423 * @param[in] gemm_info Type to output.
424 *
425 * @return Modified output stream.
426 */
427inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
428{
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +0000429 os << "( n0=" << (unsigned int)gemm_info.n0 << " k0=" << gemm_info.k0 << " h0=" << gemm_info.h0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << " exp_img=" <<
430 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100431 return os;
432}
433
434/** Formatted output of the GEMMRHSMatrixInfo type.
435 *
436 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
437 *
438 * @return Formatted string.
439 */
440inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
441{
442 std::stringstream str;
443 str << gemm_info;
444 return str.str();
445}
446
447/** Formatted output of the GEMMLHSMatrixInfo type.
448 *
449 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
450 *
451 * @return Formatted string.
452 */
453inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
454{
455 std::stringstream str;
456 str << gemm_info;
457 return str.str();
458}
459
460/** Formatted output of the GEMMKernelInfo type.
461 *
462 * @param[in] gemm_info GEMMKernelInfo Type to output.
463 *
464 * @return Formatted string.
465 */
466inline std::string to_string(const GEMMKernelInfo &gemm_info)
467{
468 std::stringstream str;
469 str << gemm_info;
470 return str.str();
471}
472
giuros01c04a0e82018-10-03 12:44:35 +0100473/** Formatted output of the BoundingBoxTransformInfo type.
474 *
475 * @param[out] os Output stream.
476 * @param[in] bbox_info Type to output.
477 *
478 * @return Modified output stream.
479 */
480inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
481{
482 auto weights = bbox_info.weights();
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +0000483 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
484 "})";
giuros01c04a0e82018-10-03 12:44:35 +0100485 return os;
486}
487
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100488#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100489inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100490{
Matthew Benthamf66a7e82023-06-15 14:55:35 +0000491 return os << float(v);
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100492}
Ramy Elgammal91780022022-07-20 14:57:37 +0100493#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100494
giuros01c04a0e82018-10-03 12:44:35 +0100495/** Formatted output of the BoundingBoxTransformInfo type.
496 *
497 * @param[in] bbox_info Type to output.
498 *
499 * @return Formatted string.
500 */
501inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
502{
503 std::stringstream str;
504 str << bbox_info;
505 return str.str();
506}
507
Manuel Bottini5209be52019-02-13 16:34:56 +0000508/** Formatted output of the ComputeAnchorsInfo type.
509 *
510 * @param[out] os Output stream.
511 * @param[in] anchors_info Type to output.
512 *
513 * @return Modified output stream.
514 */
515inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
516{
517 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
518 return os;
519}
520
521/** Formatted output of the ComputeAnchorsInfo type.
522 *
523 * @param[in] anchors_info Type to output.
524 *
525 * @return Formatted string.
526 */
527inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
528{
529 std::stringstream str;
530 str << anchors_info;
531 return str.str();
532}
533
534/** Formatted output of the GenerateProposalsInfo type.
535 *
536 * @param[out] os Output stream.
537 * @param[in] proposals_info Type to output.
538 *
539 * @return Modified output stream.
540 */
541inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
542{
543 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
544 return os;
545}
546
547/** Formatted output of the GenerateProposalsInfo type.
548 *
549 * @param[in] proposals_info Type to output.
550 *
551 * @return Formatted string.
552 */
553inline std::string to_string(const GenerateProposalsInfo &proposals_info)
554{
555 std::stringstream str;
556 str << proposals_info;
557 return str.str();
558}
559
Alex Gildayc357c472018-03-21 13:54:09 +0000560/** Formatted output of the QuantizationInfo type.
561 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100562 * @param[out] os Output stream.
563 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000564 *
565 * @return Modified output stream.
566 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100567inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700568{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100569 const UniformQuantizationInfo uqinfo = qinfo.uniform();
570 os << "Scale:" << uqinfo.scale << "~";
571 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700572 return os;
573}
574
Alex Gildayc357c472018-03-21 13:54:09 +0000575/** Formatted output of the QuantizationInfo type.
576 *
577 * @param[in] quantization_info Type to output.
578 *
579 * @return Formatted string.
580 */
Chunosovd621bca2017-11-03 17:33:15 +0700581inline std::string to_string(const QuantizationInfo &quantization_info)
582{
583 std::stringstream str;
584 str << quantization_info;
585 return str.str();
586}
587
Alex Gildayc357c472018-03-21 13:54:09 +0000588/** Formatted output of the activation function type.
589 *
590 * @param[out] os Output stream.
591 * @param[in] act_function Type to output.
592 *
593 * @return Modified output stream.
594 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100595inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
596{
597 switch(act_function)
598 {
599 case ActivationLayerInfo::ActivationFunction::ABS:
600 os << "ABS";
601 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100602 case ActivationLayerInfo::ActivationFunction::LINEAR:
603 os << "LINEAR";
604 break;
605 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
606 os << "LOGISTIC";
607 break;
608 case ActivationLayerInfo::ActivationFunction::RELU:
609 os << "RELU";
610 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100611 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
612 os << "BOUNDED_RELU";
613 break;
614 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
615 os << "LEAKY_RELU";
616 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100617 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
618 os << "SOFT_RELU";
619 break;
620 case ActivationLayerInfo::ActivationFunction::SQRT:
621 os << "SQRT";
622 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100623 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
624 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000625 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100626 case ActivationLayerInfo::ActivationFunction::ELU:
627 os << "ELU";
628 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100629 case ActivationLayerInfo::ActivationFunction::SQUARE:
630 os << "SQUARE";
631 break;
632 case ActivationLayerInfo::ActivationFunction::TANH:
633 os << "TANH";
634 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100635 case ActivationLayerInfo::ActivationFunction::IDENTITY:
636 os << "IDENTITY";
637 break;
morgolock07df3d42020-02-27 11:46:28 +0000638 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
639 os << "HARD_SWISH";
640 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100641 case ActivationLayerInfo::ActivationFunction::SWISH:
642 os << "SWISH";
643 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400644 case ActivationLayerInfo::ActivationFunction::GELU:
645 os << "GELU";
646 break;
morgolock07df3d42020-02-27 11:46:28 +0000647
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100648 default:
649 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
650 }
651
652 return os;
653}
654
Alex Gildayc357c472018-03-21 13:54:09 +0000655/** Formatted output of the activation function info type.
656 *
SiCongLi1af54162021-10-06 15:25:57 +0100657 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000658 *
659 * @return Formatted string.
660 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100661inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100662{
663 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000664 if(info.enabled())
665 {
666 str << info.activation();
667 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100668 return str.str();
669}
670
SiCongLi1af54162021-10-06 15:25:57 +0100671/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100672 *
SiCongLi1af54162021-10-06 15:25:57 +0100673 * @param[out] os Output stream.
674 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100675 *
676 * @return Formatted string.
677 */
SiCongLi1af54162021-10-06 15:25:57 +0100678inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100679{
ramelg013ae3d882021-09-12 23:07:47 +0100680 if(info != nullptr)
681 {
ramelg013ae3d882021-09-12 23:07:47 +0100682 if(info->enabled())
683 {
SiCongLi1af54162021-10-06 15:25:57 +0100684 os << info->activation();
685 os << "(";
686 os << "VAL_A=" << info->a() << ",";
687 os << "VAL_B=" << info->b();
688 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100689 }
SiCongLi1af54162021-10-06 15:25:57 +0100690 else
691 {
692 os << "disabled";
693 }
ramelg013ae3d882021-09-12 23:07:47 +0100694 }
SiCongLi1af54162021-10-06 15:25:57 +0100695 else
696 {
697 os << "nullptr";
698 }
699 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100700}
701
Alex Gildayc357c472018-03-21 13:54:09 +0000702/** Formatted output of the activation function type.
703 *
704 * @param[in] function Type to output.
705 *
706 * @return Formatted string.
707 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100708inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
709{
710 std::stringstream str;
711 str << function;
712 return str.str();
713}
714
Alex Gildayc357c472018-03-21 13:54:09 +0000715/** Formatted output of the NormType type.
716 *
717 * @param[out] os Output stream.
718 * @param[in] norm_type Type to output.
719 *
720 * @return Modified output stream.
721 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100722inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
723{
724 switch(norm_type)
725 {
726 case NormType::CROSS_MAP:
727 os << "CROSS_MAP";
728 break;
729 case NormType::IN_MAP_1D:
730 os << "IN_MAP_1D";
731 break;
732 case NormType::IN_MAP_2D:
733 os << "IN_MAP_2D";
734 break;
735 default:
736 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
737 }
738
739 return os;
740}
741
Alex Gildayc357c472018-03-21 13:54:09 +0000742/** Formatted output of @ref NormalizationLayerInfo.
743 *
744 * @param[in] info Type to output.
745 *
746 * @return Formatted string.
747 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100748inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100749{
750 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000751 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100752 return str.str();
753}
754
Alex Gildayc357c472018-03-21 13:54:09 +0000755/** Formatted output of @ref NormalizationLayerInfo.
756 *
757 * @param[out] os Output stream.
758 * @param[in] info Type to output.
759 *
760 * @return Modified output stream.
761 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100762inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
763{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000764 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100765 return os;
766}
767
Alex Gildayc357c472018-03-21 13:54:09 +0000768/** Formatted output of the PoolingType type.
769 *
770 * @param[out] os Output stream.
771 * @param[in] pool_type Type to output.
772 *
773 * @return Modified output stream.
774 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100775inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
776{
777 switch(pool_type)
778 {
779 case PoolingType::AVG:
780 os << "AVG";
781 break;
782 case PoolingType::MAX:
783 os << "MAX";
784 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100785 case PoolingType::L2:
786 os << "L2";
787 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100788 default:
789 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
790 }
791
792 return os;
793}
794
Alex Gildayc357c472018-03-21 13:54:09 +0000795/** Formatted output of @ref PoolingLayerInfo.
796 *
797 * @param[out] os Output stream.
798 * @param[in] info Type to output.
799 *
800 * @return Modified output stream.
801 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100802inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
803{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000804 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100805
806 return os;
807}
808
Alex Gildayc357c472018-03-21 13:54:09 +0000809/** Formatted output of @ref RoundingPolicy.
810 *
811 * @param[in] rounding_policy Type to output.
812 *
813 * @return Formatted string.
814 */
John Richardsondd715f22017-09-18 16:10:48 +0100815inline std::string to_string(const RoundingPolicy &rounding_policy)
816{
817 std::stringstream str;
818 str << rounding_policy;
819 return str.str();
820}
821
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000822/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000823/** Formatted output of the DataLayout type.
824 *
825 * @param[out] os Output stream.
826 * @param[in] data_layout Type to output.
827 *
828 * @return Modified output stream.
829 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000830inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
831{
832 switch(data_layout)
833 {
834 case DataLayout::UNKNOWN:
835 os << "UNKNOWN";
836 break;
837 case DataLayout::NHWC:
838 os << "NHWC";
839 break;
840 case DataLayout::NCHW:
841 os << "NCHW";
842 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100843 case DataLayout::NDHWC:
844 os << "NDHWC";
845 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100846 case DataLayout::NCDHW:
847 os << "NCDHW";
848 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000849 default:
850 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
851 }
852
853 return os;
854}
855
Alex Gildayc357c472018-03-21 13:54:09 +0000856/** Formatted output of the DataLayout type.
857 *
858 * @param[in] data_layout Type to output.
859 *
860 * @return Formatted string.
861 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000862inline std::string to_string(const arm_compute::DataLayout &data_layout)
863{
864 std::stringstream str;
865 str << data_layout;
866 return str.str();
867}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000868/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000869
Georgios Pinitase2220552018-07-20 13:23:44 +0100870/** Formatted output of the DataLayoutDimension type.
871 *
872 * @param[out] os Output stream.
873 * @param[in] data_layout_dim Data layout dimension to print.
874 *
875 * @return Modified output stream.
876 */
877inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
878{
879 switch(data_layout_dim)
880 {
881 case DataLayoutDimension::WIDTH:
882 os << "WIDTH";
883 break;
884 case DataLayoutDimension::HEIGHT:
885 os << "HEIGHT";
886 break;
887 case DataLayoutDimension::CHANNEL:
888 os << "CHANNEL";
889 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100890 case DataLayoutDimension::DEPTH:
891 os << "DEPTH";
892 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100893 case DataLayoutDimension::BATCHES:
894 os << "BATCHES";
895 break;
896 default:
897 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
898 }
899 return os;
900}
901
Alex Gildayc357c472018-03-21 13:54:09 +0000902/** Formatted output of the DataType type.
903 *
904 * @param[out] os Output stream.
905 * @param[in] data_type Type to output.
906 *
907 * @return Modified output stream.
908 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100909inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
910{
911 switch(data_type)
912 {
913 case DataType::UNKNOWN:
914 os << "UNKNOWN";
915 break;
916 case DataType::U8:
917 os << "U8";
918 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100919 case DataType::QSYMM8:
920 os << "QSYMM8";
921 break;
Chunosovd621bca2017-11-03 17:33:15 +0700922 case DataType::QASYMM8:
923 os << "QASYMM8";
924 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000925 case DataType::QASYMM8_SIGNED:
926 os << "QASYMM8_SIGNED";
927 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100928 case DataType::QSYMM8_PER_CHANNEL:
929 os << "QSYMM8_PER_CHANNEL";
930 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100931 case DataType::S8:
932 os << "S8";
933 break;
934 case DataType::U16:
935 os << "U16";
936 break;
937 case DataType::S16:
938 os << "S16";
939 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100940 case DataType::QSYMM16:
941 os << "QSYMM16";
942 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100943 case DataType::QASYMM16:
944 os << "QASYMM16";
945 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100946 case DataType::U32:
947 os << "U32";
948 break;
949 case DataType::S32:
950 os << "S32";
951 break;
952 case DataType::U64:
953 os << "U64";
954 break;
955 case DataType::S64:
956 os << "S64";
957 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000958 case DataType::BFLOAT16:
959 os << "BFLOAT16";
960 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100961 case DataType::F16:
962 os << "F16";
963 break;
964 case DataType::F32:
965 os << "F32";
966 break;
967 case DataType::F64:
968 os << "F64";
969 break;
970 case DataType::SIZET:
971 os << "SIZET";
972 break;
973 default:
974 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
975 }
976
977 return os;
978}
979
Alex Gildayc357c472018-03-21 13:54:09 +0000980/** Formatted output of the DataType type.
981 *
982 * @param[in] data_type Type to output.
983 *
984 * @return Formatted string.
985 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100986inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100987{
988 std::stringstream str;
989 str << data_type;
990 return str.str();
991}
992
Alex Gildayc357c472018-03-21 13:54:09 +0000993/** Formatted output of the Format type.
994 *
995 * @param[out] os Output stream.
996 * @param[in] format Type to output.
997 *
998 * @return Modified output stream.
999 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001000inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
1001{
1002 switch(format)
1003 {
1004 case Format::UNKNOWN:
1005 os << "UNKNOWN";
1006 break;
1007 case Format::U8:
1008 os << "U8";
1009 break;
1010 case Format::S16:
1011 os << "S16";
1012 break;
1013 case Format::U16:
1014 os << "U16";
1015 break;
1016 case Format::S32:
1017 os << "S32";
1018 break;
1019 case Format::U32:
1020 os << "U32";
1021 break;
1022 case Format::F16:
1023 os << "F16";
1024 break;
1025 case Format::F32:
1026 os << "F32";
1027 break;
1028 case Format::UV88:
1029 os << "UV88";
1030 break;
1031 case Format::RGB888:
1032 os << "RGB888";
1033 break;
1034 case Format::RGBA8888:
1035 os << "RGBA8888";
1036 break;
1037 case Format::YUV444:
1038 os << "YUV444";
1039 break;
1040 case Format::YUYV422:
1041 os << "YUYV422";
1042 break;
1043 case Format::NV12:
1044 os << "NV12";
1045 break;
1046 case Format::NV21:
1047 os << "NV21";
1048 break;
1049 case Format::IYUV:
1050 os << "IYUV";
1051 break;
1052 case Format::UYVY422:
1053 os << "UYVY422";
1054 break;
1055 default:
1056 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1057 }
1058
1059 return os;
1060}
1061
Alex Gildayc357c472018-03-21 13:54:09 +00001062/** Formatted output of the Format type.
1063 *
1064 * @param[in] format Type to output.
1065 *
1066 * @return Formatted string.
1067 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001068inline std::string to_string(const Format &format)
1069{
1070 std::stringstream str;
1071 str << format;
1072 return str.str();
1073}
1074
Alex Gildayc357c472018-03-21 13:54:09 +00001075/** Formatted output of the Channel type.
1076 *
1077 * @param[out] os Output stream.
1078 * @param[in] channel Type to output.
1079 *
1080 * @return Modified output stream.
1081 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001082inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1083{
1084 switch(channel)
1085 {
1086 case Channel::UNKNOWN:
1087 os << "UNKNOWN";
1088 break;
1089 case Channel::C0:
1090 os << "C0";
1091 break;
1092 case Channel::C1:
1093 os << "C1";
1094 break;
1095 case Channel::C2:
1096 os << "C2";
1097 break;
1098 case Channel::C3:
1099 os << "C3";
1100 break;
1101 case Channel::R:
1102 os << "R";
1103 break;
1104 case Channel::G:
1105 os << "G";
1106 break;
1107 case Channel::B:
1108 os << "B";
1109 break;
1110 case Channel::A:
1111 os << "A";
1112 break;
1113 case Channel::Y:
1114 os << "Y";
1115 break;
1116 case Channel::U:
1117 os << "U";
1118 break;
1119 case Channel::V:
1120 os << "V";
1121 break;
1122 default:
1123 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1124 }
1125
1126 return os;
1127}
1128
Alex Gildayc357c472018-03-21 13:54:09 +00001129/** Formatted output of the Channel type.
1130 *
1131 * @param[in] channel Type to output.
1132 *
1133 * @return Formatted string.
1134 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001135inline std::string to_string(const Channel &channel)
1136{
1137 std::stringstream str;
1138 str << channel;
1139 return str.str();
1140}
1141
Alex Gildayc357c472018-03-21 13:54:09 +00001142/** Formatted output of the BorderMode type.
1143 *
1144 * @param[out] os Output stream.
1145 * @param[in] mode Type to output.
1146 *
1147 * @return Modified output stream.
1148 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001149inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1150{
1151 switch(mode)
1152 {
1153 case BorderMode::UNDEFINED:
1154 os << "UNDEFINED";
1155 break;
1156 case BorderMode::CONSTANT:
1157 os << "CONSTANT";
1158 break;
1159 case BorderMode::REPLICATE:
1160 os << "REPLICATE";
1161 break;
1162 default:
1163 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1164 }
1165
1166 return os;
1167}
1168
Alex Gildayc357c472018-03-21 13:54:09 +00001169/** Formatted output of the BorderSize type.
1170 *
1171 * @param[out] os Output stream.
1172 * @param[in] border Type to output.
1173 *
1174 * @return Modified output stream.
1175 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001176inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1177{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001178 os << border.top << ","
1179 << border.right << ","
1180 << border.bottom << ","
1181 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001182
1183 return os;
1184}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001185
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001186/** Formatted output of the PaddingList type.
1187 *
1188 * @param[out] os Output stream.
1189 * @param[in] padding Type to output.
1190 *
1191 * @return Modified output stream.
1192 */
1193inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1194{
1195 os << "{";
1196 for(auto const &p : padding)
1197 {
1198 os << "{" << p.first << "," << p.second << "}";
1199 }
1200 os << "}";
1201 return os;
1202}
1203
giuros013175fcf2018-11-21 09:59:17 +00001204/** Formatted output of the Multiples type.
1205 *
1206 * @param[out] os Output stream.
1207 * @param[in] multiples Type to output.
1208 *
1209 * @return Modified output stream.
1210 */
1211inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1212{
1213 os << "(";
1214 for(size_t i = 0; i < multiples.size() - 1; i++)
1215 {
1216 os << multiples[i] << ", ";
1217 }
1218 os << multiples.back() << ")";
1219 return os;
1220}
1221
Alex Gildayc357c472018-03-21 13:54:09 +00001222/** Formatted output of the InterpolationPolicy type.
1223 *
1224 * @param[out] os Output stream.
1225 * @param[in] policy Type to output.
1226 *
1227 * @return Modified output stream.
1228 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001229inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1230{
1231 switch(policy)
1232 {
1233 case InterpolationPolicy::NEAREST_NEIGHBOR:
1234 os << "NEAREST_NEIGHBOR";
1235 break;
1236 case InterpolationPolicy::BILINEAR:
1237 os << "BILINEAR";
1238 break;
1239 case InterpolationPolicy::AREA:
1240 os << "AREA";
1241 break;
1242 default:
1243 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1244 }
1245
1246 return os;
1247}
1248
Alex Gildayc357c472018-03-21 13:54:09 +00001249/** Formatted output of the SamplingPolicy type.
1250 *
1251 * @param[out] os Output stream.
1252 * @param[in] policy Type to output.
1253 *
1254 * @return Modified output stream.
1255 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001256inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1257{
1258 switch(policy)
1259 {
1260 case SamplingPolicy::CENTER:
1261 os << "CENTER";
1262 break;
1263 case SamplingPolicy::TOP_LEFT:
1264 os << "TOP_LEFT";
1265 break;
1266 default:
1267 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1268 }
1269
1270 return os;
1271}
1272
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001273/** Formatted output of the ITensorInfo type.
1274 *
1275 * @param[out] os Output stream.
1276 * @param[in] info Tensor information.
1277 *
1278 * @return Modified output stream.
1279 */
1280inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1281{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001282 const DataType data_type = info->data_type();
1283 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001284
1285 os << "Shape=" << info->tensor_shape() << ","
1286 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001287 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001288
1289 if(is_data_type_quantized(data_type))
1290 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001291 const QuantizationInfo qinfo = info->quantization_info();
1292 const auto scales = qinfo.scale();
1293 const auto offsets = qinfo.offset();
1294
ramelg014a6d9e82021-10-02 14:34:36 +01001295 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001296 << "scales.size=" << scales.size()
1297 << ", scale(s)=" << scales << ", ";
1298
1299 os << "offsets.size=" << offsets.size()
1300 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001301 }
1302 return os;
1303}
1304
ramelg013ae3d882021-09-12 23:07:47 +01001305/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001306 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001307 * @param[out] os Output stream.
1308 * @param[in] info Type to output.
1309 *
1310 * @return Modified output stream.
1311 */
1312inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1313{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001314 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001315 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001316}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001317
ramelg013ae3d882021-09-12 23:07:47 +01001318/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001319 *
Alex Gildayc357c472018-03-21 13:54:09 +00001320 * @param[in] info Type to output.
1321 *
1322 * @return Formatted string.
1323 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001324inline std::string to_string(const TensorInfo &info)
1325{
1326 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001327 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001328 return str.str();
1329}
1330
ramelg013ae3d882021-09-12 23:07:47 +01001331/** Formatted output of the const ITensorInfo& type.
1332 *
1333 * @param[in] info Type to output.
1334 *
1335 * @return Formatted string.
1336 */
1337inline std::string to_string(const ITensorInfo &info)
1338{
1339 std::stringstream str;
1340 str << &info;
1341 return str.str();
1342}
1343
ramelg013ae3d882021-09-12 23:07:47 +01001344/** Formatted output of the const ITensorInfo* type.
1345 *
1346 * @param[in] info Type to output.
1347 *
1348 * @return Formatted string.
1349 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001350inline std::string to_string(const ITensorInfo *info)
1351{
ramelg013ae3d882021-09-12 23:07:47 +01001352 std::string ret_str = "nullptr";
1353 if(info != nullptr)
1354 {
1355 std::stringstream str;
1356 str << info;
1357 ret_str = str.str();
1358 }
1359 return ret_str;
1360}
1361
ramelg01cbbb0382021-09-17 17:36:57 +01001362/** Formatted output of the ITensorInfo* type.
1363 *
1364 * @param[in] info Type to output.
1365 *
1366 * @return Formatted string.
1367 */
1368inline std::string to_string(ITensorInfo *info)
1369{
1370 return to_string(static_cast<const ITensorInfo *>(info));
1371}
1372
1373/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001374 *
1375 * @param[in] tensor Type to output.
1376 *
1377 * @return Formatted string.
1378 */
1379inline std::string to_string(const ITensor *tensor)
1380{
1381 std::string ret_str = "nullptr";
1382 if(tensor != nullptr)
1383 {
1384 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001385 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001386 ret_str = str.str();
1387 }
1388 return ret_str;
1389}
1390
ramelg01cbbb0382021-09-17 17:36:57 +01001391/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001392 *
1393 * @param[in] tensor Type to output.
1394 *
1395 * @return Formatted string.
1396 */
1397inline std::string to_string(ITensor *tensor)
1398{
ramelg01cbbb0382021-09-17 17:36:57 +01001399 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001400}
1401
ramelg01cbbb0382021-09-17 17:36:57 +01001402/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001403 *
1404 * @param[in] tensor Type to output.
1405 *
1406 * @return Formatted string.
1407 */
1408inline std::string to_string(ITensor &tensor)
1409{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001410 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001411 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001412 return str.str();
1413}
1414
ramelg01cbbb0382021-09-17 17:36:57 +01001415#ifdef ARM_COMPUTE_OPENCL_ENABLED
1416/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1417 *
1418 * @param[in] cl_tensor Type to output.
1419 *
1420 * @return Formatted string.
1421 */
1422inline std::string to_string(const ICLTensor *cl_tensor)
1423{
1424 std::string ret_str = "nullptr";
1425 if(cl_tensor != nullptr)
1426 {
1427 std::stringstream str;
1428 str << "ICLTensor->info(): " << cl_tensor->info();
1429 ret_str = str.str();
1430 }
1431 return ret_str;
1432}
1433
1434/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1435 *
1436 * @param[in] cl_tensor Type to output.
1437 *
1438 * @return Formatted string.
1439 */
1440inline std::string to_string(ICLTensor *cl_tensor)
1441{
1442 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1443}
SiCong Li47f177e2023-02-22 17:24:09 +00001444
1445/** Formatted output of the cl::NDRange type.
1446 *
1447 * @param[out] os Output stream.
1448 * @param[in] nd_range cl::NDRange to output.
1449 *
1450 * @return Modified output stream.
1451 */
1452inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1453{
1454 os << "{"
1455 << nd_range[0] << ","
1456 << nd_range[1] << ","
1457 << nd_range[2]
1458 << "}";
1459 return os;
1460}
1461
1462/** Formatted output of the cl::NDRange type
1463 *
1464 * @param[in] nd_Range Type to output.
1465 *
1466 * @return Formatted string.
1467 */
1468inline std::string to_string(const cl::NDRange &nd_range)
1469{
1470 std::stringstream str;
1471 str << nd_range;
1472 return str.str();
1473}
ramelg01cbbb0382021-09-17 17:36:57 +01001474#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1475
Alex Gildayc357c472018-03-21 13:54:09 +00001476/** Formatted output of the Dimensions type.
1477 *
1478 * @param[in] dimensions Type to output.
1479 *
1480 * @return Formatted string.
1481 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001482template <typename T>
1483inline std::string to_string(const Dimensions<T> &dimensions)
1484{
1485 std::stringstream str;
1486 str << dimensions;
1487 return str.str();
1488}
1489
Alex Gildayc357c472018-03-21 13:54:09 +00001490/** Formatted output of the Strides type.
1491 *
1492 * @param[in] stride Type to output.
1493 *
1494 * @return Formatted string.
1495 */
John Richardsona36eae12017-09-26 16:55:59 +01001496inline std::string to_string(const Strides &stride)
1497{
1498 std::stringstream str;
1499 str << stride;
1500 return str.str();
1501}
1502
Alex Gildayc357c472018-03-21 13:54:09 +00001503/** Formatted output of the TensorShape type.
1504 *
1505 * @param[in] shape Type to output.
1506 *
1507 * @return Formatted string.
1508 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001509inline std::string to_string(const TensorShape &shape)
1510{
1511 std::stringstream str;
1512 str << shape;
1513 return str.str();
1514}
1515
Alex Gildayc357c472018-03-21 13:54:09 +00001516/** Formatted output of the Coordinates type.
1517 *
1518 * @param[in] coord Type to output.
1519 *
1520 * @return Formatted string.
1521 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001522inline std::string to_string(const Coordinates &coord)
1523{
1524 std::stringstream str;
1525 str << coord;
1526 return str.str();
1527}
1528
Anthony Barbierb940fd62018-06-04 14:14:32 +01001529/** Formatted output of the GEMMReshapeInfo type.
1530 *
1531 * @param[out] os Output stream.
1532 * @param[in] info Type to output.
1533 *
1534 * @return Modified output stream.
1535 */
1536inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1537{
1538 os << "{m=" << info.m() << ",";
1539 os << "n=" << info.n() << ",";
1540 os << "k=" << info.k() << ",";
1541 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1542 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1543 os << "}";
1544
1545 return os;
1546}
1547
1548/** Formatted output of the GEMMInfo type.
1549 *
1550 * @param[out] os Output stream.
1551 * @param[in] info Type to output.
1552 *
1553 * @return Modified output stream.
1554 */
1555inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1556{
1557 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1558 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1559 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001560 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1561 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1562 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1563 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1564 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001565 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001566 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001567
1568 return os;
1569}
1570
1571/** Formatted output of the Window::Dimension type.
1572 *
1573 * @param[out] os Output stream.
1574 * @param[in] dim Type to output.
1575 *
1576 * @return Modified output stream.
1577 */
1578inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1579{
1580 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1581
1582 return os;
1583}
1584/** Formatted output of the Window type.
1585 *
1586 * @param[out] os Output stream.
1587 * @param[in] win Type to output.
1588 *
1589 * @return Modified output stream.
1590 */
1591inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1592{
1593 os << "{";
1594 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1595 {
1596 if(i > 0)
1597 {
1598 os << ", ";
1599 }
1600 os << win[i];
1601 }
1602 os << "}";
1603
1604 return os;
1605}
1606
1607/** Formatted output of the WeightsInfo type.
1608 *
1609 * @param[in] info Type to output.
1610 *
1611 * @return Formatted string.
1612 */
1613inline std::string to_string(const WeightsInfo &info)
1614{
1615 std::stringstream str;
1616 str << info;
1617 return str.str();
1618}
1619
1620/** Formatted output of the GEMMReshapeInfo type.
1621 *
1622 * @param[in] info Type to output.
1623 *
1624 * @return Formatted string.
1625 */
1626inline std::string to_string(const GEMMReshapeInfo &info)
1627{
1628 std::stringstream str;
1629 str << info;
1630 return str.str();
1631}
1632
1633/** Formatted output of the GEMMInfo type.
1634 *
1635 * @param[in] info Type to output.
1636 *
1637 * @return Formatted string.
1638 */
1639inline std::string to_string(const GEMMInfo &info)
1640{
1641 std::stringstream str;
1642 str << info;
1643 return str.str();
1644}
1645
1646/** Formatted output of the Window::Dimension type.
1647 *
1648 * @param[in] dim Type to output.
1649 *
1650 * @return Formatted string.
1651 */
1652inline std::string to_string(const Window::Dimension &dim)
1653{
1654 std::stringstream str;
1655 str << dim;
1656 return str.str();
1657}
ramelg01cbbb0382021-09-17 17:36:57 +01001658/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001659 *
1660 * @param[in] win Type to output.
1661 *
1662 * @return Formatted string.
1663 */
1664inline std::string to_string(const Window &win)
1665{
1666 std::stringstream str;
1667 str << win;
1668 return str.str();
1669}
1670
ramelg01cbbb0382021-09-17 17:36:57 +01001671/** Formatted output of the Window* type.
1672 *
1673 * @param[in] win Type to output.
1674 *
1675 * @return Formatted string.
1676 */
1677inline std::string to_string(Window *win)
1678{
1679 std::string ret_str = "nullptr";
1680 if(win != nullptr)
1681 {
1682 std::stringstream str;
1683 str << *win;
1684 ret_str = str.str();
1685 }
1686 return ret_str;
1687}
1688
Alex Gildayc357c472018-03-21 13:54:09 +00001689/** Formatted output of the Rectangle type.
1690 *
1691 * @param[out] os Output stream.
1692 * @param[in] rect Type to output.
1693 *
1694 * @return Modified output stream.
1695 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001696inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1697{
1698 os << rect.width << "x" << rect.height;
1699 os << "+" << rect.x << "+" << rect.y;
1700
1701 return os;
1702}
1703
Usama Arif8cf8c112019-03-14 15:36:54 +00001704/** Formatted output of the PaddingMode type.
1705 *
1706 * @param[out] os Output stream.
1707 * @param[in] mode Type to output.
1708 *
1709 * @return Modified output stream.
1710 */
1711inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1712{
1713 switch(mode)
1714 {
1715 case PaddingMode::CONSTANT:
1716 os << "CONSTANT";
1717 break;
1718 case PaddingMode::REFLECT:
1719 os << "REFLECT";
1720 break;
1721 case PaddingMode::SYMMETRIC:
1722 os << "SYMMETRIC";
1723 break;
1724 default:
1725 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1726 }
1727
1728 return os;
1729}
1730
1731/** Formatted output of the PaddingMode type.
1732 *
1733 * @param[in] mode Type to output.
1734 *
1735 * @return Formatted string.
1736 */
1737inline std::string to_string(const PaddingMode &mode)
1738{
1739 std::stringstream str;
1740 str << mode;
1741 return str.str();
1742}
1743
Alex Gildayc357c472018-03-21 13:54:09 +00001744/** Formatted output of the PadStrideInfo type.
1745 *
1746 * @param[out] os Output stream.
1747 * @param[in] pad_stride_info Type to output.
1748 *
1749 * @return Modified output stream.
1750 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001751inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1752{
1753 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1754 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001755 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1756 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001757
1758 return os;
1759}
1760
Alex Gildayc357c472018-03-21 13:54:09 +00001761/** Formatted output of the PadStrideInfo type.
1762 *
1763 * @param[in] pad_stride_info Type to output.
1764 *
1765 * @return Formatted string.
1766 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001767inline std::string to_string(const PadStrideInfo &pad_stride_info)
1768{
1769 std::stringstream str;
1770 str << pad_stride_info;
1771 return str.str();
1772}
1773
Alex Gildayc357c472018-03-21 13:54:09 +00001774/** Formatted output of the BorderMode type.
1775 *
1776 * @param[in] mode Type to output.
1777 *
1778 * @return Formatted string.
1779 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001780inline std::string to_string(const BorderMode &mode)
1781{
1782 std::stringstream str;
1783 str << mode;
1784 return str.str();
1785}
1786
Alex Gildayc357c472018-03-21 13:54:09 +00001787/** Formatted output of the BorderSize type.
1788 *
1789 * @param[in] border Type to output.
1790 *
1791 * @return Formatted string.
1792 */
John Richardsonb482ce12017-09-18 12:44:01 +01001793inline std::string to_string(const BorderSize &border)
1794{
1795 std::stringstream str;
1796 str << border;
1797 return str.str();
1798}
1799
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001800/** Formatted output of the PaddingList type.
1801 *
1802 * @param[in] padding Type to output.
1803 *
1804 * @return Formatted string.
1805 */
1806inline std::string to_string(const PaddingList &padding)
1807{
1808 std::stringstream str;
1809 str << padding;
1810 return str.str();
1811}
1812
giuros013175fcf2018-11-21 09:59:17 +00001813/** Formatted output of the Multiples type.
1814 *
1815 * @param[in] multiples Type to output.
1816 *
1817 * @return Formatted string.
1818 */
1819inline std::string to_string(const Multiples &multiples)
1820{
1821 std::stringstream str;
1822 str << multiples;
1823 return str.str();
1824}
1825
Alex Gildayc357c472018-03-21 13:54:09 +00001826/** Formatted output of the InterpolationPolicy type.
1827 *
1828 * @param[in] policy Type to output.
1829 *
1830 * @return Formatted string.
1831 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001832inline std::string to_string(const InterpolationPolicy &policy)
1833{
1834 std::stringstream str;
1835 str << policy;
1836 return str.str();
1837}
1838
Alex Gildayc357c472018-03-21 13:54:09 +00001839/** Formatted output of the SamplingPolicy type.
1840 *
1841 * @param[in] policy Type to output.
1842 *
1843 * @return Formatted string.
1844 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001845inline std::string to_string(const SamplingPolicy &policy)
1846{
1847 std::stringstream str;
1848 str << policy;
1849 return str.str();
1850}
1851
Alex Gildayc357c472018-03-21 13:54:09 +00001852/** Formatted output of the ConvertPolicy type.
1853 *
1854 * @param[out] os Output stream.
1855 * @param[in] policy Type to output.
1856 *
1857 * @return Modified output stream.
1858 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001859inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1860{
1861 switch(policy)
1862 {
1863 case ConvertPolicy::WRAP:
1864 os << "WRAP";
1865 break;
1866 case ConvertPolicy::SATURATE:
1867 os << "SATURATE";
1868 break;
1869 default:
1870 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1871 }
1872
1873 return os;
1874}
1875
1876inline std::string to_string(const ConvertPolicy &policy)
1877{
1878 std::stringstream str;
1879 str << policy;
1880 return str.str();
1881}
1882
giuros01164a2722018-11-20 18:34:46 +00001883/** Formatted output of the ArithmeticOperation type.
1884 *
1885 * @param[out] os Output stream.
1886 * @param[in] op Operation to output.
1887 *
1888 * @return Modified output stream.
1889 */
1890inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1891{
1892 switch(op)
1893 {
1894 case ArithmeticOperation::ADD:
1895 os << "ADD";
1896 break;
1897 case ArithmeticOperation::SUB:
1898 os << "SUB";
1899 break;
1900 case ArithmeticOperation::DIV:
1901 os << "DIV";
1902 break;
1903 case ArithmeticOperation::MAX:
1904 os << "MAX";
1905 break;
1906 case ArithmeticOperation::MIN:
1907 os << "MIN";
1908 break;
1909 case ArithmeticOperation::SQUARED_DIFF:
1910 os << "SQUARED_DIFF";
1911 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001912 case ArithmeticOperation::POWER:
1913 os << "POWER";
1914 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001915 case ArithmeticOperation::PRELU:
1916 os << "PRELU";
1917 break;
giuros01164a2722018-11-20 18:34:46 +00001918 default:
1919 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1920 }
1921
1922 return os;
1923}
1924
1925/** Formatted output of the Arithmetic Operation
1926 *
1927 * @param[in] op Type to output.
1928 *
1929 * @return Formatted string.
1930 */
1931inline std::string to_string(const ArithmeticOperation &op)
1932{
1933 std::stringstream str;
1934 str << op;
1935 return str.str();
1936}
1937
Alex Gildayc357c472018-03-21 13:54:09 +00001938/** Formatted output of the Reduction Operations.
1939 *
1940 * @param[out] os Output stream.
1941 * @param[in] op Type to output.
1942 *
1943 * @return Modified output stream.
1944 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001945inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1946{
1947 switch(op)
1948 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001949 case ReductionOperation::SUM:
1950 os << "SUM";
1951 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001952 case ReductionOperation::SUM_SQUARE:
1953 os << "SUM_SQUARE";
1954 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001955 case ReductionOperation::MEAN_SUM:
1956 os << "MEAN_SUM";
1957 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001958 case ReductionOperation::ARG_IDX_MAX:
1959 os << "ARG_IDX_MAX";
1960 break;
1961 case ReductionOperation::ARG_IDX_MIN:
1962 os << "ARG_IDX_MIN";
1963 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001964 case ReductionOperation::PROD:
1965 os << "PROD";
1966 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001967 case ReductionOperation::MIN:
1968 os << "MIN";
1969 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001970 case ReductionOperation::MAX:
1971 os << "MAX";
1972 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001973 default:
1974 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1975 }
1976
1977 return os;
1978}
1979
Alex Gildayc357c472018-03-21 13:54:09 +00001980/** Formatted output of the Reduction Operations.
1981 *
1982 * @param[in] op Type to output.
1983 *
1984 * @return Formatted string.
1985 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001986inline std::string to_string(const ReductionOperation &op)
1987{
1988 std::stringstream str;
1989 str << op;
1990 return str.str();
1991}
1992
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001993/** Formatted output of the Comparison Operations.
1994 *
1995 * @param[out] os Output stream.
1996 * @param[in] op Type to output.
1997 *
1998 * @return Modified output stream.
1999 */
2000inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
2001{
2002 switch(op)
2003 {
2004 case ComparisonOperation::Equal:
2005 os << "Equal";
2006 break;
2007 case ComparisonOperation::NotEqual:
2008 os << "NotEqual";
2009 break;
2010 case ComparisonOperation::Greater:
2011 os << "Greater";
2012 break;
2013 case ComparisonOperation::GreaterEqual:
2014 os << "GreaterEqual";
2015 break;
2016 case ComparisonOperation::Less:
2017 os << "Less";
2018 break;
2019 case ComparisonOperation::LessEqual:
2020 os << "LessEqual";
2021 break;
2022 default:
2023 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2024 }
2025
2026 return os;
2027}
2028
Michalis Spyroue9362622018-11-23 17:41:37 +00002029/** Formatted output of the Elementwise unary Operations.
2030 *
2031 * @param[out] os Output stream.
2032 * @param[in] op Type to output.
2033 *
2034 * @return Modified output stream.
2035 */
2036inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
2037{
2038 switch(op)
2039 {
2040 case ElementWiseUnary::RSQRT:
2041 os << "RSQRT";
2042 break;
2043 case ElementWiseUnary::EXP:
2044 os << "EXP";
2045 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002046 case ElementWiseUnary::NEG:
2047 os << "NEG";
2048 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002049 case ElementWiseUnary::LOG:
2050 os << "LOG";
2051 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002052 case ElementWiseUnary::SIN:
2053 os << "SIN";
2054 break;
2055 case ElementWiseUnary::ABS:
2056 os << "ABS";
2057 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002058 case ElementWiseUnary::ROUND:
2059 os << "ROUND";
2060 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002061 case ElementWiseUnary::LOGICAL_NOT:
2062 os << "LOGICAL_NOT";
2063 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002064 default:
2065 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2066 }
2067
2068 return os;
2069}
2070
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002071/** Formatted output of the Comparison Operations.
2072 *
2073 * @param[in] op Type to output.
2074 *
2075 * @return Formatted string.
2076 */
2077inline std::string to_string(const ComparisonOperation &op)
2078{
2079 std::stringstream str;
2080 str << op;
2081 return str.str();
2082}
2083
Michalis Spyroue9362622018-11-23 17:41:37 +00002084/** Formatted output of the Elementwise unary Operations.
2085 *
2086 * @param[in] op Type to output.
2087 *
2088 * @return Formatted string.
2089 */
2090inline std::string to_string(const ElementWiseUnary &op)
2091{
2092 std::stringstream str;
2093 str << op;
2094 return str.str();
2095}
2096
Alex Gildayc357c472018-03-21 13:54:09 +00002097/** Formatted output of the Norm Type.
2098 *
2099 * @param[in] type Type to output.
2100 *
2101 * @return Formatted string.
2102 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002103inline std::string to_string(const NormType &type)
2104{
2105 std::stringstream str;
2106 str << type;
2107 return str.str();
2108}
2109
Alex Gildayc357c472018-03-21 13:54:09 +00002110/** Formatted output of the Pooling Type.
2111 *
2112 * @param[in] type Type to output.
2113 *
2114 * @return Formatted string.
2115 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002116inline std::string to_string(const PoolingType &type)
2117{
2118 std::stringstream str;
2119 str << type;
2120 return str.str();
2121}
2122
Alex Gildayc357c472018-03-21 13:54:09 +00002123/** Formatted output of the Pooling Layer Info.
2124 *
2125 * @param[in] info Type to output.
2126 *
2127 * @return Formatted string.
2128 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002129inline std::string to_string(const PoolingLayerInfo &info)
2130{
2131 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002132 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002133 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002134 << "IsGlobalPooling=" << info.is_global_pooling;
2135 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002136 {
2137 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002138 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2139 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002140 }
2141 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002142 return str.str();
2143}
2144
ramelg0137515692022-02-26 22:06:20 +00002145/** Formatted output of the Size3D type.
2146 *
2147 * @param[out] os Output stream
2148 * @param[in] size Type to output
2149 *
2150 * @return Modified output stream.
2151 */
2152inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2153{
2154 os << size.width << "x" << size.height << "x" << size.depth;
2155
2156 return os;
2157}
2158
2159/** Formatted output of the Size3D type.
2160 *
2161 * @param[in] type Type to output
2162 *
2163 * @return Formatted string.
2164 */
2165inline std::string to_string(const Size3D &type)
2166{
2167 std::stringstream str;
2168 str << type;
2169 return str.str();
2170}
2171
2172/** Formatted output of the Padding3D type.
2173 *
2174 * @param[out] os Output stream.
2175 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2176 *
2177 * @return Modified output stream.
2178 */
2179inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2180{
2181 os << padding3d.left << "," << padding3d.right << ","
2182 << padding3d.top << "," << padding3d.bottom << ","
2183 << padding3d.front << "," << padding3d.back;
2184 return os;
2185}
2186
2187/** Converts a @ref Padding3D to string
2188 *
2189 * @param[in] padding3d Padding3D value to be converted
2190 *
2191 * @return String representing the corresponding Padding3D
2192 */
2193inline std::string to_string(const Padding3D &padding3d)
2194{
2195 std::stringstream str;
2196 str << padding3d;
2197 return str.str();
2198}
2199
2200/** Formatted output of the DimensionRoundingType type.
2201 *
2202 * @param[out] os Output stream.
2203 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2204 *
2205 * @return Modified output stream.
2206 */
2207inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2208{
2209 switch(rounding_type)
2210 {
2211 case DimensionRoundingType::CEIL:
2212 os << "CEIL";
2213 break;
2214 case DimensionRoundingType::FLOOR:
2215 os << "FLOOR";
2216 break;
2217 default:
2218 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2219 }
2220 return os;
2221}
2222
2223/** Formatted output of the Pooling 3d Layer Info.
2224 *
2225 * @param[out] os Output stream.
2226 * @param[in] info Pooling 3D layer info to print to output stream.
2227 *
2228 * @return Modified output stream.
2229 */
2230inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2231{
2232 os << "{Type=" << info.pool_type << ","
2233 << "IsGlobalPooling=" << info.is_global_pooling;
2234 if(!info.is_global_pooling)
2235 {
2236 os << ","
2237 << "PoolSize=" << info.pool_size << ", "
2238 << "Stride=" << info.stride << ", "
2239 << "Padding=" << info.padding << ", "
2240 << "Exclude Padding=" << info.exclude_padding << ", "
2241 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2242 << "DimensionRoundingType=" << info.round_type;
2243 }
2244 os << "}";
2245 return os;
2246}
2247
2248/** Formatted output of the Pooling 3d Layer Info.
2249 *
2250 * @param[in] info Type to output.
2251 *
2252 * @return Formatted string.
2253 */
2254inline std::string to_string(const Pooling3dLayerInfo &info)
2255{
2256 std::stringstream str;
2257 str << info;
2258 return str.str();
2259}
2260
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002261/** Formatted output of the PriorBoxLayerInfo.
2262 *
2263 * @param[in] info Type to output.
2264 *
2265 * @return Formatted string.
2266 */
2267inline std::string to_string(const PriorBoxLayerInfo &info)
2268{
2269 std::stringstream str;
2270 str << "{";
2271 str << "Clip:" << info.clip()
2272 << "Flip:" << info.flip()
2273 << "StepX:" << info.steps()[0]
2274 << "StepY:" << info.steps()[1]
2275 << "MinSizes:" << info.min_sizes().size()
2276 << "MaxSizes:" << info.max_sizes().size()
2277 << "ImgSizeX:" << info.img_size().x
2278 << "ImgSizeY:" << info.img_size().y
2279 << "Offset:" << info.offset()
2280 << "Variances:" << info.variances().size();
2281 str << "}";
2282 return str.str();
2283}
2284
Alex Gildayc357c472018-03-21 13:54:09 +00002285/** Formatted output of the Size2D type.
2286 *
2287 * @param[out] os Output stream
2288 * @param[in] size Type to output
2289 *
2290 * @return Modified output stream.
2291 */
John Richardson25f23682017-11-27 14:35:09 +00002292inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2293{
2294 os << size.width << "x" << size.height;
2295
2296 return os;
2297}
2298
Alex Gildayc357c472018-03-21 13:54:09 +00002299/** Formatted output of the Size2D type.
2300 *
2301 * @param[in] type Type to output
2302 *
2303 * @return Formatted string.
2304 */
John Richardson25f23682017-11-27 14:35:09 +00002305inline std::string to_string(const Size2D &type)
2306{
2307 std::stringstream str;
2308 str << type;
2309 return str.str();
2310}
2311
Alex Gildayc357c472018-03-21 13:54:09 +00002312/** Formatted output of the ConvolutionMethod type.
2313 *
2314 * @param[out] os Output stream
2315 * @param[in] conv_method Type to output
2316 *
2317 * @return Modified output stream.
2318 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002319inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2320{
2321 switch(conv_method)
2322 {
2323 case ConvolutionMethod::GEMM:
2324 os << "GEMM";
2325 break;
2326 case ConvolutionMethod::DIRECT:
2327 os << "DIRECT";
2328 break;
2329 case ConvolutionMethod::WINOGRAD:
2330 os << "WINOGRAD";
2331 break;
SiCongLid9287352021-11-03 19:01:22 +00002332 case ConvolutionMethod::FFT:
2333 os << "FFT";
2334 break;
2335 case ConvolutionMethod::GEMM_CONV2D:
2336 os << "GEMM_CONV2D";
2337 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002338 default:
2339 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2340 }
2341
2342 return os;
2343}
2344
Alex Gildayc357c472018-03-21 13:54:09 +00002345/** Formatted output of the ConvolutionMethod type.
2346 *
2347 * @param[in] conv_method Type to output
2348 *
2349 * @return Formatted string.
2350 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002351inline std::string to_string(const ConvolutionMethod &conv_method)
2352{
2353 std::stringstream str;
2354 str << conv_method;
2355 return str.str();
2356}
2357
Alex Gildayc357c472018-03-21 13:54:09 +00002358/** Formatted output of the GPUTarget type.
2359 *
2360 * @param[out] os Output stream
2361 * @param[in] gpu_target Type to output
2362 *
2363 * @return Modified output stream.
2364 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002365inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2366{
2367 switch(gpu_target)
2368 {
2369 case GPUTarget::GPU_ARCH_MASK:
2370 os << "GPU_ARCH_MASK";
2371 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002372 case GPUTarget::GPU_GENERATION_MASK:
2373 os << "GPU_GENERATION_MASK";
2374 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002375 case GPUTarget::MIDGARD:
2376 os << "MIDGARD";
2377 break;
2378 case GPUTarget::BIFROST:
2379 os << "BIFROST";
2380 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002381 case GPUTarget::VALHALL:
2382 os << "VALHALL";
2383 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002384 case GPUTarget::T600:
2385 os << "T600";
2386 break;
2387 case GPUTarget::T700:
2388 os << "T700";
2389 break;
2390 case GPUTarget::T800:
2391 os << "T800";
2392 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002393 case GPUTarget::G71:
2394 os << "G71";
2395 break;
2396 case GPUTarget::G72:
2397 os << "G72";
2398 break;
2399 case GPUTarget::G51:
2400 os << "G51";
2401 break;
2402 case GPUTarget::G51BIG:
2403 os << "G51BIG";
2404 break;
2405 case GPUTarget::G51LIT:
2406 os << "G51LIT";
2407 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002408 case GPUTarget::G31:
2409 os << "G31";
2410 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002411 case GPUTarget::G76:
2412 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002413 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002414 case GPUTarget::G52:
2415 os << "G52";
2416 break;
2417 case GPUTarget::G52LIT:
2418 os << "G52LIT";
2419 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002420 case GPUTarget::G77:
2421 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002422 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002423 case GPUTarget::G57:
2424 os << "G57";
2425 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002426 case GPUTarget::G78:
2427 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002428 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002429 case GPUTarget::G68:
2430 os << "G68";
2431 break;
2432 case GPUTarget::G78AE:
2433 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002434 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002435 case GPUTarget::G710:
2436 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002437 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002438 case GPUTarget::G610:
2439 os << "G610";
2440 break;
2441 case GPUTarget::G510:
2442 os << "G510";
2443 break;
2444 case GPUTarget::G310:
2445 os << "G310";
2446 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002447 case GPUTarget::G715:
2448 os << "G715";
2449 break;
2450 case GPUTarget::G615:
2451 os << "G615";
2452 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002453 default:
2454 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2455 }
2456
2457 return os;
2458}
2459
Alex Gildayc357c472018-03-21 13:54:09 +00002460/** Formatted output of the GPUTarget type.
2461 *
2462 * @param[in] gpu_target Type to output
2463 *
2464 * @return Formatted string.
2465 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002466inline std::string to_string(const GPUTarget &gpu_target)
2467{
2468 std::stringstream str;
2469 str << gpu_target;
2470 return str.str();
2471}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002472
John Richardson8de92612018-02-22 14:09:31 +00002473/** Formatted output of the DetectionWindow type.
2474 *
2475 * @param[out] os Output stream
2476 * @param[in] detection_window Type to output
2477 *
2478 * @return Modified output stream.
2479 */
John Richardson684cb0f2018-01-09 11:17:00 +00002480inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2481{
2482 os << "{x=" << detection_window.x << ","
2483 << "y=" << detection_window.y << ","
2484 << "width=" << detection_window.width << ","
2485 << "height=" << detection_window.height << ","
2486 << "idx_class=" << detection_window.idx_class << ","
2487 << "score=" << detection_window.score << "}";
2488
2489 return os;
2490}
2491
Isabella Gottardi05e56442018-11-16 11:26:52 +00002492/** Formatted output of the DetectionOutputLayerCodeType type.
2493 *
2494 * @param[out] os Output stream
2495 * @param[in] detection_code Type to output
2496 *
2497 * @return Modified output stream.
2498 */
2499inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2500{
2501 switch(detection_code)
2502 {
2503 case DetectionOutputLayerCodeType::CENTER_SIZE:
2504 os << "CENTER_SIZE";
2505 break;
2506 case DetectionOutputLayerCodeType::CORNER:
2507 os << "CORNER";
2508 break;
2509 case DetectionOutputLayerCodeType::CORNER_SIZE:
2510 os << "CORNER_SIZE";
2511 break;
2512 case DetectionOutputLayerCodeType::TF_CENTER:
2513 os << "TF_CENTER";
2514 break;
2515 default:
2516 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2517 }
2518
2519 return os;
2520}
2521/** Formatted output of the DetectionOutputLayerCodeType type.
2522 *
2523 * @param[in] detection_code Type to output
2524 *
2525 * @return Formatted string.
2526 */
2527inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2528{
2529 std::stringstream str;
2530 str << detection_code;
2531 return str.str();
2532}
2533
2534/** Formatted output of the DetectionOutputLayerInfo type.
2535 *
2536 * @param[out] os Output stream
2537 * @param[in] detection_info Type to output
2538 *
2539 * @return Modified output stream.
2540 */
2541inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2542{
2543 os << "{Classes=" << detection_info.num_classes() << ","
2544 << "ShareLocation=" << detection_info.share_location() << ","
2545 << "CodeType=" << detection_info.code_type() << ","
2546 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2547 << "KeepTopK=" << detection_info.keep_top_k() << ","
2548 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2549 << "Eta=" << detection_info.eta() << ","
2550 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2551 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2552 << "TopK=" << detection_info.top_k() << ","
2553 << "NumLocClasses=" << detection_info.num_loc_classes()
2554 << "}";
2555
2556 return os;
2557}
2558
2559/** Formatted output of the DetectionOutputLayerInfo type.
2560 *
2561 * @param[in] detection_info Type to output
2562 *
2563 * @return Formatted string.
2564 */
2565inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2566{
2567 std::stringstream str;
2568 str << detection_info;
2569 return str.str();
2570}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002571/** Formatted output of the DetectionPostProcessLayerInfo type.
2572 *
2573 * @param[out] os Output stream
2574 * @param[in] detection_info Type to output
2575 *
2576 * @return Modified output stream.
2577 */
2578inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2579{
2580 os << "{MaxDetections=" << detection_info.max_detections() << ","
2581 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2582 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2583 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2584 << "NumClasses=" << detection_info.num_classes() << ","
2585 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2586 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2587 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2588 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2589 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2590 << "DetectionPerClass=" << detection_info.detection_per_class()
2591 << "}";
2592
2593 return os;
2594}
2595
2596/** Formatted output of the DetectionPostProcessLayerInfo type.
2597 *
2598 * @param[in] detection_info Type to output
2599 *
2600 * @return Formatted string.
2601 */
2602inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2603{
2604 std::stringstream str;
2605 str << detection_info;
2606 return str.str();
2607}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002608
John Richardson8de92612018-02-22 14:09:31 +00002609/** Formatted output of the DetectionWindow type.
2610 *
2611 * @param[in] detection_window Type to output
2612 *
2613 * @return Formatted string.
2614 */
2615inline std::string to_string(const DetectionWindow &detection_window)
2616{
2617 std::stringstream str;
2618 str << detection_window;
2619 return str.str();
2620}
2621
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002622/** Formatted output of @ref PriorBoxLayerInfo.
2623 *
2624 * @param[out] os Output stream.
2625 * @param[in] info Type to output.
2626 *
2627 * @return Modified output stream.
2628 */
2629inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2630{
2631 os << "Clip:" << info.clip()
2632 << "Flip:" << info.flip()
2633 << "StepX:" << info.steps()[0]
2634 << "StepY:" << info.steps()[1]
2635 << "MinSizes:" << info.min_sizes()
2636 << "MaxSizes:" << info.max_sizes()
2637 << "ImgSizeX:" << info.img_size().x
2638 << "ImgSizeY:" << info.img_size().y
2639 << "Offset:" << info.offset()
2640 << "Variances:" << info.variances();
2641
2642 return os;
2643}
2644
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002645/** Formatted output of the WinogradInfo type. */
2646inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2647{
2648 os << "{OutputTileSize=" << info.output_tile_size << ","
2649 << "KernelSize=" << info.kernel_size << ","
2650 << "PadStride=" << info.convolution_info << ","
2651 << "OutputDataLayout=" << info.output_data_layout << "}";
2652
2653 return os;
2654}
2655
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002656inline std::string to_string(const WinogradInfo &type)
2657{
2658 std::stringstream str;
2659 str << type;
2660 return str.str();
2661}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002662
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002663/** Convert a CLTunerMode value to a string
2664 *
2665 * @param val CLTunerMode value to be converted
2666 *
2667 * @return String representing the corresponding CLTunerMode.
2668 */
2669inline std::string to_string(const CLTunerMode val)
2670{
2671 switch(val)
2672 {
2673 case CLTunerMode::EXHAUSTIVE:
2674 {
2675 return std::string("Exhaustive");
2676 }
2677 case CLTunerMode::NORMAL:
2678 {
2679 return std::string("Normal");
2680 }
2681 case CLTunerMode::RAPID:
2682 {
2683 return std::string("Rapid");
2684 }
2685 default:
2686 {
2687 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2688 return std::string("UNDEFINED");
2689 }
2690 }
2691}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002692/** Converts a @ref CLGEMMKernelType to string
2693 *
2694 * @param[in] val CLGEMMKernelType value to be converted
2695 *
2696 * @return String representing the corresponding CLGEMMKernelType
2697 */
2698inline std::string to_string(CLGEMMKernelType val)
2699{
2700 switch(val)
2701 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002702 case CLGEMMKernelType::NATIVE:
2703 {
2704 return "Native";
2705 }
2706 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2707 {
2708 return "Reshaped_Only_RHS";
2709 }
2710 case CLGEMMKernelType::RESHAPED:
2711 {
2712 return "Reshaped";
2713 }
2714 default:
2715 {
2716 return "Unknown";
2717 }
2718 }
2719}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002720/** [Print CLTunerMode type] **/
2721/** Formatted output of the CLTunerMode type.
2722 *
2723 * @param[out] os Output stream.
2724 * @param[in] val CLTunerMode to output.
2725 *
2726 * @return Modified output stream.
2727 */
2728inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2729{
2730 os << to_string(val);
2731 return os;
2732}
2733
ramelg013ae3d882021-09-12 23:07:47 +01002734/** Formatted output of the ConvolutionInfo type.
2735 *
2736 * @param[out] os Output stream.
2737 * @param[in] conv_info ConvolutionInfo to output.
2738 *
2739 * @return Modified output stream.
2740 */
2741inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2742{
SiCongLi579ca842021-10-18 09:38:33 +01002743 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2744 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2745 << "act_info=" << to_string(conv_info.act_info) << ", "
2746 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002747 return os;
2748}
2749
2750/** Converts a @ref ConvolutionInfo to string
2751 *
2752 * @param[in] info ConvolutionInfo value to be converted
2753 *
2754 * @return String representing the corresponding ConvolutionInfo
2755 */
2756inline std::string to_string(const ConvolutionInfo &info)
2757{
2758 std::stringstream str;
2759 str << info;
2760 return str.str();
2761}
2762
2763/** Formatted output of the FullyConnectedLayerInfo type.
2764 *
2765 * @param[out] os Output stream.
2766 * @param[in] layer_info FullyConnectedLayerInfo to output.
2767 *
2768 * @return Modified output stream.
2769 */
2770inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2771{
SiCongLi579ca842021-10-18 09:38:33 +01002772 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2773 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2774 << "transpose_weights=" << layer_info.transpose_weights << ", "
2775 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2776 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
SiCongLi579ca842021-10-18 09:38:33 +01002777 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002778 return os;
2779}
2780
2781/** Converts a @ref FullyConnectedLayerInfo to string
2782 *
2783 * @param[in] info FullyConnectedLayerInfo value to be converted
2784 *
2785 * @return String representing the corresponding FullyConnectedLayerInfo
2786 */
2787inline std::string to_string(const FullyConnectedLayerInfo &info)
2788{
2789 std::stringstream str;
2790 str << info;
2791 return str.str();
2792}
2793
2794/** Formatted output of the GEMMLowpOutputStageType type.
2795 *
2796 * @param[out] os Output stream.
2797 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2798 *
2799 * @return Modified output stream.
2800 */
2801inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2802{
2803 switch(gemm_type)
2804 {
2805 case GEMMLowpOutputStageType::NONE:
2806 os << "NONE";
2807 break;
2808 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2809 os << "QUANTIZE_DOWN";
2810 break;
2811 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2812 os << "QUANTIZE_DOWN_FIXEDPOINT";
2813 break;
2814 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2815 os << "QUANTIZE_DOWN_FLOAT";
2816 break;
2817 default:
2818 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2819 }
2820 return os;
2821}
2822
2823/** Converts a @ref GEMMLowpOutputStageType to string
2824 *
2825 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2826 *
2827 * @return String representing the corresponding GEMMLowpOutputStageType
2828 */
2829inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2830{
2831 std::stringstream str;
2832 str << gemm_type;
2833 return str.str();
2834}
2835
2836/** Formatted output of the GEMMLowpOutputStageInfo type.
2837 *
2838 * @param[out] os Output stream.
2839 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2840 *
2841 * @return Modified output stream.
2842 */
2843inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2844{
SiCongLi579ca842021-10-18 09:38:33 +01002845 os << "{type=" << gemm_info.type << ", "
2846 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2847 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2848 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2849 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2850 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2851 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2852 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2853 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2854 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2855 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002856 return os;
2857}
2858
2859/** Converts a @ref GEMMLowpOutputStageInfo to string
2860 *
2861 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2862 *
2863 * @return String representing the corresponding GEMMLowpOutputStageInfo
2864 */
2865inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2866{
2867 std::stringstream str;
2868 str << gemm_info;
2869 return str.str();
2870}
2871
2872/** Formatted output of the Conv2dInfo type.
2873 *
2874 * @param[out] os Output stream.
2875 * @param[in] conv_info Conv2dInfo to output.
2876 *
2877 * @return Modified output stream.
2878 */
2879inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2880{
SiCongLi579ca842021-10-18 09:38:33 +01002881 os << "{conv_info=" << conv_info.conv_info << ", "
2882 << "dilation=" << conv_info.dilation << ", "
2883 << "act_info=" << to_string(conv_info.act_info) << ", "
2884 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2885 << "num_groups=" << conv_info.num_groups << ","
2886 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002887 return os;
2888}
2889
2890/** Converts a @ref Conv2dInfo to string
2891 *
2892 * @param[in] conv_info Conv2dInfo value to be converted
2893 *
2894 * @return String representing the corresponding Conv2dInfo
2895 */
2896inline std::string to_string(const Conv2dInfo &conv_info)
2897{
2898 std::stringstream str;
2899 str << conv_info;
2900 return str.str();
2901}
2902
2903/** Formatted output of the PixelValue type.
2904 *
2905 * @param[out] os Output stream.
2906 * @param[in] pixel_value PixelValue to output.
2907 *
2908 * @return Modified output stream.
2909 */
2910inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2911{
SiCongLi579ca842021-10-18 09:38:33 +01002912 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002913 return os;
2914}
2915
2916/** Converts a @ref PixelValue to string
2917 *
2918 * @param[in] pixel_value PixelValue value to be converted
2919 *
2920 * @return String representing the corresponding PixelValue
2921 */
2922inline std::string to_string(const PixelValue &pixel_value)
2923{
2924 std::stringstream str;
2925 str << pixel_value;
2926 return str.str();
2927}
2928
2929/** Formatted output of the ScaleKernelInfo type.
2930 *
2931 * @param[out] os Output stream.
2932 * @param[in] scale_info ScaleKernelInfo to output.
2933 *
2934 * @return Modified output stream.
2935 */
2936inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2937{
SiCongLi579ca842021-10-18 09:38:33 +01002938 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2939 << "BorderMode=" << scale_info.border_mode << ", "
2940 << "PixelValue=" << scale_info.constant_border_value << ", "
2941 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2942 << "use_padding=" << scale_info.use_padding << ", "
2943 << "align_corners=" << scale_info.align_corners << ", "
2944 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002945 return os;
2946}
2947
2948/** Converts a @ref ScaleKernelInfo to string
2949 *
2950 * @param[in] scale_info ScaleKernelInfo value to be converted
2951 *
2952 * @return String representing the corresponding ScaleKernelInfo
2953 */
2954inline std::string to_string(const ScaleKernelInfo &scale_info)
2955{
2956 std::stringstream str;
2957 str << scale_info;
2958 return str.str();
2959}
2960
2961/** Formatted output of the FFTDirection type.
2962 *
2963 * @param[out] os Output stream.
2964 * @param[in] fft_dir FFTDirection to output.
2965 *
2966 * @return Modified output stream.
2967 */
2968inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2969{
2970 switch(fft_dir)
2971 {
2972 case FFTDirection::Forward:
2973 os << "Forward";
2974 break;
2975 case FFTDirection::Inverse:
2976 os << "Inverse";
2977 break;
2978 default:
2979 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2980 }
2981 return os;
2982}
2983
2984/** Converts a @ref FFT1DInfo to string
2985 *
2986 * @param[in] fft_dir FFT1DInfo value to be converted
2987 *
2988 * @return String representing the corresponding FFT1DInfo
2989 */
2990inline std::string to_string(const FFTDirection &fft_dir)
2991{
2992 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002993 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002994 return str.str();
2995}
2996
2997/** Formatted output of the FFT1DInfo type.
2998 *
2999 * @param[out] os Output stream.
3000 * @param[in] fft1d_info FFT1DInfo to output.
3001 *
3002 * @return Modified output stream.
3003 */
3004inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
3005{
SiCongLi579ca842021-10-18 09:38:33 +01003006 os << "{axis=" << fft1d_info.axis << ", "
3007 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003008 return os;
3009}
3010
3011/** Converts a @ref FFT1DInfo to string
3012 *
3013 * @param[in] fft1d_info FFT1DInfo value to be converted
3014 *
3015 * @return String representing the corresponding FFT1DInfo
3016 */
3017inline std::string to_string(const FFT1DInfo &fft1d_info)
3018{
3019 std::stringstream str;
3020 str << fft1d_info;
3021 return str.str();
3022}
3023
3024/** Formatted output of the FFT2DInfo type.
3025 *
3026 * @param[out] os Output stream.
3027 * @param[in] fft2d_info FFT2DInfo to output.
3028 *
3029 * @return Modified output stream.
3030 */
3031inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
3032{
SiCongLi579ca842021-10-18 09:38:33 +01003033 os << "{axis=" << fft2d_info.axis0 << ", "
3034 << "axis=" << fft2d_info.axis1 << ", "
3035 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003036 return os;
3037}
3038
3039/** Converts a @ref FFT2DInfo to string
3040 *
3041 * @param[in] fft2d_info FFT2DInfo value to be converted
3042 *
3043 * @return String representing the corresponding FFT2DInfo
3044 */
3045inline std::string to_string(const FFT2DInfo &fft2d_info)
3046{
3047 std::stringstream str;
3048 str << fft2d_info;
3049 return str.str();
3050}
3051
3052/** Formatted output of the Coordinates2D type.
3053 *
3054 * @param[out] os Output stream.
3055 * @param[in] coord_2d Coordinates2D to output.
3056 *
3057 * @return Modified output stream.
3058 */
3059inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3060{
SiCongLi579ca842021-10-18 09:38:33 +01003061 os << "{x=" << coord_2d.x << ", "
3062 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003063 return os;
3064}
3065
3066/** Converts a @ref Coordinates2D to string
3067 *
3068 * @param[in] coord_2d Coordinates2D value to be converted
3069 *
3070 * @return String representing the corresponding Coordinates2D
3071 */
3072inline std::string to_string(const Coordinates2D &coord_2d)
3073{
3074 std::stringstream str;
3075 str << coord_2d;
3076 return str.str();
3077}
3078
3079/** Formatted output of the FuseBatchNormalizationType type.
3080 *
3081 * @param[out] os Output stream.
3082 * @param[in] fuse_type FuseBatchNormalizationType to output.
3083 *
3084 * @return Modified output stream.
3085 */
3086inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3087{
3088 switch(fuse_type)
3089 {
3090 case FuseBatchNormalizationType::CONVOLUTION:
3091 os << "CONVOLUTION";
3092 break;
3093 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3094 os << "DEPTHWISECONVOLUTION";
3095 break;
3096 default:
3097 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3098 }
3099 return os;
3100}
3101
3102/** Converts a @ref FuseBatchNormalizationType to string
3103 *
3104 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3105 *
3106 * @return String representing the corresponding FuseBatchNormalizationType
3107 */
3108inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3109{
3110 std::stringstream str;
3111 str << fuse_type;
3112 return str.str();
3113}
3114
ramelg01cbbb0382021-09-17 17:36:57 +01003115/** Formatted output of the SoftmaxKernelInfo type.
3116 *
3117 * @param[out] os Output stream.
3118 * @param[in] info SoftmaxKernelInfo to output.
3119 *
3120 * @return Modified output stream.
3121 */
3122inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3123{
SiCongLi579ca842021-10-18 09:38:33 +01003124 os << "{beta=" << info.beta << ", "
3125 << "is_log=" << info.is_log << ", "
3126 << "input_data_type=" << info.input_data_type << ", "
3127 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003128 return os;
3129}
3130
3131/** Converts a @ref SoftmaxKernelInfo to string
3132 *
3133 * @param[in] info SoftmaxKernelInfo value to be converted
3134 *
3135 * @return String representing the corresponding SoftmaxKernelInfo
3136 */
3137inline std::string to_string(const SoftmaxKernelInfo &info)
3138{
3139 std::stringstream str;
3140 str << info;
3141 return str.str();
3142}
3143
3144/** Formatted output of the ScaleKernelInfo type.
3145 *
3146 * @param[out] os Output stream.
3147 * @param[in] lstm_params LSTMParams to output.
3148 *
3149 * @return Modified output stream.
3150 */
3151template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003152::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003153{
ramelg014a6d9e82021-10-02 14:34:36 +01003154 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3155 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3156 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3157 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3158 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3159 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3160 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3161 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3162 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3163 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3164 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3165 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003166 << "cell_clip=" << lstm_params.cell_clip() << ", "
3167 << "projection_clip=" << lstm_params.projection_clip() << ", "
3168 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3169 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3170 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3171 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3172 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3173 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3174 << "has_projection=" << lstm_params.has_projection() << ", "
3175 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3176 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3177 return os;
3178}
3179
3180/** Converts a @ref LSTMParams to string
3181 *
3182 * @param[in] lstm_params LSTMParams<T> value to be converted
3183 *
3184 * @return String representing the corresponding LSTMParams
3185 */
3186template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003187std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003188{
3189 std::stringstream str;
3190 str << lstm_params;
3191 return str.str();
3192}
3193
3194/** Converts a @ref LSTMParams to string
3195 *
3196 * @param[in] num uint8_t value to be converted
3197 *
3198 * @return String representing the corresponding uint8_t
3199 */
3200inline std::string to_string(const uint8_t num)
3201{
3202 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3203 return ::std::to_string(static_cast<int>(num));
3204}
3205
ramelg014a6d9e82021-10-02 14:34:36 +01003206/** Available non maxima suppression types */
3207/** Formatted output of the NMSType type.
3208 *
3209 * @param[out] os Output stream.
3210 * @param[in] nms_type NMSType to output.
3211 *
3212 * @return Modified output stream.
3213 */
3214inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3215{
3216 switch(nms_type)
3217 {
3218 case NMSType::LINEAR:
3219 os << "LINEAR";
3220 break;
3221 case NMSType::GAUSSIAN:
3222 os << "GAUSSIAN";
3223 break;
3224 case NMSType::ORIGINAL:
3225 os << "ORIGINAL";
3226 break;
3227 default:
3228 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3229 }
3230 return os;
3231}
3232
3233/** Converts a @ref NMSType to string
3234 *
3235 * @param[in] nms_type NMSType value to be converted
3236 *
3237 * @return String representing the corresponding NMSType
3238 */
3239inline std::string to_string(const NMSType nms_type)
3240{
3241 std::stringstream str;
3242 str << nms_type;
3243 return str.str();
3244}
3245
3246/** Formatted output of the BoxNMSLimitInfo type.
3247 *
3248 * @param[out] os Output stream.
3249 * @param[in] info BoxNMSLimitInfo to output.
3250 *
3251 * @return Modified output stream.
3252 */
3253inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3254{
SiCongLi579ca842021-10-18 09:38:33 +01003255 os << "{score_thresh=" << info.score_thresh() << ", "
3256 << "nms=" << info.nms() << ", "
3257 << "detections_per_im=" << info.detections_per_im() << ", "
3258 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3259 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3260 << "suppress_size=" << info.suppress_size() << ", "
3261 << "min_size=" << info.min_size() << ", "
3262 << "im_width=" << info.im_width() << ", "
3263 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003264 return os;
3265}
3266
3267/** Converts a @ref BoxNMSLimitInfo to string
3268 *
3269 * @param[in] info BoxNMSLimitInfo value to be converted
3270 *
3271 * @return String representing the corresponding BoxNMSLimitInfo
3272 */
3273inline std::string to_string(const BoxNMSLimitInfo &info)
3274{
3275 std::stringstream str;
3276 str << info;
3277 return str.str();
3278}
3279
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003280/** Converts a @ref DimensionRoundingType to string
3281 *
3282 * @param[in] rounding_type DimensionRoundingType value to be converted
3283 *
3284 * @return String representing the corresponding DimensionRoundingType
3285 */
3286inline std::string to_string(const DimensionRoundingType &rounding_type)
3287{
3288 std::stringstream str;
3289 str << rounding_type;
3290 return str.str();
3291}
3292
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003293/** Formatted output of the Conv3dInfo type.
3294 *
3295 * @param[out] os Output stream.
3296 * @param[in] conv3d_info Type to output.
3297 *
3298 * @return Modified output stream.
3299 */
3300inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3301{
3302 os << conv3d_info.stride;
3303 os << ";";
3304 os << conv3d_info.padding;
3305 os << ";";
3306 os << to_string(conv3d_info.act_info);
3307 os << ";";
3308 os << conv3d_info.dilation;
3309 os << ";";
3310 os << conv3d_info.round_type;
3311 os << ";";
3312 os << conv3d_info.enable_fast_math;
3313
3314 return os;
3315}
3316
3317/** Formatted output of the Conv3dInfo type.
3318 *
3319 * @param[in] conv3d_info Type to output.
3320 *
3321 * @return Formatted string.
3322 */
3323inline std::string to_string(const Conv3dInfo &conv3d_info)
3324{
3325 std::stringstream str;
3326 str << conv3d_info;
3327 return str.str();
3328}
3329
Ramy Elgammal91780022022-07-20 14:57:37 +01003330/** Formatted output of the arm_compute::WeightFormat type.
3331 *
3332 * @param[in] wf arm_compute::WeightFormat Type to output.
3333 *
3334 * @return Formatted string.
3335 */
3336inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003337{
Ramy Elgammal91780022022-07-20 14:57:37 +01003338#define __CASE_WEIGHT_FORMAT(wf) \
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003339case WeightFormat::wf: \
3340 return #wf;
Ramy Elgammal91780022022-07-20 14:57:37 +01003341 switch(wf)
3342 {
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003343 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3344 __CASE_WEIGHT_FORMAT(ANY)
3345 __CASE_WEIGHT_FORMAT(OHWI)
3346 __CASE_WEIGHT_FORMAT(OHWIo2)
3347 __CASE_WEIGHT_FORMAT(OHWIo4)
3348 __CASE_WEIGHT_FORMAT(OHWIo8)
3349 __CASE_WEIGHT_FORMAT(OHWIo16)
3350 __CASE_WEIGHT_FORMAT(OHWIo32)
3351 __CASE_WEIGHT_FORMAT(OHWIo64)
3352 __CASE_WEIGHT_FORMAT(OHWIo128)
3353 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3354 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3355 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3356 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3357 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3358 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3359 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3360 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3361 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3362 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3363 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3364 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3365 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3366 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3367 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3368 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3369 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3370 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3371 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3372 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3373 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3374 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3375 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3376 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3377 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3378 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003379 default:
3380 return "invalid value";
3381 }
3382#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003383}
3384
Ramy Elgammal91780022022-07-20 14:57:37 +01003385/** Formatted output of the arm_compute::WeightFormat type.
3386 *
3387 * @param[out] os Output stream.
3388 * @param[in] wf WeightFormat to output.
3389 *
3390 * @return Modified output stream.
3391 */
3392inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3393{
3394 os << to_string(wf);
3395 return os;
3396}
3397
3398/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3399 *
3400 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3401 *
3402 * @return Formatted string.
3403 */
3404inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003405{
3406 std::stringstream str;
3407 str << "[Input shape = " << std::get<0>(values);
3408 str << ", ";
3409 str << "Expected output shape = " << std::get<1>(values);
3410
3411 str << ", ";
3412 str << "WeightFormat = " << std::get<2>(values) << "]";
3413 return str.str();
3414}
3415
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003416/** Formatted output of the Padding2D type.
3417 *
3418 * @param[out] os Output stream.
3419 * @param[in] padding2d Padding info for 2D dimension shape.
3420 *
3421 * @return Modified output stream.
3422 */
3423inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3424{
3425 os << padding2d.left << "," << padding2d.right << ","
3426 << padding2d.top << "," << padding2d.bottom;
3427 return os;
3428}
3429
3430/** Converts a @ref Padding2D to string
3431 *
3432 * @param[in] padding2d Padding2D value to be converted
3433 *
3434 * @return String representing the corresponding Padding2D
3435 */
3436inline std::string to_string(const Padding2D &padding2d)
3437{
3438 std::stringstream str;
3439 str << padding2d;
3440 return str.str();
3441}
3442
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003443/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3444 *
3445 * @param[out] os Output stream.
3446 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3447 *
3448 * @return Modified output stream.
3449 */
3450inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3451{
3452 os << "Pool2dAttributes="
3453 << "["
3454 << "PoolingType=" << pool2d_attr.pool_type() << ","
3455 << "PoolSize=" << pool2d_attr.pool_size() << ","
3456 << "Padding=" << pool2d_attr.pad() << ","
3457 << "Stride=" << pool2d_attr.stride() << ","
3458 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3459
3460 return os;
3461}
3462
3463/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3464 *
3465 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3466 *
3467 * @return Formatted string.
3468 */
3469inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3470{
3471 std::stringstream str;
3472 str << pool2d_attr;
3473 return str.str();
3474}
3475
3476/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3477 *
3478 * @param[out] os Output stream
3479 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3480 */
3481inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3482{
3483 os << "Settings="
3484 << "["
3485 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3486 return os;
3487}
3488
3489/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3490 *
3491 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3492 *
3493 * @return Formatted string.
3494 */
3495inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3496{
3497 std::stringstream str;
3498 str << settings;
3499 return str.str();
3500}
3501
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003502/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3503 *
3504 * @param[out] os Output stream.
3505 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3506 *
3507 * @return Modified output stream.
3508 */
3509inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3510{
3511 os << "Conv2dAttributes="
3512 << "["
3513 << "Padding=" << conv2d_attr.pad() << ", "
3514 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003515 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003516
3517 return os;
3518}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003519
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003520/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3521 *
3522 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3523 *
3524 * @return Formatted string.
3525 */
3526inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3527{
3528 std::stringstream str;
3529 str << conv2d_attr;
3530 return str.str();
3531}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003532
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003533/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3534 *
3535 * @param[out] os Output stream.
3536 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3537 *
3538 * @return Modified output stream.
3539 */
3540inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3541{
3542 os << "CastAttributes="
3543 << "["
3544 << "Data Type=" << cast_attr.data_type() << ", "
3545 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3546
3547 return os;
3548}
3549/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3550 *
3551 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3552 *
3553 * @return Formatted string.
3554 */
3555inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3556{
3557 std::stringstream str;
3558 str << cast_attr;
3559 return str.str();
3560}
3561
Gunes Bayir7dc02342022-11-21 21:46:50 +00003562/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3563 *
3564 * @param[out] os Output stream.
3565 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3566 *
3567 * @return Modified output stream.
3568 */
3569inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3570{
3571 os << "DepthwiseConv2dAttributes="
3572 << "["
3573 << "Padding=" << dw_conv2d_attr.pad() << ", "
3574 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3575 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3576 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3577 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3578
3579 return os;
3580}
3581/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3582 *
3583 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3584 *
3585 * @return Formatted string.
3586 */
3587inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3588{
3589 std::stringstream str;
3590 str << dw_conv2d_attr;
3591 return str.str();
3592}
3593
Jakub Sujak32741722022-11-25 16:43:18 +00003594/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3595 *
3596 * @param[out] os Output stream.
3597 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3598 *
3599 * @return Modified output stream.
3600 */
3601inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3602{
3603 os << "ClampAttributes="
3604 << "["
3605 << "Min value=" << clamp_attr.min_val() << ", "
3606 << "Max value=" << clamp_attr.max_val() << "]";
3607 return os;
3608}
3609/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3610 *
3611 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3612 *
3613 * @return Formatted string.
3614 */
3615inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3616{
3617 std::stringstream str;
3618 str << clamp_attr;
3619 return str.str();
3620}
3621
Jakub Sujak8ae57142022-12-02 16:09:06 +00003622/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3623 *
3624 * @param[out] os Output stream.
3625 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3626 *
3627 * @return Modified output stream.
3628 */
3629inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3630{
3631 os << "ResizeAttributes="
3632 << "["
3633 << "AlignCorners=" << resize_attr.align_corners() << ", "
3634 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3635 << "OutputHeight=" << resize_attr.output_height() << ", "
3636 << "OutputWidth=" << resize_attr.output_width() << ", "
3637 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3638 return os;
3639}
3640
3641/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3642 *
3643 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3644 *
3645 * @return Formatted string.
3646 */
3647inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3648{
3649 std::stringstream str;
3650 str << resize_attr;
3651 return str.str();
3652}
3653
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003654/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3655 *
3656 * @param[out] os Output stream.
3657 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3658 *
3659 * @return Modified output stream.
3660 */
3661inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3662{
Jakub Sujak7359a872023-01-05 14:24:13 +00003663 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003664 << "["
3665 << "Beta=" << softmax_attr.beta() << ", "
3666 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3667 << "Axis=" << softmax_attr.axis() << "]";
3668 return os;
3669}
3670/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3671 *
3672 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3673 *
3674 * @return Formatted string.
3675 */
3676inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3677{
3678 std::stringstream str;
3679 str << softmax_attr;
3680 return str.str();
3681}
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003682/** Formatted output of the arm_compute::MatMulInfo type.
3683 *
3684 * @param[out] os Output stream.
3685 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3686 *
3687 * @return Modified output stream.
3688 */
3689inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulInfo &matmul_info)
3690{
3691 os << "MatMulKernelInfo="
3692 << "["
3693 << "adj_lhs=" << matmul_info.adj_lhs() << ", "
3694 << "adj_rhs=" << matmul_info.adj_rhs() << ", "
3695 << "fused_activation=" << matmul_info.fused_activation().activation() << "]";
3696
3697 return os;
3698}
3699/** Formatted output of the arm_compute::MatMulInfo type.
3700 *
3701 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3702 *
3703 * @return Formatted string.
3704 */
3705inline std::string to_string(const arm_compute::MatMulInfo &matmul_info)
3706{
3707 std::stringstream str;
3708 str << matmul_info;
3709 return str.str();
3710}
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003711
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003712/** Formatted output of the arm_compute::MatMulKernelInfo type.
3713 *
3714 * @param[out] os Output stream.
3715 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3716 *
3717 * @return Modified output stream.
3718 */
3719inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulKernelInfo &matmul_info)
3720{
3721 os << "MatMulKernelInfo="
3722 << "["
3723 << "adj_lhs=" << matmul_info.adj_lhs << ", "
3724 << "adj_rhs=" << matmul_info.adj_rhs << ", "
3725 << "M0=" << matmul_info.m0 << ", "
3726 << "N0=" << matmul_info.n0 << ", "
3727 << "K0=" << matmul_info.k0 << ", "
3728 << "export_rhs_to_cl_image=" << matmul_info.export_rhs_to_cl_image
3729 << "]";
3730
3731 return os;
3732}
3733/** Formatted output of the arm_compute::MatMulKernelInfo type.
3734 *
3735 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3736 *
3737 * @return Formatted string.
3738 */
3739inline std::string to_string(const arm_compute::MatMulKernelInfo &matmul_info)
3740{
3741 std::stringstream str;
3742 str << matmul_info;
3743 return str.str();
3744}
3745
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003746/** Formatted output of the arm_compute::CpuMatMulSettings type.
3747 *
3748 * @param[out] os Output stream.
3749 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3750 *
3751 * @return Modified output stream.
3752 */
3753inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::CpuMatMulSettings &settings)
3754{
3755 os << "CpuMatMulSettings="
3756 << "["
3757 << "fast_math=" << settings.fast_math()
3758 << "]";
3759
3760 return os;
3761}
3762/** Formatted output of the arm_compute::CpuMatMulSettings type.
3763 *
3764 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3765 *
3766 * @return Formatted string.
3767 */
3768inline std::string to_string(const arm_compute::CpuMatMulSettings &settings)
3769{
3770 std::stringstream str;
3771 str << settings;
3772 return str.str();
3773}
3774
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003775} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003776
3777#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */