blob: dae81e4a5ab8358c4c643e5d71edd32f904756a9 [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
475/** Formatted output of the BoundingBoxTransformInfo type.
476 *
477 * @param[in] bbox_info Type to output.
478 *
479 * @return Formatted string.
480 */
481inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
482{
483 std::stringstream str;
484 str << bbox_info;
485 return str.str();
486}
487
Manuel Bottini5209be52019-02-13 16:34:56 +0000488/** Formatted output of the ComputeAnchorsInfo type.
489 *
490 * @param[out] os Output stream.
491 * @param[in] anchors_info Type to output.
492 *
493 * @return Modified output stream.
494 */
495inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
496{
497 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
498 return os;
499}
500
501/** Formatted output of the ComputeAnchorsInfo type.
502 *
503 * @param[in] anchors_info Type to output.
504 *
505 * @return Formatted string.
506 */
507inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
508{
509 std::stringstream str;
510 str << anchors_info;
511 return str.str();
512}
513
514/** Formatted output of the GenerateProposalsInfo type.
515 *
516 * @param[out] os Output stream.
517 * @param[in] proposals_info Type to output.
518 *
519 * @return Modified output stream.
520 */
521inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
522{
523 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
524 return os;
525}
526
527/** Formatted output of the GenerateProposalsInfo type.
528 *
529 * @param[in] proposals_info Type to output.
530 *
531 * @return Formatted string.
532 */
533inline std::string to_string(const GenerateProposalsInfo &proposals_info)
534{
535 std::stringstream str;
536 str << proposals_info;
537 return str.str();
538}
539
Alex Gildayc357c472018-03-21 13:54:09 +0000540/** Formatted output of the QuantizationInfo type.
541 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100542 * @param[out] os Output stream.
543 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000544 *
545 * @return Modified output stream.
546 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100547inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700548{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100549 const UniformQuantizationInfo uqinfo = qinfo.uniform();
550 os << "Scale:" << uqinfo.scale << "~";
551 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700552 return os;
553}
554
Alex Gildayc357c472018-03-21 13:54:09 +0000555/** Formatted output of the QuantizationInfo type.
556 *
557 * @param[in] quantization_info Type to output.
558 *
559 * @return Formatted string.
560 */
Chunosovd621bca2017-11-03 17:33:15 +0700561inline std::string to_string(const QuantizationInfo &quantization_info)
562{
563 std::stringstream str;
564 str << quantization_info;
565 return str.str();
566}
567
Alex Gildayc357c472018-03-21 13:54:09 +0000568/** Formatted output of the activation function type.
569 *
570 * @param[out] os Output stream.
571 * @param[in] act_function Type to output.
572 *
573 * @return Modified output stream.
574 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100575inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
576{
577 switch(act_function)
578 {
579 case ActivationLayerInfo::ActivationFunction::ABS:
580 os << "ABS";
581 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100582 case ActivationLayerInfo::ActivationFunction::LINEAR:
583 os << "LINEAR";
584 break;
585 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
586 os << "LOGISTIC";
587 break;
588 case ActivationLayerInfo::ActivationFunction::RELU:
589 os << "RELU";
590 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100591 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
592 os << "BOUNDED_RELU";
593 break;
594 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
595 os << "LEAKY_RELU";
596 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100597 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
598 os << "SOFT_RELU";
599 break;
600 case ActivationLayerInfo::ActivationFunction::SQRT:
601 os << "SQRT";
602 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100603 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
604 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000605 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100606 case ActivationLayerInfo::ActivationFunction::ELU:
607 os << "ELU";
608 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100609 case ActivationLayerInfo::ActivationFunction::SQUARE:
610 os << "SQUARE";
611 break;
612 case ActivationLayerInfo::ActivationFunction::TANH:
613 os << "TANH";
614 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100615 case ActivationLayerInfo::ActivationFunction::IDENTITY:
616 os << "IDENTITY";
617 break;
morgolock07df3d42020-02-27 11:46:28 +0000618 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
619 os << "HARD_SWISH";
620 break;
621
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100622 default:
623 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
624 }
625
626 return os;
627}
628
Alex Gildayc357c472018-03-21 13:54:09 +0000629/** Formatted output of the activation function info type.
630 *
SiCongLi1af54162021-10-06 15:25:57 +0100631 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000632 *
633 * @return Formatted string.
634 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100635inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100636{
637 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000638 if(info.enabled())
639 {
640 str << info.activation();
641 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100642 return str.str();
643}
644
SiCongLi1af54162021-10-06 15:25:57 +0100645/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100646 *
SiCongLi1af54162021-10-06 15:25:57 +0100647 * @param[out] os Output stream.
648 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100649 *
650 * @return Formatted string.
651 */
SiCongLi1af54162021-10-06 15:25:57 +0100652inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100653{
ramelg013ae3d882021-09-12 23:07:47 +0100654 if(info != nullptr)
655 {
ramelg013ae3d882021-09-12 23:07:47 +0100656 if(info->enabled())
657 {
SiCongLi1af54162021-10-06 15:25:57 +0100658 os << info->activation();
659 os << "(";
660 os << "VAL_A=" << info->a() << ",";
661 os << "VAL_B=" << info->b();
662 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100663 }
SiCongLi1af54162021-10-06 15:25:57 +0100664 else
665 {
666 os << "disabled";
667 }
ramelg013ae3d882021-09-12 23:07:47 +0100668 }
SiCongLi1af54162021-10-06 15:25:57 +0100669 else
670 {
671 os << "nullptr";
672 }
673 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100674}
675
Alex Gildayc357c472018-03-21 13:54:09 +0000676/** Formatted output of the activation function type.
677 *
678 * @param[in] function Type to output.
679 *
680 * @return Formatted string.
681 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100682inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
683{
684 std::stringstream str;
685 str << function;
686 return str.str();
687}
688
Alex Gildayc357c472018-03-21 13:54:09 +0000689/** Formatted output of the NormType type.
690 *
691 * @param[out] os Output stream.
692 * @param[in] norm_type Type to output.
693 *
694 * @return Modified output stream.
695 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100696inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
697{
698 switch(norm_type)
699 {
700 case NormType::CROSS_MAP:
701 os << "CROSS_MAP";
702 break;
703 case NormType::IN_MAP_1D:
704 os << "IN_MAP_1D";
705 break;
706 case NormType::IN_MAP_2D:
707 os << "IN_MAP_2D";
708 break;
709 default:
710 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
711 }
712
713 return os;
714}
715
Alex Gildayc357c472018-03-21 13:54:09 +0000716/** Formatted output of @ref NormalizationLayerInfo.
717 *
718 * @param[in] info Type to output.
719 *
720 * @return Formatted string.
721 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100722inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100723{
724 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000725 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100726 return str.str();
727}
728
Alex Gildayc357c472018-03-21 13:54:09 +0000729/** Formatted output of @ref NormalizationLayerInfo.
730 *
731 * @param[out] os Output stream.
732 * @param[in] info Type to output.
733 *
734 * @return Modified output stream.
735 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100736inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
737{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000738 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100739 return os;
740}
741
Alex Gildayc357c472018-03-21 13:54:09 +0000742/** Formatted output of the PoolingType type.
743 *
744 * @param[out] os Output stream.
745 * @param[in] pool_type Type to output.
746 *
747 * @return Modified output stream.
748 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100749inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
750{
751 switch(pool_type)
752 {
753 case PoolingType::AVG:
754 os << "AVG";
755 break;
756 case PoolingType::MAX:
757 os << "MAX";
758 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100759 case PoolingType::L2:
760 os << "L2";
761 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100762 default:
763 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
764 }
765
766 return os;
767}
768
Alex Gildayc357c472018-03-21 13:54:09 +0000769/** Formatted output of @ref PoolingLayerInfo.
770 *
771 * @param[out] os Output stream.
772 * @param[in] info Type to output.
773 *
774 * @return Modified output stream.
775 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100776inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
777{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000778 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100779
780 return os;
781}
782
Alex Gildayc357c472018-03-21 13:54:09 +0000783/** Formatted output of @ref RoundingPolicy.
784 *
785 * @param[in] rounding_policy Type to output.
786 *
787 * @return Formatted string.
788 */
John Richardsondd715f22017-09-18 16:10:48 +0100789inline std::string to_string(const RoundingPolicy &rounding_policy)
790{
791 std::stringstream str;
792 str << rounding_policy;
793 return str.str();
794}
795
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000796/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000797/** Formatted output of the DataLayout type.
798 *
799 * @param[out] os Output stream.
800 * @param[in] data_layout Type to output.
801 *
802 * @return Modified output stream.
803 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000804inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
805{
806 switch(data_layout)
807 {
808 case DataLayout::UNKNOWN:
809 os << "UNKNOWN";
810 break;
811 case DataLayout::NHWC:
812 os << "NHWC";
813 break;
814 case DataLayout::NCHW:
815 os << "NCHW";
816 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100817 case DataLayout::NDHWC:
818 os << "NDHWC";
819 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100820 case DataLayout::NCDHW:
821 os << "NCDHW";
822 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000823 default:
824 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
825 }
826
827 return os;
828}
829
Alex Gildayc357c472018-03-21 13:54:09 +0000830/** Formatted output of the DataLayout type.
831 *
832 * @param[in] data_layout Type to output.
833 *
834 * @return Formatted string.
835 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000836inline std::string to_string(const arm_compute::DataLayout &data_layout)
837{
838 std::stringstream str;
839 str << data_layout;
840 return str.str();
841}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000842/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000843
Georgios Pinitase2220552018-07-20 13:23:44 +0100844/** Formatted output of the DataLayoutDimension type.
845 *
846 * @param[out] os Output stream.
847 * @param[in] data_layout_dim Data layout dimension to print.
848 *
849 * @return Modified output stream.
850 */
851inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
852{
853 switch(data_layout_dim)
854 {
855 case DataLayoutDimension::WIDTH:
856 os << "WIDTH";
857 break;
858 case DataLayoutDimension::HEIGHT:
859 os << "HEIGHT";
860 break;
861 case DataLayoutDimension::CHANNEL:
862 os << "CHANNEL";
863 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100864 case DataLayoutDimension::DEPTH:
865 os << "DEPTH";
866 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100867 case DataLayoutDimension::BATCHES:
868 os << "BATCHES";
869 break;
870 default:
871 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
872 }
873 return os;
874}
875
Alex Gildayc357c472018-03-21 13:54:09 +0000876/** Formatted output of the DataType type.
877 *
878 * @param[out] os Output stream.
879 * @param[in] data_type Type to output.
880 *
881 * @return Modified output stream.
882 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100883inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
884{
885 switch(data_type)
886 {
887 case DataType::UNKNOWN:
888 os << "UNKNOWN";
889 break;
890 case DataType::U8:
891 os << "U8";
892 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100893 case DataType::QSYMM8:
894 os << "QSYMM8";
895 break;
Chunosovd621bca2017-11-03 17:33:15 +0700896 case DataType::QASYMM8:
897 os << "QASYMM8";
898 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000899 case DataType::QASYMM8_SIGNED:
900 os << "QASYMM8_SIGNED";
901 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100902 case DataType::QSYMM8_PER_CHANNEL:
903 os << "QSYMM8_PER_CHANNEL";
904 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100905 case DataType::S8:
906 os << "S8";
907 break;
908 case DataType::U16:
909 os << "U16";
910 break;
911 case DataType::S16:
912 os << "S16";
913 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100914 case DataType::QSYMM16:
915 os << "QSYMM16";
916 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100917 case DataType::QASYMM16:
918 os << "QASYMM16";
919 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100920 case DataType::U32:
921 os << "U32";
922 break;
923 case DataType::S32:
924 os << "S32";
925 break;
926 case DataType::U64:
927 os << "U64";
928 break;
929 case DataType::S64:
930 os << "S64";
931 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000932 case DataType::BFLOAT16:
933 os << "BFLOAT16";
934 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100935 case DataType::F16:
936 os << "F16";
937 break;
938 case DataType::F32:
939 os << "F32";
940 break;
941 case DataType::F64:
942 os << "F64";
943 break;
944 case DataType::SIZET:
945 os << "SIZET";
946 break;
947 default:
948 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
949 }
950
951 return os;
952}
953
Alex Gildayc357c472018-03-21 13:54:09 +0000954/** Formatted output of the DataType type.
955 *
956 * @param[in] data_type Type to output.
957 *
958 * @return Formatted string.
959 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100960inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100961{
962 std::stringstream str;
963 str << data_type;
964 return str.str();
965}
966
Alex Gildayc357c472018-03-21 13:54:09 +0000967/** Formatted output of the Format type.
968 *
969 * @param[out] os Output stream.
970 * @param[in] format Type to output.
971 *
972 * @return Modified output stream.
973 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100974inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
975{
976 switch(format)
977 {
978 case Format::UNKNOWN:
979 os << "UNKNOWN";
980 break;
981 case Format::U8:
982 os << "U8";
983 break;
984 case Format::S16:
985 os << "S16";
986 break;
987 case Format::U16:
988 os << "U16";
989 break;
990 case Format::S32:
991 os << "S32";
992 break;
993 case Format::U32:
994 os << "U32";
995 break;
996 case Format::F16:
997 os << "F16";
998 break;
999 case Format::F32:
1000 os << "F32";
1001 break;
1002 case Format::UV88:
1003 os << "UV88";
1004 break;
1005 case Format::RGB888:
1006 os << "RGB888";
1007 break;
1008 case Format::RGBA8888:
1009 os << "RGBA8888";
1010 break;
1011 case Format::YUV444:
1012 os << "YUV444";
1013 break;
1014 case Format::YUYV422:
1015 os << "YUYV422";
1016 break;
1017 case Format::NV12:
1018 os << "NV12";
1019 break;
1020 case Format::NV21:
1021 os << "NV21";
1022 break;
1023 case Format::IYUV:
1024 os << "IYUV";
1025 break;
1026 case Format::UYVY422:
1027 os << "UYVY422";
1028 break;
1029 default:
1030 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1031 }
1032
1033 return os;
1034}
1035
Alex Gildayc357c472018-03-21 13:54:09 +00001036/** Formatted output of the Format type.
1037 *
1038 * @param[in] format Type to output.
1039 *
1040 * @return Formatted string.
1041 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001042inline std::string to_string(const Format &format)
1043{
1044 std::stringstream str;
1045 str << format;
1046 return str.str();
1047}
1048
Alex Gildayc357c472018-03-21 13:54:09 +00001049/** Formatted output of the Channel type.
1050 *
1051 * @param[out] os Output stream.
1052 * @param[in] channel Type to output.
1053 *
1054 * @return Modified output stream.
1055 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001056inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1057{
1058 switch(channel)
1059 {
1060 case Channel::UNKNOWN:
1061 os << "UNKNOWN";
1062 break;
1063 case Channel::C0:
1064 os << "C0";
1065 break;
1066 case Channel::C1:
1067 os << "C1";
1068 break;
1069 case Channel::C2:
1070 os << "C2";
1071 break;
1072 case Channel::C3:
1073 os << "C3";
1074 break;
1075 case Channel::R:
1076 os << "R";
1077 break;
1078 case Channel::G:
1079 os << "G";
1080 break;
1081 case Channel::B:
1082 os << "B";
1083 break;
1084 case Channel::A:
1085 os << "A";
1086 break;
1087 case Channel::Y:
1088 os << "Y";
1089 break;
1090 case Channel::U:
1091 os << "U";
1092 break;
1093 case Channel::V:
1094 os << "V";
1095 break;
1096 default:
1097 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1098 }
1099
1100 return os;
1101}
1102
Alex Gildayc357c472018-03-21 13:54:09 +00001103/** Formatted output of the Channel type.
1104 *
1105 * @param[in] channel Type to output.
1106 *
1107 * @return Formatted string.
1108 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001109inline std::string to_string(const Channel &channel)
1110{
1111 std::stringstream str;
1112 str << channel;
1113 return str.str();
1114}
1115
Alex Gildayc357c472018-03-21 13:54:09 +00001116/** Formatted output of the BorderMode type.
1117 *
1118 * @param[out] os Output stream.
1119 * @param[in] mode Type to output.
1120 *
1121 * @return Modified output stream.
1122 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001123inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1124{
1125 switch(mode)
1126 {
1127 case BorderMode::UNDEFINED:
1128 os << "UNDEFINED";
1129 break;
1130 case BorderMode::CONSTANT:
1131 os << "CONSTANT";
1132 break;
1133 case BorderMode::REPLICATE:
1134 os << "REPLICATE";
1135 break;
1136 default:
1137 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1138 }
1139
1140 return os;
1141}
1142
Alex Gildayc357c472018-03-21 13:54:09 +00001143/** Formatted output of the BorderSize type.
1144 *
1145 * @param[out] os Output stream.
1146 * @param[in] border Type to output.
1147 *
1148 * @return Modified output stream.
1149 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001150inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1151{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001152 os << border.top << ","
1153 << border.right << ","
1154 << border.bottom << ","
1155 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001156
1157 return os;
1158}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001159
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001160/** Formatted output of the PaddingList type.
1161 *
1162 * @param[out] os Output stream.
1163 * @param[in] padding Type to output.
1164 *
1165 * @return Modified output stream.
1166 */
1167inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1168{
1169 os << "{";
1170 for(auto const &p : padding)
1171 {
1172 os << "{" << p.first << "," << p.second << "}";
1173 }
1174 os << "}";
1175 return os;
1176}
1177
giuros013175fcf2018-11-21 09:59:17 +00001178/** Formatted output of the Multiples type.
1179 *
1180 * @param[out] os Output stream.
1181 * @param[in] multiples Type to output.
1182 *
1183 * @return Modified output stream.
1184 */
1185inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1186{
1187 os << "(";
1188 for(size_t i = 0; i < multiples.size() - 1; i++)
1189 {
1190 os << multiples[i] << ", ";
1191 }
1192 os << multiples.back() << ")";
1193 return os;
1194}
1195
Alex Gildayc357c472018-03-21 13:54:09 +00001196/** Formatted output of the InterpolationPolicy type.
1197 *
1198 * @param[out] os Output stream.
1199 * @param[in] policy Type to output.
1200 *
1201 * @return Modified output stream.
1202 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001203inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1204{
1205 switch(policy)
1206 {
1207 case InterpolationPolicy::NEAREST_NEIGHBOR:
1208 os << "NEAREST_NEIGHBOR";
1209 break;
1210 case InterpolationPolicy::BILINEAR:
1211 os << "BILINEAR";
1212 break;
1213 case InterpolationPolicy::AREA:
1214 os << "AREA";
1215 break;
1216 default:
1217 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1218 }
1219
1220 return os;
1221}
1222
Alex Gildayc357c472018-03-21 13:54:09 +00001223/** Formatted output of the SamplingPolicy type.
1224 *
1225 * @param[out] os Output stream.
1226 * @param[in] policy Type to output.
1227 *
1228 * @return Modified output stream.
1229 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001230inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1231{
1232 switch(policy)
1233 {
1234 case SamplingPolicy::CENTER:
1235 os << "CENTER";
1236 break;
1237 case SamplingPolicy::TOP_LEFT:
1238 os << "TOP_LEFT";
1239 break;
1240 default:
1241 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1242 }
1243
1244 return os;
1245}
1246
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001247/** Formatted output of the ITensorInfo type.
1248 *
1249 * @param[out] os Output stream.
1250 * @param[in] info Tensor information.
1251 *
1252 * @return Modified output stream.
1253 */
1254inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1255{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001256 const DataType data_type = info->data_type();
1257 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001258
1259 os << "Shape=" << info->tensor_shape() << ","
1260 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001261 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001262
1263 if(is_data_type_quantized(data_type))
1264 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001265 const QuantizationInfo qinfo = info->quantization_info();
1266 const auto scales = qinfo.scale();
1267 const auto offsets = qinfo.offset();
1268
ramelg014a6d9e82021-10-02 14:34:36 +01001269 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001270 << "scales.size=" << scales.size()
1271 << ", scale(s)=" << scales << ", ";
1272
1273 os << "offsets.size=" << offsets.size()
1274 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001275 }
1276 return os;
1277}
1278
ramelg013ae3d882021-09-12 23:07:47 +01001279/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001280 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001281 * @param[out] os Output stream.
1282 * @param[in] info Type to output.
1283 *
1284 * @return Modified output stream.
1285 */
1286inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1287{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001288 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001289 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001290}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001291
ramelg013ae3d882021-09-12 23:07:47 +01001292/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001293 *
Alex Gildayc357c472018-03-21 13:54:09 +00001294 * @param[in] info Type to output.
1295 *
1296 * @return Formatted string.
1297 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001298inline std::string to_string(const TensorInfo &info)
1299{
1300 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001301 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001302 return str.str();
1303}
1304
ramelg013ae3d882021-09-12 23:07:47 +01001305/** Formatted output of the const ITensorInfo& type.
1306 *
1307 * @param[in] info Type to output.
1308 *
1309 * @return Formatted string.
1310 */
1311inline std::string to_string(const ITensorInfo &info)
1312{
1313 std::stringstream str;
1314 str << &info;
1315 return str.str();
1316}
1317
ramelg013ae3d882021-09-12 23:07:47 +01001318/** Formatted output of the const ITensorInfo* type.
1319 *
1320 * @param[in] info Type to output.
1321 *
1322 * @return Formatted string.
1323 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001324inline std::string to_string(const ITensorInfo *info)
1325{
ramelg013ae3d882021-09-12 23:07:47 +01001326 std::string ret_str = "nullptr";
1327 if(info != nullptr)
1328 {
1329 std::stringstream str;
1330 str << info;
1331 ret_str = str.str();
1332 }
1333 return ret_str;
1334}
1335
ramelg01cbbb0382021-09-17 17:36:57 +01001336/** Formatted output of the ITensorInfo* type.
1337 *
1338 * @param[in] info Type to output.
1339 *
1340 * @return Formatted string.
1341 */
1342inline std::string to_string(ITensorInfo *info)
1343{
1344 return to_string(static_cast<const ITensorInfo *>(info));
1345}
1346
1347/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001348 *
1349 * @param[in] tensor Type to output.
1350 *
1351 * @return Formatted string.
1352 */
1353inline std::string to_string(const ITensor *tensor)
1354{
1355 std::string ret_str = "nullptr";
1356 if(tensor != nullptr)
1357 {
1358 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001359 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001360 ret_str = str.str();
1361 }
1362 return ret_str;
1363}
1364
ramelg01cbbb0382021-09-17 17:36:57 +01001365/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001366 *
1367 * @param[in] tensor Type to output.
1368 *
1369 * @return Formatted string.
1370 */
1371inline std::string to_string(ITensor *tensor)
1372{
ramelg01cbbb0382021-09-17 17:36:57 +01001373 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001374}
1375
ramelg01cbbb0382021-09-17 17:36:57 +01001376/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001377 *
1378 * @param[in] tensor Type to output.
1379 *
1380 * @return Formatted string.
1381 */
1382inline std::string to_string(ITensor &tensor)
1383{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001384 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001385 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001386 return str.str();
1387}
1388
ramelg01cbbb0382021-09-17 17:36:57 +01001389#ifdef ARM_COMPUTE_OPENCL_ENABLED
1390/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1391 *
1392 * @param[in] cl_tensor Type to output.
1393 *
1394 * @return Formatted string.
1395 */
1396inline std::string to_string(const ICLTensor *cl_tensor)
1397{
1398 std::string ret_str = "nullptr";
1399 if(cl_tensor != nullptr)
1400 {
1401 std::stringstream str;
1402 str << "ICLTensor->info(): " << cl_tensor->info();
1403 ret_str = str.str();
1404 }
1405 return ret_str;
1406}
1407
1408/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1409 *
1410 * @param[in] cl_tensor Type to output.
1411 *
1412 * @return Formatted string.
1413 */
1414inline std::string to_string(ICLTensor *cl_tensor)
1415{
1416 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1417}
1418#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1419
Alex Gildayc357c472018-03-21 13:54:09 +00001420/** Formatted output of the Dimensions type.
1421 *
1422 * @param[in] dimensions Type to output.
1423 *
1424 * @return Formatted string.
1425 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001426template <typename T>
1427inline std::string to_string(const Dimensions<T> &dimensions)
1428{
1429 std::stringstream str;
1430 str << dimensions;
1431 return str.str();
1432}
1433
Alex Gildayc357c472018-03-21 13:54:09 +00001434/** Formatted output of the Strides type.
1435 *
1436 * @param[in] stride Type to output.
1437 *
1438 * @return Formatted string.
1439 */
John Richardsona36eae12017-09-26 16:55:59 +01001440inline std::string to_string(const Strides &stride)
1441{
1442 std::stringstream str;
1443 str << stride;
1444 return str.str();
1445}
1446
Alex Gildayc357c472018-03-21 13:54:09 +00001447/** Formatted output of the TensorShape type.
1448 *
1449 * @param[in] shape Type to output.
1450 *
1451 * @return Formatted string.
1452 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001453inline std::string to_string(const TensorShape &shape)
1454{
1455 std::stringstream str;
1456 str << shape;
1457 return str.str();
1458}
1459
Alex Gildayc357c472018-03-21 13:54:09 +00001460/** Formatted output of the Coordinates type.
1461 *
1462 * @param[in] coord Type to output.
1463 *
1464 * @return Formatted string.
1465 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001466inline std::string to_string(const Coordinates &coord)
1467{
1468 std::stringstream str;
1469 str << coord;
1470 return str.str();
1471}
1472
Anthony Barbierb940fd62018-06-04 14:14:32 +01001473/** Formatted output of the GEMMReshapeInfo type.
1474 *
1475 * @param[out] os Output stream.
1476 * @param[in] info Type to output.
1477 *
1478 * @return Modified output stream.
1479 */
1480inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1481{
1482 os << "{m=" << info.m() << ",";
1483 os << "n=" << info.n() << ",";
1484 os << "k=" << info.k() << ",";
1485 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1486 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1487 os << "}";
1488
1489 return os;
1490}
1491
1492/** Formatted output of the GEMMInfo type.
1493 *
1494 * @param[out] os Output stream.
1495 * @param[in] info Type to output.
1496 *
1497 * @return Modified output stream.
1498 */
1499inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1500{
1501 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1502 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1503 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001504 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1505 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1506 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1507 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1508 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001509 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001510 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001511
1512 return os;
1513}
1514
1515/** Formatted output of the Window::Dimension type.
1516 *
1517 * @param[out] os Output stream.
1518 * @param[in] dim Type to output.
1519 *
1520 * @return Modified output stream.
1521 */
1522inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1523{
1524 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1525
1526 return os;
1527}
1528/** Formatted output of the Window type.
1529 *
1530 * @param[out] os Output stream.
1531 * @param[in] win Type to output.
1532 *
1533 * @return Modified output stream.
1534 */
1535inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1536{
1537 os << "{";
1538 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1539 {
1540 if(i > 0)
1541 {
1542 os << ", ";
1543 }
1544 os << win[i];
1545 }
1546 os << "}";
1547
1548 return os;
1549}
1550
1551/** Formatted output of the WeightsInfo type.
1552 *
1553 * @param[in] info Type to output.
1554 *
1555 * @return Formatted string.
1556 */
1557inline std::string to_string(const WeightsInfo &info)
1558{
1559 std::stringstream str;
1560 str << info;
1561 return str.str();
1562}
1563
1564/** Formatted output of the GEMMReshapeInfo type.
1565 *
1566 * @param[in] info Type to output.
1567 *
1568 * @return Formatted string.
1569 */
1570inline std::string to_string(const GEMMReshapeInfo &info)
1571{
1572 std::stringstream str;
1573 str << info;
1574 return str.str();
1575}
1576
1577/** Formatted output of the GEMMInfo type.
1578 *
1579 * @param[in] info Type to output.
1580 *
1581 * @return Formatted string.
1582 */
1583inline std::string to_string(const GEMMInfo &info)
1584{
1585 std::stringstream str;
1586 str << info;
1587 return str.str();
1588}
1589
1590/** Formatted output of the Window::Dimension type.
1591 *
1592 * @param[in] dim Type to output.
1593 *
1594 * @return Formatted string.
1595 */
1596inline std::string to_string(const Window::Dimension &dim)
1597{
1598 std::stringstream str;
1599 str << dim;
1600 return str.str();
1601}
ramelg01cbbb0382021-09-17 17:36:57 +01001602/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001603 *
1604 * @param[in] win Type to output.
1605 *
1606 * @return Formatted string.
1607 */
1608inline std::string to_string(const Window &win)
1609{
1610 std::stringstream str;
1611 str << win;
1612 return str.str();
1613}
1614
ramelg01cbbb0382021-09-17 17:36:57 +01001615/** Formatted output of the Window* type.
1616 *
1617 * @param[in] win Type to output.
1618 *
1619 * @return Formatted string.
1620 */
1621inline std::string to_string(Window *win)
1622{
1623 std::string ret_str = "nullptr";
1624 if(win != nullptr)
1625 {
1626 std::stringstream str;
1627 str << *win;
1628 ret_str = str.str();
1629 }
1630 return ret_str;
1631}
1632
Alex Gildayc357c472018-03-21 13:54:09 +00001633/** Formatted output of the Rectangle type.
1634 *
1635 * @param[out] os Output stream.
1636 * @param[in] rect Type to output.
1637 *
1638 * @return Modified output stream.
1639 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001640inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1641{
1642 os << rect.width << "x" << rect.height;
1643 os << "+" << rect.x << "+" << rect.y;
1644
1645 return os;
1646}
1647
Usama Arif8cf8c112019-03-14 15:36:54 +00001648/** Formatted output of the PaddingMode type.
1649 *
1650 * @param[out] os Output stream.
1651 * @param[in] mode Type to output.
1652 *
1653 * @return Modified output stream.
1654 */
1655inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1656{
1657 switch(mode)
1658 {
1659 case PaddingMode::CONSTANT:
1660 os << "CONSTANT";
1661 break;
1662 case PaddingMode::REFLECT:
1663 os << "REFLECT";
1664 break;
1665 case PaddingMode::SYMMETRIC:
1666 os << "SYMMETRIC";
1667 break;
1668 default:
1669 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1670 }
1671
1672 return os;
1673}
1674
1675/** Formatted output of the PaddingMode type.
1676 *
1677 * @param[in] mode Type to output.
1678 *
1679 * @return Formatted string.
1680 */
1681inline std::string to_string(const PaddingMode &mode)
1682{
1683 std::stringstream str;
1684 str << mode;
1685 return str.str();
1686}
1687
Alex Gildayc357c472018-03-21 13:54:09 +00001688/** Formatted output of the PadStrideInfo type.
1689 *
1690 * @param[out] os Output stream.
1691 * @param[in] pad_stride_info Type to output.
1692 *
1693 * @return Modified output stream.
1694 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001695inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1696{
1697 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1698 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001699 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1700 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001701
1702 return os;
1703}
1704
Alex Gildayc357c472018-03-21 13:54:09 +00001705/** Formatted output of the PadStrideInfo type.
1706 *
1707 * @param[in] pad_stride_info Type to output.
1708 *
1709 * @return Formatted string.
1710 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001711inline std::string to_string(const PadStrideInfo &pad_stride_info)
1712{
1713 std::stringstream str;
1714 str << pad_stride_info;
1715 return str.str();
1716}
1717
Alex Gildayc357c472018-03-21 13:54:09 +00001718/** Formatted output of the BorderMode type.
1719 *
1720 * @param[in] mode Type to output.
1721 *
1722 * @return Formatted string.
1723 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001724inline std::string to_string(const BorderMode &mode)
1725{
1726 std::stringstream str;
1727 str << mode;
1728 return str.str();
1729}
1730
Alex Gildayc357c472018-03-21 13:54:09 +00001731/** Formatted output of the BorderSize type.
1732 *
1733 * @param[in] border Type to output.
1734 *
1735 * @return Formatted string.
1736 */
John Richardsonb482ce12017-09-18 12:44:01 +01001737inline std::string to_string(const BorderSize &border)
1738{
1739 std::stringstream str;
1740 str << border;
1741 return str.str();
1742}
1743
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001744/** Formatted output of the PaddingList type.
1745 *
1746 * @param[in] padding Type to output.
1747 *
1748 * @return Formatted string.
1749 */
1750inline std::string to_string(const PaddingList &padding)
1751{
1752 std::stringstream str;
1753 str << padding;
1754 return str.str();
1755}
1756
giuros013175fcf2018-11-21 09:59:17 +00001757/** Formatted output of the Multiples type.
1758 *
1759 * @param[in] multiples Type to output.
1760 *
1761 * @return Formatted string.
1762 */
1763inline std::string to_string(const Multiples &multiples)
1764{
1765 std::stringstream str;
1766 str << multiples;
1767 return str.str();
1768}
1769
Alex Gildayc357c472018-03-21 13:54:09 +00001770/** Formatted output of the InterpolationPolicy type.
1771 *
1772 * @param[in] policy Type to output.
1773 *
1774 * @return Formatted string.
1775 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001776inline std::string to_string(const InterpolationPolicy &policy)
1777{
1778 std::stringstream str;
1779 str << policy;
1780 return str.str();
1781}
1782
Alex Gildayc357c472018-03-21 13:54:09 +00001783/** Formatted output of the SamplingPolicy type.
1784 *
1785 * @param[in] policy Type to output.
1786 *
1787 * @return Formatted string.
1788 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001789inline std::string to_string(const SamplingPolicy &policy)
1790{
1791 std::stringstream str;
1792 str << policy;
1793 return str.str();
1794}
1795
Alex Gildayc357c472018-03-21 13:54:09 +00001796/** Formatted output of the ConvertPolicy type.
1797 *
1798 * @param[out] os Output stream.
1799 * @param[in] policy Type to output.
1800 *
1801 * @return Modified output stream.
1802 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001803inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1804{
1805 switch(policy)
1806 {
1807 case ConvertPolicy::WRAP:
1808 os << "WRAP";
1809 break;
1810 case ConvertPolicy::SATURATE:
1811 os << "SATURATE";
1812 break;
1813 default:
1814 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1815 }
1816
1817 return os;
1818}
1819
1820inline std::string to_string(const ConvertPolicy &policy)
1821{
1822 std::stringstream str;
1823 str << policy;
1824 return str.str();
1825}
1826
giuros01164a2722018-11-20 18:34:46 +00001827/** Formatted output of the ArithmeticOperation type.
1828 *
1829 * @param[out] os Output stream.
1830 * @param[in] op Operation to output.
1831 *
1832 * @return Modified output stream.
1833 */
1834inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1835{
1836 switch(op)
1837 {
1838 case ArithmeticOperation::ADD:
1839 os << "ADD";
1840 break;
1841 case ArithmeticOperation::SUB:
1842 os << "SUB";
1843 break;
1844 case ArithmeticOperation::DIV:
1845 os << "DIV";
1846 break;
1847 case ArithmeticOperation::MAX:
1848 os << "MAX";
1849 break;
1850 case ArithmeticOperation::MIN:
1851 os << "MIN";
1852 break;
1853 case ArithmeticOperation::SQUARED_DIFF:
1854 os << "SQUARED_DIFF";
1855 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001856 case ArithmeticOperation::POWER:
1857 os << "POWER";
1858 break;
giuros01164a2722018-11-20 18:34:46 +00001859 default:
1860 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1861 }
1862
1863 return os;
1864}
1865
1866/** Formatted output of the Arithmetic Operation
1867 *
1868 * @param[in] op Type to output.
1869 *
1870 * @return Formatted string.
1871 */
1872inline std::string to_string(const ArithmeticOperation &op)
1873{
1874 std::stringstream str;
1875 str << op;
1876 return str.str();
1877}
1878
Alex Gildayc357c472018-03-21 13:54:09 +00001879/** Formatted output of the Reduction Operations.
1880 *
1881 * @param[out] os Output stream.
1882 * @param[in] op Type to output.
1883 *
1884 * @return Modified output stream.
1885 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001886inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1887{
1888 switch(op)
1889 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001890 case ReductionOperation::SUM:
1891 os << "SUM";
1892 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001893 case ReductionOperation::SUM_SQUARE:
1894 os << "SUM_SQUARE";
1895 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001896 case ReductionOperation::MEAN_SUM:
1897 os << "MEAN_SUM";
1898 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001899 case ReductionOperation::ARG_IDX_MAX:
1900 os << "ARG_IDX_MAX";
1901 break;
1902 case ReductionOperation::ARG_IDX_MIN:
1903 os << "ARG_IDX_MIN";
1904 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001905 case ReductionOperation::PROD:
1906 os << "PROD";
1907 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001908 case ReductionOperation::MIN:
1909 os << "MIN";
1910 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001911 case ReductionOperation::MAX:
1912 os << "MAX";
1913 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001914 default:
1915 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1916 }
1917
1918 return os;
1919}
1920
Alex Gildayc357c472018-03-21 13:54:09 +00001921/** Formatted output of the Reduction Operations.
1922 *
1923 * @param[in] op Type to output.
1924 *
1925 * @return Formatted string.
1926 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001927inline std::string to_string(const ReductionOperation &op)
1928{
1929 std::stringstream str;
1930 str << op;
1931 return str.str();
1932}
1933
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001934/** Formatted output of the Comparison Operations.
1935 *
1936 * @param[out] os Output stream.
1937 * @param[in] op Type to output.
1938 *
1939 * @return Modified output stream.
1940 */
1941inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1942{
1943 switch(op)
1944 {
1945 case ComparisonOperation::Equal:
1946 os << "Equal";
1947 break;
1948 case ComparisonOperation::NotEqual:
1949 os << "NotEqual";
1950 break;
1951 case ComparisonOperation::Greater:
1952 os << "Greater";
1953 break;
1954 case ComparisonOperation::GreaterEqual:
1955 os << "GreaterEqual";
1956 break;
1957 case ComparisonOperation::Less:
1958 os << "Less";
1959 break;
1960 case ComparisonOperation::LessEqual:
1961 os << "LessEqual";
1962 break;
1963 default:
1964 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1965 }
1966
1967 return os;
1968}
1969
Michalis Spyroue9362622018-11-23 17:41:37 +00001970/** Formatted output of the Elementwise unary Operations.
1971 *
1972 * @param[out] os Output stream.
1973 * @param[in] op Type to output.
1974 *
1975 * @return Modified output stream.
1976 */
1977inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1978{
1979 switch(op)
1980 {
1981 case ElementWiseUnary::RSQRT:
1982 os << "RSQRT";
1983 break;
1984 case ElementWiseUnary::EXP:
1985 os << "EXP";
1986 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001987 case ElementWiseUnary::NEG:
1988 os << "NEG";
1989 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01001990 case ElementWiseUnary::LOG:
1991 os << "LOG";
1992 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01001993 case ElementWiseUnary::SIN:
1994 os << "SIN";
1995 break;
1996 case ElementWiseUnary::ABS:
1997 os << "ABS";
1998 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01001999 case ElementWiseUnary::ROUND:
2000 os << "ROUND";
2001 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002002 case ElementWiseUnary::LOGICAL_NOT:
2003 os << "LOGICAL_NOT";
2004 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002005 default:
2006 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2007 }
2008
2009 return os;
2010}
2011
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002012/** Formatted output of the Comparison Operations.
2013 *
2014 * @param[in] op Type to output.
2015 *
2016 * @return Formatted string.
2017 */
2018inline std::string to_string(const ComparisonOperation &op)
2019{
2020 std::stringstream str;
2021 str << op;
2022 return str.str();
2023}
2024
Michalis Spyroue9362622018-11-23 17:41:37 +00002025/** Formatted output of the Elementwise unary Operations.
2026 *
2027 * @param[in] op Type to output.
2028 *
2029 * @return Formatted string.
2030 */
2031inline std::string to_string(const ElementWiseUnary &op)
2032{
2033 std::stringstream str;
2034 str << op;
2035 return str.str();
2036}
2037
Alex Gildayc357c472018-03-21 13:54:09 +00002038/** Formatted output of the Norm Type.
2039 *
2040 * @param[in] type Type to output.
2041 *
2042 * @return Formatted string.
2043 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002044inline std::string to_string(const NormType &type)
2045{
2046 std::stringstream str;
2047 str << type;
2048 return str.str();
2049}
2050
Alex Gildayc357c472018-03-21 13:54:09 +00002051/** Formatted output of the Pooling Type.
2052 *
2053 * @param[in] type Type to output.
2054 *
2055 * @return Formatted string.
2056 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002057inline std::string to_string(const PoolingType &type)
2058{
2059 std::stringstream str;
2060 str << type;
2061 return str.str();
2062}
2063
Alex Gildayc357c472018-03-21 13:54:09 +00002064/** Formatted output of the Pooling Layer Info.
2065 *
2066 * @param[in] info Type to output.
2067 *
2068 * @return Formatted string.
2069 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002070inline std::string to_string(const PoolingLayerInfo &info)
2071{
2072 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002073 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002074 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002075 << "IsGlobalPooling=" << info.is_global_pooling;
2076 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002077 {
2078 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002079 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2080 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002081 }
2082 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002083 return str.str();
2084}
2085
ramelg0137515692022-02-26 22:06:20 +00002086/** Formatted output of the Size3D type.
2087 *
2088 * @param[out] os Output stream
2089 * @param[in] size Type to output
2090 *
2091 * @return Modified output stream.
2092 */
2093inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2094{
2095 os << size.width << "x" << size.height << "x" << size.depth;
2096
2097 return os;
2098}
2099
2100/** Formatted output of the Size3D type.
2101 *
2102 * @param[in] type Type to output
2103 *
2104 * @return Formatted string.
2105 */
2106inline std::string to_string(const Size3D &type)
2107{
2108 std::stringstream str;
2109 str << type;
2110 return str.str();
2111}
2112
2113/** Formatted output of the Padding3D type.
2114 *
2115 * @param[out] os Output stream.
2116 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2117 *
2118 * @return Modified output stream.
2119 */
2120inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2121{
2122 os << padding3d.left << "," << padding3d.right << ","
2123 << padding3d.top << "," << padding3d.bottom << ","
2124 << padding3d.front << "," << padding3d.back;
2125 return os;
2126}
2127
2128/** Converts a @ref Padding3D to string
2129 *
2130 * @param[in] padding3d Padding3D value to be converted
2131 *
2132 * @return String representing the corresponding Padding3D
2133 */
2134inline std::string to_string(const Padding3D &padding3d)
2135{
2136 std::stringstream str;
2137 str << padding3d;
2138 return str.str();
2139}
2140
2141/** Formatted output of the DimensionRoundingType type.
2142 *
2143 * @param[out] os Output stream.
2144 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2145 *
2146 * @return Modified output stream.
2147 */
2148inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2149{
2150 switch(rounding_type)
2151 {
2152 case DimensionRoundingType::CEIL:
2153 os << "CEIL";
2154 break;
2155 case DimensionRoundingType::FLOOR:
2156 os << "FLOOR";
2157 break;
2158 default:
2159 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2160 }
2161 return os;
2162}
2163
2164/** Formatted output of the Pooling 3d Layer Info.
2165 *
2166 * @param[out] os Output stream.
2167 * @param[in] info Pooling 3D layer info to print to output stream.
2168 *
2169 * @return Modified output stream.
2170 */
2171inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2172{
2173 os << "{Type=" << info.pool_type << ","
2174 << "IsGlobalPooling=" << info.is_global_pooling;
2175 if(!info.is_global_pooling)
2176 {
2177 os << ","
2178 << "PoolSize=" << info.pool_size << ", "
2179 << "Stride=" << info.stride << ", "
2180 << "Padding=" << info.padding << ", "
2181 << "Exclude Padding=" << info.exclude_padding << ", "
2182 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2183 << "DimensionRoundingType=" << info.round_type;
2184 }
2185 os << "}";
2186 return os;
2187}
2188
2189/** Formatted output of the Pooling 3d Layer Info.
2190 *
2191 * @param[in] info Type to output.
2192 *
2193 * @return Formatted string.
2194 */
2195inline std::string to_string(const Pooling3dLayerInfo &info)
2196{
2197 std::stringstream str;
2198 str << info;
2199 return str.str();
2200}
2201
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002202/** Formatted output of the PriorBoxLayerInfo.
2203 *
2204 * @param[in] info Type to output.
2205 *
2206 * @return Formatted string.
2207 */
2208inline std::string to_string(const PriorBoxLayerInfo &info)
2209{
2210 std::stringstream str;
2211 str << "{";
2212 str << "Clip:" << info.clip()
2213 << "Flip:" << info.flip()
2214 << "StepX:" << info.steps()[0]
2215 << "StepY:" << info.steps()[1]
2216 << "MinSizes:" << info.min_sizes().size()
2217 << "MaxSizes:" << info.max_sizes().size()
2218 << "ImgSizeX:" << info.img_size().x
2219 << "ImgSizeY:" << info.img_size().y
2220 << "Offset:" << info.offset()
2221 << "Variances:" << info.variances().size();
2222 str << "}";
2223 return str.str();
2224}
2225
Alex Gildayc357c472018-03-21 13:54:09 +00002226/** Formatted output of the Size2D type.
2227 *
2228 * @param[out] os Output stream
2229 * @param[in] size Type to output
2230 *
2231 * @return Modified output stream.
2232 */
John Richardson25f23682017-11-27 14:35:09 +00002233inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2234{
2235 os << size.width << "x" << size.height;
2236
2237 return os;
2238}
2239
Alex Gildayc357c472018-03-21 13:54:09 +00002240/** Formatted output of the Size2D type.
2241 *
2242 * @param[in] type Type to output
2243 *
2244 * @return Formatted string.
2245 */
John Richardson25f23682017-11-27 14:35:09 +00002246inline std::string to_string(const Size2D &type)
2247{
2248 std::stringstream str;
2249 str << type;
2250 return str.str();
2251}
2252
Alex Gildayc357c472018-03-21 13:54:09 +00002253/** Formatted output of the ConvolutionMethod type.
2254 *
2255 * @param[out] os Output stream
2256 * @param[in] conv_method Type to output
2257 *
2258 * @return Modified output stream.
2259 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002260inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2261{
2262 switch(conv_method)
2263 {
2264 case ConvolutionMethod::GEMM:
2265 os << "GEMM";
2266 break;
2267 case ConvolutionMethod::DIRECT:
2268 os << "DIRECT";
2269 break;
2270 case ConvolutionMethod::WINOGRAD:
2271 os << "WINOGRAD";
2272 break;
SiCongLid9287352021-11-03 19:01:22 +00002273 case ConvolutionMethod::FFT:
2274 os << "FFT";
2275 break;
2276 case ConvolutionMethod::GEMM_CONV2D:
2277 os << "GEMM_CONV2D";
2278 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002279 default:
2280 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2281 }
2282
2283 return os;
2284}
2285
Alex Gildayc357c472018-03-21 13:54:09 +00002286/** Formatted output of the ConvolutionMethod type.
2287 *
2288 * @param[in] conv_method Type to output
2289 *
2290 * @return Formatted string.
2291 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002292inline std::string to_string(const ConvolutionMethod &conv_method)
2293{
2294 std::stringstream str;
2295 str << conv_method;
2296 return str.str();
2297}
2298
Alex Gildayc357c472018-03-21 13:54:09 +00002299/** Formatted output of the GPUTarget type.
2300 *
2301 * @param[out] os Output stream
2302 * @param[in] gpu_target Type to output
2303 *
2304 * @return Modified output stream.
2305 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002306inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2307{
2308 switch(gpu_target)
2309 {
2310 case GPUTarget::GPU_ARCH_MASK:
2311 os << "GPU_ARCH_MASK";
2312 break;
2313 case GPUTarget::MIDGARD:
2314 os << "MIDGARD";
2315 break;
2316 case GPUTarget::BIFROST:
2317 os << "BIFROST";
2318 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002319 case GPUTarget::VALHALL:
2320 os << "VALHALL";
2321 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002322 case GPUTarget::T600:
2323 os << "T600";
2324 break;
2325 case GPUTarget::T700:
2326 os << "T700";
2327 break;
2328 case GPUTarget::T800:
2329 os << "T800";
2330 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002331 case GPUTarget::G71:
2332 os << "G71";
2333 break;
2334 case GPUTarget::G72:
2335 os << "G72";
2336 break;
2337 case GPUTarget::G51:
2338 os << "G51";
2339 break;
2340 case GPUTarget::G51BIG:
2341 os << "G51BIG";
2342 break;
2343 case GPUTarget::G51LIT:
2344 os << "G51LIT";
2345 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002346 case GPUTarget::G76:
2347 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002348 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002349 case GPUTarget::G77:
2350 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002351 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002352 case GPUTarget::G78:
2353 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002354 break;
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002355 case GPUTarget::G31:
2356 os << "G31";
2357 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002358 case GPUTarget::G710:
2359 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002360 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002361 default:
2362 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2363 }
2364
2365 return os;
2366}
2367
Alex Gildayc357c472018-03-21 13:54:09 +00002368/** Formatted output of the GPUTarget type.
2369 *
2370 * @param[in] gpu_target Type to output
2371 *
2372 * @return Formatted string.
2373 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002374inline std::string to_string(const GPUTarget &gpu_target)
2375{
2376 std::stringstream str;
2377 str << gpu_target;
2378 return str.str();
2379}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002380
John Richardson8de92612018-02-22 14:09:31 +00002381/** Formatted output of the DetectionWindow type.
2382 *
2383 * @param[out] os Output stream
2384 * @param[in] detection_window Type to output
2385 *
2386 * @return Modified output stream.
2387 */
John Richardson684cb0f2018-01-09 11:17:00 +00002388inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2389{
2390 os << "{x=" << detection_window.x << ","
2391 << "y=" << detection_window.y << ","
2392 << "width=" << detection_window.width << ","
2393 << "height=" << detection_window.height << ","
2394 << "idx_class=" << detection_window.idx_class << ","
2395 << "score=" << detection_window.score << "}";
2396
2397 return os;
2398}
2399
Isabella Gottardi05e56442018-11-16 11:26:52 +00002400/** Formatted output of the DetectionOutputLayerCodeType type.
2401 *
2402 * @param[out] os Output stream
2403 * @param[in] detection_code Type to output
2404 *
2405 * @return Modified output stream.
2406 */
2407inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2408{
2409 switch(detection_code)
2410 {
2411 case DetectionOutputLayerCodeType::CENTER_SIZE:
2412 os << "CENTER_SIZE";
2413 break;
2414 case DetectionOutputLayerCodeType::CORNER:
2415 os << "CORNER";
2416 break;
2417 case DetectionOutputLayerCodeType::CORNER_SIZE:
2418 os << "CORNER_SIZE";
2419 break;
2420 case DetectionOutputLayerCodeType::TF_CENTER:
2421 os << "TF_CENTER";
2422 break;
2423 default:
2424 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2425 }
2426
2427 return os;
2428}
2429/** Formatted output of the DetectionOutputLayerCodeType type.
2430 *
2431 * @param[in] detection_code Type to output
2432 *
2433 * @return Formatted string.
2434 */
2435inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2436{
2437 std::stringstream str;
2438 str << detection_code;
2439 return str.str();
2440}
2441
2442/** Formatted output of the DetectionOutputLayerInfo type.
2443 *
2444 * @param[out] os Output stream
2445 * @param[in] detection_info Type to output
2446 *
2447 * @return Modified output stream.
2448 */
2449inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2450{
2451 os << "{Classes=" << detection_info.num_classes() << ","
2452 << "ShareLocation=" << detection_info.share_location() << ","
2453 << "CodeType=" << detection_info.code_type() << ","
2454 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2455 << "KeepTopK=" << detection_info.keep_top_k() << ","
2456 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2457 << "Eta=" << detection_info.eta() << ","
2458 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2459 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2460 << "TopK=" << detection_info.top_k() << ","
2461 << "NumLocClasses=" << detection_info.num_loc_classes()
2462 << "}";
2463
2464 return os;
2465}
2466
2467/** Formatted output of the DetectionOutputLayerInfo type.
2468 *
2469 * @param[in] detection_info Type to output
2470 *
2471 * @return Formatted string.
2472 */
2473inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2474{
2475 std::stringstream str;
2476 str << detection_info;
2477 return str.str();
2478}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002479/** Formatted output of the DetectionPostProcessLayerInfo type.
2480 *
2481 * @param[out] os Output stream
2482 * @param[in] detection_info Type to output
2483 *
2484 * @return Modified output stream.
2485 */
2486inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2487{
2488 os << "{MaxDetections=" << detection_info.max_detections() << ","
2489 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2490 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2491 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2492 << "NumClasses=" << detection_info.num_classes() << ","
2493 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2494 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2495 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2496 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2497 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2498 << "DetectionPerClass=" << detection_info.detection_per_class()
2499 << "}";
2500
2501 return os;
2502}
2503
2504/** Formatted output of the DetectionPostProcessLayerInfo type.
2505 *
2506 * @param[in] detection_info Type to output
2507 *
2508 * @return Formatted string.
2509 */
2510inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2511{
2512 std::stringstream str;
2513 str << detection_info;
2514 return str.str();
2515}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002516
John Richardson8de92612018-02-22 14:09:31 +00002517/** Formatted output of the DetectionWindow type.
2518 *
2519 * @param[in] detection_window Type to output
2520 *
2521 * @return Formatted string.
2522 */
2523inline std::string to_string(const DetectionWindow &detection_window)
2524{
2525 std::stringstream str;
2526 str << detection_window;
2527 return str.str();
2528}
2529
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002530/** Formatted output of @ref PriorBoxLayerInfo.
2531 *
2532 * @param[out] os Output stream.
2533 * @param[in] info Type to output.
2534 *
2535 * @return Modified output stream.
2536 */
2537inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2538{
2539 os << "Clip:" << info.clip()
2540 << "Flip:" << info.flip()
2541 << "StepX:" << info.steps()[0]
2542 << "StepY:" << info.steps()[1]
2543 << "MinSizes:" << info.min_sizes()
2544 << "MaxSizes:" << info.max_sizes()
2545 << "ImgSizeX:" << info.img_size().x
2546 << "ImgSizeY:" << info.img_size().y
2547 << "Offset:" << info.offset()
2548 << "Variances:" << info.variances();
2549
2550 return os;
2551}
2552
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002553/** Formatted output of the WinogradInfo type. */
2554inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2555{
2556 os << "{OutputTileSize=" << info.output_tile_size << ","
2557 << "KernelSize=" << info.kernel_size << ","
2558 << "PadStride=" << info.convolution_info << ","
2559 << "OutputDataLayout=" << info.output_data_layout << "}";
2560
2561 return os;
2562}
2563
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002564inline std::string to_string(const WinogradInfo &type)
2565{
2566 std::stringstream str;
2567 str << type;
2568 return str.str();
2569}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002570
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002571/** Convert a CLTunerMode value to a string
2572 *
2573 * @param val CLTunerMode value to be converted
2574 *
2575 * @return String representing the corresponding CLTunerMode.
2576 */
2577inline std::string to_string(const CLTunerMode val)
2578{
2579 switch(val)
2580 {
2581 case CLTunerMode::EXHAUSTIVE:
2582 {
2583 return std::string("Exhaustive");
2584 }
2585 case CLTunerMode::NORMAL:
2586 {
2587 return std::string("Normal");
2588 }
2589 case CLTunerMode::RAPID:
2590 {
2591 return std::string("Rapid");
2592 }
2593 default:
2594 {
2595 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2596 return std::string("UNDEFINED");
2597 }
2598 }
2599}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002600/** Converts a @ref CLGEMMKernelType to string
2601 *
2602 * @param[in] val CLGEMMKernelType value to be converted
2603 *
2604 * @return String representing the corresponding CLGEMMKernelType
2605 */
2606inline std::string to_string(CLGEMMKernelType val)
2607{
2608 switch(val)
2609 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002610 case CLGEMMKernelType::NATIVE:
2611 {
2612 return "Native";
2613 }
2614 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2615 {
2616 return "Reshaped_Only_RHS";
2617 }
2618 case CLGEMMKernelType::RESHAPED:
2619 {
2620 return "Reshaped";
2621 }
2622 default:
2623 {
2624 return "Unknown";
2625 }
2626 }
2627}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002628/** [Print CLTunerMode type] **/
2629/** Formatted output of the CLTunerMode type.
2630 *
2631 * @param[out] os Output stream.
2632 * @param[in] val CLTunerMode to output.
2633 *
2634 * @return Modified output stream.
2635 */
2636inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2637{
2638 os << to_string(val);
2639 return os;
2640}
2641
ramelg013ae3d882021-09-12 23:07:47 +01002642/** Formatted output of the ConvolutionInfo type.
2643 *
2644 * @param[out] os Output stream.
2645 * @param[in] conv_info ConvolutionInfo to output.
2646 *
2647 * @return Modified output stream.
2648 */
2649inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2650{
SiCongLi579ca842021-10-18 09:38:33 +01002651 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2652 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2653 << "act_info=" << to_string(conv_info.act_info) << ", "
2654 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002655 return os;
2656}
2657
2658/** Converts a @ref ConvolutionInfo to string
2659 *
2660 * @param[in] info ConvolutionInfo value to be converted
2661 *
2662 * @return String representing the corresponding ConvolutionInfo
2663 */
2664inline std::string to_string(const ConvolutionInfo &info)
2665{
2666 std::stringstream str;
2667 str << info;
2668 return str.str();
2669}
2670
2671/** Formatted output of the FullyConnectedLayerInfo type.
2672 *
2673 * @param[out] os Output stream.
2674 * @param[in] layer_info FullyConnectedLayerInfo to output.
2675 *
2676 * @return Modified output stream.
2677 */
2678inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2679{
SiCongLi579ca842021-10-18 09:38:33 +01002680 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2681 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2682 << "transpose_weights=" << layer_info.transpose_weights << ", "
2683 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2684 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2685 << "constant_weights=" << layer_info.transpose_weights << ", "
2686 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002687 return os;
2688}
2689
2690/** Converts a @ref FullyConnectedLayerInfo to string
2691 *
2692 * @param[in] info FullyConnectedLayerInfo value to be converted
2693 *
2694 * @return String representing the corresponding FullyConnectedLayerInfo
2695 */
2696inline std::string to_string(const FullyConnectedLayerInfo &info)
2697{
2698 std::stringstream str;
2699 str << info;
2700 return str.str();
2701}
2702
2703/** Formatted output of the GEMMLowpOutputStageType type.
2704 *
2705 * @param[out] os Output stream.
2706 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2707 *
2708 * @return Modified output stream.
2709 */
2710inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2711{
2712 switch(gemm_type)
2713 {
2714 case GEMMLowpOutputStageType::NONE:
2715 os << "NONE";
2716 break;
2717 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2718 os << "QUANTIZE_DOWN";
2719 break;
2720 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2721 os << "QUANTIZE_DOWN_FIXEDPOINT";
2722 break;
2723 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2724 os << "QUANTIZE_DOWN_FLOAT";
2725 break;
2726 default:
2727 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2728 }
2729 return os;
2730}
2731
2732/** Converts a @ref GEMMLowpOutputStageType to string
2733 *
2734 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2735 *
2736 * @return String representing the corresponding GEMMLowpOutputStageType
2737 */
2738inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2739{
2740 std::stringstream str;
2741 str << gemm_type;
2742 return str.str();
2743}
2744
2745/** Formatted output of the GEMMLowpOutputStageInfo type.
2746 *
2747 * @param[out] os Output stream.
2748 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2749 *
2750 * @return Modified output stream.
2751 */
2752inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2753{
SiCongLi579ca842021-10-18 09:38:33 +01002754 os << "{type=" << gemm_info.type << ", "
2755 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2756 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2757 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2758 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2759 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2760 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2761 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2762 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2763 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2764 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002765 return os;
2766}
2767
2768/** Converts a @ref GEMMLowpOutputStageInfo to string
2769 *
2770 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2771 *
2772 * @return String representing the corresponding GEMMLowpOutputStageInfo
2773 */
2774inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2775{
2776 std::stringstream str;
2777 str << gemm_info;
2778 return str.str();
2779}
2780
2781/** Formatted output of the Conv2dInfo type.
2782 *
2783 * @param[out] os Output stream.
2784 * @param[in] conv_info Conv2dInfo to output.
2785 *
2786 * @return Modified output stream.
2787 */
2788inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2789{
SiCongLi579ca842021-10-18 09:38:33 +01002790 os << "{conv_info=" << conv_info.conv_info << ", "
2791 << "dilation=" << conv_info.dilation << ", "
2792 << "act_info=" << to_string(conv_info.act_info) << ", "
2793 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2794 << "num_groups=" << conv_info.num_groups << ","
2795 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002796 return os;
2797}
2798
2799/** Converts a @ref Conv2dInfo to string
2800 *
2801 * @param[in] conv_info Conv2dInfo value to be converted
2802 *
2803 * @return String representing the corresponding Conv2dInfo
2804 */
2805inline std::string to_string(const Conv2dInfo &conv_info)
2806{
2807 std::stringstream str;
2808 str << conv_info;
2809 return str.str();
2810}
2811
2812/** Formatted output of the PixelValue type.
2813 *
2814 * @param[out] os Output stream.
2815 * @param[in] pixel_value PixelValue to output.
2816 *
2817 * @return Modified output stream.
2818 */
2819inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2820{
SiCongLi579ca842021-10-18 09:38:33 +01002821 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002822 return os;
2823}
2824
2825/** Converts a @ref PixelValue to string
2826 *
2827 * @param[in] pixel_value PixelValue value to be converted
2828 *
2829 * @return String representing the corresponding PixelValue
2830 */
2831inline std::string to_string(const PixelValue &pixel_value)
2832{
2833 std::stringstream str;
2834 str << pixel_value;
2835 return str.str();
2836}
2837
2838/** Formatted output of the ScaleKernelInfo type.
2839 *
2840 * @param[out] os Output stream.
2841 * @param[in] scale_info ScaleKernelInfo to output.
2842 *
2843 * @return Modified output stream.
2844 */
2845inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2846{
SiCongLi579ca842021-10-18 09:38:33 +01002847 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2848 << "BorderMode=" << scale_info.border_mode << ", "
2849 << "PixelValue=" << scale_info.constant_border_value << ", "
2850 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2851 << "use_padding=" << scale_info.use_padding << ", "
2852 << "align_corners=" << scale_info.align_corners << ", "
2853 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002854 return os;
2855}
2856
2857/** Converts a @ref ScaleKernelInfo to string
2858 *
2859 * @param[in] scale_info ScaleKernelInfo value to be converted
2860 *
2861 * @return String representing the corresponding ScaleKernelInfo
2862 */
2863inline std::string to_string(const ScaleKernelInfo &scale_info)
2864{
2865 std::stringstream str;
2866 str << scale_info;
2867 return str.str();
2868}
2869
2870/** Formatted output of the FFTDirection type.
2871 *
2872 * @param[out] os Output stream.
2873 * @param[in] fft_dir FFTDirection to output.
2874 *
2875 * @return Modified output stream.
2876 */
2877inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2878{
2879 switch(fft_dir)
2880 {
2881 case FFTDirection::Forward:
2882 os << "Forward";
2883 break;
2884 case FFTDirection::Inverse:
2885 os << "Inverse";
2886 break;
2887 default:
2888 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2889 }
2890 return os;
2891}
2892
2893/** Converts a @ref FFT1DInfo to string
2894 *
2895 * @param[in] fft_dir FFT1DInfo value to be converted
2896 *
2897 * @return String representing the corresponding FFT1DInfo
2898 */
2899inline std::string to_string(const FFTDirection &fft_dir)
2900{
2901 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002902 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002903 return str.str();
2904}
2905
2906/** Formatted output of the FFT1DInfo type.
2907 *
2908 * @param[out] os Output stream.
2909 * @param[in] fft1d_info FFT1DInfo to output.
2910 *
2911 * @return Modified output stream.
2912 */
2913inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2914{
SiCongLi579ca842021-10-18 09:38:33 +01002915 os << "{axis=" << fft1d_info.axis << ", "
2916 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002917 return os;
2918}
2919
2920/** Converts a @ref FFT1DInfo to string
2921 *
2922 * @param[in] fft1d_info FFT1DInfo value to be converted
2923 *
2924 * @return String representing the corresponding FFT1DInfo
2925 */
2926inline std::string to_string(const FFT1DInfo &fft1d_info)
2927{
2928 std::stringstream str;
2929 str << fft1d_info;
2930 return str.str();
2931}
2932
2933/** Formatted output of the FFT2DInfo type.
2934 *
2935 * @param[out] os Output stream.
2936 * @param[in] fft2d_info FFT2DInfo to output.
2937 *
2938 * @return Modified output stream.
2939 */
2940inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2941{
SiCongLi579ca842021-10-18 09:38:33 +01002942 os << "{axis=" << fft2d_info.axis0 << ", "
2943 << "axis=" << fft2d_info.axis1 << ", "
2944 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002945 return os;
2946}
2947
2948/** Converts a @ref FFT2DInfo to string
2949 *
2950 * @param[in] fft2d_info FFT2DInfo value to be converted
2951 *
2952 * @return String representing the corresponding FFT2DInfo
2953 */
2954inline std::string to_string(const FFT2DInfo &fft2d_info)
2955{
2956 std::stringstream str;
2957 str << fft2d_info;
2958 return str.str();
2959}
2960
2961/** Formatted output of the Coordinates2D type.
2962 *
2963 * @param[out] os Output stream.
2964 * @param[in] coord_2d Coordinates2D to output.
2965 *
2966 * @return Modified output stream.
2967 */
2968inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2969{
SiCongLi579ca842021-10-18 09:38:33 +01002970 os << "{x=" << coord_2d.x << ", "
2971 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002972 return os;
2973}
2974
2975/** Converts a @ref Coordinates2D to string
2976 *
2977 * @param[in] coord_2d Coordinates2D value to be converted
2978 *
2979 * @return String representing the corresponding Coordinates2D
2980 */
2981inline std::string to_string(const Coordinates2D &coord_2d)
2982{
2983 std::stringstream str;
2984 str << coord_2d;
2985 return str.str();
2986}
2987
2988/** Formatted output of the FuseBatchNormalizationType type.
2989 *
2990 * @param[out] os Output stream.
2991 * @param[in] fuse_type FuseBatchNormalizationType to output.
2992 *
2993 * @return Modified output stream.
2994 */
2995inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2996{
2997 switch(fuse_type)
2998 {
2999 case FuseBatchNormalizationType::CONVOLUTION:
3000 os << "CONVOLUTION";
3001 break;
3002 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3003 os << "DEPTHWISECONVOLUTION";
3004 break;
3005 default:
3006 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3007 }
3008 return os;
3009}
3010
3011/** Converts a @ref FuseBatchNormalizationType to string
3012 *
3013 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3014 *
3015 * @return String representing the corresponding FuseBatchNormalizationType
3016 */
3017inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3018{
3019 std::stringstream str;
3020 str << fuse_type;
3021 return str.str();
3022}
3023
ramelg01cbbb0382021-09-17 17:36:57 +01003024/** Formatted output of the SoftmaxKernelInfo type.
3025 *
3026 * @param[out] os Output stream.
3027 * @param[in] info SoftmaxKernelInfo to output.
3028 *
3029 * @return Modified output stream.
3030 */
3031inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3032{
SiCongLi579ca842021-10-18 09:38:33 +01003033 os << "{beta=" << info.beta << ", "
3034 << "is_log=" << info.is_log << ", "
3035 << "input_data_type=" << info.input_data_type << ", "
3036 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003037 return os;
3038}
3039
3040/** Converts a @ref SoftmaxKernelInfo to string
3041 *
3042 * @param[in] info SoftmaxKernelInfo value to be converted
3043 *
3044 * @return String representing the corresponding SoftmaxKernelInfo
3045 */
3046inline std::string to_string(const SoftmaxKernelInfo &info)
3047{
3048 std::stringstream str;
3049 str << info;
3050 return str.str();
3051}
3052
3053/** Formatted output of the ScaleKernelInfo type.
3054 *
3055 * @param[out] os Output stream.
3056 * @param[in] lstm_params LSTMParams to output.
3057 *
3058 * @return Modified output stream.
3059 */
3060template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003061::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003062{
ramelg014a6d9e82021-10-02 14:34:36 +01003063 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3064 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3065 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3066 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3067 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3068 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3069 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3070 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3071 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3072 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3073 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3074 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003075 << "cell_clip=" << lstm_params.cell_clip() << ", "
3076 << "projection_clip=" << lstm_params.projection_clip() << ", "
3077 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3078 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3079 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3080 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3081 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3082 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3083 << "has_projection=" << lstm_params.has_projection() << ", "
3084 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3085 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3086 return os;
3087}
3088
3089/** Converts a @ref LSTMParams to string
3090 *
3091 * @param[in] lstm_params LSTMParams<T> value to be converted
3092 *
3093 * @return String representing the corresponding LSTMParams
3094 */
3095template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003096std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003097{
3098 std::stringstream str;
3099 str << lstm_params;
3100 return str.str();
3101}
3102
3103/** Converts a @ref LSTMParams to string
3104 *
3105 * @param[in] num uint8_t value to be converted
3106 *
3107 * @return String representing the corresponding uint8_t
3108 */
3109inline std::string to_string(const uint8_t num)
3110{
3111 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3112 return ::std::to_string(static_cast<int>(num));
3113}
3114
ramelg014a6d9e82021-10-02 14:34:36 +01003115/** Available non maxima suppression types */
3116/** Formatted output of the NMSType type.
3117 *
3118 * @param[out] os Output stream.
3119 * @param[in] nms_type NMSType to output.
3120 *
3121 * @return Modified output stream.
3122 */
3123inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3124{
3125 switch(nms_type)
3126 {
3127 case NMSType::LINEAR:
3128 os << "LINEAR";
3129 break;
3130 case NMSType::GAUSSIAN:
3131 os << "GAUSSIAN";
3132 break;
3133 case NMSType::ORIGINAL:
3134 os << "ORIGINAL";
3135 break;
3136 default:
3137 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3138 }
3139 return os;
3140}
3141
3142/** Converts a @ref NMSType to string
3143 *
3144 * @param[in] nms_type NMSType value to be converted
3145 *
3146 * @return String representing the corresponding NMSType
3147 */
3148inline std::string to_string(const NMSType nms_type)
3149{
3150 std::stringstream str;
3151 str << nms_type;
3152 return str.str();
3153}
3154
3155/** Formatted output of the BoxNMSLimitInfo type.
3156 *
3157 * @param[out] os Output stream.
3158 * @param[in] info BoxNMSLimitInfo to output.
3159 *
3160 * @return Modified output stream.
3161 */
3162inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3163{
SiCongLi579ca842021-10-18 09:38:33 +01003164 os << "{score_thresh=" << info.score_thresh() << ", "
3165 << "nms=" << info.nms() << ", "
3166 << "detections_per_im=" << info.detections_per_im() << ", "
3167 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3168 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3169 << "suppress_size=" << info.suppress_size() << ", "
3170 << "min_size=" << info.min_size() << ", "
3171 << "im_width=" << info.im_width() << ", "
3172 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003173 return os;
3174}
3175
3176/** Converts a @ref BoxNMSLimitInfo to string
3177 *
3178 * @param[in] info BoxNMSLimitInfo value to be converted
3179 *
3180 * @return String representing the corresponding BoxNMSLimitInfo
3181 */
3182inline std::string to_string(const BoxNMSLimitInfo &info)
3183{
3184 std::stringstream str;
3185 str << info;
3186 return str.str();
3187}
3188
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003189/** Converts a @ref DimensionRoundingType to string
3190 *
3191 * @param[in] rounding_type DimensionRoundingType value to be converted
3192 *
3193 * @return String representing the corresponding DimensionRoundingType
3194 */
3195inline std::string to_string(const DimensionRoundingType &rounding_type)
3196{
3197 std::stringstream str;
3198 str << rounding_type;
3199 return str.str();
3200}
3201
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003202/** Formatted output of the Conv3dInfo type.
3203 *
3204 * @param[out] os Output stream.
3205 * @param[in] conv3d_info Type to output.
3206 *
3207 * @return Modified output stream.
3208 */
3209inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3210{
3211 os << conv3d_info.stride;
3212 os << ";";
3213 os << conv3d_info.padding;
3214 os << ";";
3215 os << to_string(conv3d_info.act_info);
3216 os << ";";
3217 os << conv3d_info.dilation;
3218 os << ";";
3219 os << conv3d_info.round_type;
3220 os << ";";
3221 os << conv3d_info.enable_fast_math;
3222
3223 return os;
3224}
3225
3226/** Formatted output of the Conv3dInfo type.
3227 *
3228 * @param[in] conv3d_info Type to output.
3229 *
3230 * @return Formatted string.
3231 */
3232inline std::string to_string(const Conv3dInfo &conv3d_info)
3233{
3234 std::stringstream str;
3235 str << conv3d_info;
3236 return str.str();
3237}
3238
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003239} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003240
3241#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */