blob: 0122229ed2ec01e82bd08173f6a7e56a4c081fc0 [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 Bayir7dc02342022-11-21 21:46:50 +000042#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010043#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000044#include "arm_compute/runtime/CL/CLTypes.h"
ramelg013ae3d882021-09-12 23:07:47 +010045#include "arm_compute/runtime/FunctionDescriptors.h"
ramelg01cbbb0382021-09-17 17:36:57 +010046#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000047#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000048#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010050#include <sstream>
51#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010052
53namespace arm_compute
54{
Anthony Barbierb940fd62018-06-04 14:14:32 +010055/** Formatted output if arg is not null
56 *
57 * @param[in] arg Object to print
58 *
59 * @return String representing arg.
60 */
61template <typename T>
62std::string to_string_if_not_null(T *arg)
63{
64 if(arg == nullptr)
65 {
66 return "nullptr";
67 }
68 else
69 {
70 return to_string(*arg);
71 }
72}
Anthony Barbierb4670212018-05-18 16:55:39 +010073
ramelg014a6d9e82021-10-02 14:34:36 +010074/** Fallback method: try to use std::to_string:
75 *
76 * @param[in] val Value to convert to string
77 *
78 * @return String representing val.
79 */
80template <typename T>
81inline std::string to_string(const T &val)
82{
83 return support::cpp11::to_string(val);
84}
85
ramelg01b1ba1e32021-09-25 11:53:26 +010086/** Formatted output of a vector of objects.
87 *
ramelg014a6d9e82021-10-02 14:34:36 +010088 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
89 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
90 *
ramelg01b1ba1e32021-09-25 11:53:26 +010091 * @param[out] os Output stream
92 * @param[in] args Vector of objects to print
93 *
94 * @return Modified output stream.
95 */
96template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +010097::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +010098{
99 const size_t max_print_size = 5U;
100
101 os << "[";
102 bool first = true;
103 size_t i;
104 for(i = 0; i < args.size(); ++i)
105 {
106 if(i == max_print_size)
107 {
108 break;
109 }
110 if(first)
111 {
112 first = false;
113 }
114 else
115 {
116 os << ", ";
117 }
ramelg014a6d9e82021-10-02 14:34:36 +0100118 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100119 }
120 if(i < args.size())
121 {
122 os << ", ...";
123 }
124 os << "]";
125 return os;
126}
127
ramelg014a6d9e82021-10-02 14:34:36 +0100128/** Formatted output of a vector of objects.
129 *
130 * @param[in] args Vector of objects to print
131 *
132 * @return String representing args.
133 */
134template <typename T>
135std::string to_string(const std::vector<T> &args)
136{
137 std::stringstream str;
138 str << args;
139 return str.str();
140}
141
SiCongLi1af54162021-10-06 15:25:57 +0100142/** @name (EXPERIMENTAL_POST_OPS)
143 * @{
144 */
145/** Formmated output of the @ref experimental::PostOpType type
146 *
147 * @param[out] os Output stream.
148 * @param[in] post_op_type Type to output.
149 *
150 * @return Modified output stream.
151 */
152inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
153{
154 os << "type=";
155 switch(post_op_type)
156 {
157 case experimental::PostOpType::Activation:
158 {
159 os << "Activation";
160 break;
161 }
162 case experimental::PostOpType::Eltwise_Add:
163 {
164 os << "Eltwise_Add";
165 break;
166 }
ramelg016049eda2021-10-29 10:52:53 +0100167 case experimental::PostOpType::Eltwise_PRelu:
168 {
169 os << "Eltwise_PRelu";
170 break;
171 }
SiCongLi1af54162021-10-06 15:25:57 +0100172 default:
173 {
174 ARM_COMPUTE_ERROR("Unsupported PostOpType");
175 break;
176 }
177 }
178 return os;
179}
180/** Converts a @ref experimental::PostOpType to string
181 *
182 * @param[in] post_op_type PostOpType value to be converted
183 *
184 * @return String representing the corresponding PostOpType
185 */
186inline std::string to_string(experimental::PostOpType post_op_type)
187{
188 std::stringstream str;
189 str << post_op_type;
190 return str.str();
191}
192/** Formatted output of the @ref experimental::IPostOp type.
193 *
194 * @param[out] os Output stream.
195 * @param[in] post_op Type to output.
196 *
197 * @return Modified output stream.
198 */
199template <typename T>
200inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
201{
202 os << "<";
203 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100204 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100205 switch(post_op.type())
206 {
207 case experimental::PostOpType::Activation:
208 {
209 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
210 os << "act_info=" << &(_post_op->_act_info);
211 break;
212 }
213 case experimental::PostOpType::Eltwise_Add:
214 {
215 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
216 os << "convert_policy=" << _post_op->_policy;
217 break;
218 }
ramelg016049eda2021-10-29 10:52:53 +0100219 case experimental::PostOpType::Eltwise_PRelu:
220 {
221 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
222 os << "convert_policy=" << _post_op->_policy;
223 break;
224 }
SiCongLi1af54162021-10-06 15:25:57 +0100225 default:
226 {
227 ARM_COMPUTE_ERROR("Unsupported PostOpType");
228 break;
229 }
230 }
231 os << ">";
232 return os;
233}
234/** Converts an @ref experimental::IPostOp to string
235 *
236 * @param[in] post_op IPostOp value to be converted
237 *
238 * @return String representing the corresponding IPostOp
239 */
240template <typename T>
241inline std::string to_string(const experimental::IPostOp<T> &post_op)
242{
243 std::stringstream str;
244 str << post_op;
245 return str.str();
246}
247/** Formatted output of the @ref experimental::PostOpList type.
248 *
249 * @param[out] os Output stream.
250 * @param[in] post_ops Type to output.
251 *
252 * @return Modified output stream.
253 */
254template <typename T>
255inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
256{
257 os << "[";
258 for(const auto &post_op : post_ops.get_list())
259 {
260 os << *post_op << ",";
261 }
262 os << "]";
263 return os;
264}
265/** Converts a @ref experimental::PostOpList to string
266 *
267 * @param[in] post_ops PostOpList value to be converted
268 *
269 * @return String representing the corresponding PostOpList
270 */
271template <typename T>
272inline std::string to_string(const experimental::PostOpList<T> &post_ops)
273{
274 std::stringstream str;
275 str << post_ops;
276 return str.str();
277}
278/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
279
Alex Gildayc357c472018-03-21 13:54:09 +0000280/** Formatted output of the Dimensions type.
281 *
282 * @param[out] os Output stream.
283 * @param[in] dimensions Type to output.
284 *
285 * @return Modified output stream.
286 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100287template <typename T>
288inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
289{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100290 if(dimensions.num_dimensions() > 0)
291 {
292 os << dimensions[0];
293
294 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
295 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100296 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100297 }
298 }
299
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100300 return os;
301}
302
Alex Gildayc357c472018-03-21 13:54:09 +0000303/** Formatted output of the RoundingPolicy type.
304 *
305 * @param[out] os Output stream.
306 * @param[in] rounding_policy Type to output.
307 *
308 * @return Modified output stream.
309 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100310inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100311{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100312 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100313 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100314 case RoundingPolicy::TO_ZERO:
315 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100316 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100317 case RoundingPolicy::TO_NEAREST_UP:
318 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100319 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100320 case RoundingPolicy::TO_NEAREST_EVEN:
321 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100322 break;
323 default:
324 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
325 }
326
327 return os;
328}
329
Alex Gildayc357c472018-03-21 13:54:09 +0000330/** Formatted output of the WeightsInfo type.
331 *
332 * @param[out] os Output stream.
333 * @param[in] weights_info Type to output.
334 *
335 * @return Modified output stream.
336 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100337inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100338{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100339 os << weights_info.are_reshaped() << ";";
340 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100341
342 return os;
343}
344
Alex Gildayc357c472018-03-21 13:54:09 +0000345/** Formatted output of the ROIPoolingInfo type.
346 *
347 * @param[out] os Output stream.
348 * @param[in] pool_info Type to output.
349 *
350 * @return Modified output stream.
351 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100352inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100353{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100354 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100355 return os;
356}
357
giuros0118870812018-09-13 09:31:40 +0100358/** Formatted output of the ROIPoolingInfo type.
359 *
360 * @param[in] pool_info Type to output.
361 *
362 * @return Formatted string.
363 */
364inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
365{
366 std::stringstream str;
367 str << pool_info;
368 return str.str();
369}
370
morgolockaba2f912020-05-05 16:28:19 +0100371/** Formatted output of the GEMMKernelInfo type.
372 *
373 * @param[out] os Output stream.
374 * @param[in] gemm_info Type to output.
375 *
376 * @return Modified output stream.
377 */
378inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
379{
SiCongLi579ca842021-10-18 09:38:33 +0100380 os << "( m=" << gemm_info.m;
381 os << " n=" << gemm_info.n;
382 os << " k=" << gemm_info.k;
383 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
384 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
385 os << " broadcast_bias=" << gemm_info.broadcast_bias;
386 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
387 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
388 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
389 os << " a_offset=" << gemm_info.a_offset;
390 os << " b_offset=" << gemm_info.b_offset;
391 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100392 os << ")";
393 return os;
394}
395
396/** Formatted output of the GEMMLHSMatrixInfo type.
397 *
398 * @param[out] os Output stream.
399 * @param[in] gemm_info Type to output.
400 *
401 * @return Modified output stream.
402 */
403inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
404{
SiCongLi579ca842021-10-18 09:38:33 +0100405 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 +0100406 return os;
407}
408
409/** Formatted output of the GEMMRHSMatrixInfo type.
410 *
411 * @param[out] os Output stream.
412 * @param[in] gemm_info Type to output.
413 *
414 * @return Modified output stream.
415 */
416inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
417{
SiCongLi579ca842021-10-18 09:38:33 +0100418 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 +0000419 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100420 return os;
421}
422
423/** Formatted output of the GEMMRHSMatrixInfo type.
424 *
425 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
426 *
427 * @return Formatted string.
428 */
429inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
430{
431 std::stringstream str;
432 str << gemm_info;
433 return str.str();
434}
435
436/** Formatted output of the GEMMLHSMatrixInfo type.
437 *
438 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
439 *
440 * @return Formatted string.
441 */
442inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
443{
444 std::stringstream str;
445 str << gemm_info;
446 return str.str();
447}
448
449/** Formatted output of the GEMMKernelInfo type.
450 *
451 * @param[in] gemm_info GEMMKernelInfo Type to output.
452 *
453 * @return Formatted string.
454 */
455inline std::string to_string(const GEMMKernelInfo &gemm_info)
456{
457 std::stringstream str;
458 str << gemm_info;
459 return str.str();
460}
461
giuros01c04a0e82018-10-03 12:44:35 +0100462/** Formatted output of the BoundingBoxTransformInfo type.
463 *
464 * @param[out] os Output stream.
465 * @param[in] bbox_info Type to output.
466 *
467 * @return Modified output stream.
468 */
469inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
470{
471 auto weights = bbox_info.weights();
SiCongLi579ca842021-10-18 09:38:33 +0100472 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 +0100473 "})";
474 return os;
475}
476
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100477#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100478inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100479{
480 std::stringstream str;
481 str << v;
482 os << str.str();
483 return os;
484}
Ramy Elgammal91780022022-07-20 14:57:37 +0100485#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100486
giuros01c04a0e82018-10-03 12:44:35 +0100487/** Formatted output of the BoundingBoxTransformInfo type.
488 *
489 * @param[in] bbox_info Type to output.
490 *
491 * @return Formatted string.
492 */
493inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
494{
495 std::stringstream str;
496 str << bbox_info;
497 return str.str();
498}
499
Manuel Bottini5209be52019-02-13 16:34:56 +0000500/** Formatted output of the ComputeAnchorsInfo type.
501 *
502 * @param[out] os Output stream.
503 * @param[in] anchors_info Type to output.
504 *
505 * @return Modified output stream.
506 */
507inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
508{
509 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
510 return os;
511}
512
513/** Formatted output of the ComputeAnchorsInfo type.
514 *
515 * @param[in] anchors_info Type to output.
516 *
517 * @return Formatted string.
518 */
519inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
520{
521 std::stringstream str;
522 str << anchors_info;
523 return str.str();
524}
525
526/** Formatted output of the GenerateProposalsInfo type.
527 *
528 * @param[out] os Output stream.
529 * @param[in] proposals_info Type to output.
530 *
531 * @return Modified output stream.
532 */
533inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
534{
535 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
536 return os;
537}
538
539/** Formatted output of the GenerateProposalsInfo type.
540 *
541 * @param[in] proposals_info Type to output.
542 *
543 * @return Formatted string.
544 */
545inline std::string to_string(const GenerateProposalsInfo &proposals_info)
546{
547 std::stringstream str;
548 str << proposals_info;
549 return str.str();
550}
551
Alex Gildayc357c472018-03-21 13:54:09 +0000552/** Formatted output of the QuantizationInfo type.
553 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100554 * @param[out] os Output stream.
555 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000556 *
557 * @return Modified output stream.
558 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100559inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700560{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100561 const UniformQuantizationInfo uqinfo = qinfo.uniform();
562 os << "Scale:" << uqinfo.scale << "~";
563 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700564 return os;
565}
566
Alex Gildayc357c472018-03-21 13:54:09 +0000567/** Formatted output of the QuantizationInfo type.
568 *
569 * @param[in] quantization_info Type to output.
570 *
571 * @return Formatted string.
572 */
Chunosovd621bca2017-11-03 17:33:15 +0700573inline std::string to_string(const QuantizationInfo &quantization_info)
574{
575 std::stringstream str;
576 str << quantization_info;
577 return str.str();
578}
579
Alex Gildayc357c472018-03-21 13:54:09 +0000580/** Formatted output of the activation function type.
581 *
582 * @param[out] os Output stream.
583 * @param[in] act_function Type to output.
584 *
585 * @return Modified output stream.
586 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100587inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
588{
589 switch(act_function)
590 {
591 case ActivationLayerInfo::ActivationFunction::ABS:
592 os << "ABS";
593 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100594 case ActivationLayerInfo::ActivationFunction::LINEAR:
595 os << "LINEAR";
596 break;
597 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
598 os << "LOGISTIC";
599 break;
600 case ActivationLayerInfo::ActivationFunction::RELU:
601 os << "RELU";
602 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100603 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
604 os << "BOUNDED_RELU";
605 break;
606 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
607 os << "LEAKY_RELU";
608 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100609 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
610 os << "SOFT_RELU";
611 break;
612 case ActivationLayerInfo::ActivationFunction::SQRT:
613 os << "SQRT";
614 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100615 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
616 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000617 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100618 case ActivationLayerInfo::ActivationFunction::ELU:
619 os << "ELU";
620 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100621 case ActivationLayerInfo::ActivationFunction::SQUARE:
622 os << "SQUARE";
623 break;
624 case ActivationLayerInfo::ActivationFunction::TANH:
625 os << "TANH";
626 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100627 case ActivationLayerInfo::ActivationFunction::IDENTITY:
628 os << "IDENTITY";
629 break;
morgolock07df3d42020-02-27 11:46:28 +0000630 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
631 os << "HARD_SWISH";
632 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100633 case ActivationLayerInfo::ActivationFunction::SWISH:
634 os << "SWISH";
635 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400636 case ActivationLayerInfo::ActivationFunction::GELU:
637 os << "GELU";
638 break;
morgolock07df3d42020-02-27 11:46:28 +0000639
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100640 default:
641 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
642 }
643
644 return os;
645}
646
Alex Gildayc357c472018-03-21 13:54:09 +0000647/** Formatted output of the activation function info type.
648 *
SiCongLi1af54162021-10-06 15:25:57 +0100649 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000650 *
651 * @return Formatted string.
652 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100653inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100654{
655 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000656 if(info.enabled())
657 {
658 str << info.activation();
659 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100660 return str.str();
661}
662
SiCongLi1af54162021-10-06 15:25:57 +0100663/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100664 *
SiCongLi1af54162021-10-06 15:25:57 +0100665 * @param[out] os Output stream.
666 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100667 *
668 * @return Formatted string.
669 */
SiCongLi1af54162021-10-06 15:25:57 +0100670inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100671{
ramelg013ae3d882021-09-12 23:07:47 +0100672 if(info != nullptr)
673 {
ramelg013ae3d882021-09-12 23:07:47 +0100674 if(info->enabled())
675 {
SiCongLi1af54162021-10-06 15:25:57 +0100676 os << info->activation();
677 os << "(";
678 os << "VAL_A=" << info->a() << ",";
679 os << "VAL_B=" << info->b();
680 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100681 }
SiCongLi1af54162021-10-06 15:25:57 +0100682 else
683 {
684 os << "disabled";
685 }
ramelg013ae3d882021-09-12 23:07:47 +0100686 }
SiCongLi1af54162021-10-06 15:25:57 +0100687 else
688 {
689 os << "nullptr";
690 }
691 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100692}
693
Alex Gildayc357c472018-03-21 13:54:09 +0000694/** Formatted output of the activation function type.
695 *
696 * @param[in] function Type to output.
697 *
698 * @return Formatted string.
699 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100700inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
701{
702 std::stringstream str;
703 str << function;
704 return str.str();
705}
706
Alex Gildayc357c472018-03-21 13:54:09 +0000707/** Formatted output of the NormType type.
708 *
709 * @param[out] os Output stream.
710 * @param[in] norm_type Type to output.
711 *
712 * @return Modified output stream.
713 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100714inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
715{
716 switch(norm_type)
717 {
718 case NormType::CROSS_MAP:
719 os << "CROSS_MAP";
720 break;
721 case NormType::IN_MAP_1D:
722 os << "IN_MAP_1D";
723 break;
724 case NormType::IN_MAP_2D:
725 os << "IN_MAP_2D";
726 break;
727 default:
728 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
729 }
730
731 return os;
732}
733
Alex Gildayc357c472018-03-21 13:54:09 +0000734/** Formatted output of @ref NormalizationLayerInfo.
735 *
736 * @param[in] info Type to output.
737 *
738 * @return Formatted string.
739 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100740inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100741{
742 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000743 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100744 return str.str();
745}
746
Alex Gildayc357c472018-03-21 13:54:09 +0000747/** Formatted output of @ref NormalizationLayerInfo.
748 *
749 * @param[out] os Output stream.
750 * @param[in] info Type to output.
751 *
752 * @return Modified output stream.
753 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100754inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
755{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000756 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100757 return os;
758}
759
Alex Gildayc357c472018-03-21 13:54:09 +0000760/** Formatted output of the PoolingType type.
761 *
762 * @param[out] os Output stream.
763 * @param[in] pool_type Type to output.
764 *
765 * @return Modified output stream.
766 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100767inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
768{
769 switch(pool_type)
770 {
771 case PoolingType::AVG:
772 os << "AVG";
773 break;
774 case PoolingType::MAX:
775 os << "MAX";
776 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100777 case PoolingType::L2:
778 os << "L2";
779 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100780 default:
781 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
782 }
783
784 return os;
785}
786
Alex Gildayc357c472018-03-21 13:54:09 +0000787/** Formatted output of @ref PoolingLayerInfo.
788 *
789 * @param[out] os Output stream.
790 * @param[in] info Type to output.
791 *
792 * @return Modified output stream.
793 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100794inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
795{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000796 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100797
798 return os;
799}
800
Alex Gildayc357c472018-03-21 13:54:09 +0000801/** Formatted output of @ref RoundingPolicy.
802 *
803 * @param[in] rounding_policy Type to output.
804 *
805 * @return Formatted string.
806 */
John Richardsondd715f22017-09-18 16:10:48 +0100807inline std::string to_string(const RoundingPolicy &rounding_policy)
808{
809 std::stringstream str;
810 str << rounding_policy;
811 return str.str();
812}
813
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000814/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000815/** Formatted output of the DataLayout type.
816 *
817 * @param[out] os Output stream.
818 * @param[in] data_layout Type to output.
819 *
820 * @return Modified output stream.
821 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000822inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
823{
824 switch(data_layout)
825 {
826 case DataLayout::UNKNOWN:
827 os << "UNKNOWN";
828 break;
829 case DataLayout::NHWC:
830 os << "NHWC";
831 break;
832 case DataLayout::NCHW:
833 os << "NCHW";
834 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100835 case DataLayout::NDHWC:
836 os << "NDHWC";
837 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100838 case DataLayout::NCDHW:
839 os << "NCDHW";
840 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000841 default:
842 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
843 }
844
845 return os;
846}
847
Alex Gildayc357c472018-03-21 13:54:09 +0000848/** Formatted output of the DataLayout type.
849 *
850 * @param[in] data_layout Type to output.
851 *
852 * @return Formatted string.
853 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000854inline std::string to_string(const arm_compute::DataLayout &data_layout)
855{
856 std::stringstream str;
857 str << data_layout;
858 return str.str();
859}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000860/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000861
Georgios Pinitase2220552018-07-20 13:23:44 +0100862/** Formatted output of the DataLayoutDimension type.
863 *
864 * @param[out] os Output stream.
865 * @param[in] data_layout_dim Data layout dimension to print.
866 *
867 * @return Modified output stream.
868 */
869inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
870{
871 switch(data_layout_dim)
872 {
873 case DataLayoutDimension::WIDTH:
874 os << "WIDTH";
875 break;
876 case DataLayoutDimension::HEIGHT:
877 os << "HEIGHT";
878 break;
879 case DataLayoutDimension::CHANNEL:
880 os << "CHANNEL";
881 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100882 case DataLayoutDimension::DEPTH:
883 os << "DEPTH";
884 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100885 case DataLayoutDimension::BATCHES:
886 os << "BATCHES";
887 break;
888 default:
889 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
890 }
891 return os;
892}
893
Alex Gildayc357c472018-03-21 13:54:09 +0000894/** Formatted output of the DataType type.
895 *
896 * @param[out] os Output stream.
897 * @param[in] data_type Type to output.
898 *
899 * @return Modified output stream.
900 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100901inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
902{
903 switch(data_type)
904 {
905 case DataType::UNKNOWN:
906 os << "UNKNOWN";
907 break;
908 case DataType::U8:
909 os << "U8";
910 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100911 case DataType::QSYMM8:
912 os << "QSYMM8";
913 break;
Chunosovd621bca2017-11-03 17:33:15 +0700914 case DataType::QASYMM8:
915 os << "QASYMM8";
916 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000917 case DataType::QASYMM8_SIGNED:
918 os << "QASYMM8_SIGNED";
919 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100920 case DataType::QSYMM8_PER_CHANNEL:
921 os << "QSYMM8_PER_CHANNEL";
922 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100923 case DataType::S8:
924 os << "S8";
925 break;
926 case DataType::U16:
927 os << "U16";
928 break;
929 case DataType::S16:
930 os << "S16";
931 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100932 case DataType::QSYMM16:
933 os << "QSYMM16";
934 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100935 case DataType::QASYMM16:
936 os << "QASYMM16";
937 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100938 case DataType::U32:
939 os << "U32";
940 break;
941 case DataType::S32:
942 os << "S32";
943 break;
944 case DataType::U64:
945 os << "U64";
946 break;
947 case DataType::S64:
948 os << "S64";
949 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000950 case DataType::BFLOAT16:
951 os << "BFLOAT16";
952 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100953 case DataType::F16:
954 os << "F16";
955 break;
956 case DataType::F32:
957 os << "F32";
958 break;
959 case DataType::F64:
960 os << "F64";
961 break;
962 case DataType::SIZET:
963 os << "SIZET";
964 break;
965 default:
966 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
967 }
968
969 return os;
970}
971
Alex Gildayc357c472018-03-21 13:54:09 +0000972/** Formatted output of the DataType type.
973 *
974 * @param[in] data_type Type to output.
975 *
976 * @return Formatted string.
977 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100978inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100979{
980 std::stringstream str;
981 str << data_type;
982 return str.str();
983}
984
Alex Gildayc357c472018-03-21 13:54:09 +0000985/** Formatted output of the Format type.
986 *
987 * @param[out] os Output stream.
988 * @param[in] format Type to output.
989 *
990 * @return Modified output stream.
991 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100992inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
993{
994 switch(format)
995 {
996 case Format::UNKNOWN:
997 os << "UNKNOWN";
998 break;
999 case Format::U8:
1000 os << "U8";
1001 break;
1002 case Format::S16:
1003 os << "S16";
1004 break;
1005 case Format::U16:
1006 os << "U16";
1007 break;
1008 case Format::S32:
1009 os << "S32";
1010 break;
1011 case Format::U32:
1012 os << "U32";
1013 break;
1014 case Format::F16:
1015 os << "F16";
1016 break;
1017 case Format::F32:
1018 os << "F32";
1019 break;
1020 case Format::UV88:
1021 os << "UV88";
1022 break;
1023 case Format::RGB888:
1024 os << "RGB888";
1025 break;
1026 case Format::RGBA8888:
1027 os << "RGBA8888";
1028 break;
1029 case Format::YUV444:
1030 os << "YUV444";
1031 break;
1032 case Format::YUYV422:
1033 os << "YUYV422";
1034 break;
1035 case Format::NV12:
1036 os << "NV12";
1037 break;
1038 case Format::NV21:
1039 os << "NV21";
1040 break;
1041 case Format::IYUV:
1042 os << "IYUV";
1043 break;
1044 case Format::UYVY422:
1045 os << "UYVY422";
1046 break;
1047 default:
1048 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1049 }
1050
1051 return os;
1052}
1053
Alex Gildayc357c472018-03-21 13:54:09 +00001054/** Formatted output of the Format type.
1055 *
1056 * @param[in] format Type to output.
1057 *
1058 * @return Formatted string.
1059 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001060inline std::string to_string(const Format &format)
1061{
1062 std::stringstream str;
1063 str << format;
1064 return str.str();
1065}
1066
Alex Gildayc357c472018-03-21 13:54:09 +00001067/** Formatted output of the Channel type.
1068 *
1069 * @param[out] os Output stream.
1070 * @param[in] channel Type to output.
1071 *
1072 * @return Modified output stream.
1073 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001074inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1075{
1076 switch(channel)
1077 {
1078 case Channel::UNKNOWN:
1079 os << "UNKNOWN";
1080 break;
1081 case Channel::C0:
1082 os << "C0";
1083 break;
1084 case Channel::C1:
1085 os << "C1";
1086 break;
1087 case Channel::C2:
1088 os << "C2";
1089 break;
1090 case Channel::C3:
1091 os << "C3";
1092 break;
1093 case Channel::R:
1094 os << "R";
1095 break;
1096 case Channel::G:
1097 os << "G";
1098 break;
1099 case Channel::B:
1100 os << "B";
1101 break;
1102 case Channel::A:
1103 os << "A";
1104 break;
1105 case Channel::Y:
1106 os << "Y";
1107 break;
1108 case Channel::U:
1109 os << "U";
1110 break;
1111 case Channel::V:
1112 os << "V";
1113 break;
1114 default:
1115 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1116 }
1117
1118 return os;
1119}
1120
Alex Gildayc357c472018-03-21 13:54:09 +00001121/** Formatted output of the Channel type.
1122 *
1123 * @param[in] channel Type to output.
1124 *
1125 * @return Formatted string.
1126 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001127inline std::string to_string(const Channel &channel)
1128{
1129 std::stringstream str;
1130 str << channel;
1131 return str.str();
1132}
1133
Alex Gildayc357c472018-03-21 13:54:09 +00001134/** Formatted output of the BorderMode type.
1135 *
1136 * @param[out] os Output stream.
1137 * @param[in] mode Type to output.
1138 *
1139 * @return Modified output stream.
1140 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001141inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1142{
1143 switch(mode)
1144 {
1145 case BorderMode::UNDEFINED:
1146 os << "UNDEFINED";
1147 break;
1148 case BorderMode::CONSTANT:
1149 os << "CONSTANT";
1150 break;
1151 case BorderMode::REPLICATE:
1152 os << "REPLICATE";
1153 break;
1154 default:
1155 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1156 }
1157
1158 return os;
1159}
1160
Alex Gildayc357c472018-03-21 13:54:09 +00001161/** Formatted output of the BorderSize type.
1162 *
1163 * @param[out] os Output stream.
1164 * @param[in] border Type to output.
1165 *
1166 * @return Modified output stream.
1167 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001168inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1169{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001170 os << border.top << ","
1171 << border.right << ","
1172 << border.bottom << ","
1173 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001174
1175 return os;
1176}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001177
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001178/** Formatted output of the PaddingList type.
1179 *
1180 * @param[out] os Output stream.
1181 * @param[in] padding Type to output.
1182 *
1183 * @return Modified output stream.
1184 */
1185inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1186{
1187 os << "{";
1188 for(auto const &p : padding)
1189 {
1190 os << "{" << p.first << "," << p.second << "}";
1191 }
1192 os << "}";
1193 return os;
1194}
1195
giuros013175fcf2018-11-21 09:59:17 +00001196/** Formatted output of the Multiples type.
1197 *
1198 * @param[out] os Output stream.
1199 * @param[in] multiples Type to output.
1200 *
1201 * @return Modified output stream.
1202 */
1203inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1204{
1205 os << "(";
1206 for(size_t i = 0; i < multiples.size() - 1; i++)
1207 {
1208 os << multiples[i] << ", ";
1209 }
1210 os << multiples.back() << ")";
1211 return os;
1212}
1213
Alex Gildayc357c472018-03-21 13:54:09 +00001214/** Formatted output of the InterpolationPolicy type.
1215 *
1216 * @param[out] os Output stream.
1217 * @param[in] policy Type to output.
1218 *
1219 * @return Modified output stream.
1220 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001221inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1222{
1223 switch(policy)
1224 {
1225 case InterpolationPolicy::NEAREST_NEIGHBOR:
1226 os << "NEAREST_NEIGHBOR";
1227 break;
1228 case InterpolationPolicy::BILINEAR:
1229 os << "BILINEAR";
1230 break;
1231 case InterpolationPolicy::AREA:
1232 os << "AREA";
1233 break;
1234 default:
1235 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1236 }
1237
1238 return os;
1239}
1240
Alex Gildayc357c472018-03-21 13:54:09 +00001241/** Formatted output of the SamplingPolicy type.
1242 *
1243 * @param[out] os Output stream.
1244 * @param[in] policy Type to output.
1245 *
1246 * @return Modified output stream.
1247 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001248inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1249{
1250 switch(policy)
1251 {
1252 case SamplingPolicy::CENTER:
1253 os << "CENTER";
1254 break;
1255 case SamplingPolicy::TOP_LEFT:
1256 os << "TOP_LEFT";
1257 break;
1258 default:
1259 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1260 }
1261
1262 return os;
1263}
1264
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001265/** Formatted output of the ITensorInfo type.
1266 *
1267 * @param[out] os Output stream.
1268 * @param[in] info Tensor information.
1269 *
1270 * @return Modified output stream.
1271 */
1272inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1273{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001274 const DataType data_type = info->data_type();
1275 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001276
1277 os << "Shape=" << info->tensor_shape() << ","
1278 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001279 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001280
1281 if(is_data_type_quantized(data_type))
1282 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001283 const QuantizationInfo qinfo = info->quantization_info();
1284 const auto scales = qinfo.scale();
1285 const auto offsets = qinfo.offset();
1286
ramelg014a6d9e82021-10-02 14:34:36 +01001287 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001288 << "scales.size=" << scales.size()
1289 << ", scale(s)=" << scales << ", ";
1290
1291 os << "offsets.size=" << offsets.size()
1292 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001293 }
1294 return os;
1295}
1296
ramelg013ae3d882021-09-12 23:07:47 +01001297/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001298 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001299 * @param[out] os Output stream.
1300 * @param[in] info Type to output.
1301 *
1302 * @return Modified output stream.
1303 */
1304inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1305{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001306 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001307 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001308}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001309
ramelg013ae3d882021-09-12 23:07:47 +01001310/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001311 *
Alex Gildayc357c472018-03-21 13:54:09 +00001312 * @param[in] info Type to output.
1313 *
1314 * @return Formatted string.
1315 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001316inline std::string to_string(const TensorInfo &info)
1317{
1318 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001319 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001320 return str.str();
1321}
1322
ramelg013ae3d882021-09-12 23:07:47 +01001323/** Formatted output of the const ITensorInfo& type.
1324 *
1325 * @param[in] info Type to output.
1326 *
1327 * @return Formatted string.
1328 */
1329inline std::string to_string(const ITensorInfo &info)
1330{
1331 std::stringstream str;
1332 str << &info;
1333 return str.str();
1334}
1335
ramelg013ae3d882021-09-12 23:07:47 +01001336/** Formatted output of the const ITensorInfo* type.
1337 *
1338 * @param[in] info Type to output.
1339 *
1340 * @return Formatted string.
1341 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001342inline std::string to_string(const ITensorInfo *info)
1343{
ramelg013ae3d882021-09-12 23:07:47 +01001344 std::string ret_str = "nullptr";
1345 if(info != nullptr)
1346 {
1347 std::stringstream str;
1348 str << info;
1349 ret_str = str.str();
1350 }
1351 return ret_str;
1352}
1353
ramelg01cbbb0382021-09-17 17:36:57 +01001354/** Formatted output of the ITensorInfo* type.
1355 *
1356 * @param[in] info Type to output.
1357 *
1358 * @return Formatted string.
1359 */
1360inline std::string to_string(ITensorInfo *info)
1361{
1362 return to_string(static_cast<const ITensorInfo *>(info));
1363}
1364
1365/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001366 *
1367 * @param[in] tensor Type to output.
1368 *
1369 * @return Formatted string.
1370 */
1371inline std::string to_string(const ITensor *tensor)
1372{
1373 std::string ret_str = "nullptr";
1374 if(tensor != nullptr)
1375 {
1376 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001377 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001378 ret_str = str.str();
1379 }
1380 return ret_str;
1381}
1382
ramelg01cbbb0382021-09-17 17:36:57 +01001383/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001384 *
1385 * @param[in] tensor Type to output.
1386 *
1387 * @return Formatted string.
1388 */
1389inline std::string to_string(ITensor *tensor)
1390{
ramelg01cbbb0382021-09-17 17:36:57 +01001391 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001392}
1393
ramelg01cbbb0382021-09-17 17:36:57 +01001394/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001395 *
1396 * @param[in] tensor Type to output.
1397 *
1398 * @return Formatted string.
1399 */
1400inline std::string to_string(ITensor &tensor)
1401{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001402 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001403 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001404 return str.str();
1405}
1406
ramelg01cbbb0382021-09-17 17:36:57 +01001407#ifdef ARM_COMPUTE_OPENCL_ENABLED
1408/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1409 *
1410 * @param[in] cl_tensor Type to output.
1411 *
1412 * @return Formatted string.
1413 */
1414inline std::string to_string(const ICLTensor *cl_tensor)
1415{
1416 std::string ret_str = "nullptr";
1417 if(cl_tensor != nullptr)
1418 {
1419 std::stringstream str;
1420 str << "ICLTensor->info(): " << cl_tensor->info();
1421 ret_str = str.str();
1422 }
1423 return ret_str;
1424}
1425
1426/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1427 *
1428 * @param[in] cl_tensor Type to output.
1429 *
1430 * @return Formatted string.
1431 */
1432inline std::string to_string(ICLTensor *cl_tensor)
1433{
1434 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1435}
1436#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1437
Alex Gildayc357c472018-03-21 13:54:09 +00001438/** Formatted output of the Dimensions type.
1439 *
1440 * @param[in] dimensions Type to output.
1441 *
1442 * @return Formatted string.
1443 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001444template <typename T>
1445inline std::string to_string(const Dimensions<T> &dimensions)
1446{
1447 std::stringstream str;
1448 str << dimensions;
1449 return str.str();
1450}
1451
Alex Gildayc357c472018-03-21 13:54:09 +00001452/** Formatted output of the Strides type.
1453 *
1454 * @param[in] stride Type to output.
1455 *
1456 * @return Formatted string.
1457 */
John Richardsona36eae12017-09-26 16:55:59 +01001458inline std::string to_string(const Strides &stride)
1459{
1460 std::stringstream str;
1461 str << stride;
1462 return str.str();
1463}
1464
Alex Gildayc357c472018-03-21 13:54:09 +00001465/** Formatted output of the TensorShape type.
1466 *
1467 * @param[in] shape Type to output.
1468 *
1469 * @return Formatted string.
1470 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001471inline std::string to_string(const TensorShape &shape)
1472{
1473 std::stringstream str;
1474 str << shape;
1475 return str.str();
1476}
1477
Alex Gildayc357c472018-03-21 13:54:09 +00001478/** Formatted output of the Coordinates type.
1479 *
1480 * @param[in] coord Type to output.
1481 *
1482 * @return Formatted string.
1483 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001484inline std::string to_string(const Coordinates &coord)
1485{
1486 std::stringstream str;
1487 str << coord;
1488 return str.str();
1489}
1490
Anthony Barbierb940fd62018-06-04 14:14:32 +01001491/** Formatted output of the GEMMReshapeInfo type.
1492 *
1493 * @param[out] os Output stream.
1494 * @param[in] info Type to output.
1495 *
1496 * @return Modified output stream.
1497 */
1498inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1499{
1500 os << "{m=" << info.m() << ",";
1501 os << "n=" << info.n() << ",";
1502 os << "k=" << info.k() << ",";
1503 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1504 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1505 os << "}";
1506
1507 return os;
1508}
1509
1510/** Formatted output of the GEMMInfo type.
1511 *
1512 * @param[out] os Output stream.
1513 * @param[in] info Type to output.
1514 *
1515 * @return Modified output stream.
1516 */
1517inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1518{
1519 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1520 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1521 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001522 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1523 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1524 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1525 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1526 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001527 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001528 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001529
1530 return os;
1531}
1532
1533/** Formatted output of the Window::Dimension type.
1534 *
1535 * @param[out] os Output stream.
1536 * @param[in] dim Type to output.
1537 *
1538 * @return Modified output stream.
1539 */
1540inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1541{
1542 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1543
1544 return os;
1545}
1546/** Formatted output of the Window type.
1547 *
1548 * @param[out] os Output stream.
1549 * @param[in] win Type to output.
1550 *
1551 * @return Modified output stream.
1552 */
1553inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1554{
1555 os << "{";
1556 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1557 {
1558 if(i > 0)
1559 {
1560 os << ", ";
1561 }
1562 os << win[i];
1563 }
1564 os << "}";
1565
1566 return os;
1567}
1568
1569/** Formatted output of the WeightsInfo type.
1570 *
1571 * @param[in] info Type to output.
1572 *
1573 * @return Formatted string.
1574 */
1575inline std::string to_string(const WeightsInfo &info)
1576{
1577 std::stringstream str;
1578 str << info;
1579 return str.str();
1580}
1581
1582/** Formatted output of the GEMMReshapeInfo type.
1583 *
1584 * @param[in] info Type to output.
1585 *
1586 * @return Formatted string.
1587 */
1588inline std::string to_string(const GEMMReshapeInfo &info)
1589{
1590 std::stringstream str;
1591 str << info;
1592 return str.str();
1593}
1594
1595/** Formatted output of the GEMMInfo type.
1596 *
1597 * @param[in] info Type to output.
1598 *
1599 * @return Formatted string.
1600 */
1601inline std::string to_string(const GEMMInfo &info)
1602{
1603 std::stringstream str;
1604 str << info;
1605 return str.str();
1606}
1607
1608/** Formatted output of the Window::Dimension type.
1609 *
1610 * @param[in] dim Type to output.
1611 *
1612 * @return Formatted string.
1613 */
1614inline std::string to_string(const Window::Dimension &dim)
1615{
1616 std::stringstream str;
1617 str << dim;
1618 return str.str();
1619}
ramelg01cbbb0382021-09-17 17:36:57 +01001620/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001621 *
1622 * @param[in] win Type to output.
1623 *
1624 * @return Formatted string.
1625 */
1626inline std::string to_string(const Window &win)
1627{
1628 std::stringstream str;
1629 str << win;
1630 return str.str();
1631}
1632
ramelg01cbbb0382021-09-17 17:36:57 +01001633/** Formatted output of the Window* type.
1634 *
1635 * @param[in] win Type to output.
1636 *
1637 * @return Formatted string.
1638 */
1639inline std::string to_string(Window *win)
1640{
1641 std::string ret_str = "nullptr";
1642 if(win != nullptr)
1643 {
1644 std::stringstream str;
1645 str << *win;
1646 ret_str = str.str();
1647 }
1648 return ret_str;
1649}
1650
Alex Gildayc357c472018-03-21 13:54:09 +00001651/** Formatted output of the Rectangle type.
1652 *
1653 * @param[out] os Output stream.
1654 * @param[in] rect Type to output.
1655 *
1656 * @return Modified output stream.
1657 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001658inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1659{
1660 os << rect.width << "x" << rect.height;
1661 os << "+" << rect.x << "+" << rect.y;
1662
1663 return os;
1664}
1665
Usama Arif8cf8c112019-03-14 15:36:54 +00001666/** Formatted output of the PaddingMode type.
1667 *
1668 * @param[out] os Output stream.
1669 * @param[in] mode Type to output.
1670 *
1671 * @return Modified output stream.
1672 */
1673inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1674{
1675 switch(mode)
1676 {
1677 case PaddingMode::CONSTANT:
1678 os << "CONSTANT";
1679 break;
1680 case PaddingMode::REFLECT:
1681 os << "REFLECT";
1682 break;
1683 case PaddingMode::SYMMETRIC:
1684 os << "SYMMETRIC";
1685 break;
1686 default:
1687 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1688 }
1689
1690 return os;
1691}
1692
1693/** Formatted output of the PaddingMode type.
1694 *
1695 * @param[in] mode Type to output.
1696 *
1697 * @return Formatted string.
1698 */
1699inline std::string to_string(const PaddingMode &mode)
1700{
1701 std::stringstream str;
1702 str << mode;
1703 return str.str();
1704}
1705
Alex Gildayc357c472018-03-21 13:54:09 +00001706/** Formatted output of the PadStrideInfo type.
1707 *
1708 * @param[out] os Output stream.
1709 * @param[in] pad_stride_info Type to output.
1710 *
1711 * @return Modified output stream.
1712 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001713inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1714{
1715 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1716 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001717 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1718 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001719
1720 return os;
1721}
1722
Alex Gildayc357c472018-03-21 13:54:09 +00001723/** Formatted output of the PadStrideInfo type.
1724 *
1725 * @param[in] pad_stride_info Type to output.
1726 *
1727 * @return Formatted string.
1728 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001729inline std::string to_string(const PadStrideInfo &pad_stride_info)
1730{
1731 std::stringstream str;
1732 str << pad_stride_info;
1733 return str.str();
1734}
1735
Alex Gildayc357c472018-03-21 13:54:09 +00001736/** Formatted output of the BorderMode type.
1737 *
1738 * @param[in] mode Type to output.
1739 *
1740 * @return Formatted string.
1741 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001742inline std::string to_string(const BorderMode &mode)
1743{
1744 std::stringstream str;
1745 str << mode;
1746 return str.str();
1747}
1748
Alex Gildayc357c472018-03-21 13:54:09 +00001749/** Formatted output of the BorderSize type.
1750 *
1751 * @param[in] border Type to output.
1752 *
1753 * @return Formatted string.
1754 */
John Richardsonb482ce12017-09-18 12:44:01 +01001755inline std::string to_string(const BorderSize &border)
1756{
1757 std::stringstream str;
1758 str << border;
1759 return str.str();
1760}
1761
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001762/** Formatted output of the PaddingList type.
1763 *
1764 * @param[in] padding Type to output.
1765 *
1766 * @return Formatted string.
1767 */
1768inline std::string to_string(const PaddingList &padding)
1769{
1770 std::stringstream str;
1771 str << padding;
1772 return str.str();
1773}
1774
giuros013175fcf2018-11-21 09:59:17 +00001775/** Formatted output of the Multiples type.
1776 *
1777 * @param[in] multiples Type to output.
1778 *
1779 * @return Formatted string.
1780 */
1781inline std::string to_string(const Multiples &multiples)
1782{
1783 std::stringstream str;
1784 str << multiples;
1785 return str.str();
1786}
1787
Alex Gildayc357c472018-03-21 13:54:09 +00001788/** Formatted output of the InterpolationPolicy type.
1789 *
1790 * @param[in] policy Type to output.
1791 *
1792 * @return Formatted string.
1793 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001794inline std::string to_string(const InterpolationPolicy &policy)
1795{
1796 std::stringstream str;
1797 str << policy;
1798 return str.str();
1799}
1800
Alex Gildayc357c472018-03-21 13:54:09 +00001801/** Formatted output of the SamplingPolicy type.
1802 *
1803 * @param[in] policy Type to output.
1804 *
1805 * @return Formatted string.
1806 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001807inline std::string to_string(const SamplingPolicy &policy)
1808{
1809 std::stringstream str;
1810 str << policy;
1811 return str.str();
1812}
1813
Alex Gildayc357c472018-03-21 13:54:09 +00001814/** Formatted output of the ConvertPolicy type.
1815 *
1816 * @param[out] os Output stream.
1817 * @param[in] policy Type to output.
1818 *
1819 * @return Modified output stream.
1820 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001821inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1822{
1823 switch(policy)
1824 {
1825 case ConvertPolicy::WRAP:
1826 os << "WRAP";
1827 break;
1828 case ConvertPolicy::SATURATE:
1829 os << "SATURATE";
1830 break;
1831 default:
1832 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1833 }
1834
1835 return os;
1836}
1837
1838inline std::string to_string(const ConvertPolicy &policy)
1839{
1840 std::stringstream str;
1841 str << policy;
1842 return str.str();
1843}
1844
giuros01164a2722018-11-20 18:34:46 +00001845/** Formatted output of the ArithmeticOperation type.
1846 *
1847 * @param[out] os Output stream.
1848 * @param[in] op Operation to output.
1849 *
1850 * @return Modified output stream.
1851 */
1852inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1853{
1854 switch(op)
1855 {
1856 case ArithmeticOperation::ADD:
1857 os << "ADD";
1858 break;
1859 case ArithmeticOperation::SUB:
1860 os << "SUB";
1861 break;
1862 case ArithmeticOperation::DIV:
1863 os << "DIV";
1864 break;
1865 case ArithmeticOperation::MAX:
1866 os << "MAX";
1867 break;
1868 case ArithmeticOperation::MIN:
1869 os << "MIN";
1870 break;
1871 case ArithmeticOperation::SQUARED_DIFF:
1872 os << "SQUARED_DIFF";
1873 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001874 case ArithmeticOperation::POWER:
1875 os << "POWER";
1876 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001877 case ArithmeticOperation::PRELU:
1878 os << "PRELU";
1879 break;
giuros01164a2722018-11-20 18:34:46 +00001880 default:
1881 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1882 }
1883
1884 return os;
1885}
1886
1887/** Formatted output of the Arithmetic Operation
1888 *
1889 * @param[in] op Type to output.
1890 *
1891 * @return Formatted string.
1892 */
1893inline std::string to_string(const ArithmeticOperation &op)
1894{
1895 std::stringstream str;
1896 str << op;
1897 return str.str();
1898}
1899
Alex Gildayc357c472018-03-21 13:54:09 +00001900/** Formatted output of the Reduction Operations.
1901 *
1902 * @param[out] os Output stream.
1903 * @param[in] op Type to output.
1904 *
1905 * @return Modified output stream.
1906 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001907inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1908{
1909 switch(op)
1910 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001911 case ReductionOperation::SUM:
1912 os << "SUM";
1913 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001914 case ReductionOperation::SUM_SQUARE:
1915 os << "SUM_SQUARE";
1916 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001917 case ReductionOperation::MEAN_SUM:
1918 os << "MEAN_SUM";
1919 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001920 case ReductionOperation::ARG_IDX_MAX:
1921 os << "ARG_IDX_MAX";
1922 break;
1923 case ReductionOperation::ARG_IDX_MIN:
1924 os << "ARG_IDX_MIN";
1925 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001926 case ReductionOperation::PROD:
1927 os << "PROD";
1928 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001929 case ReductionOperation::MIN:
1930 os << "MIN";
1931 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001932 case ReductionOperation::MAX:
1933 os << "MAX";
1934 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001935 default:
1936 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1937 }
1938
1939 return os;
1940}
1941
Alex Gildayc357c472018-03-21 13:54:09 +00001942/** Formatted output of the Reduction Operations.
1943 *
1944 * @param[in] op Type to output.
1945 *
1946 * @return Formatted string.
1947 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001948inline std::string to_string(const ReductionOperation &op)
1949{
1950 std::stringstream str;
1951 str << op;
1952 return str.str();
1953}
1954
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001955/** Formatted output of the Comparison Operations.
1956 *
1957 * @param[out] os Output stream.
1958 * @param[in] op Type to output.
1959 *
1960 * @return Modified output stream.
1961 */
1962inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1963{
1964 switch(op)
1965 {
1966 case ComparisonOperation::Equal:
1967 os << "Equal";
1968 break;
1969 case ComparisonOperation::NotEqual:
1970 os << "NotEqual";
1971 break;
1972 case ComparisonOperation::Greater:
1973 os << "Greater";
1974 break;
1975 case ComparisonOperation::GreaterEqual:
1976 os << "GreaterEqual";
1977 break;
1978 case ComparisonOperation::Less:
1979 os << "Less";
1980 break;
1981 case ComparisonOperation::LessEqual:
1982 os << "LessEqual";
1983 break;
1984 default:
1985 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1986 }
1987
1988 return os;
1989}
1990
Michalis Spyroue9362622018-11-23 17:41:37 +00001991/** Formatted output of the Elementwise unary Operations.
1992 *
1993 * @param[out] os Output stream.
1994 * @param[in] op Type to output.
1995 *
1996 * @return Modified output stream.
1997 */
1998inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1999{
2000 switch(op)
2001 {
2002 case ElementWiseUnary::RSQRT:
2003 os << "RSQRT";
2004 break;
2005 case ElementWiseUnary::EXP:
2006 os << "EXP";
2007 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002008 case ElementWiseUnary::NEG:
2009 os << "NEG";
2010 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002011 case ElementWiseUnary::LOG:
2012 os << "LOG";
2013 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002014 case ElementWiseUnary::SIN:
2015 os << "SIN";
2016 break;
2017 case ElementWiseUnary::ABS:
2018 os << "ABS";
2019 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002020 case ElementWiseUnary::ROUND:
2021 os << "ROUND";
2022 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002023 case ElementWiseUnary::LOGICAL_NOT:
2024 os << "LOGICAL_NOT";
2025 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002026 default:
2027 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2028 }
2029
2030 return os;
2031}
2032
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002033/** Formatted output of the Comparison Operations.
2034 *
2035 * @param[in] op Type to output.
2036 *
2037 * @return Formatted string.
2038 */
2039inline std::string to_string(const ComparisonOperation &op)
2040{
2041 std::stringstream str;
2042 str << op;
2043 return str.str();
2044}
2045
Michalis Spyroue9362622018-11-23 17:41:37 +00002046/** Formatted output of the Elementwise unary Operations.
2047 *
2048 * @param[in] op Type to output.
2049 *
2050 * @return Formatted string.
2051 */
2052inline std::string to_string(const ElementWiseUnary &op)
2053{
2054 std::stringstream str;
2055 str << op;
2056 return str.str();
2057}
2058
Alex Gildayc357c472018-03-21 13:54:09 +00002059/** Formatted output of the Norm Type.
2060 *
2061 * @param[in] type Type to output.
2062 *
2063 * @return Formatted string.
2064 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002065inline std::string to_string(const NormType &type)
2066{
2067 std::stringstream str;
2068 str << type;
2069 return str.str();
2070}
2071
Alex Gildayc357c472018-03-21 13:54:09 +00002072/** Formatted output of the Pooling Type.
2073 *
2074 * @param[in] type Type to output.
2075 *
2076 * @return Formatted string.
2077 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002078inline std::string to_string(const PoolingType &type)
2079{
2080 std::stringstream str;
2081 str << type;
2082 return str.str();
2083}
2084
Alex Gildayc357c472018-03-21 13:54:09 +00002085/** Formatted output of the Pooling Layer Info.
2086 *
2087 * @param[in] info Type to output.
2088 *
2089 * @return Formatted string.
2090 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002091inline std::string to_string(const PoolingLayerInfo &info)
2092{
2093 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002094 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002095 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002096 << "IsGlobalPooling=" << info.is_global_pooling;
2097 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002098 {
2099 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002100 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2101 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002102 }
2103 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002104 return str.str();
2105}
2106
ramelg0137515692022-02-26 22:06:20 +00002107/** Formatted output of the Size3D type.
2108 *
2109 * @param[out] os Output stream
2110 * @param[in] size Type to output
2111 *
2112 * @return Modified output stream.
2113 */
2114inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2115{
2116 os << size.width << "x" << size.height << "x" << size.depth;
2117
2118 return os;
2119}
2120
2121/** Formatted output of the Size3D type.
2122 *
2123 * @param[in] type Type to output
2124 *
2125 * @return Formatted string.
2126 */
2127inline std::string to_string(const Size3D &type)
2128{
2129 std::stringstream str;
2130 str << type;
2131 return str.str();
2132}
2133
2134/** Formatted output of the Padding3D type.
2135 *
2136 * @param[out] os Output stream.
2137 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2138 *
2139 * @return Modified output stream.
2140 */
2141inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2142{
2143 os << padding3d.left << "," << padding3d.right << ","
2144 << padding3d.top << "," << padding3d.bottom << ","
2145 << padding3d.front << "," << padding3d.back;
2146 return os;
2147}
2148
2149/** Converts a @ref Padding3D to string
2150 *
2151 * @param[in] padding3d Padding3D value to be converted
2152 *
2153 * @return String representing the corresponding Padding3D
2154 */
2155inline std::string to_string(const Padding3D &padding3d)
2156{
2157 std::stringstream str;
2158 str << padding3d;
2159 return str.str();
2160}
2161
2162/** Formatted output of the DimensionRoundingType type.
2163 *
2164 * @param[out] os Output stream.
2165 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2166 *
2167 * @return Modified output stream.
2168 */
2169inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2170{
2171 switch(rounding_type)
2172 {
2173 case DimensionRoundingType::CEIL:
2174 os << "CEIL";
2175 break;
2176 case DimensionRoundingType::FLOOR:
2177 os << "FLOOR";
2178 break;
2179 default:
2180 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2181 }
2182 return os;
2183}
2184
2185/** Formatted output of the Pooling 3d Layer Info.
2186 *
2187 * @param[out] os Output stream.
2188 * @param[in] info Pooling 3D layer info to print to output stream.
2189 *
2190 * @return Modified output stream.
2191 */
2192inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2193{
2194 os << "{Type=" << info.pool_type << ","
2195 << "IsGlobalPooling=" << info.is_global_pooling;
2196 if(!info.is_global_pooling)
2197 {
2198 os << ","
2199 << "PoolSize=" << info.pool_size << ", "
2200 << "Stride=" << info.stride << ", "
2201 << "Padding=" << info.padding << ", "
2202 << "Exclude Padding=" << info.exclude_padding << ", "
2203 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2204 << "DimensionRoundingType=" << info.round_type;
2205 }
2206 os << "}";
2207 return os;
2208}
2209
2210/** Formatted output of the Pooling 3d Layer Info.
2211 *
2212 * @param[in] info Type to output.
2213 *
2214 * @return Formatted string.
2215 */
2216inline std::string to_string(const Pooling3dLayerInfo &info)
2217{
2218 std::stringstream str;
2219 str << info;
2220 return str.str();
2221}
2222
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002223/** Formatted output of the PriorBoxLayerInfo.
2224 *
2225 * @param[in] info Type to output.
2226 *
2227 * @return Formatted string.
2228 */
2229inline std::string to_string(const PriorBoxLayerInfo &info)
2230{
2231 std::stringstream str;
2232 str << "{";
2233 str << "Clip:" << info.clip()
2234 << "Flip:" << info.flip()
2235 << "StepX:" << info.steps()[0]
2236 << "StepY:" << info.steps()[1]
2237 << "MinSizes:" << info.min_sizes().size()
2238 << "MaxSizes:" << info.max_sizes().size()
2239 << "ImgSizeX:" << info.img_size().x
2240 << "ImgSizeY:" << info.img_size().y
2241 << "Offset:" << info.offset()
2242 << "Variances:" << info.variances().size();
2243 str << "}";
2244 return str.str();
2245}
2246
Alex Gildayc357c472018-03-21 13:54:09 +00002247/** Formatted output of the Size2D type.
2248 *
2249 * @param[out] os Output stream
2250 * @param[in] size Type to output
2251 *
2252 * @return Modified output stream.
2253 */
John Richardson25f23682017-11-27 14:35:09 +00002254inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2255{
2256 os << size.width << "x" << size.height;
2257
2258 return os;
2259}
2260
Alex Gildayc357c472018-03-21 13:54:09 +00002261/** Formatted output of the Size2D type.
2262 *
2263 * @param[in] type Type to output
2264 *
2265 * @return Formatted string.
2266 */
John Richardson25f23682017-11-27 14:35:09 +00002267inline std::string to_string(const Size2D &type)
2268{
2269 std::stringstream str;
2270 str << type;
2271 return str.str();
2272}
2273
Alex Gildayc357c472018-03-21 13:54:09 +00002274/** Formatted output of the ConvolutionMethod type.
2275 *
2276 * @param[out] os Output stream
2277 * @param[in] conv_method Type to output
2278 *
2279 * @return Modified output stream.
2280 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002281inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2282{
2283 switch(conv_method)
2284 {
2285 case ConvolutionMethod::GEMM:
2286 os << "GEMM";
2287 break;
2288 case ConvolutionMethod::DIRECT:
2289 os << "DIRECT";
2290 break;
2291 case ConvolutionMethod::WINOGRAD:
2292 os << "WINOGRAD";
2293 break;
SiCongLid9287352021-11-03 19:01:22 +00002294 case ConvolutionMethod::FFT:
2295 os << "FFT";
2296 break;
2297 case ConvolutionMethod::GEMM_CONV2D:
2298 os << "GEMM_CONV2D";
2299 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002300 default:
2301 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2302 }
2303
2304 return os;
2305}
2306
Alex Gildayc357c472018-03-21 13:54:09 +00002307/** Formatted output of the ConvolutionMethod type.
2308 *
2309 * @param[in] conv_method Type to output
2310 *
2311 * @return Formatted string.
2312 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002313inline std::string to_string(const ConvolutionMethod &conv_method)
2314{
2315 std::stringstream str;
2316 str << conv_method;
2317 return str.str();
2318}
2319
Alex Gildayc357c472018-03-21 13:54:09 +00002320/** Formatted output of the GPUTarget type.
2321 *
2322 * @param[out] os Output stream
2323 * @param[in] gpu_target Type to output
2324 *
2325 * @return Modified output stream.
2326 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002327inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2328{
2329 switch(gpu_target)
2330 {
2331 case GPUTarget::GPU_ARCH_MASK:
2332 os << "GPU_ARCH_MASK";
2333 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002334 case GPUTarget::GPU_GENERATION_MASK:
2335 os << "GPU_GENERATION_MASK";
2336 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002337 case GPUTarget::MIDGARD:
2338 os << "MIDGARD";
2339 break;
2340 case GPUTarget::BIFROST:
2341 os << "BIFROST";
2342 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002343 case GPUTarget::VALHALL:
2344 os << "VALHALL";
2345 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002346 case GPUTarget::T600:
2347 os << "T600";
2348 break;
2349 case GPUTarget::T700:
2350 os << "T700";
2351 break;
2352 case GPUTarget::T800:
2353 os << "T800";
2354 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002355 case GPUTarget::G71:
2356 os << "G71";
2357 break;
2358 case GPUTarget::G72:
2359 os << "G72";
2360 break;
2361 case GPUTarget::G51:
2362 os << "G51";
2363 break;
2364 case GPUTarget::G51BIG:
2365 os << "G51BIG";
2366 break;
2367 case GPUTarget::G51LIT:
2368 os << "G51LIT";
2369 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002370 case GPUTarget::G31:
2371 os << "G31";
2372 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002373 case GPUTarget::G76:
2374 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002375 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002376 case GPUTarget::G52:
2377 os << "G52";
2378 break;
2379 case GPUTarget::G52LIT:
2380 os << "G52LIT";
2381 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002382 case GPUTarget::G77:
2383 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002384 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002385 case GPUTarget::G57:
2386 os << "G57";
2387 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002388 case GPUTarget::G78:
2389 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002390 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002391 case GPUTarget::G68:
2392 os << "G68";
2393 break;
2394 case GPUTarget::G78AE:
2395 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002396 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002397 case GPUTarget::G710:
2398 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002399 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002400 case GPUTarget::G610:
2401 os << "G610";
2402 break;
2403 case GPUTarget::G510:
2404 os << "G510";
2405 break;
2406 case GPUTarget::G310:
2407 os << "G310";
2408 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002409 case GPUTarget::G715:
2410 os << "G715";
2411 break;
2412 case GPUTarget::G615:
2413 os << "G615";
2414 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002415 default:
2416 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2417 }
2418
2419 return os;
2420}
2421
Alex Gildayc357c472018-03-21 13:54:09 +00002422/** Formatted output of the GPUTarget type.
2423 *
2424 * @param[in] gpu_target Type to output
2425 *
2426 * @return Formatted string.
2427 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002428inline std::string to_string(const GPUTarget &gpu_target)
2429{
2430 std::stringstream str;
2431 str << gpu_target;
2432 return str.str();
2433}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002434
John Richardson8de92612018-02-22 14:09:31 +00002435/** Formatted output of the DetectionWindow type.
2436 *
2437 * @param[out] os Output stream
2438 * @param[in] detection_window Type to output
2439 *
2440 * @return Modified output stream.
2441 */
John Richardson684cb0f2018-01-09 11:17:00 +00002442inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2443{
2444 os << "{x=" << detection_window.x << ","
2445 << "y=" << detection_window.y << ","
2446 << "width=" << detection_window.width << ","
2447 << "height=" << detection_window.height << ","
2448 << "idx_class=" << detection_window.idx_class << ","
2449 << "score=" << detection_window.score << "}";
2450
2451 return os;
2452}
2453
Isabella Gottardi05e56442018-11-16 11:26:52 +00002454/** Formatted output of the DetectionOutputLayerCodeType type.
2455 *
2456 * @param[out] os Output stream
2457 * @param[in] detection_code Type to output
2458 *
2459 * @return Modified output stream.
2460 */
2461inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2462{
2463 switch(detection_code)
2464 {
2465 case DetectionOutputLayerCodeType::CENTER_SIZE:
2466 os << "CENTER_SIZE";
2467 break;
2468 case DetectionOutputLayerCodeType::CORNER:
2469 os << "CORNER";
2470 break;
2471 case DetectionOutputLayerCodeType::CORNER_SIZE:
2472 os << "CORNER_SIZE";
2473 break;
2474 case DetectionOutputLayerCodeType::TF_CENTER:
2475 os << "TF_CENTER";
2476 break;
2477 default:
2478 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2479 }
2480
2481 return os;
2482}
2483/** Formatted output of the DetectionOutputLayerCodeType type.
2484 *
2485 * @param[in] detection_code Type to output
2486 *
2487 * @return Formatted string.
2488 */
2489inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2490{
2491 std::stringstream str;
2492 str << detection_code;
2493 return str.str();
2494}
2495
2496/** Formatted output of the DetectionOutputLayerInfo type.
2497 *
2498 * @param[out] os Output stream
2499 * @param[in] detection_info Type to output
2500 *
2501 * @return Modified output stream.
2502 */
2503inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2504{
2505 os << "{Classes=" << detection_info.num_classes() << ","
2506 << "ShareLocation=" << detection_info.share_location() << ","
2507 << "CodeType=" << detection_info.code_type() << ","
2508 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2509 << "KeepTopK=" << detection_info.keep_top_k() << ","
2510 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2511 << "Eta=" << detection_info.eta() << ","
2512 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2513 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2514 << "TopK=" << detection_info.top_k() << ","
2515 << "NumLocClasses=" << detection_info.num_loc_classes()
2516 << "}";
2517
2518 return os;
2519}
2520
2521/** Formatted output of the DetectionOutputLayerInfo type.
2522 *
2523 * @param[in] detection_info Type to output
2524 *
2525 * @return Formatted string.
2526 */
2527inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2528{
2529 std::stringstream str;
2530 str << detection_info;
2531 return str.str();
2532}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002533/** Formatted output of the DetectionPostProcessLayerInfo type.
2534 *
2535 * @param[out] os Output stream
2536 * @param[in] detection_info Type to output
2537 *
2538 * @return Modified output stream.
2539 */
2540inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2541{
2542 os << "{MaxDetections=" << detection_info.max_detections() << ","
2543 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2544 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2545 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2546 << "NumClasses=" << detection_info.num_classes() << ","
2547 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2548 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2549 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2550 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2551 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2552 << "DetectionPerClass=" << detection_info.detection_per_class()
2553 << "}";
2554
2555 return os;
2556}
2557
2558/** Formatted output of the DetectionPostProcessLayerInfo type.
2559 *
2560 * @param[in] detection_info Type to output
2561 *
2562 * @return Formatted string.
2563 */
2564inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2565{
2566 std::stringstream str;
2567 str << detection_info;
2568 return str.str();
2569}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002570
John Richardson8de92612018-02-22 14:09:31 +00002571/** Formatted output of the DetectionWindow type.
2572 *
2573 * @param[in] detection_window Type to output
2574 *
2575 * @return Formatted string.
2576 */
2577inline std::string to_string(const DetectionWindow &detection_window)
2578{
2579 std::stringstream str;
2580 str << detection_window;
2581 return str.str();
2582}
2583
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002584/** Formatted output of @ref PriorBoxLayerInfo.
2585 *
2586 * @param[out] os Output stream.
2587 * @param[in] info Type to output.
2588 *
2589 * @return Modified output stream.
2590 */
2591inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2592{
2593 os << "Clip:" << info.clip()
2594 << "Flip:" << info.flip()
2595 << "StepX:" << info.steps()[0]
2596 << "StepY:" << info.steps()[1]
2597 << "MinSizes:" << info.min_sizes()
2598 << "MaxSizes:" << info.max_sizes()
2599 << "ImgSizeX:" << info.img_size().x
2600 << "ImgSizeY:" << info.img_size().y
2601 << "Offset:" << info.offset()
2602 << "Variances:" << info.variances();
2603
2604 return os;
2605}
2606
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002607/** Formatted output of the WinogradInfo type. */
2608inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2609{
2610 os << "{OutputTileSize=" << info.output_tile_size << ","
2611 << "KernelSize=" << info.kernel_size << ","
2612 << "PadStride=" << info.convolution_info << ","
2613 << "OutputDataLayout=" << info.output_data_layout << "}";
2614
2615 return os;
2616}
2617
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002618inline std::string to_string(const WinogradInfo &type)
2619{
2620 std::stringstream str;
2621 str << type;
2622 return str.str();
2623}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002624
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002625/** Convert a CLTunerMode value to a string
2626 *
2627 * @param val CLTunerMode value to be converted
2628 *
2629 * @return String representing the corresponding CLTunerMode.
2630 */
2631inline std::string to_string(const CLTunerMode val)
2632{
2633 switch(val)
2634 {
2635 case CLTunerMode::EXHAUSTIVE:
2636 {
2637 return std::string("Exhaustive");
2638 }
2639 case CLTunerMode::NORMAL:
2640 {
2641 return std::string("Normal");
2642 }
2643 case CLTunerMode::RAPID:
2644 {
2645 return std::string("Rapid");
2646 }
2647 default:
2648 {
2649 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2650 return std::string("UNDEFINED");
2651 }
2652 }
2653}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002654/** Converts a @ref CLGEMMKernelType to string
2655 *
2656 * @param[in] val CLGEMMKernelType value to be converted
2657 *
2658 * @return String representing the corresponding CLGEMMKernelType
2659 */
2660inline std::string to_string(CLGEMMKernelType val)
2661{
2662 switch(val)
2663 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002664 case CLGEMMKernelType::NATIVE:
2665 {
2666 return "Native";
2667 }
2668 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2669 {
2670 return "Reshaped_Only_RHS";
2671 }
2672 case CLGEMMKernelType::RESHAPED:
2673 {
2674 return "Reshaped";
2675 }
2676 default:
2677 {
2678 return "Unknown";
2679 }
2680 }
2681}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002682/** [Print CLTunerMode type] **/
2683/** Formatted output of the CLTunerMode type.
2684 *
2685 * @param[out] os Output stream.
2686 * @param[in] val CLTunerMode to output.
2687 *
2688 * @return Modified output stream.
2689 */
2690inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2691{
2692 os << to_string(val);
2693 return os;
2694}
2695
ramelg013ae3d882021-09-12 23:07:47 +01002696/** Formatted output of the ConvolutionInfo type.
2697 *
2698 * @param[out] os Output stream.
2699 * @param[in] conv_info ConvolutionInfo to output.
2700 *
2701 * @return Modified output stream.
2702 */
2703inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2704{
SiCongLi579ca842021-10-18 09:38:33 +01002705 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2706 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2707 << "act_info=" << to_string(conv_info.act_info) << ", "
2708 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002709 return os;
2710}
2711
2712/** Converts a @ref ConvolutionInfo to string
2713 *
2714 * @param[in] info ConvolutionInfo value to be converted
2715 *
2716 * @return String representing the corresponding ConvolutionInfo
2717 */
2718inline std::string to_string(const ConvolutionInfo &info)
2719{
2720 std::stringstream str;
2721 str << info;
2722 return str.str();
2723}
2724
2725/** Formatted output of the FullyConnectedLayerInfo type.
2726 *
2727 * @param[out] os Output stream.
2728 * @param[in] layer_info FullyConnectedLayerInfo to output.
2729 *
2730 * @return Modified output stream.
2731 */
2732inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2733{
SiCongLi579ca842021-10-18 09:38:33 +01002734 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2735 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2736 << "transpose_weights=" << layer_info.transpose_weights << ", "
2737 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2738 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2739 << "constant_weights=" << layer_info.transpose_weights << ", "
2740 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002741 return os;
2742}
2743
2744/** Converts a @ref FullyConnectedLayerInfo to string
2745 *
2746 * @param[in] info FullyConnectedLayerInfo value to be converted
2747 *
2748 * @return String representing the corresponding FullyConnectedLayerInfo
2749 */
2750inline std::string to_string(const FullyConnectedLayerInfo &info)
2751{
2752 std::stringstream str;
2753 str << info;
2754 return str.str();
2755}
2756
2757/** Formatted output of the GEMMLowpOutputStageType type.
2758 *
2759 * @param[out] os Output stream.
2760 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2761 *
2762 * @return Modified output stream.
2763 */
2764inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2765{
2766 switch(gemm_type)
2767 {
2768 case GEMMLowpOutputStageType::NONE:
2769 os << "NONE";
2770 break;
2771 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2772 os << "QUANTIZE_DOWN";
2773 break;
2774 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2775 os << "QUANTIZE_DOWN_FIXEDPOINT";
2776 break;
2777 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2778 os << "QUANTIZE_DOWN_FLOAT";
2779 break;
2780 default:
2781 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2782 }
2783 return os;
2784}
2785
2786/** Converts a @ref GEMMLowpOutputStageType to string
2787 *
2788 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2789 *
2790 * @return String representing the corresponding GEMMLowpOutputStageType
2791 */
2792inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2793{
2794 std::stringstream str;
2795 str << gemm_type;
2796 return str.str();
2797}
2798
2799/** Formatted output of the GEMMLowpOutputStageInfo type.
2800 *
2801 * @param[out] os Output stream.
2802 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2803 *
2804 * @return Modified output stream.
2805 */
2806inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2807{
SiCongLi579ca842021-10-18 09:38:33 +01002808 os << "{type=" << gemm_info.type << ", "
2809 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2810 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2811 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2812 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2813 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2814 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2815 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2816 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2817 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2818 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002819 return os;
2820}
2821
2822/** Converts a @ref GEMMLowpOutputStageInfo to string
2823 *
2824 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2825 *
2826 * @return String representing the corresponding GEMMLowpOutputStageInfo
2827 */
2828inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2829{
2830 std::stringstream str;
2831 str << gemm_info;
2832 return str.str();
2833}
2834
2835/** Formatted output of the Conv2dInfo type.
2836 *
2837 * @param[out] os Output stream.
2838 * @param[in] conv_info Conv2dInfo to output.
2839 *
2840 * @return Modified output stream.
2841 */
2842inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2843{
SiCongLi579ca842021-10-18 09:38:33 +01002844 os << "{conv_info=" << conv_info.conv_info << ", "
2845 << "dilation=" << conv_info.dilation << ", "
2846 << "act_info=" << to_string(conv_info.act_info) << ", "
2847 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2848 << "num_groups=" << conv_info.num_groups << ","
2849 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002850 return os;
2851}
2852
2853/** Converts a @ref Conv2dInfo to string
2854 *
2855 * @param[in] conv_info Conv2dInfo value to be converted
2856 *
2857 * @return String representing the corresponding Conv2dInfo
2858 */
2859inline std::string to_string(const Conv2dInfo &conv_info)
2860{
2861 std::stringstream str;
2862 str << conv_info;
2863 return str.str();
2864}
2865
2866/** Formatted output of the PixelValue type.
2867 *
2868 * @param[out] os Output stream.
2869 * @param[in] pixel_value PixelValue to output.
2870 *
2871 * @return Modified output stream.
2872 */
2873inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2874{
SiCongLi579ca842021-10-18 09:38:33 +01002875 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002876 return os;
2877}
2878
2879/** Converts a @ref PixelValue to string
2880 *
2881 * @param[in] pixel_value PixelValue value to be converted
2882 *
2883 * @return String representing the corresponding PixelValue
2884 */
2885inline std::string to_string(const PixelValue &pixel_value)
2886{
2887 std::stringstream str;
2888 str << pixel_value;
2889 return str.str();
2890}
2891
2892/** Formatted output of the ScaleKernelInfo type.
2893 *
2894 * @param[out] os Output stream.
2895 * @param[in] scale_info ScaleKernelInfo to output.
2896 *
2897 * @return Modified output stream.
2898 */
2899inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2900{
SiCongLi579ca842021-10-18 09:38:33 +01002901 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2902 << "BorderMode=" << scale_info.border_mode << ", "
2903 << "PixelValue=" << scale_info.constant_border_value << ", "
2904 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2905 << "use_padding=" << scale_info.use_padding << ", "
2906 << "align_corners=" << scale_info.align_corners << ", "
2907 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002908 return os;
2909}
2910
2911/** Converts a @ref ScaleKernelInfo to string
2912 *
2913 * @param[in] scale_info ScaleKernelInfo value to be converted
2914 *
2915 * @return String representing the corresponding ScaleKernelInfo
2916 */
2917inline std::string to_string(const ScaleKernelInfo &scale_info)
2918{
2919 std::stringstream str;
2920 str << scale_info;
2921 return str.str();
2922}
2923
2924/** Formatted output of the FFTDirection type.
2925 *
2926 * @param[out] os Output stream.
2927 * @param[in] fft_dir FFTDirection to output.
2928 *
2929 * @return Modified output stream.
2930 */
2931inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2932{
2933 switch(fft_dir)
2934 {
2935 case FFTDirection::Forward:
2936 os << "Forward";
2937 break;
2938 case FFTDirection::Inverse:
2939 os << "Inverse";
2940 break;
2941 default:
2942 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2943 }
2944 return os;
2945}
2946
2947/** Converts a @ref FFT1DInfo to string
2948 *
2949 * @param[in] fft_dir FFT1DInfo value to be converted
2950 *
2951 * @return String representing the corresponding FFT1DInfo
2952 */
2953inline std::string to_string(const FFTDirection &fft_dir)
2954{
2955 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002956 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002957 return str.str();
2958}
2959
2960/** Formatted output of the FFT1DInfo type.
2961 *
2962 * @param[out] os Output stream.
2963 * @param[in] fft1d_info FFT1DInfo to output.
2964 *
2965 * @return Modified output stream.
2966 */
2967inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2968{
SiCongLi579ca842021-10-18 09:38:33 +01002969 os << "{axis=" << fft1d_info.axis << ", "
2970 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002971 return os;
2972}
2973
2974/** Converts a @ref FFT1DInfo to string
2975 *
2976 * @param[in] fft1d_info FFT1DInfo value to be converted
2977 *
2978 * @return String representing the corresponding FFT1DInfo
2979 */
2980inline std::string to_string(const FFT1DInfo &fft1d_info)
2981{
2982 std::stringstream str;
2983 str << fft1d_info;
2984 return str.str();
2985}
2986
2987/** Formatted output of the FFT2DInfo type.
2988 *
2989 * @param[out] os Output stream.
2990 * @param[in] fft2d_info FFT2DInfo to output.
2991 *
2992 * @return Modified output stream.
2993 */
2994inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2995{
SiCongLi579ca842021-10-18 09:38:33 +01002996 os << "{axis=" << fft2d_info.axis0 << ", "
2997 << "axis=" << fft2d_info.axis1 << ", "
2998 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002999 return os;
3000}
3001
3002/** Converts a @ref FFT2DInfo to string
3003 *
3004 * @param[in] fft2d_info FFT2DInfo value to be converted
3005 *
3006 * @return String representing the corresponding FFT2DInfo
3007 */
3008inline std::string to_string(const FFT2DInfo &fft2d_info)
3009{
3010 std::stringstream str;
3011 str << fft2d_info;
3012 return str.str();
3013}
3014
3015/** Formatted output of the Coordinates2D type.
3016 *
3017 * @param[out] os Output stream.
3018 * @param[in] coord_2d Coordinates2D to output.
3019 *
3020 * @return Modified output stream.
3021 */
3022inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3023{
SiCongLi579ca842021-10-18 09:38:33 +01003024 os << "{x=" << coord_2d.x << ", "
3025 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003026 return os;
3027}
3028
3029/** Converts a @ref Coordinates2D to string
3030 *
3031 * @param[in] coord_2d Coordinates2D value to be converted
3032 *
3033 * @return String representing the corresponding Coordinates2D
3034 */
3035inline std::string to_string(const Coordinates2D &coord_2d)
3036{
3037 std::stringstream str;
3038 str << coord_2d;
3039 return str.str();
3040}
3041
3042/** Formatted output of the FuseBatchNormalizationType type.
3043 *
3044 * @param[out] os Output stream.
3045 * @param[in] fuse_type FuseBatchNormalizationType to output.
3046 *
3047 * @return Modified output stream.
3048 */
3049inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3050{
3051 switch(fuse_type)
3052 {
3053 case FuseBatchNormalizationType::CONVOLUTION:
3054 os << "CONVOLUTION";
3055 break;
3056 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3057 os << "DEPTHWISECONVOLUTION";
3058 break;
3059 default:
3060 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3061 }
3062 return os;
3063}
3064
3065/** Converts a @ref FuseBatchNormalizationType to string
3066 *
3067 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3068 *
3069 * @return String representing the corresponding FuseBatchNormalizationType
3070 */
3071inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3072{
3073 std::stringstream str;
3074 str << fuse_type;
3075 return str.str();
3076}
3077
ramelg01cbbb0382021-09-17 17:36:57 +01003078/** Formatted output of the SoftmaxKernelInfo type.
3079 *
3080 * @param[out] os Output stream.
3081 * @param[in] info SoftmaxKernelInfo to output.
3082 *
3083 * @return Modified output stream.
3084 */
3085inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3086{
SiCongLi579ca842021-10-18 09:38:33 +01003087 os << "{beta=" << info.beta << ", "
3088 << "is_log=" << info.is_log << ", "
3089 << "input_data_type=" << info.input_data_type << ", "
3090 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003091 return os;
3092}
3093
3094/** Converts a @ref SoftmaxKernelInfo to string
3095 *
3096 * @param[in] info SoftmaxKernelInfo value to be converted
3097 *
3098 * @return String representing the corresponding SoftmaxKernelInfo
3099 */
3100inline std::string to_string(const SoftmaxKernelInfo &info)
3101{
3102 std::stringstream str;
3103 str << info;
3104 return str.str();
3105}
3106
3107/** Formatted output of the ScaleKernelInfo type.
3108 *
3109 * @param[out] os Output stream.
3110 * @param[in] lstm_params LSTMParams to output.
3111 *
3112 * @return Modified output stream.
3113 */
3114template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003115::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003116{
ramelg014a6d9e82021-10-02 14:34:36 +01003117 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3118 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3119 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3120 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3121 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3122 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3123 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3124 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3125 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3126 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3127 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3128 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003129 << "cell_clip=" << lstm_params.cell_clip() << ", "
3130 << "projection_clip=" << lstm_params.projection_clip() << ", "
3131 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3132 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3133 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3134 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3135 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3136 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3137 << "has_projection=" << lstm_params.has_projection() << ", "
3138 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3139 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3140 return os;
3141}
3142
3143/** Converts a @ref LSTMParams to string
3144 *
3145 * @param[in] lstm_params LSTMParams<T> value to be converted
3146 *
3147 * @return String representing the corresponding LSTMParams
3148 */
3149template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003150std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003151{
3152 std::stringstream str;
3153 str << lstm_params;
3154 return str.str();
3155}
3156
3157/** Converts a @ref LSTMParams to string
3158 *
3159 * @param[in] num uint8_t value to be converted
3160 *
3161 * @return String representing the corresponding uint8_t
3162 */
3163inline std::string to_string(const uint8_t num)
3164{
3165 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3166 return ::std::to_string(static_cast<int>(num));
3167}
3168
ramelg014a6d9e82021-10-02 14:34:36 +01003169/** Available non maxima suppression types */
3170/** Formatted output of the NMSType type.
3171 *
3172 * @param[out] os Output stream.
3173 * @param[in] nms_type NMSType to output.
3174 *
3175 * @return Modified output stream.
3176 */
3177inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3178{
3179 switch(nms_type)
3180 {
3181 case NMSType::LINEAR:
3182 os << "LINEAR";
3183 break;
3184 case NMSType::GAUSSIAN:
3185 os << "GAUSSIAN";
3186 break;
3187 case NMSType::ORIGINAL:
3188 os << "ORIGINAL";
3189 break;
3190 default:
3191 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3192 }
3193 return os;
3194}
3195
3196/** Converts a @ref NMSType to string
3197 *
3198 * @param[in] nms_type NMSType value to be converted
3199 *
3200 * @return String representing the corresponding NMSType
3201 */
3202inline std::string to_string(const NMSType nms_type)
3203{
3204 std::stringstream str;
3205 str << nms_type;
3206 return str.str();
3207}
3208
3209/** Formatted output of the BoxNMSLimitInfo type.
3210 *
3211 * @param[out] os Output stream.
3212 * @param[in] info BoxNMSLimitInfo to output.
3213 *
3214 * @return Modified output stream.
3215 */
3216inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3217{
SiCongLi579ca842021-10-18 09:38:33 +01003218 os << "{score_thresh=" << info.score_thresh() << ", "
3219 << "nms=" << info.nms() << ", "
3220 << "detections_per_im=" << info.detections_per_im() << ", "
3221 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3222 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3223 << "suppress_size=" << info.suppress_size() << ", "
3224 << "min_size=" << info.min_size() << ", "
3225 << "im_width=" << info.im_width() << ", "
3226 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003227 return os;
3228}
3229
3230/** Converts a @ref BoxNMSLimitInfo to string
3231 *
3232 * @param[in] info BoxNMSLimitInfo value to be converted
3233 *
3234 * @return String representing the corresponding BoxNMSLimitInfo
3235 */
3236inline std::string to_string(const BoxNMSLimitInfo &info)
3237{
3238 std::stringstream str;
3239 str << info;
3240 return str.str();
3241}
3242
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003243/** Converts a @ref DimensionRoundingType to string
3244 *
3245 * @param[in] rounding_type DimensionRoundingType value to be converted
3246 *
3247 * @return String representing the corresponding DimensionRoundingType
3248 */
3249inline std::string to_string(const DimensionRoundingType &rounding_type)
3250{
3251 std::stringstream str;
3252 str << rounding_type;
3253 return str.str();
3254}
3255
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003256/** Formatted output of the Conv3dInfo type.
3257 *
3258 * @param[out] os Output stream.
3259 * @param[in] conv3d_info Type to output.
3260 *
3261 * @return Modified output stream.
3262 */
3263inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3264{
3265 os << conv3d_info.stride;
3266 os << ";";
3267 os << conv3d_info.padding;
3268 os << ";";
3269 os << to_string(conv3d_info.act_info);
3270 os << ";";
3271 os << conv3d_info.dilation;
3272 os << ";";
3273 os << conv3d_info.round_type;
3274 os << ";";
3275 os << conv3d_info.enable_fast_math;
3276
3277 return os;
3278}
3279
3280/** Formatted output of the Conv3dInfo type.
3281 *
3282 * @param[in] conv3d_info Type to output.
3283 *
3284 * @return Formatted string.
3285 */
3286inline std::string to_string(const Conv3dInfo &conv3d_info)
3287{
3288 std::stringstream str;
3289 str << conv3d_info;
3290 return str.str();
3291}
3292
Ramy Elgammal91780022022-07-20 14:57:37 +01003293/** Formatted output of the arm_compute::WeightFormat type.
3294 *
3295 * @param[in] wf arm_compute::WeightFormat Type to output.
3296 *
3297 * @return Formatted string.
3298 */
3299inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003300{
Ramy Elgammal91780022022-07-20 14:57:37 +01003301#define __CASE_WEIGHT_FORMAT(wf) \
3302case WeightFormat::wf: \
3303 return #wf;
3304 switch(wf)
3305 {
3306 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3307 __CASE_WEIGHT_FORMAT(ANY)
3308 __CASE_WEIGHT_FORMAT(OHWI)
3309 __CASE_WEIGHT_FORMAT(OHWIo2)
3310 __CASE_WEIGHT_FORMAT(OHWIo4)
3311 __CASE_WEIGHT_FORMAT(OHWIo8)
3312 __CASE_WEIGHT_FORMAT(OHWIo16)
3313 __CASE_WEIGHT_FORMAT(OHWIo32)
3314 __CASE_WEIGHT_FORMAT(OHWIo64)
3315 __CASE_WEIGHT_FORMAT(OHWIo128)
3316 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3317 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3318 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3319 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3320 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3321 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3322 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3323 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3324 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3325 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3326 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3327 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3328 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3329 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3330 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3331 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3332 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3333 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3334 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3335 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3336 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3337 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3338 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3339 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3340 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3341 __CASE_WEIGHT_FORMAT(OHWIo64i8)
3342 default:
3343 return "invalid value";
3344 }
3345#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003346}
3347
Ramy Elgammal91780022022-07-20 14:57:37 +01003348/** Formatted output of the arm_compute::WeightFormat type.
3349 *
3350 * @param[out] os Output stream.
3351 * @param[in] wf WeightFormat to output.
3352 *
3353 * @return Modified output stream.
3354 */
3355inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3356{
3357 os << to_string(wf);
3358 return os;
3359}
3360
3361/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3362 *
3363 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3364 *
3365 * @return Formatted string.
3366 */
3367inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003368{
3369 std::stringstream str;
3370 str << "[Input shape = " << std::get<0>(values);
3371 str << ", ";
3372 str << "Expected output shape = " << std::get<1>(values);
3373
3374 str << ", ";
3375 str << "WeightFormat = " << std::get<2>(values) << "]";
3376 return str.str();
3377}
3378
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003379/** Formatted output of the Padding2D type.
3380 *
3381 * @param[out] os Output stream.
3382 * @param[in] padding2d Padding info for 2D dimension shape.
3383 *
3384 * @return Modified output stream.
3385 */
3386inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3387{
3388 os << padding2d.left << "," << padding2d.right << ","
3389 << padding2d.top << "," << padding2d.bottom;
3390 return os;
3391}
3392
3393/** Converts a @ref Padding2D to string
3394 *
3395 * @param[in] padding2d Padding2D value to be converted
3396 *
3397 * @return String representing the corresponding Padding2D
3398 */
3399inline std::string to_string(const Padding2D &padding2d)
3400{
3401 std::stringstream str;
3402 str << padding2d;
3403 return str.str();
3404}
3405
3406/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3407 *
3408 * @param[out] os Output stream.
3409 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3410 *
3411 * @return Modified output stream.
3412 */
3413inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3414{
3415 os << "Conv2dAttributes="
3416 << "["
3417 << "Padding=" << conv2d_attr.pad() << ", "
3418 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003419 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003420
3421 return os;
3422}
3423/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3424 *
3425 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3426 *
3427 * @return Formatted string.
3428 */
3429inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3430{
3431 std::stringstream str;
3432 str << conv2d_attr;
3433 return str.str();
3434}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003435
3436/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3437 *
3438 * @param[out] os Output stream.
3439 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3440 *
3441 * @return Modified output stream.
3442 */
3443inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3444{
3445 os << "DepthwiseConv2dAttributes="
3446 << "["
3447 << "Padding=" << dw_conv2d_attr.pad() << ", "
3448 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3449 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3450 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3451 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3452
3453 return os;
3454}
3455/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3456 *
3457 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3458 *
3459 * @return Formatted string.
3460 */
3461inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3462{
3463 std::stringstream str;
3464 str << dw_conv2d_attr;
3465 return str.str();
3466}
3467
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003468} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003469
3470#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */