blob: 23e73f6a9e86baa064dc172cf20389d124dff0f7 [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"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010041#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000042#include "arm_compute/runtime/CL/CLTypes.h"
ramelg013ae3d882021-09-12 23:07:47 +010043#include "arm_compute/runtime/FunctionDescriptors.h"
ramelg01cbbb0382021-09-17 17:36:57 +010044#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000045#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000046#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010047#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010048#include <sstream>
49#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010050
51namespace arm_compute
52{
Anthony Barbierb940fd62018-06-04 14:14:32 +010053/** Formatted output if arg is not null
54 *
55 * @param[in] arg Object to print
56 *
57 * @return String representing arg.
58 */
59template <typename T>
60std::string to_string_if_not_null(T *arg)
61{
62 if(arg == nullptr)
63 {
64 return "nullptr";
65 }
66 else
67 {
68 return to_string(*arg);
69 }
70}
Anthony Barbierb4670212018-05-18 16:55:39 +010071
ramelg014a6d9e82021-10-02 14:34:36 +010072/** Fallback method: try to use std::to_string:
73 *
74 * @param[in] val Value to convert to string
75 *
76 * @return String representing val.
77 */
78template <typename T>
79inline std::string to_string(const T &val)
80{
81 return support::cpp11::to_string(val);
82}
83
ramelg01b1ba1e32021-09-25 11:53:26 +010084/** Formatted output of a vector of objects.
85 *
ramelg014a6d9e82021-10-02 14:34:36 +010086 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
87 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
88 *
ramelg01b1ba1e32021-09-25 11:53:26 +010089 * @param[out] os Output stream
90 * @param[in] args Vector of objects to print
91 *
92 * @return Modified output stream.
93 */
94template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +010095::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +010096{
97 const size_t max_print_size = 5U;
98
99 os << "[";
100 bool first = true;
101 size_t i;
102 for(i = 0; i < args.size(); ++i)
103 {
104 if(i == max_print_size)
105 {
106 break;
107 }
108 if(first)
109 {
110 first = false;
111 }
112 else
113 {
114 os << ", ";
115 }
ramelg014a6d9e82021-10-02 14:34:36 +0100116 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100117 }
118 if(i < args.size())
119 {
120 os << ", ...";
121 }
122 os << "]";
123 return os;
124}
125
ramelg014a6d9e82021-10-02 14:34:36 +0100126/** Formatted output of a vector of objects.
127 *
128 * @param[in] args Vector of objects to print
129 *
130 * @return String representing args.
131 */
132template <typename T>
133std::string to_string(const std::vector<T> &args)
134{
135 std::stringstream str;
136 str << args;
137 return str.str();
138}
139
SiCongLi1af54162021-10-06 15:25:57 +0100140/** @name (EXPERIMENTAL_POST_OPS)
141 * @{
142 */
143/** Formmated output of the @ref experimental::PostOpType type
144 *
145 * @param[out] os Output stream.
146 * @param[in] post_op_type Type to output.
147 *
148 * @return Modified output stream.
149 */
150inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
151{
152 os << "type=";
153 switch(post_op_type)
154 {
155 case experimental::PostOpType::Activation:
156 {
157 os << "Activation";
158 break;
159 }
160 case experimental::PostOpType::Eltwise_Add:
161 {
162 os << "Eltwise_Add";
163 break;
164 }
ramelg016049eda2021-10-29 10:52:53 +0100165 case experimental::PostOpType::Eltwise_PRelu:
166 {
167 os << "Eltwise_PRelu";
168 break;
169 }
SiCongLi1af54162021-10-06 15:25:57 +0100170 default:
171 {
172 ARM_COMPUTE_ERROR("Unsupported PostOpType");
173 break;
174 }
175 }
176 return os;
177}
178/** Converts a @ref experimental::PostOpType to string
179 *
180 * @param[in] post_op_type PostOpType value to be converted
181 *
182 * @return String representing the corresponding PostOpType
183 */
184inline std::string to_string(experimental::PostOpType post_op_type)
185{
186 std::stringstream str;
187 str << post_op_type;
188 return str.str();
189}
190/** Formatted output of the @ref experimental::IPostOp type.
191 *
192 * @param[out] os Output stream.
193 * @param[in] post_op Type to output.
194 *
195 * @return Modified output stream.
196 */
197template <typename T>
198inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
199{
200 os << "<";
201 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100202 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100203 switch(post_op.type())
204 {
205 case experimental::PostOpType::Activation:
206 {
207 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
208 os << "act_info=" << &(_post_op->_act_info);
209 break;
210 }
211 case experimental::PostOpType::Eltwise_Add:
212 {
213 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
214 os << "convert_policy=" << _post_op->_policy;
215 break;
216 }
ramelg016049eda2021-10-29 10:52:53 +0100217 case experimental::PostOpType::Eltwise_PRelu:
218 {
219 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
220 os << "convert_policy=" << _post_op->_policy;
221 break;
222 }
SiCongLi1af54162021-10-06 15:25:57 +0100223 default:
224 {
225 ARM_COMPUTE_ERROR("Unsupported PostOpType");
226 break;
227 }
228 }
229 os << ">";
230 return os;
231}
232/** Converts an @ref experimental::IPostOp to string
233 *
234 * @param[in] post_op IPostOp value to be converted
235 *
236 * @return String representing the corresponding IPostOp
237 */
238template <typename T>
239inline std::string to_string(const experimental::IPostOp<T> &post_op)
240{
241 std::stringstream str;
242 str << post_op;
243 return str.str();
244}
245/** Formatted output of the @ref experimental::PostOpList type.
246 *
247 * @param[out] os Output stream.
248 * @param[in] post_ops Type to output.
249 *
250 * @return Modified output stream.
251 */
252template <typename T>
253inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
254{
255 os << "[";
256 for(const auto &post_op : post_ops.get_list())
257 {
258 os << *post_op << ",";
259 }
260 os << "]";
261 return os;
262}
263/** Converts a @ref experimental::PostOpList to string
264 *
265 * @param[in] post_ops PostOpList value to be converted
266 *
267 * @return String representing the corresponding PostOpList
268 */
269template <typename T>
270inline std::string to_string(const experimental::PostOpList<T> &post_ops)
271{
272 std::stringstream str;
273 str << post_ops;
274 return str.str();
275}
276/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
277
Alex Gildayc357c472018-03-21 13:54:09 +0000278/** Formatted output of the Dimensions type.
279 *
280 * @param[out] os Output stream.
281 * @param[in] dimensions Type to output.
282 *
283 * @return Modified output stream.
284 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100285template <typename T>
286inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
287{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100288 if(dimensions.num_dimensions() > 0)
289 {
290 os << dimensions[0];
291
292 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
293 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100294 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100295 }
296 }
297
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298 return os;
299}
300
Alex Gildayc357c472018-03-21 13:54:09 +0000301/** Formatted output of the RoundingPolicy type.
302 *
303 * @param[out] os Output stream.
304 * @param[in] rounding_policy Type to output.
305 *
306 * @return Modified output stream.
307 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100308inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100309{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100310 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100311 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100312 case RoundingPolicy::TO_ZERO:
313 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100314 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100315 case RoundingPolicy::TO_NEAREST_UP:
316 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100317 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100318 case RoundingPolicy::TO_NEAREST_EVEN:
319 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100320 break;
321 default:
322 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
323 }
324
325 return os;
326}
327
Alex Gildayc357c472018-03-21 13:54:09 +0000328/** Formatted output of the WeightsInfo type.
329 *
330 * @param[out] os Output stream.
331 * @param[in] weights_info Type to output.
332 *
333 * @return Modified output stream.
334 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100335inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100336{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100337 os << weights_info.are_reshaped() << ";";
338 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100339
340 return os;
341}
342
Alex Gildayc357c472018-03-21 13:54:09 +0000343/** Formatted output of the ROIPoolingInfo type.
344 *
345 * @param[out] os Output stream.
346 * @param[in] pool_info Type to output.
347 *
348 * @return Modified output stream.
349 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100350inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100351{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100352 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100353 return os;
354}
355
giuros0118870812018-09-13 09:31:40 +0100356/** Formatted output of the ROIPoolingInfo type.
357 *
358 * @param[in] pool_info Type to output.
359 *
360 * @return Formatted string.
361 */
362inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
363{
364 std::stringstream str;
365 str << pool_info;
366 return str.str();
367}
368
morgolockaba2f912020-05-05 16:28:19 +0100369/** Formatted output of the GEMMKernelInfo type.
370 *
371 * @param[out] os Output stream.
372 * @param[in] gemm_info Type to output.
373 *
374 * @return Modified output stream.
375 */
376inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
377{
SiCongLi579ca842021-10-18 09:38:33 +0100378 os << "( m=" << gemm_info.m;
379 os << " n=" << gemm_info.n;
380 os << " k=" << gemm_info.k;
381 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
382 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
383 os << " broadcast_bias=" << gemm_info.broadcast_bias;
384 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
385 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
386 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
387 os << " a_offset=" << gemm_info.a_offset;
388 os << " b_offset=" << gemm_info.b_offset;
389 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100390 os << ")";
391 return os;
392}
393
394/** Formatted output of the GEMMLHSMatrixInfo type.
395 *
396 * @param[out] os Output stream.
397 * @param[in] gemm_info Type to output.
398 *
399 * @return Modified output stream.
400 */
401inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
402{
SiCongLi579ca842021-10-18 09:38:33 +0100403 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 +0100404 return os;
405}
406
407/** Formatted output of the GEMMRHSMatrixInfo type.
408 *
409 * @param[out] os Output stream.
410 * @param[in] gemm_info Type to output.
411 *
412 * @return Modified output stream.
413 */
414inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
415{
SiCongLi579ca842021-10-18 09:38:33 +0100416 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 +0000417 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100418 return os;
419}
420
421/** Formatted output of the GEMMRHSMatrixInfo type.
422 *
423 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
424 *
425 * @return Formatted string.
426 */
427inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
428{
429 std::stringstream str;
430 str << gemm_info;
431 return str.str();
432}
433
434/** Formatted output of the GEMMLHSMatrixInfo type.
435 *
436 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
437 *
438 * @return Formatted string.
439 */
440inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
441{
442 std::stringstream str;
443 str << gemm_info;
444 return str.str();
445}
446
447/** Formatted output of the GEMMKernelInfo type.
448 *
449 * @param[in] gemm_info GEMMKernelInfo Type to output.
450 *
451 * @return Formatted string.
452 */
453inline std::string to_string(const GEMMKernelInfo &gemm_info)
454{
455 std::stringstream str;
456 str << gemm_info;
457 return str.str();
458}
459
giuros01c04a0e82018-10-03 12:44:35 +0100460/** Formatted output of the BoundingBoxTransformInfo type.
461 *
462 * @param[out] os Output stream.
463 * @param[in] bbox_info Type to output.
464 *
465 * @return Modified output stream.
466 */
467inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
468{
469 auto weights = bbox_info.weights();
SiCongLi579ca842021-10-18 09:38:33 +0100470 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 +0100471 "})";
472 return os;
473}
474
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100475#if defined(ARM_COMPUTE_ENABLE_BF16)
476inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16& v)
477{
478 std::stringstream str;
479 str << v;
480 os << str.str();
481 return os;
482}
483#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
484
giuros01c04a0e82018-10-03 12:44:35 +0100485/** Formatted output of the BoundingBoxTransformInfo type.
486 *
487 * @param[in] bbox_info Type to output.
488 *
489 * @return Formatted string.
490 */
491inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
492{
493 std::stringstream str;
494 str << bbox_info;
495 return str.str();
496}
497
Manuel Bottini5209be52019-02-13 16:34:56 +0000498/** Formatted output of the ComputeAnchorsInfo type.
499 *
500 * @param[out] os Output stream.
501 * @param[in] anchors_info Type to output.
502 *
503 * @return Modified output stream.
504 */
505inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
506{
507 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
508 return os;
509}
510
511/** Formatted output of the ComputeAnchorsInfo type.
512 *
513 * @param[in] anchors_info Type to output.
514 *
515 * @return Formatted string.
516 */
517inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
518{
519 std::stringstream str;
520 str << anchors_info;
521 return str.str();
522}
523
524/** Formatted output of the GenerateProposalsInfo type.
525 *
526 * @param[out] os Output stream.
527 * @param[in] proposals_info Type to output.
528 *
529 * @return Modified output stream.
530 */
531inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
532{
533 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
534 return os;
535}
536
537/** Formatted output of the GenerateProposalsInfo type.
538 *
539 * @param[in] proposals_info Type to output.
540 *
541 * @return Formatted string.
542 */
543inline std::string to_string(const GenerateProposalsInfo &proposals_info)
544{
545 std::stringstream str;
546 str << proposals_info;
547 return str.str();
548}
549
Alex Gildayc357c472018-03-21 13:54:09 +0000550/** Formatted output of the QuantizationInfo type.
551 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100552 * @param[out] os Output stream.
553 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000554 *
555 * @return Modified output stream.
556 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100557inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700558{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100559 const UniformQuantizationInfo uqinfo = qinfo.uniform();
560 os << "Scale:" << uqinfo.scale << "~";
561 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700562 return os;
563}
564
Alex Gildayc357c472018-03-21 13:54:09 +0000565/** Formatted output of the QuantizationInfo type.
566 *
567 * @param[in] quantization_info Type to output.
568 *
569 * @return Formatted string.
570 */
Chunosovd621bca2017-11-03 17:33:15 +0700571inline std::string to_string(const QuantizationInfo &quantization_info)
572{
573 std::stringstream str;
574 str << quantization_info;
575 return str.str();
576}
577
Alex Gildayc357c472018-03-21 13:54:09 +0000578/** Formatted output of the activation function type.
579 *
580 * @param[out] os Output stream.
581 * @param[in] act_function Type to output.
582 *
583 * @return Modified output stream.
584 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100585inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
586{
587 switch(act_function)
588 {
589 case ActivationLayerInfo::ActivationFunction::ABS:
590 os << "ABS";
591 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100592 case ActivationLayerInfo::ActivationFunction::LINEAR:
593 os << "LINEAR";
594 break;
595 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
596 os << "LOGISTIC";
597 break;
598 case ActivationLayerInfo::ActivationFunction::RELU:
599 os << "RELU";
600 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100601 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
602 os << "BOUNDED_RELU";
603 break;
604 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
605 os << "LEAKY_RELU";
606 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100607 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
608 os << "SOFT_RELU";
609 break;
610 case ActivationLayerInfo::ActivationFunction::SQRT:
611 os << "SQRT";
612 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100613 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
614 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000615 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100616 case ActivationLayerInfo::ActivationFunction::ELU:
617 os << "ELU";
618 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100619 case ActivationLayerInfo::ActivationFunction::SQUARE:
620 os << "SQUARE";
621 break;
622 case ActivationLayerInfo::ActivationFunction::TANH:
623 os << "TANH";
624 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100625 case ActivationLayerInfo::ActivationFunction::IDENTITY:
626 os << "IDENTITY";
627 break;
morgolock07df3d42020-02-27 11:46:28 +0000628 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
629 os << "HARD_SWISH";
630 break;
631
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100632 default:
633 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
634 }
635
636 return os;
637}
638
Alex Gildayc357c472018-03-21 13:54:09 +0000639/** Formatted output of the activation function info type.
640 *
SiCongLi1af54162021-10-06 15:25:57 +0100641 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000642 *
643 * @return Formatted string.
644 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100645inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100646{
647 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000648 if(info.enabled())
649 {
650 str << info.activation();
651 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100652 return str.str();
653}
654
SiCongLi1af54162021-10-06 15:25:57 +0100655/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100656 *
SiCongLi1af54162021-10-06 15:25:57 +0100657 * @param[out] os Output stream.
658 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100659 *
660 * @return Formatted string.
661 */
SiCongLi1af54162021-10-06 15:25:57 +0100662inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100663{
ramelg013ae3d882021-09-12 23:07:47 +0100664 if(info != nullptr)
665 {
ramelg013ae3d882021-09-12 23:07:47 +0100666 if(info->enabled())
667 {
SiCongLi1af54162021-10-06 15:25:57 +0100668 os << info->activation();
669 os << "(";
670 os << "VAL_A=" << info->a() << ",";
671 os << "VAL_B=" << info->b();
672 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100673 }
SiCongLi1af54162021-10-06 15:25:57 +0100674 else
675 {
676 os << "disabled";
677 }
ramelg013ae3d882021-09-12 23:07:47 +0100678 }
SiCongLi1af54162021-10-06 15:25:57 +0100679 else
680 {
681 os << "nullptr";
682 }
683 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100684}
685
Alex Gildayc357c472018-03-21 13:54:09 +0000686/** Formatted output of the activation function type.
687 *
688 * @param[in] function Type to output.
689 *
690 * @return Formatted string.
691 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100692inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
693{
694 std::stringstream str;
695 str << function;
696 return str.str();
697}
698
Alex Gildayc357c472018-03-21 13:54:09 +0000699/** Formatted output of the NormType type.
700 *
701 * @param[out] os Output stream.
702 * @param[in] norm_type Type to output.
703 *
704 * @return Modified output stream.
705 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100706inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
707{
708 switch(norm_type)
709 {
710 case NormType::CROSS_MAP:
711 os << "CROSS_MAP";
712 break;
713 case NormType::IN_MAP_1D:
714 os << "IN_MAP_1D";
715 break;
716 case NormType::IN_MAP_2D:
717 os << "IN_MAP_2D";
718 break;
719 default:
720 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
721 }
722
723 return os;
724}
725
Alex Gildayc357c472018-03-21 13:54:09 +0000726/** Formatted output of @ref NormalizationLayerInfo.
727 *
728 * @param[in] info Type to output.
729 *
730 * @return Formatted string.
731 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100732inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100733{
734 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000735 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100736 return str.str();
737}
738
Alex Gildayc357c472018-03-21 13:54:09 +0000739/** Formatted output of @ref NormalizationLayerInfo.
740 *
741 * @param[out] os Output stream.
742 * @param[in] info Type to output.
743 *
744 * @return Modified output stream.
745 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100746inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
747{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000748 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100749 return os;
750}
751
Alex Gildayc357c472018-03-21 13:54:09 +0000752/** Formatted output of the PoolingType type.
753 *
754 * @param[out] os Output stream.
755 * @param[in] pool_type Type to output.
756 *
757 * @return Modified output stream.
758 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100759inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
760{
761 switch(pool_type)
762 {
763 case PoolingType::AVG:
764 os << "AVG";
765 break;
766 case PoolingType::MAX:
767 os << "MAX";
768 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100769 case PoolingType::L2:
770 os << "L2";
771 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100772 default:
773 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
774 }
775
776 return os;
777}
778
Alex Gildayc357c472018-03-21 13:54:09 +0000779/** Formatted output of @ref PoolingLayerInfo.
780 *
781 * @param[out] os Output stream.
782 * @param[in] info Type to output.
783 *
784 * @return Modified output stream.
785 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100786inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
787{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000788 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100789
790 return os;
791}
792
Alex Gildayc357c472018-03-21 13:54:09 +0000793/** Formatted output of @ref RoundingPolicy.
794 *
795 * @param[in] rounding_policy Type to output.
796 *
797 * @return Formatted string.
798 */
John Richardsondd715f22017-09-18 16:10:48 +0100799inline std::string to_string(const RoundingPolicy &rounding_policy)
800{
801 std::stringstream str;
802 str << rounding_policy;
803 return str.str();
804}
805
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000806/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000807/** Formatted output of the DataLayout type.
808 *
809 * @param[out] os Output stream.
810 * @param[in] data_layout Type to output.
811 *
812 * @return Modified output stream.
813 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000814inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
815{
816 switch(data_layout)
817 {
818 case DataLayout::UNKNOWN:
819 os << "UNKNOWN";
820 break;
821 case DataLayout::NHWC:
822 os << "NHWC";
823 break;
824 case DataLayout::NCHW:
825 os << "NCHW";
826 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100827 case DataLayout::NDHWC:
828 os << "NDHWC";
829 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100830 case DataLayout::NCDHW:
831 os << "NCDHW";
832 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000833 default:
834 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
835 }
836
837 return os;
838}
839
Alex Gildayc357c472018-03-21 13:54:09 +0000840/** Formatted output of the DataLayout type.
841 *
842 * @param[in] data_layout Type to output.
843 *
844 * @return Formatted string.
845 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000846inline std::string to_string(const arm_compute::DataLayout &data_layout)
847{
848 std::stringstream str;
849 str << data_layout;
850 return str.str();
851}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000852/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000853
Georgios Pinitase2220552018-07-20 13:23:44 +0100854/** Formatted output of the DataLayoutDimension type.
855 *
856 * @param[out] os Output stream.
857 * @param[in] data_layout_dim Data layout dimension to print.
858 *
859 * @return Modified output stream.
860 */
861inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
862{
863 switch(data_layout_dim)
864 {
865 case DataLayoutDimension::WIDTH:
866 os << "WIDTH";
867 break;
868 case DataLayoutDimension::HEIGHT:
869 os << "HEIGHT";
870 break;
871 case DataLayoutDimension::CHANNEL:
872 os << "CHANNEL";
873 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100874 case DataLayoutDimension::DEPTH:
875 os << "DEPTH";
876 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100877 case DataLayoutDimension::BATCHES:
878 os << "BATCHES";
879 break;
880 default:
881 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
882 }
883 return os;
884}
885
Alex Gildayc357c472018-03-21 13:54:09 +0000886/** Formatted output of the DataType type.
887 *
888 * @param[out] os Output stream.
889 * @param[in] data_type Type to output.
890 *
891 * @return Modified output stream.
892 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100893inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
894{
895 switch(data_type)
896 {
897 case DataType::UNKNOWN:
898 os << "UNKNOWN";
899 break;
900 case DataType::U8:
901 os << "U8";
902 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100903 case DataType::QSYMM8:
904 os << "QSYMM8";
905 break;
Chunosovd621bca2017-11-03 17:33:15 +0700906 case DataType::QASYMM8:
907 os << "QASYMM8";
908 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000909 case DataType::QASYMM8_SIGNED:
910 os << "QASYMM8_SIGNED";
911 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100912 case DataType::QSYMM8_PER_CHANNEL:
913 os << "QSYMM8_PER_CHANNEL";
914 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100915 case DataType::S8:
916 os << "S8";
917 break;
918 case DataType::U16:
919 os << "U16";
920 break;
921 case DataType::S16:
922 os << "S16";
923 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100924 case DataType::QSYMM16:
925 os << "QSYMM16";
926 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100927 case DataType::QASYMM16:
928 os << "QASYMM16";
929 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100930 case DataType::U32:
931 os << "U32";
932 break;
933 case DataType::S32:
934 os << "S32";
935 break;
936 case DataType::U64:
937 os << "U64";
938 break;
939 case DataType::S64:
940 os << "S64";
941 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000942 case DataType::BFLOAT16:
943 os << "BFLOAT16";
944 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100945 case DataType::F16:
946 os << "F16";
947 break;
948 case DataType::F32:
949 os << "F32";
950 break;
951 case DataType::F64:
952 os << "F64";
953 break;
954 case DataType::SIZET:
955 os << "SIZET";
956 break;
957 default:
958 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
959 }
960
961 return os;
962}
963
Alex Gildayc357c472018-03-21 13:54:09 +0000964/** Formatted output of the DataType type.
965 *
966 * @param[in] data_type Type to output.
967 *
968 * @return Formatted string.
969 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100970inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100971{
972 std::stringstream str;
973 str << data_type;
974 return str.str();
975}
976
Alex Gildayc357c472018-03-21 13:54:09 +0000977/** Formatted output of the Format type.
978 *
979 * @param[out] os Output stream.
980 * @param[in] format Type to output.
981 *
982 * @return Modified output stream.
983 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100984inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
985{
986 switch(format)
987 {
988 case Format::UNKNOWN:
989 os << "UNKNOWN";
990 break;
991 case Format::U8:
992 os << "U8";
993 break;
994 case Format::S16:
995 os << "S16";
996 break;
997 case Format::U16:
998 os << "U16";
999 break;
1000 case Format::S32:
1001 os << "S32";
1002 break;
1003 case Format::U32:
1004 os << "U32";
1005 break;
1006 case Format::F16:
1007 os << "F16";
1008 break;
1009 case Format::F32:
1010 os << "F32";
1011 break;
1012 case Format::UV88:
1013 os << "UV88";
1014 break;
1015 case Format::RGB888:
1016 os << "RGB888";
1017 break;
1018 case Format::RGBA8888:
1019 os << "RGBA8888";
1020 break;
1021 case Format::YUV444:
1022 os << "YUV444";
1023 break;
1024 case Format::YUYV422:
1025 os << "YUYV422";
1026 break;
1027 case Format::NV12:
1028 os << "NV12";
1029 break;
1030 case Format::NV21:
1031 os << "NV21";
1032 break;
1033 case Format::IYUV:
1034 os << "IYUV";
1035 break;
1036 case Format::UYVY422:
1037 os << "UYVY422";
1038 break;
1039 default:
1040 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1041 }
1042
1043 return os;
1044}
1045
Alex Gildayc357c472018-03-21 13:54:09 +00001046/** Formatted output of the Format type.
1047 *
1048 * @param[in] format Type to output.
1049 *
1050 * @return Formatted string.
1051 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001052inline std::string to_string(const Format &format)
1053{
1054 std::stringstream str;
1055 str << format;
1056 return str.str();
1057}
1058
Alex Gildayc357c472018-03-21 13:54:09 +00001059/** Formatted output of the Channel type.
1060 *
1061 * @param[out] os Output stream.
1062 * @param[in] channel Type to output.
1063 *
1064 * @return Modified output stream.
1065 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001066inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1067{
1068 switch(channel)
1069 {
1070 case Channel::UNKNOWN:
1071 os << "UNKNOWN";
1072 break;
1073 case Channel::C0:
1074 os << "C0";
1075 break;
1076 case Channel::C1:
1077 os << "C1";
1078 break;
1079 case Channel::C2:
1080 os << "C2";
1081 break;
1082 case Channel::C3:
1083 os << "C3";
1084 break;
1085 case Channel::R:
1086 os << "R";
1087 break;
1088 case Channel::G:
1089 os << "G";
1090 break;
1091 case Channel::B:
1092 os << "B";
1093 break;
1094 case Channel::A:
1095 os << "A";
1096 break;
1097 case Channel::Y:
1098 os << "Y";
1099 break;
1100 case Channel::U:
1101 os << "U";
1102 break;
1103 case Channel::V:
1104 os << "V";
1105 break;
1106 default:
1107 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1108 }
1109
1110 return os;
1111}
1112
Alex Gildayc357c472018-03-21 13:54:09 +00001113/** Formatted output of the Channel type.
1114 *
1115 * @param[in] channel Type to output.
1116 *
1117 * @return Formatted string.
1118 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001119inline std::string to_string(const Channel &channel)
1120{
1121 std::stringstream str;
1122 str << channel;
1123 return str.str();
1124}
1125
Alex Gildayc357c472018-03-21 13:54:09 +00001126/** Formatted output of the BorderMode type.
1127 *
1128 * @param[out] os Output stream.
1129 * @param[in] mode Type to output.
1130 *
1131 * @return Modified output stream.
1132 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001133inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1134{
1135 switch(mode)
1136 {
1137 case BorderMode::UNDEFINED:
1138 os << "UNDEFINED";
1139 break;
1140 case BorderMode::CONSTANT:
1141 os << "CONSTANT";
1142 break;
1143 case BorderMode::REPLICATE:
1144 os << "REPLICATE";
1145 break;
1146 default:
1147 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1148 }
1149
1150 return os;
1151}
1152
Alex Gildayc357c472018-03-21 13:54:09 +00001153/** Formatted output of the BorderSize type.
1154 *
1155 * @param[out] os Output stream.
1156 * @param[in] border Type to output.
1157 *
1158 * @return Modified output stream.
1159 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001160inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1161{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001162 os << border.top << ","
1163 << border.right << ","
1164 << border.bottom << ","
1165 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001166
1167 return os;
1168}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001169
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001170/** Formatted output of the PaddingList type.
1171 *
1172 * @param[out] os Output stream.
1173 * @param[in] padding Type to output.
1174 *
1175 * @return Modified output stream.
1176 */
1177inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1178{
1179 os << "{";
1180 for(auto const &p : padding)
1181 {
1182 os << "{" << p.first << "," << p.second << "}";
1183 }
1184 os << "}";
1185 return os;
1186}
1187
giuros013175fcf2018-11-21 09:59:17 +00001188/** Formatted output of the Multiples type.
1189 *
1190 * @param[out] os Output stream.
1191 * @param[in] multiples Type to output.
1192 *
1193 * @return Modified output stream.
1194 */
1195inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1196{
1197 os << "(";
1198 for(size_t i = 0; i < multiples.size() - 1; i++)
1199 {
1200 os << multiples[i] << ", ";
1201 }
1202 os << multiples.back() << ")";
1203 return os;
1204}
1205
Alex Gildayc357c472018-03-21 13:54:09 +00001206/** Formatted output of the InterpolationPolicy type.
1207 *
1208 * @param[out] os Output stream.
1209 * @param[in] policy Type to output.
1210 *
1211 * @return Modified output stream.
1212 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001213inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1214{
1215 switch(policy)
1216 {
1217 case InterpolationPolicy::NEAREST_NEIGHBOR:
1218 os << "NEAREST_NEIGHBOR";
1219 break;
1220 case InterpolationPolicy::BILINEAR:
1221 os << "BILINEAR";
1222 break;
1223 case InterpolationPolicy::AREA:
1224 os << "AREA";
1225 break;
1226 default:
1227 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1228 }
1229
1230 return os;
1231}
1232
Alex Gildayc357c472018-03-21 13:54:09 +00001233/** Formatted output of the SamplingPolicy type.
1234 *
1235 * @param[out] os Output stream.
1236 * @param[in] policy Type to output.
1237 *
1238 * @return Modified output stream.
1239 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001240inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1241{
1242 switch(policy)
1243 {
1244 case SamplingPolicy::CENTER:
1245 os << "CENTER";
1246 break;
1247 case SamplingPolicy::TOP_LEFT:
1248 os << "TOP_LEFT";
1249 break;
1250 default:
1251 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1252 }
1253
1254 return os;
1255}
1256
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001257/** Formatted output of the ITensorInfo type.
1258 *
1259 * @param[out] os Output stream.
1260 * @param[in] info Tensor information.
1261 *
1262 * @return Modified output stream.
1263 */
1264inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1265{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001266 const DataType data_type = info->data_type();
1267 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001268
1269 os << "Shape=" << info->tensor_shape() << ","
1270 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001271 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001272
1273 if(is_data_type_quantized(data_type))
1274 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001275 const QuantizationInfo qinfo = info->quantization_info();
1276 const auto scales = qinfo.scale();
1277 const auto offsets = qinfo.offset();
1278
ramelg014a6d9e82021-10-02 14:34:36 +01001279 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001280 << "scales.size=" << scales.size()
1281 << ", scale(s)=" << scales << ", ";
1282
1283 os << "offsets.size=" << offsets.size()
1284 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001285 }
1286 return os;
1287}
1288
ramelg013ae3d882021-09-12 23:07:47 +01001289/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001290 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001291 * @param[out] os Output stream.
1292 * @param[in] info Type to output.
1293 *
1294 * @return Modified output stream.
1295 */
1296inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1297{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001298 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001299 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001300}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001301
ramelg013ae3d882021-09-12 23:07:47 +01001302/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001303 *
Alex Gildayc357c472018-03-21 13:54:09 +00001304 * @param[in] info Type to output.
1305 *
1306 * @return Formatted string.
1307 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001308inline std::string to_string(const TensorInfo &info)
1309{
1310 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001311 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001312 return str.str();
1313}
1314
ramelg013ae3d882021-09-12 23:07:47 +01001315/** Formatted output of the const ITensorInfo& type.
1316 *
1317 * @param[in] info Type to output.
1318 *
1319 * @return Formatted string.
1320 */
1321inline std::string to_string(const ITensorInfo &info)
1322{
1323 std::stringstream str;
1324 str << &info;
1325 return str.str();
1326}
1327
ramelg013ae3d882021-09-12 23:07:47 +01001328/** Formatted output of the const ITensorInfo* type.
1329 *
1330 * @param[in] info Type to output.
1331 *
1332 * @return Formatted string.
1333 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001334inline std::string to_string(const ITensorInfo *info)
1335{
ramelg013ae3d882021-09-12 23:07:47 +01001336 std::string ret_str = "nullptr";
1337 if(info != nullptr)
1338 {
1339 std::stringstream str;
1340 str << info;
1341 ret_str = str.str();
1342 }
1343 return ret_str;
1344}
1345
ramelg01cbbb0382021-09-17 17:36:57 +01001346/** Formatted output of the ITensorInfo* type.
1347 *
1348 * @param[in] info Type to output.
1349 *
1350 * @return Formatted string.
1351 */
1352inline std::string to_string(ITensorInfo *info)
1353{
1354 return to_string(static_cast<const ITensorInfo *>(info));
1355}
1356
1357/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001358 *
1359 * @param[in] tensor Type to output.
1360 *
1361 * @return Formatted string.
1362 */
1363inline std::string to_string(const ITensor *tensor)
1364{
1365 std::string ret_str = "nullptr";
1366 if(tensor != nullptr)
1367 {
1368 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001369 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001370 ret_str = str.str();
1371 }
1372 return ret_str;
1373}
1374
ramelg01cbbb0382021-09-17 17:36:57 +01001375/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001376 *
1377 * @param[in] tensor Type to output.
1378 *
1379 * @return Formatted string.
1380 */
1381inline std::string to_string(ITensor *tensor)
1382{
ramelg01cbbb0382021-09-17 17:36:57 +01001383 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001384}
1385
ramelg01cbbb0382021-09-17 17:36:57 +01001386/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001387 *
1388 * @param[in] tensor Type to output.
1389 *
1390 * @return Formatted string.
1391 */
1392inline std::string to_string(ITensor &tensor)
1393{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001394 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001395 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001396 return str.str();
1397}
1398
ramelg01cbbb0382021-09-17 17:36:57 +01001399#ifdef ARM_COMPUTE_OPENCL_ENABLED
1400/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1401 *
1402 * @param[in] cl_tensor Type to output.
1403 *
1404 * @return Formatted string.
1405 */
1406inline std::string to_string(const ICLTensor *cl_tensor)
1407{
1408 std::string ret_str = "nullptr";
1409 if(cl_tensor != nullptr)
1410 {
1411 std::stringstream str;
1412 str << "ICLTensor->info(): " << cl_tensor->info();
1413 ret_str = str.str();
1414 }
1415 return ret_str;
1416}
1417
1418/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1419 *
1420 * @param[in] cl_tensor Type to output.
1421 *
1422 * @return Formatted string.
1423 */
1424inline std::string to_string(ICLTensor *cl_tensor)
1425{
1426 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1427}
1428#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1429
Alex Gildayc357c472018-03-21 13:54:09 +00001430/** Formatted output of the Dimensions type.
1431 *
1432 * @param[in] dimensions Type to output.
1433 *
1434 * @return Formatted string.
1435 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001436template <typename T>
1437inline std::string to_string(const Dimensions<T> &dimensions)
1438{
1439 std::stringstream str;
1440 str << dimensions;
1441 return str.str();
1442}
1443
Alex Gildayc357c472018-03-21 13:54:09 +00001444/** Formatted output of the Strides type.
1445 *
1446 * @param[in] stride Type to output.
1447 *
1448 * @return Formatted string.
1449 */
John Richardsona36eae12017-09-26 16:55:59 +01001450inline std::string to_string(const Strides &stride)
1451{
1452 std::stringstream str;
1453 str << stride;
1454 return str.str();
1455}
1456
Alex Gildayc357c472018-03-21 13:54:09 +00001457/** Formatted output of the TensorShape type.
1458 *
1459 * @param[in] shape Type to output.
1460 *
1461 * @return Formatted string.
1462 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001463inline std::string to_string(const TensorShape &shape)
1464{
1465 std::stringstream str;
1466 str << shape;
1467 return str.str();
1468}
1469
Alex Gildayc357c472018-03-21 13:54:09 +00001470/** Formatted output of the Coordinates type.
1471 *
1472 * @param[in] coord Type to output.
1473 *
1474 * @return Formatted string.
1475 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001476inline std::string to_string(const Coordinates &coord)
1477{
1478 std::stringstream str;
1479 str << coord;
1480 return str.str();
1481}
1482
Anthony Barbierb940fd62018-06-04 14:14:32 +01001483/** Formatted output of the GEMMReshapeInfo type.
1484 *
1485 * @param[out] os Output stream.
1486 * @param[in] info Type to output.
1487 *
1488 * @return Modified output stream.
1489 */
1490inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1491{
1492 os << "{m=" << info.m() << ",";
1493 os << "n=" << info.n() << ",";
1494 os << "k=" << info.k() << ",";
1495 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1496 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1497 os << "}";
1498
1499 return os;
1500}
1501
1502/** Formatted output of the GEMMInfo type.
1503 *
1504 * @param[out] os Output stream.
1505 * @param[in] info Type to output.
1506 *
1507 * @return Modified output stream.
1508 */
1509inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1510{
1511 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1512 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1513 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001514 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1515 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1516 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1517 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1518 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001519 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001520 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001521
1522 return os;
1523}
1524
1525/** Formatted output of the Window::Dimension type.
1526 *
1527 * @param[out] os Output stream.
1528 * @param[in] dim Type to output.
1529 *
1530 * @return Modified output stream.
1531 */
1532inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1533{
1534 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1535
1536 return os;
1537}
1538/** Formatted output of the Window type.
1539 *
1540 * @param[out] os Output stream.
1541 * @param[in] win Type to output.
1542 *
1543 * @return Modified output stream.
1544 */
1545inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1546{
1547 os << "{";
1548 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1549 {
1550 if(i > 0)
1551 {
1552 os << ", ";
1553 }
1554 os << win[i];
1555 }
1556 os << "}";
1557
1558 return os;
1559}
1560
1561/** Formatted output of the WeightsInfo type.
1562 *
1563 * @param[in] info Type to output.
1564 *
1565 * @return Formatted string.
1566 */
1567inline std::string to_string(const WeightsInfo &info)
1568{
1569 std::stringstream str;
1570 str << info;
1571 return str.str();
1572}
1573
1574/** Formatted output of the GEMMReshapeInfo type.
1575 *
1576 * @param[in] info Type to output.
1577 *
1578 * @return Formatted string.
1579 */
1580inline std::string to_string(const GEMMReshapeInfo &info)
1581{
1582 std::stringstream str;
1583 str << info;
1584 return str.str();
1585}
1586
1587/** Formatted output of the GEMMInfo type.
1588 *
1589 * @param[in] info Type to output.
1590 *
1591 * @return Formatted string.
1592 */
1593inline std::string to_string(const GEMMInfo &info)
1594{
1595 std::stringstream str;
1596 str << info;
1597 return str.str();
1598}
1599
1600/** Formatted output of the Window::Dimension type.
1601 *
1602 * @param[in] dim Type to output.
1603 *
1604 * @return Formatted string.
1605 */
1606inline std::string to_string(const Window::Dimension &dim)
1607{
1608 std::stringstream str;
1609 str << dim;
1610 return str.str();
1611}
ramelg01cbbb0382021-09-17 17:36:57 +01001612/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001613 *
1614 * @param[in] win Type to output.
1615 *
1616 * @return Formatted string.
1617 */
1618inline std::string to_string(const Window &win)
1619{
1620 std::stringstream str;
1621 str << win;
1622 return str.str();
1623}
1624
ramelg01cbbb0382021-09-17 17:36:57 +01001625/** Formatted output of the Window* type.
1626 *
1627 * @param[in] win Type to output.
1628 *
1629 * @return Formatted string.
1630 */
1631inline std::string to_string(Window *win)
1632{
1633 std::string ret_str = "nullptr";
1634 if(win != nullptr)
1635 {
1636 std::stringstream str;
1637 str << *win;
1638 ret_str = str.str();
1639 }
1640 return ret_str;
1641}
1642
Alex Gildayc357c472018-03-21 13:54:09 +00001643/** Formatted output of the Rectangle type.
1644 *
1645 * @param[out] os Output stream.
1646 * @param[in] rect Type to output.
1647 *
1648 * @return Modified output stream.
1649 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001650inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1651{
1652 os << rect.width << "x" << rect.height;
1653 os << "+" << rect.x << "+" << rect.y;
1654
1655 return os;
1656}
1657
Usama Arif8cf8c112019-03-14 15:36:54 +00001658/** Formatted output of the PaddingMode type.
1659 *
1660 * @param[out] os Output stream.
1661 * @param[in] mode Type to output.
1662 *
1663 * @return Modified output stream.
1664 */
1665inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1666{
1667 switch(mode)
1668 {
1669 case PaddingMode::CONSTANT:
1670 os << "CONSTANT";
1671 break;
1672 case PaddingMode::REFLECT:
1673 os << "REFLECT";
1674 break;
1675 case PaddingMode::SYMMETRIC:
1676 os << "SYMMETRIC";
1677 break;
1678 default:
1679 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1680 }
1681
1682 return os;
1683}
1684
1685/** Formatted output of the PaddingMode type.
1686 *
1687 * @param[in] mode Type to output.
1688 *
1689 * @return Formatted string.
1690 */
1691inline std::string to_string(const PaddingMode &mode)
1692{
1693 std::stringstream str;
1694 str << mode;
1695 return str.str();
1696}
1697
Alex Gildayc357c472018-03-21 13:54:09 +00001698/** Formatted output of the PadStrideInfo type.
1699 *
1700 * @param[out] os Output stream.
1701 * @param[in] pad_stride_info Type to output.
1702 *
1703 * @return Modified output stream.
1704 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001705inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1706{
1707 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1708 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001709 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1710 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001711
1712 return os;
1713}
1714
Alex Gildayc357c472018-03-21 13:54:09 +00001715/** Formatted output of the PadStrideInfo type.
1716 *
1717 * @param[in] pad_stride_info Type to output.
1718 *
1719 * @return Formatted string.
1720 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001721inline std::string to_string(const PadStrideInfo &pad_stride_info)
1722{
1723 std::stringstream str;
1724 str << pad_stride_info;
1725 return str.str();
1726}
1727
Alex Gildayc357c472018-03-21 13:54:09 +00001728/** Formatted output of the BorderMode type.
1729 *
1730 * @param[in] mode Type to output.
1731 *
1732 * @return Formatted string.
1733 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001734inline std::string to_string(const BorderMode &mode)
1735{
1736 std::stringstream str;
1737 str << mode;
1738 return str.str();
1739}
1740
Alex Gildayc357c472018-03-21 13:54:09 +00001741/** Formatted output of the BorderSize type.
1742 *
1743 * @param[in] border Type to output.
1744 *
1745 * @return Formatted string.
1746 */
John Richardsonb482ce12017-09-18 12:44:01 +01001747inline std::string to_string(const BorderSize &border)
1748{
1749 std::stringstream str;
1750 str << border;
1751 return str.str();
1752}
1753
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001754/** Formatted output of the PaddingList type.
1755 *
1756 * @param[in] padding Type to output.
1757 *
1758 * @return Formatted string.
1759 */
1760inline std::string to_string(const PaddingList &padding)
1761{
1762 std::stringstream str;
1763 str << padding;
1764 return str.str();
1765}
1766
giuros013175fcf2018-11-21 09:59:17 +00001767/** Formatted output of the Multiples type.
1768 *
1769 * @param[in] multiples Type to output.
1770 *
1771 * @return Formatted string.
1772 */
1773inline std::string to_string(const Multiples &multiples)
1774{
1775 std::stringstream str;
1776 str << multiples;
1777 return str.str();
1778}
1779
Alex Gildayc357c472018-03-21 13:54:09 +00001780/** Formatted output of the InterpolationPolicy type.
1781 *
1782 * @param[in] policy Type to output.
1783 *
1784 * @return Formatted string.
1785 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001786inline std::string to_string(const InterpolationPolicy &policy)
1787{
1788 std::stringstream str;
1789 str << policy;
1790 return str.str();
1791}
1792
Alex Gildayc357c472018-03-21 13:54:09 +00001793/** Formatted output of the SamplingPolicy type.
1794 *
1795 * @param[in] policy Type to output.
1796 *
1797 * @return Formatted string.
1798 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001799inline std::string to_string(const SamplingPolicy &policy)
1800{
1801 std::stringstream str;
1802 str << policy;
1803 return str.str();
1804}
1805
Alex Gildayc357c472018-03-21 13:54:09 +00001806/** Formatted output of the ConvertPolicy type.
1807 *
1808 * @param[out] os Output stream.
1809 * @param[in] policy Type to output.
1810 *
1811 * @return Modified output stream.
1812 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001813inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1814{
1815 switch(policy)
1816 {
1817 case ConvertPolicy::WRAP:
1818 os << "WRAP";
1819 break;
1820 case ConvertPolicy::SATURATE:
1821 os << "SATURATE";
1822 break;
1823 default:
1824 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1825 }
1826
1827 return os;
1828}
1829
1830inline std::string to_string(const ConvertPolicy &policy)
1831{
1832 std::stringstream str;
1833 str << policy;
1834 return str.str();
1835}
1836
giuros01164a2722018-11-20 18:34:46 +00001837/** Formatted output of the ArithmeticOperation type.
1838 *
1839 * @param[out] os Output stream.
1840 * @param[in] op Operation to output.
1841 *
1842 * @return Modified output stream.
1843 */
1844inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1845{
1846 switch(op)
1847 {
1848 case ArithmeticOperation::ADD:
1849 os << "ADD";
1850 break;
1851 case ArithmeticOperation::SUB:
1852 os << "SUB";
1853 break;
1854 case ArithmeticOperation::DIV:
1855 os << "DIV";
1856 break;
1857 case ArithmeticOperation::MAX:
1858 os << "MAX";
1859 break;
1860 case ArithmeticOperation::MIN:
1861 os << "MIN";
1862 break;
1863 case ArithmeticOperation::SQUARED_DIFF:
1864 os << "SQUARED_DIFF";
1865 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001866 case ArithmeticOperation::POWER:
1867 os << "POWER";
1868 break;
giuros01164a2722018-11-20 18:34:46 +00001869 default:
1870 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1871 }
1872
1873 return os;
1874}
1875
1876/** Formatted output of the Arithmetic Operation
1877 *
1878 * @param[in] op Type to output.
1879 *
1880 * @return Formatted string.
1881 */
1882inline std::string to_string(const ArithmeticOperation &op)
1883{
1884 std::stringstream str;
1885 str << op;
1886 return str.str();
1887}
1888
Alex Gildayc357c472018-03-21 13:54:09 +00001889/** Formatted output of the Reduction Operations.
1890 *
1891 * @param[out] os Output stream.
1892 * @param[in] op Type to output.
1893 *
1894 * @return Modified output stream.
1895 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001896inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1897{
1898 switch(op)
1899 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001900 case ReductionOperation::SUM:
1901 os << "SUM";
1902 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001903 case ReductionOperation::SUM_SQUARE:
1904 os << "SUM_SQUARE";
1905 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001906 case ReductionOperation::MEAN_SUM:
1907 os << "MEAN_SUM";
1908 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001909 case ReductionOperation::ARG_IDX_MAX:
1910 os << "ARG_IDX_MAX";
1911 break;
1912 case ReductionOperation::ARG_IDX_MIN:
1913 os << "ARG_IDX_MIN";
1914 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001915 case ReductionOperation::PROD:
1916 os << "PROD";
1917 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001918 case ReductionOperation::MIN:
1919 os << "MIN";
1920 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001921 case ReductionOperation::MAX:
1922 os << "MAX";
1923 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001924 default:
1925 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1926 }
1927
1928 return os;
1929}
1930
Alex Gildayc357c472018-03-21 13:54:09 +00001931/** Formatted output of the Reduction Operations.
1932 *
1933 * @param[in] op Type to output.
1934 *
1935 * @return Formatted string.
1936 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001937inline std::string to_string(const ReductionOperation &op)
1938{
1939 std::stringstream str;
1940 str << op;
1941 return str.str();
1942}
1943
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001944/** Formatted output of the Comparison Operations.
1945 *
1946 * @param[out] os Output stream.
1947 * @param[in] op Type to output.
1948 *
1949 * @return Modified output stream.
1950 */
1951inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1952{
1953 switch(op)
1954 {
1955 case ComparisonOperation::Equal:
1956 os << "Equal";
1957 break;
1958 case ComparisonOperation::NotEqual:
1959 os << "NotEqual";
1960 break;
1961 case ComparisonOperation::Greater:
1962 os << "Greater";
1963 break;
1964 case ComparisonOperation::GreaterEqual:
1965 os << "GreaterEqual";
1966 break;
1967 case ComparisonOperation::Less:
1968 os << "Less";
1969 break;
1970 case ComparisonOperation::LessEqual:
1971 os << "LessEqual";
1972 break;
1973 default:
1974 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1975 }
1976
1977 return os;
1978}
1979
Michalis Spyroue9362622018-11-23 17:41:37 +00001980/** Formatted output of the Elementwise unary Operations.
1981 *
1982 * @param[out] os Output stream.
1983 * @param[in] op Type to output.
1984 *
1985 * @return Modified output stream.
1986 */
1987inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1988{
1989 switch(op)
1990 {
1991 case ElementWiseUnary::RSQRT:
1992 os << "RSQRT";
1993 break;
1994 case ElementWiseUnary::EXP:
1995 os << "EXP";
1996 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001997 case ElementWiseUnary::NEG:
1998 os << "NEG";
1999 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002000 case ElementWiseUnary::LOG:
2001 os << "LOG";
2002 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002003 case ElementWiseUnary::SIN:
2004 os << "SIN";
2005 break;
2006 case ElementWiseUnary::ABS:
2007 os << "ABS";
2008 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002009 case ElementWiseUnary::ROUND:
2010 os << "ROUND";
2011 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002012 case ElementWiseUnary::LOGICAL_NOT:
2013 os << "LOGICAL_NOT";
2014 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002015 default:
2016 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2017 }
2018
2019 return os;
2020}
2021
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002022/** Formatted output of the Comparison Operations.
2023 *
2024 * @param[in] op Type to output.
2025 *
2026 * @return Formatted string.
2027 */
2028inline std::string to_string(const ComparisonOperation &op)
2029{
2030 std::stringstream str;
2031 str << op;
2032 return str.str();
2033}
2034
Michalis Spyroue9362622018-11-23 17:41:37 +00002035/** Formatted output of the Elementwise unary Operations.
2036 *
2037 * @param[in] op Type to output.
2038 *
2039 * @return Formatted string.
2040 */
2041inline std::string to_string(const ElementWiseUnary &op)
2042{
2043 std::stringstream str;
2044 str << op;
2045 return str.str();
2046}
2047
Alex Gildayc357c472018-03-21 13:54:09 +00002048/** Formatted output of the Norm Type.
2049 *
2050 * @param[in] type Type to output.
2051 *
2052 * @return Formatted string.
2053 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002054inline std::string to_string(const NormType &type)
2055{
2056 std::stringstream str;
2057 str << type;
2058 return str.str();
2059}
2060
Alex Gildayc357c472018-03-21 13:54:09 +00002061/** Formatted output of the Pooling Type.
2062 *
2063 * @param[in] type Type to output.
2064 *
2065 * @return Formatted string.
2066 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002067inline std::string to_string(const PoolingType &type)
2068{
2069 std::stringstream str;
2070 str << type;
2071 return str.str();
2072}
2073
Alex Gildayc357c472018-03-21 13:54:09 +00002074/** Formatted output of the Pooling Layer Info.
2075 *
2076 * @param[in] info Type to output.
2077 *
2078 * @return Formatted string.
2079 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002080inline std::string to_string(const PoolingLayerInfo &info)
2081{
2082 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002083 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002084 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002085 << "IsGlobalPooling=" << info.is_global_pooling;
2086 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002087 {
2088 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002089 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2090 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002091 }
2092 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002093 return str.str();
2094}
2095
ramelg0137515692022-02-26 22:06:20 +00002096/** Formatted output of the Size3D type.
2097 *
2098 * @param[out] os Output stream
2099 * @param[in] size Type to output
2100 *
2101 * @return Modified output stream.
2102 */
2103inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2104{
2105 os << size.width << "x" << size.height << "x" << size.depth;
2106
2107 return os;
2108}
2109
2110/** Formatted output of the Size3D type.
2111 *
2112 * @param[in] type Type to output
2113 *
2114 * @return Formatted string.
2115 */
2116inline std::string to_string(const Size3D &type)
2117{
2118 std::stringstream str;
2119 str << type;
2120 return str.str();
2121}
2122
2123/** Formatted output of the Padding3D type.
2124 *
2125 * @param[out] os Output stream.
2126 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2127 *
2128 * @return Modified output stream.
2129 */
2130inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2131{
2132 os << padding3d.left << "," << padding3d.right << ","
2133 << padding3d.top << "," << padding3d.bottom << ","
2134 << padding3d.front << "," << padding3d.back;
2135 return os;
2136}
2137
2138/** Converts a @ref Padding3D to string
2139 *
2140 * @param[in] padding3d Padding3D value to be converted
2141 *
2142 * @return String representing the corresponding Padding3D
2143 */
2144inline std::string to_string(const Padding3D &padding3d)
2145{
2146 std::stringstream str;
2147 str << padding3d;
2148 return str.str();
2149}
2150
2151/** Formatted output of the DimensionRoundingType type.
2152 *
2153 * @param[out] os Output stream.
2154 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2155 *
2156 * @return Modified output stream.
2157 */
2158inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2159{
2160 switch(rounding_type)
2161 {
2162 case DimensionRoundingType::CEIL:
2163 os << "CEIL";
2164 break;
2165 case DimensionRoundingType::FLOOR:
2166 os << "FLOOR";
2167 break;
2168 default:
2169 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2170 }
2171 return os;
2172}
2173
2174/** Formatted output of the Pooling 3d Layer Info.
2175 *
2176 * @param[out] os Output stream.
2177 * @param[in] info Pooling 3D layer info to print to output stream.
2178 *
2179 * @return Modified output stream.
2180 */
2181inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2182{
2183 os << "{Type=" << info.pool_type << ","
2184 << "IsGlobalPooling=" << info.is_global_pooling;
2185 if(!info.is_global_pooling)
2186 {
2187 os << ","
2188 << "PoolSize=" << info.pool_size << ", "
2189 << "Stride=" << info.stride << ", "
2190 << "Padding=" << info.padding << ", "
2191 << "Exclude Padding=" << info.exclude_padding << ", "
2192 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2193 << "DimensionRoundingType=" << info.round_type;
2194 }
2195 os << "}";
2196 return os;
2197}
2198
2199/** Formatted output of the Pooling 3d Layer Info.
2200 *
2201 * @param[in] info Type to output.
2202 *
2203 * @return Formatted string.
2204 */
2205inline std::string to_string(const Pooling3dLayerInfo &info)
2206{
2207 std::stringstream str;
2208 str << info;
2209 return str.str();
2210}
2211
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002212/** Formatted output of the PriorBoxLayerInfo.
2213 *
2214 * @param[in] info Type to output.
2215 *
2216 * @return Formatted string.
2217 */
2218inline std::string to_string(const PriorBoxLayerInfo &info)
2219{
2220 std::stringstream str;
2221 str << "{";
2222 str << "Clip:" << info.clip()
2223 << "Flip:" << info.flip()
2224 << "StepX:" << info.steps()[0]
2225 << "StepY:" << info.steps()[1]
2226 << "MinSizes:" << info.min_sizes().size()
2227 << "MaxSizes:" << info.max_sizes().size()
2228 << "ImgSizeX:" << info.img_size().x
2229 << "ImgSizeY:" << info.img_size().y
2230 << "Offset:" << info.offset()
2231 << "Variances:" << info.variances().size();
2232 str << "}";
2233 return str.str();
2234}
2235
Alex Gildayc357c472018-03-21 13:54:09 +00002236/** Formatted output of the Size2D type.
2237 *
2238 * @param[out] os Output stream
2239 * @param[in] size Type to output
2240 *
2241 * @return Modified output stream.
2242 */
John Richardson25f23682017-11-27 14:35:09 +00002243inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2244{
2245 os << size.width << "x" << size.height;
2246
2247 return os;
2248}
2249
Alex Gildayc357c472018-03-21 13:54:09 +00002250/** Formatted output of the Size2D type.
2251 *
2252 * @param[in] type Type to output
2253 *
2254 * @return Formatted string.
2255 */
John Richardson25f23682017-11-27 14:35:09 +00002256inline std::string to_string(const Size2D &type)
2257{
2258 std::stringstream str;
2259 str << type;
2260 return str.str();
2261}
2262
Alex Gildayc357c472018-03-21 13:54:09 +00002263/** Formatted output of the ConvolutionMethod type.
2264 *
2265 * @param[out] os Output stream
2266 * @param[in] conv_method Type to output
2267 *
2268 * @return Modified output stream.
2269 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002270inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2271{
2272 switch(conv_method)
2273 {
2274 case ConvolutionMethod::GEMM:
2275 os << "GEMM";
2276 break;
2277 case ConvolutionMethod::DIRECT:
2278 os << "DIRECT";
2279 break;
2280 case ConvolutionMethod::WINOGRAD:
2281 os << "WINOGRAD";
2282 break;
SiCongLid9287352021-11-03 19:01:22 +00002283 case ConvolutionMethod::FFT:
2284 os << "FFT";
2285 break;
2286 case ConvolutionMethod::GEMM_CONV2D:
2287 os << "GEMM_CONV2D";
2288 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002289 default:
2290 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2291 }
2292
2293 return os;
2294}
2295
Alex Gildayc357c472018-03-21 13:54:09 +00002296/** Formatted output of the ConvolutionMethod type.
2297 *
2298 * @param[in] conv_method Type to output
2299 *
2300 * @return Formatted string.
2301 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002302inline std::string to_string(const ConvolutionMethod &conv_method)
2303{
2304 std::stringstream str;
2305 str << conv_method;
2306 return str.str();
2307}
2308
Alex Gildayc357c472018-03-21 13:54:09 +00002309/** Formatted output of the GPUTarget type.
2310 *
2311 * @param[out] os Output stream
2312 * @param[in] gpu_target Type to output
2313 *
2314 * @return Modified output stream.
2315 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002316inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2317{
2318 switch(gpu_target)
2319 {
2320 case GPUTarget::GPU_ARCH_MASK:
2321 os << "GPU_ARCH_MASK";
2322 break;
2323 case GPUTarget::MIDGARD:
2324 os << "MIDGARD";
2325 break;
2326 case GPUTarget::BIFROST:
2327 os << "BIFROST";
2328 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002329 case GPUTarget::VALHALL:
2330 os << "VALHALL";
2331 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002332 case GPUTarget::T600:
2333 os << "T600";
2334 break;
2335 case GPUTarget::T700:
2336 os << "T700";
2337 break;
2338 case GPUTarget::T800:
2339 os << "T800";
2340 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002341 case GPUTarget::G71:
2342 os << "G71";
2343 break;
2344 case GPUTarget::G72:
2345 os << "G72";
2346 break;
2347 case GPUTarget::G51:
2348 os << "G51";
2349 break;
2350 case GPUTarget::G51BIG:
2351 os << "G51BIG";
2352 break;
2353 case GPUTarget::G51LIT:
2354 os << "G51LIT";
2355 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002356 case GPUTarget::G76:
2357 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002358 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002359 case GPUTarget::G77:
2360 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002361 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002362 case GPUTarget::G78:
2363 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002364 break;
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002365 case GPUTarget::G31:
2366 os << "G31";
2367 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002368 case GPUTarget::G710:
2369 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002370 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002371 case GPUTarget::G715:
2372 os << "G715";
2373 break;
2374 case GPUTarget::G615:
2375 os << "G615";
2376 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002377 default:
2378 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2379 }
2380
2381 return os;
2382}
2383
Alex Gildayc357c472018-03-21 13:54:09 +00002384/** Formatted output of the GPUTarget type.
2385 *
2386 * @param[in] gpu_target Type to output
2387 *
2388 * @return Formatted string.
2389 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002390inline std::string to_string(const GPUTarget &gpu_target)
2391{
2392 std::stringstream str;
2393 str << gpu_target;
2394 return str.str();
2395}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002396
John Richardson8de92612018-02-22 14:09:31 +00002397/** Formatted output of the DetectionWindow type.
2398 *
2399 * @param[out] os Output stream
2400 * @param[in] detection_window Type to output
2401 *
2402 * @return Modified output stream.
2403 */
John Richardson684cb0f2018-01-09 11:17:00 +00002404inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2405{
2406 os << "{x=" << detection_window.x << ","
2407 << "y=" << detection_window.y << ","
2408 << "width=" << detection_window.width << ","
2409 << "height=" << detection_window.height << ","
2410 << "idx_class=" << detection_window.idx_class << ","
2411 << "score=" << detection_window.score << "}";
2412
2413 return os;
2414}
2415
Isabella Gottardi05e56442018-11-16 11:26:52 +00002416/** Formatted output of the DetectionOutputLayerCodeType type.
2417 *
2418 * @param[out] os Output stream
2419 * @param[in] detection_code Type to output
2420 *
2421 * @return Modified output stream.
2422 */
2423inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2424{
2425 switch(detection_code)
2426 {
2427 case DetectionOutputLayerCodeType::CENTER_SIZE:
2428 os << "CENTER_SIZE";
2429 break;
2430 case DetectionOutputLayerCodeType::CORNER:
2431 os << "CORNER";
2432 break;
2433 case DetectionOutputLayerCodeType::CORNER_SIZE:
2434 os << "CORNER_SIZE";
2435 break;
2436 case DetectionOutputLayerCodeType::TF_CENTER:
2437 os << "TF_CENTER";
2438 break;
2439 default:
2440 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2441 }
2442
2443 return os;
2444}
2445/** Formatted output of the DetectionOutputLayerCodeType type.
2446 *
2447 * @param[in] detection_code Type to output
2448 *
2449 * @return Formatted string.
2450 */
2451inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2452{
2453 std::stringstream str;
2454 str << detection_code;
2455 return str.str();
2456}
2457
2458/** Formatted output of the DetectionOutputLayerInfo type.
2459 *
2460 * @param[out] os Output stream
2461 * @param[in] detection_info Type to output
2462 *
2463 * @return Modified output stream.
2464 */
2465inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2466{
2467 os << "{Classes=" << detection_info.num_classes() << ","
2468 << "ShareLocation=" << detection_info.share_location() << ","
2469 << "CodeType=" << detection_info.code_type() << ","
2470 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2471 << "KeepTopK=" << detection_info.keep_top_k() << ","
2472 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2473 << "Eta=" << detection_info.eta() << ","
2474 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2475 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2476 << "TopK=" << detection_info.top_k() << ","
2477 << "NumLocClasses=" << detection_info.num_loc_classes()
2478 << "}";
2479
2480 return os;
2481}
2482
2483/** Formatted output of the DetectionOutputLayerInfo type.
2484 *
2485 * @param[in] detection_info Type to output
2486 *
2487 * @return Formatted string.
2488 */
2489inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2490{
2491 std::stringstream str;
2492 str << detection_info;
2493 return str.str();
2494}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002495/** Formatted output of the DetectionPostProcessLayerInfo type.
2496 *
2497 * @param[out] os Output stream
2498 * @param[in] detection_info Type to output
2499 *
2500 * @return Modified output stream.
2501 */
2502inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2503{
2504 os << "{MaxDetections=" << detection_info.max_detections() << ","
2505 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2506 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2507 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2508 << "NumClasses=" << detection_info.num_classes() << ","
2509 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2510 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2511 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2512 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2513 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2514 << "DetectionPerClass=" << detection_info.detection_per_class()
2515 << "}";
2516
2517 return os;
2518}
2519
2520/** Formatted output of the DetectionPostProcessLayerInfo type.
2521 *
2522 * @param[in] detection_info Type to output
2523 *
2524 * @return Formatted string.
2525 */
2526inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2527{
2528 std::stringstream str;
2529 str << detection_info;
2530 return str.str();
2531}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002532
John Richardson8de92612018-02-22 14:09:31 +00002533/** Formatted output of the DetectionWindow type.
2534 *
2535 * @param[in] detection_window Type to output
2536 *
2537 * @return Formatted string.
2538 */
2539inline std::string to_string(const DetectionWindow &detection_window)
2540{
2541 std::stringstream str;
2542 str << detection_window;
2543 return str.str();
2544}
2545
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002546/** Formatted output of @ref PriorBoxLayerInfo.
2547 *
2548 * @param[out] os Output stream.
2549 * @param[in] info Type to output.
2550 *
2551 * @return Modified output stream.
2552 */
2553inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2554{
2555 os << "Clip:" << info.clip()
2556 << "Flip:" << info.flip()
2557 << "StepX:" << info.steps()[0]
2558 << "StepY:" << info.steps()[1]
2559 << "MinSizes:" << info.min_sizes()
2560 << "MaxSizes:" << info.max_sizes()
2561 << "ImgSizeX:" << info.img_size().x
2562 << "ImgSizeY:" << info.img_size().y
2563 << "Offset:" << info.offset()
2564 << "Variances:" << info.variances();
2565
2566 return os;
2567}
2568
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002569/** Formatted output of the WinogradInfo type. */
2570inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2571{
2572 os << "{OutputTileSize=" << info.output_tile_size << ","
2573 << "KernelSize=" << info.kernel_size << ","
2574 << "PadStride=" << info.convolution_info << ","
2575 << "OutputDataLayout=" << info.output_data_layout << "}";
2576
2577 return os;
2578}
2579
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002580inline std::string to_string(const WinogradInfo &type)
2581{
2582 std::stringstream str;
2583 str << type;
2584 return str.str();
2585}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002586
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002587/** Convert a CLTunerMode value to a string
2588 *
2589 * @param val CLTunerMode value to be converted
2590 *
2591 * @return String representing the corresponding CLTunerMode.
2592 */
2593inline std::string to_string(const CLTunerMode val)
2594{
2595 switch(val)
2596 {
2597 case CLTunerMode::EXHAUSTIVE:
2598 {
2599 return std::string("Exhaustive");
2600 }
2601 case CLTunerMode::NORMAL:
2602 {
2603 return std::string("Normal");
2604 }
2605 case CLTunerMode::RAPID:
2606 {
2607 return std::string("Rapid");
2608 }
2609 default:
2610 {
2611 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2612 return std::string("UNDEFINED");
2613 }
2614 }
2615}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002616/** Converts a @ref CLGEMMKernelType to string
2617 *
2618 * @param[in] val CLGEMMKernelType value to be converted
2619 *
2620 * @return String representing the corresponding CLGEMMKernelType
2621 */
2622inline std::string to_string(CLGEMMKernelType val)
2623{
2624 switch(val)
2625 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002626 case CLGEMMKernelType::NATIVE:
2627 {
2628 return "Native";
2629 }
2630 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2631 {
2632 return "Reshaped_Only_RHS";
2633 }
2634 case CLGEMMKernelType::RESHAPED:
2635 {
2636 return "Reshaped";
2637 }
2638 default:
2639 {
2640 return "Unknown";
2641 }
2642 }
2643}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002644/** [Print CLTunerMode type] **/
2645/** Formatted output of the CLTunerMode type.
2646 *
2647 * @param[out] os Output stream.
2648 * @param[in] val CLTunerMode to output.
2649 *
2650 * @return Modified output stream.
2651 */
2652inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2653{
2654 os << to_string(val);
2655 return os;
2656}
2657
ramelg013ae3d882021-09-12 23:07:47 +01002658/** Formatted output of the ConvolutionInfo type.
2659 *
2660 * @param[out] os Output stream.
2661 * @param[in] conv_info ConvolutionInfo to output.
2662 *
2663 * @return Modified output stream.
2664 */
2665inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2666{
SiCongLi579ca842021-10-18 09:38:33 +01002667 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2668 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2669 << "act_info=" << to_string(conv_info.act_info) << ", "
2670 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002671 return os;
2672}
2673
2674/** Converts a @ref ConvolutionInfo to string
2675 *
2676 * @param[in] info ConvolutionInfo value to be converted
2677 *
2678 * @return String representing the corresponding ConvolutionInfo
2679 */
2680inline std::string to_string(const ConvolutionInfo &info)
2681{
2682 std::stringstream str;
2683 str << info;
2684 return str.str();
2685}
2686
2687/** Formatted output of the FullyConnectedLayerInfo type.
2688 *
2689 * @param[out] os Output stream.
2690 * @param[in] layer_info FullyConnectedLayerInfo to output.
2691 *
2692 * @return Modified output stream.
2693 */
2694inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2695{
SiCongLi579ca842021-10-18 09:38:33 +01002696 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2697 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2698 << "transpose_weights=" << layer_info.transpose_weights << ", "
2699 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2700 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2701 << "constant_weights=" << layer_info.transpose_weights << ", "
2702 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002703 return os;
2704}
2705
2706/** Converts a @ref FullyConnectedLayerInfo to string
2707 *
2708 * @param[in] info FullyConnectedLayerInfo value to be converted
2709 *
2710 * @return String representing the corresponding FullyConnectedLayerInfo
2711 */
2712inline std::string to_string(const FullyConnectedLayerInfo &info)
2713{
2714 std::stringstream str;
2715 str << info;
2716 return str.str();
2717}
2718
2719/** Formatted output of the GEMMLowpOutputStageType type.
2720 *
2721 * @param[out] os Output stream.
2722 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2723 *
2724 * @return Modified output stream.
2725 */
2726inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2727{
2728 switch(gemm_type)
2729 {
2730 case GEMMLowpOutputStageType::NONE:
2731 os << "NONE";
2732 break;
2733 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2734 os << "QUANTIZE_DOWN";
2735 break;
2736 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2737 os << "QUANTIZE_DOWN_FIXEDPOINT";
2738 break;
2739 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2740 os << "QUANTIZE_DOWN_FLOAT";
2741 break;
2742 default:
2743 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2744 }
2745 return os;
2746}
2747
2748/** Converts a @ref GEMMLowpOutputStageType to string
2749 *
2750 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2751 *
2752 * @return String representing the corresponding GEMMLowpOutputStageType
2753 */
2754inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2755{
2756 std::stringstream str;
2757 str << gemm_type;
2758 return str.str();
2759}
2760
2761/** Formatted output of the GEMMLowpOutputStageInfo type.
2762 *
2763 * @param[out] os Output stream.
2764 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2765 *
2766 * @return Modified output stream.
2767 */
2768inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2769{
SiCongLi579ca842021-10-18 09:38:33 +01002770 os << "{type=" << gemm_info.type << ", "
2771 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2772 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2773 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2774 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2775 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2776 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2777 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2778 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2779 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2780 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002781 return os;
2782}
2783
2784/** Converts a @ref GEMMLowpOutputStageInfo to string
2785 *
2786 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2787 *
2788 * @return String representing the corresponding GEMMLowpOutputStageInfo
2789 */
2790inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2791{
2792 std::stringstream str;
2793 str << gemm_info;
2794 return str.str();
2795}
2796
2797/** Formatted output of the Conv2dInfo type.
2798 *
2799 * @param[out] os Output stream.
2800 * @param[in] conv_info Conv2dInfo to output.
2801 *
2802 * @return Modified output stream.
2803 */
2804inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2805{
SiCongLi579ca842021-10-18 09:38:33 +01002806 os << "{conv_info=" << conv_info.conv_info << ", "
2807 << "dilation=" << conv_info.dilation << ", "
2808 << "act_info=" << to_string(conv_info.act_info) << ", "
2809 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2810 << "num_groups=" << conv_info.num_groups << ","
2811 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002812 return os;
2813}
2814
2815/** Converts a @ref Conv2dInfo to string
2816 *
2817 * @param[in] conv_info Conv2dInfo value to be converted
2818 *
2819 * @return String representing the corresponding Conv2dInfo
2820 */
2821inline std::string to_string(const Conv2dInfo &conv_info)
2822{
2823 std::stringstream str;
2824 str << conv_info;
2825 return str.str();
2826}
2827
2828/** Formatted output of the PixelValue type.
2829 *
2830 * @param[out] os Output stream.
2831 * @param[in] pixel_value PixelValue to output.
2832 *
2833 * @return Modified output stream.
2834 */
2835inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2836{
SiCongLi579ca842021-10-18 09:38:33 +01002837 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002838 return os;
2839}
2840
2841/** Converts a @ref PixelValue to string
2842 *
2843 * @param[in] pixel_value PixelValue value to be converted
2844 *
2845 * @return String representing the corresponding PixelValue
2846 */
2847inline std::string to_string(const PixelValue &pixel_value)
2848{
2849 std::stringstream str;
2850 str << pixel_value;
2851 return str.str();
2852}
2853
2854/** Formatted output of the ScaleKernelInfo type.
2855 *
2856 * @param[out] os Output stream.
2857 * @param[in] scale_info ScaleKernelInfo to output.
2858 *
2859 * @return Modified output stream.
2860 */
2861inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2862{
SiCongLi579ca842021-10-18 09:38:33 +01002863 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2864 << "BorderMode=" << scale_info.border_mode << ", "
2865 << "PixelValue=" << scale_info.constant_border_value << ", "
2866 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2867 << "use_padding=" << scale_info.use_padding << ", "
2868 << "align_corners=" << scale_info.align_corners << ", "
2869 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002870 return os;
2871}
2872
2873/** Converts a @ref ScaleKernelInfo to string
2874 *
2875 * @param[in] scale_info ScaleKernelInfo value to be converted
2876 *
2877 * @return String representing the corresponding ScaleKernelInfo
2878 */
2879inline std::string to_string(const ScaleKernelInfo &scale_info)
2880{
2881 std::stringstream str;
2882 str << scale_info;
2883 return str.str();
2884}
2885
2886/** Formatted output of the FFTDirection type.
2887 *
2888 * @param[out] os Output stream.
2889 * @param[in] fft_dir FFTDirection to output.
2890 *
2891 * @return Modified output stream.
2892 */
2893inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2894{
2895 switch(fft_dir)
2896 {
2897 case FFTDirection::Forward:
2898 os << "Forward";
2899 break;
2900 case FFTDirection::Inverse:
2901 os << "Inverse";
2902 break;
2903 default:
2904 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2905 }
2906 return os;
2907}
2908
2909/** Converts a @ref FFT1DInfo to string
2910 *
2911 * @param[in] fft_dir FFT1DInfo value to be converted
2912 *
2913 * @return String representing the corresponding FFT1DInfo
2914 */
2915inline std::string to_string(const FFTDirection &fft_dir)
2916{
2917 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002918 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002919 return str.str();
2920}
2921
2922/** Formatted output of the FFT1DInfo type.
2923 *
2924 * @param[out] os Output stream.
2925 * @param[in] fft1d_info FFT1DInfo to output.
2926 *
2927 * @return Modified output stream.
2928 */
2929inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2930{
SiCongLi579ca842021-10-18 09:38:33 +01002931 os << "{axis=" << fft1d_info.axis << ", "
2932 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002933 return os;
2934}
2935
2936/** Converts a @ref FFT1DInfo to string
2937 *
2938 * @param[in] fft1d_info FFT1DInfo value to be converted
2939 *
2940 * @return String representing the corresponding FFT1DInfo
2941 */
2942inline std::string to_string(const FFT1DInfo &fft1d_info)
2943{
2944 std::stringstream str;
2945 str << fft1d_info;
2946 return str.str();
2947}
2948
2949/** Formatted output of the FFT2DInfo type.
2950 *
2951 * @param[out] os Output stream.
2952 * @param[in] fft2d_info FFT2DInfo to output.
2953 *
2954 * @return Modified output stream.
2955 */
2956inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2957{
SiCongLi579ca842021-10-18 09:38:33 +01002958 os << "{axis=" << fft2d_info.axis0 << ", "
2959 << "axis=" << fft2d_info.axis1 << ", "
2960 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002961 return os;
2962}
2963
2964/** Converts a @ref FFT2DInfo to string
2965 *
2966 * @param[in] fft2d_info FFT2DInfo value to be converted
2967 *
2968 * @return String representing the corresponding FFT2DInfo
2969 */
2970inline std::string to_string(const FFT2DInfo &fft2d_info)
2971{
2972 std::stringstream str;
2973 str << fft2d_info;
2974 return str.str();
2975}
2976
2977/** Formatted output of the Coordinates2D type.
2978 *
2979 * @param[out] os Output stream.
2980 * @param[in] coord_2d Coordinates2D to output.
2981 *
2982 * @return Modified output stream.
2983 */
2984inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2985{
SiCongLi579ca842021-10-18 09:38:33 +01002986 os << "{x=" << coord_2d.x << ", "
2987 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002988 return os;
2989}
2990
2991/** Converts a @ref Coordinates2D to string
2992 *
2993 * @param[in] coord_2d Coordinates2D value to be converted
2994 *
2995 * @return String representing the corresponding Coordinates2D
2996 */
2997inline std::string to_string(const Coordinates2D &coord_2d)
2998{
2999 std::stringstream str;
3000 str << coord_2d;
3001 return str.str();
3002}
3003
3004/** Formatted output of the FuseBatchNormalizationType type.
3005 *
3006 * @param[out] os Output stream.
3007 * @param[in] fuse_type FuseBatchNormalizationType to output.
3008 *
3009 * @return Modified output stream.
3010 */
3011inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3012{
3013 switch(fuse_type)
3014 {
3015 case FuseBatchNormalizationType::CONVOLUTION:
3016 os << "CONVOLUTION";
3017 break;
3018 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3019 os << "DEPTHWISECONVOLUTION";
3020 break;
3021 default:
3022 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3023 }
3024 return os;
3025}
3026
3027/** Converts a @ref FuseBatchNormalizationType to string
3028 *
3029 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3030 *
3031 * @return String representing the corresponding FuseBatchNormalizationType
3032 */
3033inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3034{
3035 std::stringstream str;
3036 str << fuse_type;
3037 return str.str();
3038}
3039
ramelg01cbbb0382021-09-17 17:36:57 +01003040/** Formatted output of the SoftmaxKernelInfo type.
3041 *
3042 * @param[out] os Output stream.
3043 * @param[in] info SoftmaxKernelInfo to output.
3044 *
3045 * @return Modified output stream.
3046 */
3047inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3048{
SiCongLi579ca842021-10-18 09:38:33 +01003049 os << "{beta=" << info.beta << ", "
3050 << "is_log=" << info.is_log << ", "
3051 << "input_data_type=" << info.input_data_type << ", "
3052 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003053 return os;
3054}
3055
3056/** Converts a @ref SoftmaxKernelInfo to string
3057 *
3058 * @param[in] info SoftmaxKernelInfo value to be converted
3059 *
3060 * @return String representing the corresponding SoftmaxKernelInfo
3061 */
3062inline std::string to_string(const SoftmaxKernelInfo &info)
3063{
3064 std::stringstream str;
3065 str << info;
3066 return str.str();
3067}
3068
3069/** Formatted output of the ScaleKernelInfo type.
3070 *
3071 * @param[out] os Output stream.
3072 * @param[in] lstm_params LSTMParams to output.
3073 *
3074 * @return Modified output stream.
3075 */
3076template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003077::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003078{
ramelg014a6d9e82021-10-02 14:34:36 +01003079 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3080 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3081 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3082 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3083 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3084 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3085 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3086 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3087 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3088 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3089 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3090 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003091 << "cell_clip=" << lstm_params.cell_clip() << ", "
3092 << "projection_clip=" << lstm_params.projection_clip() << ", "
3093 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3094 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3095 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3096 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3097 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3098 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3099 << "has_projection=" << lstm_params.has_projection() << ", "
3100 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3101 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3102 return os;
3103}
3104
3105/** Converts a @ref LSTMParams to string
3106 *
3107 * @param[in] lstm_params LSTMParams<T> value to be converted
3108 *
3109 * @return String representing the corresponding LSTMParams
3110 */
3111template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003112std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003113{
3114 std::stringstream str;
3115 str << lstm_params;
3116 return str.str();
3117}
3118
3119/** Converts a @ref LSTMParams to string
3120 *
3121 * @param[in] num uint8_t value to be converted
3122 *
3123 * @return String representing the corresponding uint8_t
3124 */
3125inline std::string to_string(const uint8_t num)
3126{
3127 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3128 return ::std::to_string(static_cast<int>(num));
3129}
3130
ramelg014a6d9e82021-10-02 14:34:36 +01003131/** Available non maxima suppression types */
3132/** Formatted output of the NMSType type.
3133 *
3134 * @param[out] os Output stream.
3135 * @param[in] nms_type NMSType to output.
3136 *
3137 * @return Modified output stream.
3138 */
3139inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3140{
3141 switch(nms_type)
3142 {
3143 case NMSType::LINEAR:
3144 os << "LINEAR";
3145 break;
3146 case NMSType::GAUSSIAN:
3147 os << "GAUSSIAN";
3148 break;
3149 case NMSType::ORIGINAL:
3150 os << "ORIGINAL";
3151 break;
3152 default:
3153 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3154 }
3155 return os;
3156}
3157
3158/** Converts a @ref NMSType to string
3159 *
3160 * @param[in] nms_type NMSType value to be converted
3161 *
3162 * @return String representing the corresponding NMSType
3163 */
3164inline std::string to_string(const NMSType nms_type)
3165{
3166 std::stringstream str;
3167 str << nms_type;
3168 return str.str();
3169}
3170
3171/** Formatted output of the BoxNMSLimitInfo type.
3172 *
3173 * @param[out] os Output stream.
3174 * @param[in] info BoxNMSLimitInfo to output.
3175 *
3176 * @return Modified output stream.
3177 */
3178inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3179{
SiCongLi579ca842021-10-18 09:38:33 +01003180 os << "{score_thresh=" << info.score_thresh() << ", "
3181 << "nms=" << info.nms() << ", "
3182 << "detections_per_im=" << info.detections_per_im() << ", "
3183 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3184 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3185 << "suppress_size=" << info.suppress_size() << ", "
3186 << "min_size=" << info.min_size() << ", "
3187 << "im_width=" << info.im_width() << ", "
3188 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003189 return os;
3190}
3191
3192/** Converts a @ref BoxNMSLimitInfo to string
3193 *
3194 * @param[in] info BoxNMSLimitInfo value to be converted
3195 *
3196 * @return String representing the corresponding BoxNMSLimitInfo
3197 */
3198inline std::string to_string(const BoxNMSLimitInfo &info)
3199{
3200 std::stringstream str;
3201 str << info;
3202 return str.str();
3203}
3204
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003205/** Converts a @ref DimensionRoundingType to string
3206 *
3207 * @param[in] rounding_type DimensionRoundingType value to be converted
3208 *
3209 * @return String representing the corresponding DimensionRoundingType
3210 */
3211inline std::string to_string(const DimensionRoundingType &rounding_type)
3212{
3213 std::stringstream str;
3214 str << rounding_type;
3215 return str.str();
3216}
3217
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003218/** Formatted output of the Conv3dInfo type.
3219 *
3220 * @param[out] os Output stream.
3221 * @param[in] conv3d_info Type to output.
3222 *
3223 * @return Modified output stream.
3224 */
3225inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3226{
3227 os << conv3d_info.stride;
3228 os << ";";
3229 os << conv3d_info.padding;
3230 os << ";";
3231 os << to_string(conv3d_info.act_info);
3232 os << ";";
3233 os << conv3d_info.dilation;
3234 os << ";";
3235 os << conv3d_info.round_type;
3236 os << ";";
3237 os << conv3d_info.enable_fast_math;
3238
3239 return os;
3240}
3241
3242/** Formatted output of the Conv3dInfo type.
3243 *
3244 * @param[in] conv3d_info Type to output.
3245 *
3246 * @return Formatted string.
3247 */
3248inline std::string to_string(const Conv3dInfo &conv3d_info)
3249{
3250 std::stringstream str;
3251 str << conv3d_info;
3252 return str.str();
3253}
3254
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003255inline ::std::ostream &operator<<(::std::ostream &os, const arm_gemm::WeightFormat &wf)
3256{
3257 os << arm_gemm::to_string(wf);
3258 return os;
3259}
3260inline std::string to_string(const arm_gemm::WeightFormat wf)
3261{
3262 std::stringstream str;
3263 str << wf;
3264 return str.str();
3265}
3266
3267inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_gemm::WeightFormat> values)
3268{
3269 std::stringstream str;
3270 str << "[Input shape = " << std::get<0>(values);
3271 str << ", ";
3272 str << "Expected output shape = " << std::get<1>(values);
3273
3274 str << ", ";
3275 str << "WeightFormat = " << std::get<2>(values) << "]";
3276 return str.str();
3277}
3278
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003279} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003280
3281#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */