blob: 515e568657994cdafc8ab297b9cd6031e9ad7d49 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002 * Copyright (c) 2017-2022 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
Anthony Barbier6ff3b192017-09-04 18:44:23 +010031#include "arm_compute/core/Dimensions.h"
32#include "arm_compute/core/Error.h"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010033#include "arm_compute/core/GPUTarget.h"
morgolockaba2f912020-05-05 16:28:19 +010034#include "arm_compute/core/KernelDescriptors.h"
John Richardson25f23682017-11-27 14:35:09 +000035#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010036#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000037#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038#include "arm_compute/core/Types.h"
SiCongLi1af54162021-10-06 15:25:57 +010039#include "arm_compute/core/experimental/IPostOp.h"
SiCongLi31778612021-11-12 17:33:45 +000040#include "arm_compute/core/experimental/PostOps.h"
Ramy Elgammal73f19af2022-10-23 11:44:49 +010041#include "arm_compute/dynamic_fusion/sketch/OperatorAttributes.h"
Gunes Bayir1dc6ff12022-12-06 20:48:31 +000042#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000043#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010044#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000045#include "arm_compute/runtime/CL/CLTypes.h"
ramelg013ae3d882021-09-12 23:07:47 +010046#include "arm_compute/runtime/FunctionDescriptors.h"
ramelg01cbbb0382021-09-17 17:36:57 +010047#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000048#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000049#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010050#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010051#include <sstream>
52#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053
54namespace arm_compute
55{
Anthony Barbierb940fd62018-06-04 14:14:32 +010056/** Formatted output if arg is not null
57 *
58 * @param[in] arg Object to print
59 *
60 * @return String representing arg.
61 */
62template <typename T>
63std::string to_string_if_not_null(T *arg)
64{
65 if(arg == nullptr)
66 {
67 return "nullptr";
68 }
69 else
70 {
71 return to_string(*arg);
72 }
73}
Anthony Barbierb4670212018-05-18 16:55:39 +010074
ramelg014a6d9e82021-10-02 14:34:36 +010075/** Fallback method: try to use std::to_string:
76 *
77 * @param[in] val Value to convert to string
78 *
79 * @return String representing val.
80 */
81template <typename T>
82inline std::string to_string(const T &val)
83{
84 return support::cpp11::to_string(val);
85}
86
ramelg01b1ba1e32021-09-25 11:53:26 +010087/** Formatted output of a vector of objects.
88 *
ramelg014a6d9e82021-10-02 14:34:36 +010089 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
90 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
91 *
ramelg01b1ba1e32021-09-25 11:53:26 +010092 * @param[out] os Output stream
93 * @param[in] args Vector of objects to print
94 *
95 * @return Modified output stream.
96 */
97template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +010098::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +010099{
100 const size_t max_print_size = 5U;
101
102 os << "[";
103 bool first = true;
104 size_t i;
105 for(i = 0; i < args.size(); ++i)
106 {
107 if(i == max_print_size)
108 {
109 break;
110 }
111 if(first)
112 {
113 first = false;
114 }
115 else
116 {
117 os << ", ";
118 }
ramelg014a6d9e82021-10-02 14:34:36 +0100119 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100120 }
121 if(i < args.size())
122 {
123 os << ", ...";
124 }
125 os << "]";
126 return os;
127}
128
ramelg014a6d9e82021-10-02 14:34:36 +0100129/** Formatted output of a vector of objects.
130 *
131 * @param[in] args Vector of objects to print
132 *
133 * @return String representing args.
134 */
135template <typename T>
136std::string to_string(const std::vector<T> &args)
137{
138 std::stringstream str;
139 str << args;
140 return str.str();
141}
142
SiCongLi1af54162021-10-06 15:25:57 +0100143/** @name (EXPERIMENTAL_POST_OPS)
144 * @{
145 */
146/** Formmated output of the @ref experimental::PostOpType type
147 *
148 * @param[out] os Output stream.
149 * @param[in] post_op_type Type to output.
150 *
151 * @return Modified output stream.
152 */
153inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
154{
155 os << "type=";
156 switch(post_op_type)
157 {
158 case experimental::PostOpType::Activation:
159 {
160 os << "Activation";
161 break;
162 }
163 case experimental::PostOpType::Eltwise_Add:
164 {
165 os << "Eltwise_Add";
166 break;
167 }
ramelg016049eda2021-10-29 10:52:53 +0100168 case experimental::PostOpType::Eltwise_PRelu:
169 {
170 os << "Eltwise_PRelu";
171 break;
172 }
SiCongLi1af54162021-10-06 15:25:57 +0100173 default:
174 {
175 ARM_COMPUTE_ERROR("Unsupported PostOpType");
176 break;
177 }
178 }
179 return os;
180}
181/** Converts a @ref experimental::PostOpType to string
182 *
183 * @param[in] post_op_type PostOpType value to be converted
184 *
185 * @return String representing the corresponding PostOpType
186 */
187inline std::string to_string(experimental::PostOpType post_op_type)
188{
189 std::stringstream str;
190 str << post_op_type;
191 return str.str();
192}
193/** Formatted output of the @ref experimental::IPostOp type.
194 *
195 * @param[out] os Output stream.
196 * @param[in] post_op Type to output.
197 *
198 * @return Modified output stream.
199 */
200template <typename T>
201inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
202{
203 os << "<";
204 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100205 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100206 switch(post_op.type())
207 {
208 case experimental::PostOpType::Activation:
209 {
210 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
211 os << "act_info=" << &(_post_op->_act_info);
212 break;
213 }
214 case experimental::PostOpType::Eltwise_Add:
215 {
216 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
217 os << "convert_policy=" << _post_op->_policy;
218 break;
219 }
ramelg016049eda2021-10-29 10:52:53 +0100220 case experimental::PostOpType::Eltwise_PRelu:
221 {
222 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
223 os << "convert_policy=" << _post_op->_policy;
224 break;
225 }
SiCongLi1af54162021-10-06 15:25:57 +0100226 default:
227 {
228 ARM_COMPUTE_ERROR("Unsupported PostOpType");
229 break;
230 }
231 }
232 os << ">";
233 return os;
234}
235/** Converts an @ref experimental::IPostOp to string
236 *
237 * @param[in] post_op IPostOp value to be converted
238 *
239 * @return String representing the corresponding IPostOp
240 */
241template <typename T>
242inline std::string to_string(const experimental::IPostOp<T> &post_op)
243{
244 std::stringstream str;
245 str << post_op;
246 return str.str();
247}
248/** Formatted output of the @ref experimental::PostOpList type.
249 *
250 * @param[out] os Output stream.
251 * @param[in] post_ops Type to output.
252 *
253 * @return Modified output stream.
254 */
255template <typename T>
256inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
257{
258 os << "[";
259 for(const auto &post_op : post_ops.get_list())
260 {
261 os << *post_op << ",";
262 }
263 os << "]";
264 return os;
265}
266/** Converts a @ref experimental::PostOpList to string
267 *
268 * @param[in] post_ops PostOpList value to be converted
269 *
270 * @return String representing the corresponding PostOpList
271 */
272template <typename T>
273inline std::string to_string(const experimental::PostOpList<T> &post_ops)
274{
275 std::stringstream str;
276 str << post_ops;
277 return str.str();
278}
279/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
280
Alex Gildayc357c472018-03-21 13:54:09 +0000281/** Formatted output of the Dimensions type.
282 *
283 * @param[out] os Output stream.
284 * @param[in] dimensions Type to output.
285 *
286 * @return Modified output stream.
287 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100288template <typename T>
289inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
290{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100291 if(dimensions.num_dimensions() > 0)
292 {
293 os << dimensions[0];
294
295 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
296 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100297 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298 }
299 }
300
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100301 return os;
302}
303
Alex Gildayc357c472018-03-21 13:54:09 +0000304/** Formatted output of the RoundingPolicy type.
305 *
306 * @param[out] os Output stream.
307 * @param[in] rounding_policy Type to output.
308 *
309 * @return Modified output stream.
310 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100311inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100312{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100313 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100314 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100315 case RoundingPolicy::TO_ZERO:
316 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100317 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100318 case RoundingPolicy::TO_NEAREST_UP:
319 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100320 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100321 case RoundingPolicy::TO_NEAREST_EVEN:
322 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100323 break;
324 default:
325 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
326 }
327
328 return os;
329}
330
Alex Gildayc357c472018-03-21 13:54:09 +0000331/** Formatted output of the WeightsInfo type.
332 *
333 * @param[out] os Output stream.
334 * @param[in] weights_info Type to output.
335 *
336 * @return Modified output stream.
337 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100338inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100339{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100340 os << weights_info.are_reshaped() << ";";
341 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100342
343 return os;
344}
345
Alex Gildayc357c472018-03-21 13:54:09 +0000346/** Formatted output of the ROIPoolingInfo type.
347 *
348 * @param[out] os Output stream.
349 * @param[in] pool_info Type to output.
350 *
351 * @return Modified output stream.
352 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100353inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100354{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100355 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100356 return os;
357}
358
giuros0118870812018-09-13 09:31:40 +0100359/** Formatted output of the ROIPoolingInfo type.
360 *
361 * @param[in] pool_info Type to output.
362 *
363 * @return Formatted string.
364 */
365inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
366{
367 std::stringstream str;
368 str << pool_info;
369 return str.str();
370}
371
morgolockaba2f912020-05-05 16:28:19 +0100372/** Formatted output of the GEMMKernelInfo type.
373 *
374 * @param[out] os Output stream.
375 * @param[in] gemm_info Type to output.
376 *
377 * @return Modified output stream.
378 */
379inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
380{
SiCongLi579ca842021-10-18 09:38:33 +0100381 os << "( m=" << gemm_info.m;
382 os << " n=" << gemm_info.n;
383 os << " k=" << gemm_info.k;
384 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
385 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
386 os << " broadcast_bias=" << gemm_info.broadcast_bias;
387 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
388 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
389 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
390 os << " a_offset=" << gemm_info.a_offset;
391 os << " b_offset=" << gemm_info.b_offset;
392 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100393 os << ")";
394 return os;
395}
396
397/** Formatted output of the GEMMLHSMatrixInfo type.
398 *
399 * @param[out] os Output stream.
400 * @param[in] gemm_info Type to output.
401 *
402 * @return Modified output stream.
403 */
404inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
405{
SiCongLi579ca842021-10-18 09:38:33 +0100406 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 +0100407 return os;
408}
409
410/** Formatted output of the GEMMRHSMatrixInfo type.
411 *
412 * @param[out] os Output stream.
413 * @param[in] gemm_info Type to output.
414 *
415 * @return Modified output stream.
416 */
417inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
418{
SiCongLi579ca842021-10-18 09:38:33 +0100419 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=" <<
SiCong Lidb4a6c12021-02-05 09:30:57 +0000420 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100421 return os;
422}
423
424/** Formatted output of the GEMMRHSMatrixInfo type.
425 *
426 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
427 *
428 * @return Formatted string.
429 */
430inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
431{
432 std::stringstream str;
433 str << gemm_info;
434 return str.str();
435}
436
437/** Formatted output of the GEMMLHSMatrixInfo type.
438 *
439 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
440 *
441 * @return Formatted string.
442 */
443inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
444{
445 std::stringstream str;
446 str << gemm_info;
447 return str.str();
448}
449
450/** Formatted output of the GEMMKernelInfo type.
451 *
452 * @param[in] gemm_info GEMMKernelInfo Type to output.
453 *
454 * @return Formatted string.
455 */
456inline std::string to_string(const GEMMKernelInfo &gemm_info)
457{
458 std::stringstream str;
459 str << gemm_info;
460 return str.str();
461}
462
giuros01c04a0e82018-10-03 12:44:35 +0100463/** Formatted output of the BoundingBoxTransformInfo type.
464 *
465 * @param[out] os Output stream.
466 * @param[in] bbox_info Type to output.
467 *
468 * @return Modified output stream.
469 */
470inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
471{
472 auto weights = bbox_info.weights();
SiCongLi579ca842021-10-18 09:38:33 +0100473 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
giuros01c04a0e82018-10-03 12:44:35 +0100474 "})";
475 return os;
476}
477
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100478#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100479inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100480{
481 std::stringstream str;
482 str << v;
483 os << str.str();
484 return os;
485}
Ramy Elgammal91780022022-07-20 14:57:37 +0100486#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100487
giuros01c04a0e82018-10-03 12:44:35 +0100488/** Formatted output of the BoundingBoxTransformInfo type.
489 *
490 * @param[in] bbox_info Type to output.
491 *
492 * @return Formatted string.
493 */
494inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
495{
496 std::stringstream str;
497 str << bbox_info;
498 return str.str();
499}
500
Manuel Bottini5209be52019-02-13 16:34:56 +0000501/** Formatted output of the ComputeAnchorsInfo type.
502 *
503 * @param[out] os Output stream.
504 * @param[in] anchors_info Type to output.
505 *
506 * @return Modified output stream.
507 */
508inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
509{
510 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
511 return os;
512}
513
514/** Formatted output of the ComputeAnchorsInfo type.
515 *
516 * @param[in] anchors_info Type to output.
517 *
518 * @return Formatted string.
519 */
520inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
521{
522 std::stringstream str;
523 str << anchors_info;
524 return str.str();
525}
526
527/** Formatted output of the GenerateProposalsInfo type.
528 *
529 * @param[out] os Output stream.
530 * @param[in] proposals_info Type to output.
531 *
532 * @return Modified output stream.
533 */
534inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
535{
536 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
537 return os;
538}
539
540/** Formatted output of the GenerateProposalsInfo type.
541 *
542 * @param[in] proposals_info Type to output.
543 *
544 * @return Formatted string.
545 */
546inline std::string to_string(const GenerateProposalsInfo &proposals_info)
547{
548 std::stringstream str;
549 str << proposals_info;
550 return str.str();
551}
552
Alex Gildayc357c472018-03-21 13:54:09 +0000553/** Formatted output of the QuantizationInfo type.
554 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100555 * @param[out] os Output stream.
556 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000557 *
558 * @return Modified output stream.
559 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100560inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700561{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100562 const UniformQuantizationInfo uqinfo = qinfo.uniform();
563 os << "Scale:" << uqinfo.scale << "~";
564 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700565 return os;
566}
567
Alex Gildayc357c472018-03-21 13:54:09 +0000568/** Formatted output of the QuantizationInfo type.
569 *
570 * @param[in] quantization_info Type to output.
571 *
572 * @return Formatted string.
573 */
Chunosovd621bca2017-11-03 17:33:15 +0700574inline std::string to_string(const QuantizationInfo &quantization_info)
575{
576 std::stringstream str;
577 str << quantization_info;
578 return str.str();
579}
580
Alex Gildayc357c472018-03-21 13:54:09 +0000581/** Formatted output of the activation function type.
582 *
583 * @param[out] os Output stream.
584 * @param[in] act_function Type to output.
585 *
586 * @return Modified output stream.
587 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100588inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
589{
590 switch(act_function)
591 {
592 case ActivationLayerInfo::ActivationFunction::ABS:
593 os << "ABS";
594 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100595 case ActivationLayerInfo::ActivationFunction::LINEAR:
596 os << "LINEAR";
597 break;
598 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
599 os << "LOGISTIC";
600 break;
601 case ActivationLayerInfo::ActivationFunction::RELU:
602 os << "RELU";
603 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100604 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
605 os << "BOUNDED_RELU";
606 break;
607 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
608 os << "LEAKY_RELU";
609 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100610 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
611 os << "SOFT_RELU";
612 break;
613 case ActivationLayerInfo::ActivationFunction::SQRT:
614 os << "SQRT";
615 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100616 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
617 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000618 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100619 case ActivationLayerInfo::ActivationFunction::ELU:
620 os << "ELU";
621 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100622 case ActivationLayerInfo::ActivationFunction::SQUARE:
623 os << "SQUARE";
624 break;
625 case ActivationLayerInfo::ActivationFunction::TANH:
626 os << "TANH";
627 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100628 case ActivationLayerInfo::ActivationFunction::IDENTITY:
629 os << "IDENTITY";
630 break;
morgolock07df3d42020-02-27 11:46:28 +0000631 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
632 os << "HARD_SWISH";
633 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100634 case ActivationLayerInfo::ActivationFunction::SWISH:
635 os << "SWISH";
636 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400637 case ActivationLayerInfo::ActivationFunction::GELU:
638 os << "GELU";
639 break;
morgolock07df3d42020-02-27 11:46:28 +0000640
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100641 default:
642 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
643 }
644
645 return os;
646}
647
Alex Gildayc357c472018-03-21 13:54:09 +0000648/** Formatted output of the activation function info type.
649 *
SiCongLi1af54162021-10-06 15:25:57 +0100650 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000651 *
652 * @return Formatted string.
653 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100654inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100655{
656 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000657 if(info.enabled())
658 {
659 str << info.activation();
660 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100661 return str.str();
662}
663
SiCongLi1af54162021-10-06 15:25:57 +0100664/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100665 *
SiCongLi1af54162021-10-06 15:25:57 +0100666 * @param[out] os Output stream.
667 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100668 *
669 * @return Formatted string.
670 */
SiCongLi1af54162021-10-06 15:25:57 +0100671inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100672{
ramelg013ae3d882021-09-12 23:07:47 +0100673 if(info != nullptr)
674 {
ramelg013ae3d882021-09-12 23:07:47 +0100675 if(info->enabled())
676 {
SiCongLi1af54162021-10-06 15:25:57 +0100677 os << info->activation();
678 os << "(";
679 os << "VAL_A=" << info->a() << ",";
680 os << "VAL_B=" << info->b();
681 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100682 }
SiCongLi1af54162021-10-06 15:25:57 +0100683 else
684 {
685 os << "disabled";
686 }
ramelg013ae3d882021-09-12 23:07:47 +0100687 }
SiCongLi1af54162021-10-06 15:25:57 +0100688 else
689 {
690 os << "nullptr";
691 }
692 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100693}
694
Alex Gildayc357c472018-03-21 13:54:09 +0000695/** Formatted output of the activation function type.
696 *
697 * @param[in] function Type to output.
698 *
699 * @return Formatted string.
700 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100701inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
702{
703 std::stringstream str;
704 str << function;
705 return str.str();
706}
707
Alex Gildayc357c472018-03-21 13:54:09 +0000708/** Formatted output of the NormType type.
709 *
710 * @param[out] os Output stream.
711 * @param[in] norm_type Type to output.
712 *
713 * @return Modified output stream.
714 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100715inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
716{
717 switch(norm_type)
718 {
719 case NormType::CROSS_MAP:
720 os << "CROSS_MAP";
721 break;
722 case NormType::IN_MAP_1D:
723 os << "IN_MAP_1D";
724 break;
725 case NormType::IN_MAP_2D:
726 os << "IN_MAP_2D";
727 break;
728 default:
729 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
730 }
731
732 return os;
733}
734
Alex Gildayc357c472018-03-21 13:54:09 +0000735/** Formatted output of @ref NormalizationLayerInfo.
736 *
737 * @param[in] info Type to output.
738 *
739 * @return Formatted string.
740 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100741inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100742{
743 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000744 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100745 return str.str();
746}
747
Alex Gildayc357c472018-03-21 13:54:09 +0000748/** Formatted output of @ref NormalizationLayerInfo.
749 *
750 * @param[out] os Output stream.
751 * @param[in] info Type to output.
752 *
753 * @return Modified output stream.
754 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100755inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
756{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000757 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100758 return os;
759}
760
Alex Gildayc357c472018-03-21 13:54:09 +0000761/** Formatted output of the PoolingType type.
762 *
763 * @param[out] os Output stream.
764 * @param[in] pool_type Type to output.
765 *
766 * @return Modified output stream.
767 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100768inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
769{
770 switch(pool_type)
771 {
772 case PoolingType::AVG:
773 os << "AVG";
774 break;
775 case PoolingType::MAX:
776 os << "MAX";
777 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100778 case PoolingType::L2:
779 os << "L2";
780 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100781 default:
782 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
783 }
784
785 return os;
786}
787
Alex Gildayc357c472018-03-21 13:54:09 +0000788/** Formatted output of @ref PoolingLayerInfo.
789 *
790 * @param[out] os Output stream.
791 * @param[in] info Type to output.
792 *
793 * @return Modified output stream.
794 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100795inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
796{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000797 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100798
799 return os;
800}
801
Alex Gildayc357c472018-03-21 13:54:09 +0000802/** Formatted output of @ref RoundingPolicy.
803 *
804 * @param[in] rounding_policy Type to output.
805 *
806 * @return Formatted string.
807 */
John Richardsondd715f22017-09-18 16:10:48 +0100808inline std::string to_string(const RoundingPolicy &rounding_policy)
809{
810 std::stringstream str;
811 str << rounding_policy;
812 return str.str();
813}
814
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000815/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000816/** Formatted output of the DataLayout type.
817 *
818 * @param[out] os Output stream.
819 * @param[in] data_layout Type to output.
820 *
821 * @return Modified output stream.
822 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000823inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
824{
825 switch(data_layout)
826 {
827 case DataLayout::UNKNOWN:
828 os << "UNKNOWN";
829 break;
830 case DataLayout::NHWC:
831 os << "NHWC";
832 break;
833 case DataLayout::NCHW:
834 os << "NCHW";
835 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100836 case DataLayout::NDHWC:
837 os << "NDHWC";
838 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100839 case DataLayout::NCDHW:
840 os << "NCDHW";
841 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000842 default:
843 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
844 }
845
846 return os;
847}
848
Alex Gildayc357c472018-03-21 13:54:09 +0000849/** Formatted output of the DataLayout type.
850 *
851 * @param[in] data_layout Type to output.
852 *
853 * @return Formatted string.
854 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000855inline std::string to_string(const arm_compute::DataLayout &data_layout)
856{
857 std::stringstream str;
858 str << data_layout;
859 return str.str();
860}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000861/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000862
Georgios Pinitase2220552018-07-20 13:23:44 +0100863/** Formatted output of the DataLayoutDimension type.
864 *
865 * @param[out] os Output stream.
866 * @param[in] data_layout_dim Data layout dimension to print.
867 *
868 * @return Modified output stream.
869 */
870inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
871{
872 switch(data_layout_dim)
873 {
874 case DataLayoutDimension::WIDTH:
875 os << "WIDTH";
876 break;
877 case DataLayoutDimension::HEIGHT:
878 os << "HEIGHT";
879 break;
880 case DataLayoutDimension::CHANNEL:
881 os << "CHANNEL";
882 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100883 case DataLayoutDimension::DEPTH:
884 os << "DEPTH";
885 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100886 case DataLayoutDimension::BATCHES:
887 os << "BATCHES";
888 break;
889 default:
890 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
891 }
892 return os;
893}
894
Alex Gildayc357c472018-03-21 13:54:09 +0000895/** Formatted output of the DataType type.
896 *
897 * @param[out] os Output stream.
898 * @param[in] data_type Type to output.
899 *
900 * @return Modified output stream.
901 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100902inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
903{
904 switch(data_type)
905 {
906 case DataType::UNKNOWN:
907 os << "UNKNOWN";
908 break;
909 case DataType::U8:
910 os << "U8";
911 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100912 case DataType::QSYMM8:
913 os << "QSYMM8";
914 break;
Chunosovd621bca2017-11-03 17:33:15 +0700915 case DataType::QASYMM8:
916 os << "QASYMM8";
917 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000918 case DataType::QASYMM8_SIGNED:
919 os << "QASYMM8_SIGNED";
920 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100921 case DataType::QSYMM8_PER_CHANNEL:
922 os << "QSYMM8_PER_CHANNEL";
923 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100924 case DataType::S8:
925 os << "S8";
926 break;
927 case DataType::U16:
928 os << "U16";
929 break;
930 case DataType::S16:
931 os << "S16";
932 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100933 case DataType::QSYMM16:
934 os << "QSYMM16";
935 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100936 case DataType::QASYMM16:
937 os << "QASYMM16";
938 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100939 case DataType::U32:
940 os << "U32";
941 break;
942 case DataType::S32:
943 os << "S32";
944 break;
945 case DataType::U64:
946 os << "U64";
947 break;
948 case DataType::S64:
949 os << "S64";
950 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000951 case DataType::BFLOAT16:
952 os << "BFLOAT16";
953 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100954 case DataType::F16:
955 os << "F16";
956 break;
957 case DataType::F32:
958 os << "F32";
959 break;
960 case DataType::F64:
961 os << "F64";
962 break;
963 case DataType::SIZET:
964 os << "SIZET";
965 break;
966 default:
967 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
968 }
969
970 return os;
971}
972
Alex Gildayc357c472018-03-21 13:54:09 +0000973/** Formatted output of the DataType type.
974 *
975 * @param[in] data_type Type to output.
976 *
977 * @return Formatted string.
978 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100979inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100980{
981 std::stringstream str;
982 str << data_type;
983 return str.str();
984}
985
Alex Gildayc357c472018-03-21 13:54:09 +0000986/** Formatted output of the Format type.
987 *
988 * @param[out] os Output stream.
989 * @param[in] format Type to output.
990 *
991 * @return Modified output stream.
992 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100993inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
994{
995 switch(format)
996 {
997 case Format::UNKNOWN:
998 os << "UNKNOWN";
999 break;
1000 case Format::U8:
1001 os << "U8";
1002 break;
1003 case Format::S16:
1004 os << "S16";
1005 break;
1006 case Format::U16:
1007 os << "U16";
1008 break;
1009 case Format::S32:
1010 os << "S32";
1011 break;
1012 case Format::U32:
1013 os << "U32";
1014 break;
1015 case Format::F16:
1016 os << "F16";
1017 break;
1018 case Format::F32:
1019 os << "F32";
1020 break;
1021 case Format::UV88:
1022 os << "UV88";
1023 break;
1024 case Format::RGB888:
1025 os << "RGB888";
1026 break;
1027 case Format::RGBA8888:
1028 os << "RGBA8888";
1029 break;
1030 case Format::YUV444:
1031 os << "YUV444";
1032 break;
1033 case Format::YUYV422:
1034 os << "YUYV422";
1035 break;
1036 case Format::NV12:
1037 os << "NV12";
1038 break;
1039 case Format::NV21:
1040 os << "NV21";
1041 break;
1042 case Format::IYUV:
1043 os << "IYUV";
1044 break;
1045 case Format::UYVY422:
1046 os << "UYVY422";
1047 break;
1048 default:
1049 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1050 }
1051
1052 return os;
1053}
1054
Alex Gildayc357c472018-03-21 13:54:09 +00001055/** Formatted output of the Format type.
1056 *
1057 * @param[in] format Type to output.
1058 *
1059 * @return Formatted string.
1060 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001061inline std::string to_string(const Format &format)
1062{
1063 std::stringstream str;
1064 str << format;
1065 return str.str();
1066}
1067
Alex Gildayc357c472018-03-21 13:54:09 +00001068/** Formatted output of the Channel type.
1069 *
1070 * @param[out] os Output stream.
1071 * @param[in] channel Type to output.
1072 *
1073 * @return Modified output stream.
1074 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001075inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1076{
1077 switch(channel)
1078 {
1079 case Channel::UNKNOWN:
1080 os << "UNKNOWN";
1081 break;
1082 case Channel::C0:
1083 os << "C0";
1084 break;
1085 case Channel::C1:
1086 os << "C1";
1087 break;
1088 case Channel::C2:
1089 os << "C2";
1090 break;
1091 case Channel::C3:
1092 os << "C3";
1093 break;
1094 case Channel::R:
1095 os << "R";
1096 break;
1097 case Channel::G:
1098 os << "G";
1099 break;
1100 case Channel::B:
1101 os << "B";
1102 break;
1103 case Channel::A:
1104 os << "A";
1105 break;
1106 case Channel::Y:
1107 os << "Y";
1108 break;
1109 case Channel::U:
1110 os << "U";
1111 break;
1112 case Channel::V:
1113 os << "V";
1114 break;
1115 default:
1116 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1117 }
1118
1119 return os;
1120}
1121
Alex Gildayc357c472018-03-21 13:54:09 +00001122/** Formatted output of the Channel type.
1123 *
1124 * @param[in] channel Type to output.
1125 *
1126 * @return Formatted string.
1127 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001128inline std::string to_string(const Channel &channel)
1129{
1130 std::stringstream str;
1131 str << channel;
1132 return str.str();
1133}
1134
Alex Gildayc357c472018-03-21 13:54:09 +00001135/** Formatted output of the BorderMode type.
1136 *
1137 * @param[out] os Output stream.
1138 * @param[in] mode Type to output.
1139 *
1140 * @return Modified output stream.
1141 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001142inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1143{
1144 switch(mode)
1145 {
1146 case BorderMode::UNDEFINED:
1147 os << "UNDEFINED";
1148 break;
1149 case BorderMode::CONSTANT:
1150 os << "CONSTANT";
1151 break;
1152 case BorderMode::REPLICATE:
1153 os << "REPLICATE";
1154 break;
1155 default:
1156 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1157 }
1158
1159 return os;
1160}
1161
Alex Gildayc357c472018-03-21 13:54:09 +00001162/** Formatted output of the BorderSize type.
1163 *
1164 * @param[out] os Output stream.
1165 * @param[in] border Type to output.
1166 *
1167 * @return Modified output stream.
1168 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001169inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1170{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001171 os << border.top << ","
1172 << border.right << ","
1173 << border.bottom << ","
1174 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001175
1176 return os;
1177}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001178
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001179/** Formatted output of the PaddingList type.
1180 *
1181 * @param[out] os Output stream.
1182 * @param[in] padding Type to output.
1183 *
1184 * @return Modified output stream.
1185 */
1186inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1187{
1188 os << "{";
1189 for(auto const &p : padding)
1190 {
1191 os << "{" << p.first << "," << p.second << "}";
1192 }
1193 os << "}";
1194 return os;
1195}
1196
giuros013175fcf2018-11-21 09:59:17 +00001197/** Formatted output of the Multiples type.
1198 *
1199 * @param[out] os Output stream.
1200 * @param[in] multiples Type to output.
1201 *
1202 * @return Modified output stream.
1203 */
1204inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1205{
1206 os << "(";
1207 for(size_t i = 0; i < multiples.size() - 1; i++)
1208 {
1209 os << multiples[i] << ", ";
1210 }
1211 os << multiples.back() << ")";
1212 return os;
1213}
1214
Alex Gildayc357c472018-03-21 13:54:09 +00001215/** Formatted output of the InterpolationPolicy type.
1216 *
1217 * @param[out] os Output stream.
1218 * @param[in] policy Type to output.
1219 *
1220 * @return Modified output stream.
1221 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001222inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1223{
1224 switch(policy)
1225 {
1226 case InterpolationPolicy::NEAREST_NEIGHBOR:
1227 os << "NEAREST_NEIGHBOR";
1228 break;
1229 case InterpolationPolicy::BILINEAR:
1230 os << "BILINEAR";
1231 break;
1232 case InterpolationPolicy::AREA:
1233 os << "AREA";
1234 break;
1235 default:
1236 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1237 }
1238
1239 return os;
1240}
1241
Alex Gildayc357c472018-03-21 13:54:09 +00001242/** Formatted output of the SamplingPolicy type.
1243 *
1244 * @param[out] os Output stream.
1245 * @param[in] policy Type to output.
1246 *
1247 * @return Modified output stream.
1248 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001249inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1250{
1251 switch(policy)
1252 {
1253 case SamplingPolicy::CENTER:
1254 os << "CENTER";
1255 break;
1256 case SamplingPolicy::TOP_LEFT:
1257 os << "TOP_LEFT";
1258 break;
1259 default:
1260 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1261 }
1262
1263 return os;
1264}
1265
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001266/** Formatted output of the ITensorInfo type.
1267 *
1268 * @param[out] os Output stream.
1269 * @param[in] info Tensor information.
1270 *
1271 * @return Modified output stream.
1272 */
1273inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1274{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001275 const DataType data_type = info->data_type();
1276 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001277
1278 os << "Shape=" << info->tensor_shape() << ","
1279 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001280 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001281
1282 if(is_data_type_quantized(data_type))
1283 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001284 const QuantizationInfo qinfo = info->quantization_info();
1285 const auto scales = qinfo.scale();
1286 const auto offsets = qinfo.offset();
1287
ramelg014a6d9e82021-10-02 14:34:36 +01001288 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001289 << "scales.size=" << scales.size()
1290 << ", scale(s)=" << scales << ", ";
1291
1292 os << "offsets.size=" << offsets.size()
1293 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001294 }
1295 return os;
1296}
1297
ramelg013ae3d882021-09-12 23:07:47 +01001298/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001299 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001300 * @param[out] os Output stream.
1301 * @param[in] info Type to output.
1302 *
1303 * @return Modified output stream.
1304 */
1305inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1306{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001307 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001308 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001309}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001310
ramelg013ae3d882021-09-12 23:07:47 +01001311/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001312 *
Alex Gildayc357c472018-03-21 13:54:09 +00001313 * @param[in] info Type to output.
1314 *
1315 * @return Formatted string.
1316 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001317inline std::string to_string(const TensorInfo &info)
1318{
1319 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001320 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001321 return str.str();
1322}
1323
ramelg013ae3d882021-09-12 23:07:47 +01001324/** Formatted output of the const ITensorInfo& type.
1325 *
1326 * @param[in] info Type to output.
1327 *
1328 * @return Formatted string.
1329 */
1330inline std::string to_string(const ITensorInfo &info)
1331{
1332 std::stringstream str;
1333 str << &info;
1334 return str.str();
1335}
1336
ramelg013ae3d882021-09-12 23:07:47 +01001337/** Formatted output of the const ITensorInfo* type.
1338 *
1339 * @param[in] info Type to output.
1340 *
1341 * @return Formatted string.
1342 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001343inline std::string to_string(const ITensorInfo *info)
1344{
ramelg013ae3d882021-09-12 23:07:47 +01001345 std::string ret_str = "nullptr";
1346 if(info != nullptr)
1347 {
1348 std::stringstream str;
1349 str << info;
1350 ret_str = str.str();
1351 }
1352 return ret_str;
1353}
1354
ramelg01cbbb0382021-09-17 17:36:57 +01001355/** Formatted output of the ITensorInfo* type.
1356 *
1357 * @param[in] info Type to output.
1358 *
1359 * @return Formatted string.
1360 */
1361inline std::string to_string(ITensorInfo *info)
1362{
1363 return to_string(static_cast<const ITensorInfo *>(info));
1364}
1365
1366/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001367 *
1368 * @param[in] tensor Type to output.
1369 *
1370 * @return Formatted string.
1371 */
1372inline std::string to_string(const ITensor *tensor)
1373{
1374 std::string ret_str = "nullptr";
1375 if(tensor != nullptr)
1376 {
1377 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001378 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001379 ret_str = str.str();
1380 }
1381 return ret_str;
1382}
1383
ramelg01cbbb0382021-09-17 17:36:57 +01001384/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001385 *
1386 * @param[in] tensor Type to output.
1387 *
1388 * @return Formatted string.
1389 */
1390inline std::string to_string(ITensor *tensor)
1391{
ramelg01cbbb0382021-09-17 17:36:57 +01001392 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001393}
1394
ramelg01cbbb0382021-09-17 17:36:57 +01001395/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001396 *
1397 * @param[in] tensor Type to output.
1398 *
1399 * @return Formatted string.
1400 */
1401inline std::string to_string(ITensor &tensor)
1402{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001403 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001404 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001405 return str.str();
1406}
1407
ramelg01cbbb0382021-09-17 17:36:57 +01001408#ifdef ARM_COMPUTE_OPENCL_ENABLED
1409/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1410 *
1411 * @param[in] cl_tensor Type to output.
1412 *
1413 * @return Formatted string.
1414 */
1415inline std::string to_string(const ICLTensor *cl_tensor)
1416{
1417 std::string ret_str = "nullptr";
1418 if(cl_tensor != nullptr)
1419 {
1420 std::stringstream str;
1421 str << "ICLTensor->info(): " << cl_tensor->info();
1422 ret_str = str.str();
1423 }
1424 return ret_str;
1425}
1426
1427/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1428 *
1429 * @param[in] cl_tensor Type to output.
1430 *
1431 * @return Formatted string.
1432 */
1433inline std::string to_string(ICLTensor *cl_tensor)
1434{
1435 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1436}
1437#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1438
Alex Gildayc357c472018-03-21 13:54:09 +00001439/** Formatted output of the Dimensions type.
1440 *
1441 * @param[in] dimensions Type to output.
1442 *
1443 * @return Formatted string.
1444 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001445template <typename T>
1446inline std::string to_string(const Dimensions<T> &dimensions)
1447{
1448 std::stringstream str;
1449 str << dimensions;
1450 return str.str();
1451}
1452
Alex Gildayc357c472018-03-21 13:54:09 +00001453/** Formatted output of the Strides type.
1454 *
1455 * @param[in] stride Type to output.
1456 *
1457 * @return Formatted string.
1458 */
John Richardsona36eae12017-09-26 16:55:59 +01001459inline std::string to_string(const Strides &stride)
1460{
1461 std::stringstream str;
1462 str << stride;
1463 return str.str();
1464}
1465
Alex Gildayc357c472018-03-21 13:54:09 +00001466/** Formatted output of the TensorShape type.
1467 *
1468 * @param[in] shape Type to output.
1469 *
1470 * @return Formatted string.
1471 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001472inline std::string to_string(const TensorShape &shape)
1473{
1474 std::stringstream str;
1475 str << shape;
1476 return str.str();
1477}
1478
Alex Gildayc357c472018-03-21 13:54:09 +00001479/** Formatted output of the Coordinates type.
1480 *
1481 * @param[in] coord Type to output.
1482 *
1483 * @return Formatted string.
1484 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001485inline std::string to_string(const Coordinates &coord)
1486{
1487 std::stringstream str;
1488 str << coord;
1489 return str.str();
1490}
1491
Anthony Barbierb940fd62018-06-04 14:14:32 +01001492/** Formatted output of the GEMMReshapeInfo type.
1493 *
1494 * @param[out] os Output stream.
1495 * @param[in] info Type to output.
1496 *
1497 * @return Modified output stream.
1498 */
1499inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1500{
1501 os << "{m=" << info.m() << ",";
1502 os << "n=" << info.n() << ",";
1503 os << "k=" << info.k() << ",";
1504 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1505 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1506 os << "}";
1507
1508 return os;
1509}
1510
1511/** Formatted output of the GEMMInfo type.
1512 *
1513 * @param[out] os Output stream.
1514 * @param[in] info Type to output.
1515 *
1516 * @return Modified output stream.
1517 */
1518inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1519{
1520 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1521 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1522 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001523 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1524 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1525 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1526 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1527 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001528 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001529 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001530
1531 return os;
1532}
1533
1534/** Formatted output of the Window::Dimension type.
1535 *
1536 * @param[out] os Output stream.
1537 * @param[in] dim Type to output.
1538 *
1539 * @return Modified output stream.
1540 */
1541inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1542{
1543 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1544
1545 return os;
1546}
1547/** Formatted output of the Window type.
1548 *
1549 * @param[out] os Output stream.
1550 * @param[in] win Type to output.
1551 *
1552 * @return Modified output stream.
1553 */
1554inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1555{
1556 os << "{";
1557 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1558 {
1559 if(i > 0)
1560 {
1561 os << ", ";
1562 }
1563 os << win[i];
1564 }
1565 os << "}";
1566
1567 return os;
1568}
1569
1570/** Formatted output of the WeightsInfo type.
1571 *
1572 * @param[in] info Type to output.
1573 *
1574 * @return Formatted string.
1575 */
1576inline std::string to_string(const WeightsInfo &info)
1577{
1578 std::stringstream str;
1579 str << info;
1580 return str.str();
1581}
1582
1583/** Formatted output of the GEMMReshapeInfo type.
1584 *
1585 * @param[in] info Type to output.
1586 *
1587 * @return Formatted string.
1588 */
1589inline std::string to_string(const GEMMReshapeInfo &info)
1590{
1591 std::stringstream str;
1592 str << info;
1593 return str.str();
1594}
1595
1596/** Formatted output of the GEMMInfo type.
1597 *
1598 * @param[in] info Type to output.
1599 *
1600 * @return Formatted string.
1601 */
1602inline std::string to_string(const GEMMInfo &info)
1603{
1604 std::stringstream str;
1605 str << info;
1606 return str.str();
1607}
1608
1609/** Formatted output of the Window::Dimension type.
1610 *
1611 * @param[in] dim Type to output.
1612 *
1613 * @return Formatted string.
1614 */
1615inline std::string to_string(const Window::Dimension &dim)
1616{
1617 std::stringstream str;
1618 str << dim;
1619 return str.str();
1620}
ramelg01cbbb0382021-09-17 17:36:57 +01001621/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001622 *
1623 * @param[in] win Type to output.
1624 *
1625 * @return Formatted string.
1626 */
1627inline std::string to_string(const Window &win)
1628{
1629 std::stringstream str;
1630 str << win;
1631 return str.str();
1632}
1633
ramelg01cbbb0382021-09-17 17:36:57 +01001634/** Formatted output of the Window* type.
1635 *
1636 * @param[in] win Type to output.
1637 *
1638 * @return Formatted string.
1639 */
1640inline std::string to_string(Window *win)
1641{
1642 std::string ret_str = "nullptr";
1643 if(win != nullptr)
1644 {
1645 std::stringstream str;
1646 str << *win;
1647 ret_str = str.str();
1648 }
1649 return ret_str;
1650}
1651
Alex Gildayc357c472018-03-21 13:54:09 +00001652/** Formatted output of the Rectangle type.
1653 *
1654 * @param[out] os Output stream.
1655 * @param[in] rect Type to output.
1656 *
1657 * @return Modified output stream.
1658 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001659inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1660{
1661 os << rect.width << "x" << rect.height;
1662 os << "+" << rect.x << "+" << rect.y;
1663
1664 return os;
1665}
1666
Usama Arif8cf8c112019-03-14 15:36:54 +00001667/** Formatted output of the PaddingMode type.
1668 *
1669 * @param[out] os Output stream.
1670 * @param[in] mode Type to output.
1671 *
1672 * @return Modified output stream.
1673 */
1674inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1675{
1676 switch(mode)
1677 {
1678 case PaddingMode::CONSTANT:
1679 os << "CONSTANT";
1680 break;
1681 case PaddingMode::REFLECT:
1682 os << "REFLECT";
1683 break;
1684 case PaddingMode::SYMMETRIC:
1685 os << "SYMMETRIC";
1686 break;
1687 default:
1688 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1689 }
1690
1691 return os;
1692}
1693
1694/** Formatted output of the PaddingMode type.
1695 *
1696 * @param[in] mode Type to output.
1697 *
1698 * @return Formatted string.
1699 */
1700inline std::string to_string(const PaddingMode &mode)
1701{
1702 std::stringstream str;
1703 str << mode;
1704 return str.str();
1705}
1706
Alex Gildayc357c472018-03-21 13:54:09 +00001707/** Formatted output of the PadStrideInfo type.
1708 *
1709 * @param[out] os Output stream.
1710 * @param[in] pad_stride_info Type to output.
1711 *
1712 * @return Modified output stream.
1713 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001714inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1715{
1716 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1717 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001718 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1719 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001720
1721 return os;
1722}
1723
Alex Gildayc357c472018-03-21 13:54:09 +00001724/** Formatted output of the PadStrideInfo type.
1725 *
1726 * @param[in] pad_stride_info Type to output.
1727 *
1728 * @return Formatted string.
1729 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001730inline std::string to_string(const PadStrideInfo &pad_stride_info)
1731{
1732 std::stringstream str;
1733 str << pad_stride_info;
1734 return str.str();
1735}
1736
Alex Gildayc357c472018-03-21 13:54:09 +00001737/** Formatted output of the BorderMode type.
1738 *
1739 * @param[in] mode Type to output.
1740 *
1741 * @return Formatted string.
1742 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001743inline std::string to_string(const BorderMode &mode)
1744{
1745 std::stringstream str;
1746 str << mode;
1747 return str.str();
1748}
1749
Alex Gildayc357c472018-03-21 13:54:09 +00001750/** Formatted output of the BorderSize type.
1751 *
1752 * @param[in] border Type to output.
1753 *
1754 * @return Formatted string.
1755 */
John Richardsonb482ce12017-09-18 12:44:01 +01001756inline std::string to_string(const BorderSize &border)
1757{
1758 std::stringstream str;
1759 str << border;
1760 return str.str();
1761}
1762
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001763/** Formatted output of the PaddingList type.
1764 *
1765 * @param[in] padding Type to output.
1766 *
1767 * @return Formatted string.
1768 */
1769inline std::string to_string(const PaddingList &padding)
1770{
1771 std::stringstream str;
1772 str << padding;
1773 return str.str();
1774}
1775
giuros013175fcf2018-11-21 09:59:17 +00001776/** Formatted output of the Multiples type.
1777 *
1778 * @param[in] multiples Type to output.
1779 *
1780 * @return Formatted string.
1781 */
1782inline std::string to_string(const Multiples &multiples)
1783{
1784 std::stringstream str;
1785 str << multiples;
1786 return str.str();
1787}
1788
Alex Gildayc357c472018-03-21 13:54:09 +00001789/** Formatted output of the InterpolationPolicy type.
1790 *
1791 * @param[in] policy Type to output.
1792 *
1793 * @return Formatted string.
1794 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001795inline std::string to_string(const InterpolationPolicy &policy)
1796{
1797 std::stringstream str;
1798 str << policy;
1799 return str.str();
1800}
1801
Alex Gildayc357c472018-03-21 13:54:09 +00001802/** Formatted output of the SamplingPolicy type.
1803 *
1804 * @param[in] policy Type to output.
1805 *
1806 * @return Formatted string.
1807 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001808inline std::string to_string(const SamplingPolicy &policy)
1809{
1810 std::stringstream str;
1811 str << policy;
1812 return str.str();
1813}
1814
Alex Gildayc357c472018-03-21 13:54:09 +00001815/** Formatted output of the ConvertPolicy type.
1816 *
1817 * @param[out] os Output stream.
1818 * @param[in] policy Type to output.
1819 *
1820 * @return Modified output stream.
1821 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001822inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1823{
1824 switch(policy)
1825 {
1826 case ConvertPolicy::WRAP:
1827 os << "WRAP";
1828 break;
1829 case ConvertPolicy::SATURATE:
1830 os << "SATURATE";
1831 break;
1832 default:
1833 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1834 }
1835
1836 return os;
1837}
1838
1839inline std::string to_string(const ConvertPolicy &policy)
1840{
1841 std::stringstream str;
1842 str << policy;
1843 return str.str();
1844}
1845
giuros01164a2722018-11-20 18:34:46 +00001846/** Formatted output of the ArithmeticOperation type.
1847 *
1848 * @param[out] os Output stream.
1849 * @param[in] op Operation to output.
1850 *
1851 * @return Modified output stream.
1852 */
1853inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1854{
1855 switch(op)
1856 {
1857 case ArithmeticOperation::ADD:
1858 os << "ADD";
1859 break;
1860 case ArithmeticOperation::SUB:
1861 os << "SUB";
1862 break;
1863 case ArithmeticOperation::DIV:
1864 os << "DIV";
1865 break;
1866 case ArithmeticOperation::MAX:
1867 os << "MAX";
1868 break;
1869 case ArithmeticOperation::MIN:
1870 os << "MIN";
1871 break;
1872 case ArithmeticOperation::SQUARED_DIFF:
1873 os << "SQUARED_DIFF";
1874 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001875 case ArithmeticOperation::POWER:
1876 os << "POWER";
1877 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001878 case ArithmeticOperation::PRELU:
1879 os << "PRELU";
1880 break;
giuros01164a2722018-11-20 18:34:46 +00001881 default:
1882 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1883 }
1884
1885 return os;
1886}
1887
1888/** Formatted output of the Arithmetic Operation
1889 *
1890 * @param[in] op Type to output.
1891 *
1892 * @return Formatted string.
1893 */
1894inline std::string to_string(const ArithmeticOperation &op)
1895{
1896 std::stringstream str;
1897 str << op;
1898 return str.str();
1899}
1900
Alex Gildayc357c472018-03-21 13:54:09 +00001901/** Formatted output of the Reduction Operations.
1902 *
1903 * @param[out] os Output stream.
1904 * @param[in] op Type to output.
1905 *
1906 * @return Modified output stream.
1907 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001908inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1909{
1910 switch(op)
1911 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001912 case ReductionOperation::SUM:
1913 os << "SUM";
1914 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001915 case ReductionOperation::SUM_SQUARE:
1916 os << "SUM_SQUARE";
1917 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001918 case ReductionOperation::MEAN_SUM:
1919 os << "MEAN_SUM";
1920 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001921 case ReductionOperation::ARG_IDX_MAX:
1922 os << "ARG_IDX_MAX";
1923 break;
1924 case ReductionOperation::ARG_IDX_MIN:
1925 os << "ARG_IDX_MIN";
1926 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001927 case ReductionOperation::PROD:
1928 os << "PROD";
1929 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001930 case ReductionOperation::MIN:
1931 os << "MIN";
1932 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001933 case ReductionOperation::MAX:
1934 os << "MAX";
1935 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001936 default:
1937 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1938 }
1939
1940 return os;
1941}
1942
Alex Gildayc357c472018-03-21 13:54:09 +00001943/** Formatted output of the Reduction Operations.
1944 *
1945 * @param[in] op Type to output.
1946 *
1947 * @return Formatted string.
1948 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001949inline std::string to_string(const ReductionOperation &op)
1950{
1951 std::stringstream str;
1952 str << op;
1953 return str.str();
1954}
1955
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001956/** Formatted output of the Comparison Operations.
1957 *
1958 * @param[out] os Output stream.
1959 * @param[in] op Type to output.
1960 *
1961 * @return Modified output stream.
1962 */
1963inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1964{
1965 switch(op)
1966 {
1967 case ComparisonOperation::Equal:
1968 os << "Equal";
1969 break;
1970 case ComparisonOperation::NotEqual:
1971 os << "NotEqual";
1972 break;
1973 case ComparisonOperation::Greater:
1974 os << "Greater";
1975 break;
1976 case ComparisonOperation::GreaterEqual:
1977 os << "GreaterEqual";
1978 break;
1979 case ComparisonOperation::Less:
1980 os << "Less";
1981 break;
1982 case ComparisonOperation::LessEqual:
1983 os << "LessEqual";
1984 break;
1985 default:
1986 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1987 }
1988
1989 return os;
1990}
1991
Michalis Spyroue9362622018-11-23 17:41:37 +00001992/** Formatted output of the Elementwise unary Operations.
1993 *
1994 * @param[out] os Output stream.
1995 * @param[in] op Type to output.
1996 *
1997 * @return Modified output stream.
1998 */
1999inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
2000{
2001 switch(op)
2002 {
2003 case ElementWiseUnary::RSQRT:
2004 os << "RSQRT";
2005 break;
2006 case ElementWiseUnary::EXP:
2007 os << "EXP";
2008 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002009 case ElementWiseUnary::NEG:
2010 os << "NEG";
2011 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002012 case ElementWiseUnary::LOG:
2013 os << "LOG";
2014 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002015 case ElementWiseUnary::SIN:
2016 os << "SIN";
2017 break;
2018 case ElementWiseUnary::ABS:
2019 os << "ABS";
2020 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002021 case ElementWiseUnary::ROUND:
2022 os << "ROUND";
2023 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002024 case ElementWiseUnary::LOGICAL_NOT:
2025 os << "LOGICAL_NOT";
2026 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002027 default:
2028 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2029 }
2030
2031 return os;
2032}
2033
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002034/** Formatted output of the Comparison Operations.
2035 *
2036 * @param[in] op Type to output.
2037 *
2038 * @return Formatted string.
2039 */
2040inline std::string to_string(const ComparisonOperation &op)
2041{
2042 std::stringstream str;
2043 str << op;
2044 return str.str();
2045}
2046
Michalis Spyroue9362622018-11-23 17:41:37 +00002047/** Formatted output of the Elementwise unary Operations.
2048 *
2049 * @param[in] op Type to output.
2050 *
2051 * @return Formatted string.
2052 */
2053inline std::string to_string(const ElementWiseUnary &op)
2054{
2055 std::stringstream str;
2056 str << op;
2057 return str.str();
2058}
2059
Alex Gildayc357c472018-03-21 13:54:09 +00002060/** Formatted output of the Norm Type.
2061 *
2062 * @param[in] type Type to output.
2063 *
2064 * @return Formatted string.
2065 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002066inline std::string to_string(const NormType &type)
2067{
2068 std::stringstream str;
2069 str << type;
2070 return str.str();
2071}
2072
Alex Gildayc357c472018-03-21 13:54:09 +00002073/** Formatted output of the Pooling Type.
2074 *
2075 * @param[in] type Type to output.
2076 *
2077 * @return Formatted string.
2078 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002079inline std::string to_string(const PoolingType &type)
2080{
2081 std::stringstream str;
2082 str << type;
2083 return str.str();
2084}
2085
Alex Gildayc357c472018-03-21 13:54:09 +00002086/** Formatted output of the Pooling Layer Info.
2087 *
2088 * @param[in] info Type to output.
2089 *
2090 * @return Formatted string.
2091 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002092inline std::string to_string(const PoolingLayerInfo &info)
2093{
2094 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002095 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002096 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002097 << "IsGlobalPooling=" << info.is_global_pooling;
2098 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002099 {
2100 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002101 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2102 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002103 }
2104 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002105 return str.str();
2106}
2107
ramelg0137515692022-02-26 22:06:20 +00002108/** Formatted output of the Size3D type.
2109 *
2110 * @param[out] os Output stream
2111 * @param[in] size Type to output
2112 *
2113 * @return Modified output stream.
2114 */
2115inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2116{
2117 os << size.width << "x" << size.height << "x" << size.depth;
2118
2119 return os;
2120}
2121
2122/** Formatted output of the Size3D type.
2123 *
2124 * @param[in] type Type to output
2125 *
2126 * @return Formatted string.
2127 */
2128inline std::string to_string(const Size3D &type)
2129{
2130 std::stringstream str;
2131 str << type;
2132 return str.str();
2133}
2134
2135/** Formatted output of the Padding3D type.
2136 *
2137 * @param[out] os Output stream.
2138 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2139 *
2140 * @return Modified output stream.
2141 */
2142inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2143{
2144 os << padding3d.left << "," << padding3d.right << ","
2145 << padding3d.top << "," << padding3d.bottom << ","
2146 << padding3d.front << "," << padding3d.back;
2147 return os;
2148}
2149
2150/** Converts a @ref Padding3D to string
2151 *
2152 * @param[in] padding3d Padding3D value to be converted
2153 *
2154 * @return String representing the corresponding Padding3D
2155 */
2156inline std::string to_string(const Padding3D &padding3d)
2157{
2158 std::stringstream str;
2159 str << padding3d;
2160 return str.str();
2161}
2162
2163/** Formatted output of the DimensionRoundingType type.
2164 *
2165 * @param[out] os Output stream.
2166 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2167 *
2168 * @return Modified output stream.
2169 */
2170inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2171{
2172 switch(rounding_type)
2173 {
2174 case DimensionRoundingType::CEIL:
2175 os << "CEIL";
2176 break;
2177 case DimensionRoundingType::FLOOR:
2178 os << "FLOOR";
2179 break;
2180 default:
2181 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2182 }
2183 return os;
2184}
2185
2186/** Formatted output of the Pooling 3d Layer Info.
2187 *
2188 * @param[out] os Output stream.
2189 * @param[in] info Pooling 3D layer info to print to output stream.
2190 *
2191 * @return Modified output stream.
2192 */
2193inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2194{
2195 os << "{Type=" << info.pool_type << ","
2196 << "IsGlobalPooling=" << info.is_global_pooling;
2197 if(!info.is_global_pooling)
2198 {
2199 os << ","
2200 << "PoolSize=" << info.pool_size << ", "
2201 << "Stride=" << info.stride << ", "
2202 << "Padding=" << info.padding << ", "
2203 << "Exclude Padding=" << info.exclude_padding << ", "
2204 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2205 << "DimensionRoundingType=" << info.round_type;
2206 }
2207 os << "}";
2208 return os;
2209}
2210
2211/** Formatted output of the Pooling 3d Layer Info.
2212 *
2213 * @param[in] info Type to output.
2214 *
2215 * @return Formatted string.
2216 */
2217inline std::string to_string(const Pooling3dLayerInfo &info)
2218{
2219 std::stringstream str;
2220 str << info;
2221 return str.str();
2222}
2223
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002224/** Formatted output of the PriorBoxLayerInfo.
2225 *
2226 * @param[in] info Type to output.
2227 *
2228 * @return Formatted string.
2229 */
2230inline std::string to_string(const PriorBoxLayerInfo &info)
2231{
2232 std::stringstream str;
2233 str << "{";
2234 str << "Clip:" << info.clip()
2235 << "Flip:" << info.flip()
2236 << "StepX:" << info.steps()[0]
2237 << "StepY:" << info.steps()[1]
2238 << "MinSizes:" << info.min_sizes().size()
2239 << "MaxSizes:" << info.max_sizes().size()
2240 << "ImgSizeX:" << info.img_size().x
2241 << "ImgSizeY:" << info.img_size().y
2242 << "Offset:" << info.offset()
2243 << "Variances:" << info.variances().size();
2244 str << "}";
2245 return str.str();
2246}
2247
Alex Gildayc357c472018-03-21 13:54:09 +00002248/** Formatted output of the Size2D type.
2249 *
2250 * @param[out] os Output stream
2251 * @param[in] size Type to output
2252 *
2253 * @return Modified output stream.
2254 */
John Richardson25f23682017-11-27 14:35:09 +00002255inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2256{
2257 os << size.width << "x" << size.height;
2258
2259 return os;
2260}
2261
Alex Gildayc357c472018-03-21 13:54:09 +00002262/** Formatted output of the Size2D type.
2263 *
2264 * @param[in] type Type to output
2265 *
2266 * @return Formatted string.
2267 */
John Richardson25f23682017-11-27 14:35:09 +00002268inline std::string to_string(const Size2D &type)
2269{
2270 std::stringstream str;
2271 str << type;
2272 return str.str();
2273}
2274
Alex Gildayc357c472018-03-21 13:54:09 +00002275/** Formatted output of the ConvolutionMethod type.
2276 *
2277 * @param[out] os Output stream
2278 * @param[in] conv_method Type to output
2279 *
2280 * @return Modified output stream.
2281 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002282inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2283{
2284 switch(conv_method)
2285 {
2286 case ConvolutionMethod::GEMM:
2287 os << "GEMM";
2288 break;
2289 case ConvolutionMethod::DIRECT:
2290 os << "DIRECT";
2291 break;
2292 case ConvolutionMethod::WINOGRAD:
2293 os << "WINOGRAD";
2294 break;
SiCongLid9287352021-11-03 19:01:22 +00002295 case ConvolutionMethod::FFT:
2296 os << "FFT";
2297 break;
2298 case ConvolutionMethod::GEMM_CONV2D:
2299 os << "GEMM_CONV2D";
2300 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002301 default:
2302 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2303 }
2304
2305 return os;
2306}
2307
Alex Gildayc357c472018-03-21 13:54:09 +00002308/** Formatted output of the ConvolutionMethod type.
2309 *
2310 * @param[in] conv_method Type to output
2311 *
2312 * @return Formatted string.
2313 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002314inline std::string to_string(const ConvolutionMethod &conv_method)
2315{
2316 std::stringstream str;
2317 str << conv_method;
2318 return str.str();
2319}
2320
Alex Gildayc357c472018-03-21 13:54:09 +00002321/** Formatted output of the GPUTarget type.
2322 *
2323 * @param[out] os Output stream
2324 * @param[in] gpu_target Type to output
2325 *
2326 * @return Modified output stream.
2327 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002328inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2329{
2330 switch(gpu_target)
2331 {
2332 case GPUTarget::GPU_ARCH_MASK:
2333 os << "GPU_ARCH_MASK";
2334 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002335 case GPUTarget::GPU_GENERATION_MASK:
2336 os << "GPU_GENERATION_MASK";
2337 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002338 case GPUTarget::MIDGARD:
2339 os << "MIDGARD";
2340 break;
2341 case GPUTarget::BIFROST:
2342 os << "BIFROST";
2343 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002344 case GPUTarget::VALHALL:
2345 os << "VALHALL";
2346 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002347 case GPUTarget::T600:
2348 os << "T600";
2349 break;
2350 case GPUTarget::T700:
2351 os << "T700";
2352 break;
2353 case GPUTarget::T800:
2354 os << "T800";
2355 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002356 case GPUTarget::G71:
2357 os << "G71";
2358 break;
2359 case GPUTarget::G72:
2360 os << "G72";
2361 break;
2362 case GPUTarget::G51:
2363 os << "G51";
2364 break;
2365 case GPUTarget::G51BIG:
2366 os << "G51BIG";
2367 break;
2368 case GPUTarget::G51LIT:
2369 os << "G51LIT";
2370 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002371 case GPUTarget::G31:
2372 os << "G31";
2373 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002374 case GPUTarget::G76:
2375 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002376 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002377 case GPUTarget::G52:
2378 os << "G52";
2379 break;
2380 case GPUTarget::G52LIT:
2381 os << "G52LIT";
2382 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002383 case GPUTarget::G77:
2384 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002385 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002386 case GPUTarget::G57:
2387 os << "G57";
2388 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002389 case GPUTarget::G78:
2390 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002391 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002392 case GPUTarget::G68:
2393 os << "G68";
2394 break;
2395 case GPUTarget::G78AE:
2396 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002397 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002398 case GPUTarget::G710:
2399 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002400 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002401 case GPUTarget::G610:
2402 os << "G610";
2403 break;
2404 case GPUTarget::G510:
2405 os << "G510";
2406 break;
2407 case GPUTarget::G310:
2408 os << "G310";
2409 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002410 case GPUTarget::G715:
2411 os << "G715";
2412 break;
2413 case GPUTarget::G615:
2414 os << "G615";
2415 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002416 default:
2417 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2418 }
2419
2420 return os;
2421}
2422
Alex Gildayc357c472018-03-21 13:54:09 +00002423/** Formatted output of the GPUTarget type.
2424 *
2425 * @param[in] gpu_target Type to output
2426 *
2427 * @return Formatted string.
2428 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002429inline std::string to_string(const GPUTarget &gpu_target)
2430{
2431 std::stringstream str;
2432 str << gpu_target;
2433 return str.str();
2434}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002435
John Richardson8de92612018-02-22 14:09:31 +00002436/** Formatted output of the DetectionWindow type.
2437 *
2438 * @param[out] os Output stream
2439 * @param[in] detection_window Type to output
2440 *
2441 * @return Modified output stream.
2442 */
John Richardson684cb0f2018-01-09 11:17:00 +00002443inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2444{
2445 os << "{x=" << detection_window.x << ","
2446 << "y=" << detection_window.y << ","
2447 << "width=" << detection_window.width << ","
2448 << "height=" << detection_window.height << ","
2449 << "idx_class=" << detection_window.idx_class << ","
2450 << "score=" << detection_window.score << "}";
2451
2452 return os;
2453}
2454
Isabella Gottardi05e56442018-11-16 11:26:52 +00002455/** Formatted output of the DetectionOutputLayerCodeType type.
2456 *
2457 * @param[out] os Output stream
2458 * @param[in] detection_code Type to output
2459 *
2460 * @return Modified output stream.
2461 */
2462inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2463{
2464 switch(detection_code)
2465 {
2466 case DetectionOutputLayerCodeType::CENTER_SIZE:
2467 os << "CENTER_SIZE";
2468 break;
2469 case DetectionOutputLayerCodeType::CORNER:
2470 os << "CORNER";
2471 break;
2472 case DetectionOutputLayerCodeType::CORNER_SIZE:
2473 os << "CORNER_SIZE";
2474 break;
2475 case DetectionOutputLayerCodeType::TF_CENTER:
2476 os << "TF_CENTER";
2477 break;
2478 default:
2479 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2480 }
2481
2482 return os;
2483}
2484/** Formatted output of the DetectionOutputLayerCodeType type.
2485 *
2486 * @param[in] detection_code Type to output
2487 *
2488 * @return Formatted string.
2489 */
2490inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2491{
2492 std::stringstream str;
2493 str << detection_code;
2494 return str.str();
2495}
2496
2497/** Formatted output of the DetectionOutputLayerInfo type.
2498 *
2499 * @param[out] os Output stream
2500 * @param[in] detection_info Type to output
2501 *
2502 * @return Modified output stream.
2503 */
2504inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2505{
2506 os << "{Classes=" << detection_info.num_classes() << ","
2507 << "ShareLocation=" << detection_info.share_location() << ","
2508 << "CodeType=" << detection_info.code_type() << ","
2509 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2510 << "KeepTopK=" << detection_info.keep_top_k() << ","
2511 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2512 << "Eta=" << detection_info.eta() << ","
2513 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2514 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2515 << "TopK=" << detection_info.top_k() << ","
2516 << "NumLocClasses=" << detection_info.num_loc_classes()
2517 << "}";
2518
2519 return os;
2520}
2521
2522/** Formatted output of the DetectionOutputLayerInfo type.
2523 *
2524 * @param[in] detection_info Type to output
2525 *
2526 * @return Formatted string.
2527 */
2528inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2529{
2530 std::stringstream str;
2531 str << detection_info;
2532 return str.str();
2533}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002534/** Formatted output of the DetectionPostProcessLayerInfo 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 DetectionPostProcessLayerInfo &detection_info)
2542{
2543 os << "{MaxDetections=" << detection_info.max_detections() << ","
2544 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2545 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2546 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2547 << "NumClasses=" << detection_info.num_classes() << ","
2548 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2549 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2550 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2551 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2552 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2553 << "DetectionPerClass=" << detection_info.detection_per_class()
2554 << "}";
2555
2556 return os;
2557}
2558
2559/** Formatted output of the DetectionPostProcessLayerInfo type.
2560 *
2561 * @param[in] detection_info Type to output
2562 *
2563 * @return Formatted string.
2564 */
2565inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2566{
2567 std::stringstream str;
2568 str << detection_info;
2569 return str.str();
2570}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002571
John Richardson8de92612018-02-22 14:09:31 +00002572/** Formatted output of the DetectionWindow type.
2573 *
2574 * @param[in] detection_window Type to output
2575 *
2576 * @return Formatted string.
2577 */
2578inline std::string to_string(const DetectionWindow &detection_window)
2579{
2580 std::stringstream str;
2581 str << detection_window;
2582 return str.str();
2583}
2584
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002585/** Formatted output of @ref PriorBoxLayerInfo.
2586 *
2587 * @param[out] os Output stream.
2588 * @param[in] info Type to output.
2589 *
2590 * @return Modified output stream.
2591 */
2592inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2593{
2594 os << "Clip:" << info.clip()
2595 << "Flip:" << info.flip()
2596 << "StepX:" << info.steps()[0]
2597 << "StepY:" << info.steps()[1]
2598 << "MinSizes:" << info.min_sizes()
2599 << "MaxSizes:" << info.max_sizes()
2600 << "ImgSizeX:" << info.img_size().x
2601 << "ImgSizeY:" << info.img_size().y
2602 << "Offset:" << info.offset()
2603 << "Variances:" << info.variances();
2604
2605 return os;
2606}
2607
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002608/** Formatted output of the WinogradInfo type. */
2609inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2610{
2611 os << "{OutputTileSize=" << info.output_tile_size << ","
2612 << "KernelSize=" << info.kernel_size << ","
2613 << "PadStride=" << info.convolution_info << ","
2614 << "OutputDataLayout=" << info.output_data_layout << "}";
2615
2616 return os;
2617}
2618
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002619inline std::string to_string(const WinogradInfo &type)
2620{
2621 std::stringstream str;
2622 str << type;
2623 return str.str();
2624}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002625
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002626/** Convert a CLTunerMode value to a string
2627 *
2628 * @param val CLTunerMode value to be converted
2629 *
2630 * @return String representing the corresponding CLTunerMode.
2631 */
2632inline std::string to_string(const CLTunerMode val)
2633{
2634 switch(val)
2635 {
2636 case CLTunerMode::EXHAUSTIVE:
2637 {
2638 return std::string("Exhaustive");
2639 }
2640 case CLTunerMode::NORMAL:
2641 {
2642 return std::string("Normal");
2643 }
2644 case CLTunerMode::RAPID:
2645 {
2646 return std::string("Rapid");
2647 }
2648 default:
2649 {
2650 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2651 return std::string("UNDEFINED");
2652 }
2653 }
2654}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002655/** Converts a @ref CLGEMMKernelType to string
2656 *
2657 * @param[in] val CLGEMMKernelType value to be converted
2658 *
2659 * @return String representing the corresponding CLGEMMKernelType
2660 */
2661inline std::string to_string(CLGEMMKernelType val)
2662{
2663 switch(val)
2664 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002665 case CLGEMMKernelType::NATIVE:
2666 {
2667 return "Native";
2668 }
2669 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2670 {
2671 return "Reshaped_Only_RHS";
2672 }
2673 case CLGEMMKernelType::RESHAPED:
2674 {
2675 return "Reshaped";
2676 }
2677 default:
2678 {
2679 return "Unknown";
2680 }
2681 }
2682}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002683/** [Print CLTunerMode type] **/
2684/** Formatted output of the CLTunerMode type.
2685 *
2686 * @param[out] os Output stream.
2687 * @param[in] val CLTunerMode to output.
2688 *
2689 * @return Modified output stream.
2690 */
2691inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2692{
2693 os << to_string(val);
2694 return os;
2695}
2696
ramelg013ae3d882021-09-12 23:07:47 +01002697/** Formatted output of the ConvolutionInfo type.
2698 *
2699 * @param[out] os Output stream.
2700 * @param[in] conv_info ConvolutionInfo to output.
2701 *
2702 * @return Modified output stream.
2703 */
2704inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2705{
SiCongLi579ca842021-10-18 09:38:33 +01002706 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2707 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2708 << "act_info=" << to_string(conv_info.act_info) << ", "
2709 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002710 return os;
2711}
2712
2713/** Converts a @ref ConvolutionInfo to string
2714 *
2715 * @param[in] info ConvolutionInfo value to be converted
2716 *
2717 * @return String representing the corresponding ConvolutionInfo
2718 */
2719inline std::string to_string(const ConvolutionInfo &info)
2720{
2721 std::stringstream str;
2722 str << info;
2723 return str.str();
2724}
2725
2726/** Formatted output of the FullyConnectedLayerInfo type.
2727 *
2728 * @param[out] os Output stream.
2729 * @param[in] layer_info FullyConnectedLayerInfo to output.
2730 *
2731 * @return Modified output stream.
2732 */
2733inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2734{
SiCongLi579ca842021-10-18 09:38:33 +01002735 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2736 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2737 << "transpose_weights=" << layer_info.transpose_weights << ", "
2738 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2739 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2740 << "constant_weights=" << layer_info.transpose_weights << ", "
2741 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002742 return os;
2743}
2744
2745/** Converts a @ref FullyConnectedLayerInfo to string
2746 *
2747 * @param[in] info FullyConnectedLayerInfo value to be converted
2748 *
2749 * @return String representing the corresponding FullyConnectedLayerInfo
2750 */
2751inline std::string to_string(const FullyConnectedLayerInfo &info)
2752{
2753 std::stringstream str;
2754 str << info;
2755 return str.str();
2756}
2757
2758/** Formatted output of the GEMMLowpOutputStageType type.
2759 *
2760 * @param[out] os Output stream.
2761 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2762 *
2763 * @return Modified output stream.
2764 */
2765inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2766{
2767 switch(gemm_type)
2768 {
2769 case GEMMLowpOutputStageType::NONE:
2770 os << "NONE";
2771 break;
2772 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2773 os << "QUANTIZE_DOWN";
2774 break;
2775 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2776 os << "QUANTIZE_DOWN_FIXEDPOINT";
2777 break;
2778 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2779 os << "QUANTIZE_DOWN_FLOAT";
2780 break;
2781 default:
2782 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2783 }
2784 return os;
2785}
2786
2787/** Converts a @ref GEMMLowpOutputStageType to string
2788 *
2789 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2790 *
2791 * @return String representing the corresponding GEMMLowpOutputStageType
2792 */
2793inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2794{
2795 std::stringstream str;
2796 str << gemm_type;
2797 return str.str();
2798}
2799
2800/** Formatted output of the GEMMLowpOutputStageInfo type.
2801 *
2802 * @param[out] os Output stream.
2803 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2804 *
2805 * @return Modified output stream.
2806 */
2807inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2808{
SiCongLi579ca842021-10-18 09:38:33 +01002809 os << "{type=" << gemm_info.type << ", "
2810 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2811 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2812 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2813 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2814 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2815 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2816 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2817 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2818 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2819 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002820 return os;
2821}
2822
2823/** Converts a @ref GEMMLowpOutputStageInfo to string
2824 *
2825 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2826 *
2827 * @return String representing the corresponding GEMMLowpOutputStageInfo
2828 */
2829inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2830{
2831 std::stringstream str;
2832 str << gemm_info;
2833 return str.str();
2834}
2835
2836/** Formatted output of the Conv2dInfo type.
2837 *
2838 * @param[out] os Output stream.
2839 * @param[in] conv_info Conv2dInfo to output.
2840 *
2841 * @return Modified output stream.
2842 */
2843inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2844{
SiCongLi579ca842021-10-18 09:38:33 +01002845 os << "{conv_info=" << conv_info.conv_info << ", "
2846 << "dilation=" << conv_info.dilation << ", "
2847 << "act_info=" << to_string(conv_info.act_info) << ", "
2848 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2849 << "num_groups=" << conv_info.num_groups << ","
2850 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002851 return os;
2852}
2853
2854/** Converts a @ref Conv2dInfo to string
2855 *
2856 * @param[in] conv_info Conv2dInfo value to be converted
2857 *
2858 * @return String representing the corresponding Conv2dInfo
2859 */
2860inline std::string to_string(const Conv2dInfo &conv_info)
2861{
2862 std::stringstream str;
2863 str << conv_info;
2864 return str.str();
2865}
2866
2867/** Formatted output of the PixelValue type.
2868 *
2869 * @param[out] os Output stream.
2870 * @param[in] pixel_value PixelValue to output.
2871 *
2872 * @return Modified output stream.
2873 */
2874inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2875{
SiCongLi579ca842021-10-18 09:38:33 +01002876 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002877 return os;
2878}
2879
2880/** Converts a @ref PixelValue to string
2881 *
2882 * @param[in] pixel_value PixelValue value to be converted
2883 *
2884 * @return String representing the corresponding PixelValue
2885 */
2886inline std::string to_string(const PixelValue &pixel_value)
2887{
2888 std::stringstream str;
2889 str << pixel_value;
2890 return str.str();
2891}
2892
2893/** Formatted output of the ScaleKernelInfo type.
2894 *
2895 * @param[out] os Output stream.
2896 * @param[in] scale_info ScaleKernelInfo to output.
2897 *
2898 * @return Modified output stream.
2899 */
2900inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2901{
SiCongLi579ca842021-10-18 09:38:33 +01002902 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2903 << "BorderMode=" << scale_info.border_mode << ", "
2904 << "PixelValue=" << scale_info.constant_border_value << ", "
2905 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2906 << "use_padding=" << scale_info.use_padding << ", "
2907 << "align_corners=" << scale_info.align_corners << ", "
2908 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002909 return os;
2910}
2911
2912/** Converts a @ref ScaleKernelInfo to string
2913 *
2914 * @param[in] scale_info ScaleKernelInfo value to be converted
2915 *
2916 * @return String representing the corresponding ScaleKernelInfo
2917 */
2918inline std::string to_string(const ScaleKernelInfo &scale_info)
2919{
2920 std::stringstream str;
2921 str << scale_info;
2922 return str.str();
2923}
2924
2925/** Formatted output of the FFTDirection type.
2926 *
2927 * @param[out] os Output stream.
2928 * @param[in] fft_dir FFTDirection to output.
2929 *
2930 * @return Modified output stream.
2931 */
2932inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2933{
2934 switch(fft_dir)
2935 {
2936 case FFTDirection::Forward:
2937 os << "Forward";
2938 break;
2939 case FFTDirection::Inverse:
2940 os << "Inverse";
2941 break;
2942 default:
2943 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2944 }
2945 return os;
2946}
2947
2948/** Converts a @ref FFT1DInfo to string
2949 *
2950 * @param[in] fft_dir FFT1DInfo value to be converted
2951 *
2952 * @return String representing the corresponding FFT1DInfo
2953 */
2954inline std::string to_string(const FFTDirection &fft_dir)
2955{
2956 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002957 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002958 return str.str();
2959}
2960
2961/** Formatted output of the FFT1DInfo type.
2962 *
2963 * @param[out] os Output stream.
2964 * @param[in] fft1d_info FFT1DInfo to output.
2965 *
2966 * @return Modified output stream.
2967 */
2968inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2969{
SiCongLi579ca842021-10-18 09:38:33 +01002970 os << "{axis=" << fft1d_info.axis << ", "
2971 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002972 return os;
2973}
2974
2975/** Converts a @ref FFT1DInfo to string
2976 *
2977 * @param[in] fft1d_info FFT1DInfo value to be converted
2978 *
2979 * @return String representing the corresponding FFT1DInfo
2980 */
2981inline std::string to_string(const FFT1DInfo &fft1d_info)
2982{
2983 std::stringstream str;
2984 str << fft1d_info;
2985 return str.str();
2986}
2987
2988/** Formatted output of the FFT2DInfo type.
2989 *
2990 * @param[out] os Output stream.
2991 * @param[in] fft2d_info FFT2DInfo to output.
2992 *
2993 * @return Modified output stream.
2994 */
2995inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2996{
SiCongLi579ca842021-10-18 09:38:33 +01002997 os << "{axis=" << fft2d_info.axis0 << ", "
2998 << "axis=" << fft2d_info.axis1 << ", "
2999 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003000 return os;
3001}
3002
3003/** Converts a @ref FFT2DInfo to string
3004 *
3005 * @param[in] fft2d_info FFT2DInfo value to be converted
3006 *
3007 * @return String representing the corresponding FFT2DInfo
3008 */
3009inline std::string to_string(const FFT2DInfo &fft2d_info)
3010{
3011 std::stringstream str;
3012 str << fft2d_info;
3013 return str.str();
3014}
3015
3016/** Formatted output of the Coordinates2D type.
3017 *
3018 * @param[out] os Output stream.
3019 * @param[in] coord_2d Coordinates2D to output.
3020 *
3021 * @return Modified output stream.
3022 */
3023inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3024{
SiCongLi579ca842021-10-18 09:38:33 +01003025 os << "{x=" << coord_2d.x << ", "
3026 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003027 return os;
3028}
3029
3030/** Converts a @ref Coordinates2D to string
3031 *
3032 * @param[in] coord_2d Coordinates2D value to be converted
3033 *
3034 * @return String representing the corresponding Coordinates2D
3035 */
3036inline std::string to_string(const Coordinates2D &coord_2d)
3037{
3038 std::stringstream str;
3039 str << coord_2d;
3040 return str.str();
3041}
3042
3043/** Formatted output of the FuseBatchNormalizationType type.
3044 *
3045 * @param[out] os Output stream.
3046 * @param[in] fuse_type FuseBatchNormalizationType to output.
3047 *
3048 * @return Modified output stream.
3049 */
3050inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3051{
3052 switch(fuse_type)
3053 {
3054 case FuseBatchNormalizationType::CONVOLUTION:
3055 os << "CONVOLUTION";
3056 break;
3057 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3058 os << "DEPTHWISECONVOLUTION";
3059 break;
3060 default:
3061 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3062 }
3063 return os;
3064}
3065
3066/** Converts a @ref FuseBatchNormalizationType to string
3067 *
3068 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3069 *
3070 * @return String representing the corresponding FuseBatchNormalizationType
3071 */
3072inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3073{
3074 std::stringstream str;
3075 str << fuse_type;
3076 return str.str();
3077}
3078
ramelg01cbbb0382021-09-17 17:36:57 +01003079/** Formatted output of the SoftmaxKernelInfo type.
3080 *
3081 * @param[out] os Output stream.
3082 * @param[in] info SoftmaxKernelInfo to output.
3083 *
3084 * @return Modified output stream.
3085 */
3086inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3087{
SiCongLi579ca842021-10-18 09:38:33 +01003088 os << "{beta=" << info.beta << ", "
3089 << "is_log=" << info.is_log << ", "
3090 << "input_data_type=" << info.input_data_type << ", "
3091 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003092 return os;
3093}
3094
3095/** Converts a @ref SoftmaxKernelInfo to string
3096 *
3097 * @param[in] info SoftmaxKernelInfo value to be converted
3098 *
3099 * @return String representing the corresponding SoftmaxKernelInfo
3100 */
3101inline std::string to_string(const SoftmaxKernelInfo &info)
3102{
3103 std::stringstream str;
3104 str << info;
3105 return str.str();
3106}
3107
3108/** Formatted output of the ScaleKernelInfo type.
3109 *
3110 * @param[out] os Output stream.
3111 * @param[in] lstm_params LSTMParams to output.
3112 *
3113 * @return Modified output stream.
3114 */
3115template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003116::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003117{
ramelg014a6d9e82021-10-02 14:34:36 +01003118 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3119 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3120 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3121 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3122 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3123 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3124 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3125 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3126 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3127 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3128 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3129 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003130 << "cell_clip=" << lstm_params.cell_clip() << ", "
3131 << "projection_clip=" << lstm_params.projection_clip() << ", "
3132 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3133 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3134 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3135 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3136 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3137 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3138 << "has_projection=" << lstm_params.has_projection() << ", "
3139 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3140 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3141 return os;
3142}
3143
3144/** Converts a @ref LSTMParams to string
3145 *
3146 * @param[in] lstm_params LSTMParams<T> value to be converted
3147 *
3148 * @return String representing the corresponding LSTMParams
3149 */
3150template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003151std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003152{
3153 std::stringstream str;
3154 str << lstm_params;
3155 return str.str();
3156}
3157
3158/** Converts a @ref LSTMParams to string
3159 *
3160 * @param[in] num uint8_t value to be converted
3161 *
3162 * @return String representing the corresponding uint8_t
3163 */
3164inline std::string to_string(const uint8_t num)
3165{
3166 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3167 return ::std::to_string(static_cast<int>(num));
3168}
3169
ramelg014a6d9e82021-10-02 14:34:36 +01003170/** Available non maxima suppression types */
3171/** Formatted output of the NMSType type.
3172 *
3173 * @param[out] os Output stream.
3174 * @param[in] nms_type NMSType to output.
3175 *
3176 * @return Modified output stream.
3177 */
3178inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3179{
3180 switch(nms_type)
3181 {
3182 case NMSType::LINEAR:
3183 os << "LINEAR";
3184 break;
3185 case NMSType::GAUSSIAN:
3186 os << "GAUSSIAN";
3187 break;
3188 case NMSType::ORIGINAL:
3189 os << "ORIGINAL";
3190 break;
3191 default:
3192 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3193 }
3194 return os;
3195}
3196
3197/** Converts a @ref NMSType to string
3198 *
3199 * @param[in] nms_type NMSType value to be converted
3200 *
3201 * @return String representing the corresponding NMSType
3202 */
3203inline std::string to_string(const NMSType nms_type)
3204{
3205 std::stringstream str;
3206 str << nms_type;
3207 return str.str();
3208}
3209
3210/** Formatted output of the BoxNMSLimitInfo type.
3211 *
3212 * @param[out] os Output stream.
3213 * @param[in] info BoxNMSLimitInfo to output.
3214 *
3215 * @return Modified output stream.
3216 */
3217inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3218{
SiCongLi579ca842021-10-18 09:38:33 +01003219 os << "{score_thresh=" << info.score_thresh() << ", "
3220 << "nms=" << info.nms() << ", "
3221 << "detections_per_im=" << info.detections_per_im() << ", "
3222 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3223 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3224 << "suppress_size=" << info.suppress_size() << ", "
3225 << "min_size=" << info.min_size() << ", "
3226 << "im_width=" << info.im_width() << ", "
3227 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003228 return os;
3229}
3230
3231/** Converts a @ref BoxNMSLimitInfo to string
3232 *
3233 * @param[in] info BoxNMSLimitInfo value to be converted
3234 *
3235 * @return String representing the corresponding BoxNMSLimitInfo
3236 */
3237inline std::string to_string(const BoxNMSLimitInfo &info)
3238{
3239 std::stringstream str;
3240 str << info;
3241 return str.str();
3242}
3243
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003244/** Converts a @ref DimensionRoundingType to string
3245 *
3246 * @param[in] rounding_type DimensionRoundingType value to be converted
3247 *
3248 * @return String representing the corresponding DimensionRoundingType
3249 */
3250inline std::string to_string(const DimensionRoundingType &rounding_type)
3251{
3252 std::stringstream str;
3253 str << rounding_type;
3254 return str.str();
3255}
3256
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003257/** Formatted output of the Conv3dInfo type.
3258 *
3259 * @param[out] os Output stream.
3260 * @param[in] conv3d_info Type to output.
3261 *
3262 * @return Modified output stream.
3263 */
3264inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3265{
3266 os << conv3d_info.stride;
3267 os << ";";
3268 os << conv3d_info.padding;
3269 os << ";";
3270 os << to_string(conv3d_info.act_info);
3271 os << ";";
3272 os << conv3d_info.dilation;
3273 os << ";";
3274 os << conv3d_info.round_type;
3275 os << ";";
3276 os << conv3d_info.enable_fast_math;
3277
3278 return os;
3279}
3280
3281/** Formatted output of the Conv3dInfo type.
3282 *
3283 * @param[in] conv3d_info Type to output.
3284 *
3285 * @return Formatted string.
3286 */
3287inline std::string to_string(const Conv3dInfo &conv3d_info)
3288{
3289 std::stringstream str;
3290 str << conv3d_info;
3291 return str.str();
3292}
3293
Ramy Elgammal91780022022-07-20 14:57:37 +01003294/** Formatted output of the arm_compute::WeightFormat type.
3295 *
3296 * @param[in] wf arm_compute::WeightFormat Type to output.
3297 *
3298 * @return Formatted string.
3299 */
3300inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003301{
Ramy Elgammal91780022022-07-20 14:57:37 +01003302#define __CASE_WEIGHT_FORMAT(wf) \
3303case WeightFormat::wf: \
3304 return #wf;
3305 switch(wf)
3306 {
3307 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3308 __CASE_WEIGHT_FORMAT(ANY)
3309 __CASE_WEIGHT_FORMAT(OHWI)
3310 __CASE_WEIGHT_FORMAT(OHWIo2)
3311 __CASE_WEIGHT_FORMAT(OHWIo4)
3312 __CASE_WEIGHT_FORMAT(OHWIo8)
3313 __CASE_WEIGHT_FORMAT(OHWIo16)
3314 __CASE_WEIGHT_FORMAT(OHWIo32)
3315 __CASE_WEIGHT_FORMAT(OHWIo64)
3316 __CASE_WEIGHT_FORMAT(OHWIo128)
3317 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3318 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3319 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3320 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3321 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3322 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3323 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3324 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3325 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3326 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3327 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3328 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3329 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3330 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3331 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3332 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3333 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3334 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3335 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3336 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3337 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3338 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3339 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3340 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3341 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3342 __CASE_WEIGHT_FORMAT(OHWIo64i8)
3343 default:
3344 return "invalid value";
3345 }
3346#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003347}
3348
Ramy Elgammal91780022022-07-20 14:57:37 +01003349/** Formatted output of the arm_compute::WeightFormat type.
3350 *
3351 * @param[out] os Output stream.
3352 * @param[in] wf WeightFormat to output.
3353 *
3354 * @return Modified output stream.
3355 */
3356inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3357{
3358 os << to_string(wf);
3359 return os;
3360}
3361
3362/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3363 *
3364 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3365 *
3366 * @return Formatted string.
3367 */
3368inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003369{
3370 std::stringstream str;
3371 str << "[Input shape = " << std::get<0>(values);
3372 str << ", ";
3373 str << "Expected output shape = " << std::get<1>(values);
3374
3375 str << ", ";
3376 str << "WeightFormat = " << std::get<2>(values) << "]";
3377 return str.str();
3378}
3379
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003380/** Formatted output of the Padding2D type.
3381 *
3382 * @param[out] os Output stream.
3383 * @param[in] padding2d Padding info for 2D dimension shape.
3384 *
3385 * @return Modified output stream.
3386 */
3387inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3388{
3389 os << padding2d.left << "," << padding2d.right << ","
3390 << padding2d.top << "," << padding2d.bottom;
3391 return os;
3392}
3393
3394/** Converts a @ref Padding2D to string
3395 *
3396 * @param[in] padding2d Padding2D value to be converted
3397 *
3398 * @return String representing the corresponding Padding2D
3399 */
3400inline std::string to_string(const Padding2D &padding2d)
3401{
3402 std::stringstream str;
3403 str << padding2d;
3404 return str.str();
3405}
3406
3407/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3408 *
3409 * @param[out] os Output stream.
3410 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3411 *
3412 * @return Modified output stream.
3413 */
3414inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3415{
3416 os << "Conv2dAttributes="
3417 << "["
3418 << "Padding=" << conv2d_attr.pad() << ", "
3419 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003420 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003421
3422 return os;
3423}
3424/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3425 *
3426 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3427 *
3428 * @return Formatted string.
3429 */
3430inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3431{
3432 std::stringstream str;
3433 str << conv2d_attr;
3434 return str.str();
3435}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003436
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003437/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3438 *
3439 * @param[out] os Output stream.
3440 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3441 *
3442 * @return Modified output stream.
3443 */
3444inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3445{
3446 os << "CastAttributes="
3447 << "["
3448 << "Data Type=" << cast_attr.data_type() << ", "
3449 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3450
3451 return os;
3452}
3453/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3454 *
3455 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3456 *
3457 * @return Formatted string.
3458 */
3459inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3460{
3461 std::stringstream str;
3462 str << cast_attr;
3463 return str.str();
3464}
3465
Gunes Bayir7dc02342022-11-21 21:46:50 +00003466/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3467 *
3468 * @param[out] os Output stream.
3469 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3470 *
3471 * @return Modified output stream.
3472 */
3473inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3474{
3475 os << "DepthwiseConv2dAttributes="
3476 << "["
3477 << "Padding=" << dw_conv2d_attr.pad() << ", "
3478 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3479 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3480 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3481 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3482
3483 return os;
3484}
3485/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3486 *
3487 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3488 *
3489 * @return Formatted string.
3490 */
3491inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3492{
3493 std::stringstream str;
3494 str << dw_conv2d_attr;
3495 return str.str();
3496}
3497
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003498} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003499
3500#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */