blob: 0327cd1b358f90b35c0a40ef97c4609e597006c3 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Pablo Marquez Tello6bcdc572023-01-11 09:54:00 +00002 * Copyright (c) 2017-2023 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Anthony Barbier4dbc0a92018-08-27 13:39:47 +010024#ifndef __ARM_COMPUTE_TYPE_PRINTER_H__
25#define __ARM_COMPUTE_TYPE_PRINTER_H__
Anthony Barbier6ff3b192017-09-04 18:44:23 +010026
ramelg01cbbb0382021-09-17 17:36:57 +010027#ifdef ARM_COMPUTE_OPENCL_ENABLED
28#include "arm_compute/core/CL/ICLTensor.h"
29#endif /* ARM_COMPUTE_OPENCL_ENABLED */
30
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"
Gunes Bayir1dc6ff12022-12-06 20:48:31 +000041#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
Jakub Sujak32741722022-11-25 16:43:18 +000042#include "arm_compute/dynamic_fusion/sketch/attributes/ClampAttributes.h"
SiCong Li5a63d1e2023-01-06 16:28:57 +000043#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000044#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000045#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
Jakub Sujak8ae57142022-12-02 16:09:06 +000046#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Gunes Bayiraecb5d92022-12-18 21:31:29 +000047#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h"
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +000048#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuPool2d.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010049#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000050#include "arm_compute/runtime/CL/CLTypes.h"
ramelg013ae3d882021-09-12 23:07:47 +010051#include "arm_compute/runtime/FunctionDescriptors.h"
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +000052#include "arm_compute/runtime/NEON/functions/NEMatMul.h"
ramelg01cbbb0382021-09-17 17:36:57 +010053#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000054#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000055#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010056#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010057#include <sstream>
58#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010059
60namespace arm_compute
61{
Anthony Barbierb940fd62018-06-04 14:14:32 +010062/** Formatted output if arg is not null
63 *
64 * @param[in] arg Object to print
65 *
66 * @return String representing arg.
67 */
68template <typename T>
69std::string to_string_if_not_null(T *arg)
70{
71 if(arg == nullptr)
72 {
73 return "nullptr";
74 }
75 else
76 {
77 return to_string(*arg);
78 }
79}
Anthony Barbierb4670212018-05-18 16:55:39 +010080
ramelg014a6d9e82021-10-02 14:34:36 +010081/** Fallback method: try to use std::to_string:
82 *
83 * @param[in] val Value to convert to string
84 *
85 * @return String representing val.
86 */
87template <typename T>
88inline std::string to_string(const T &val)
89{
90 return support::cpp11::to_string(val);
91}
92
ramelg01b1ba1e32021-09-25 11:53:26 +010093/** Formatted output of a vector of objects.
94 *
ramelg014a6d9e82021-10-02 14:34:36 +010095 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
96 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
97 *
ramelg01b1ba1e32021-09-25 11:53:26 +010098 * @param[out] os Output stream
99 * @param[in] args Vector of objects to print
100 *
101 * @return Modified output stream.
102 */
103template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100104::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100105{
106 const size_t max_print_size = 5U;
107
108 os << "[";
109 bool first = true;
110 size_t i;
111 for(i = 0; i < args.size(); ++i)
112 {
113 if(i == max_print_size)
114 {
115 break;
116 }
117 if(first)
118 {
119 first = false;
120 }
121 else
122 {
123 os << ", ";
124 }
ramelg014a6d9e82021-10-02 14:34:36 +0100125 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100126 }
127 if(i < args.size())
128 {
129 os << ", ...";
130 }
131 os << "]";
132 return os;
133}
134
ramelg014a6d9e82021-10-02 14:34:36 +0100135/** Formatted output of a vector of objects.
136 *
137 * @param[in] args Vector of objects to print
138 *
139 * @return String representing args.
140 */
141template <typename T>
142std::string to_string(const std::vector<T> &args)
143{
144 std::stringstream str;
145 str << args;
146 return str.str();
147}
148
SiCongLi1af54162021-10-06 15:25:57 +0100149/** @name (EXPERIMENTAL_POST_OPS)
150 * @{
151 */
152/** Formmated output of the @ref experimental::PostOpType type
153 *
154 * @param[out] os Output stream.
155 * @param[in] post_op_type Type to output.
156 *
157 * @return Modified output stream.
158 */
159inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
160{
161 os << "type=";
162 switch(post_op_type)
163 {
164 case experimental::PostOpType::Activation:
165 {
166 os << "Activation";
167 break;
168 }
169 case experimental::PostOpType::Eltwise_Add:
170 {
171 os << "Eltwise_Add";
172 break;
173 }
ramelg016049eda2021-10-29 10:52:53 +0100174 case experimental::PostOpType::Eltwise_PRelu:
175 {
176 os << "Eltwise_PRelu";
177 break;
178 }
SiCongLi1af54162021-10-06 15:25:57 +0100179 default:
180 {
181 ARM_COMPUTE_ERROR("Unsupported PostOpType");
182 break;
183 }
184 }
185 return os;
186}
187/** Converts a @ref experimental::PostOpType to string
188 *
189 * @param[in] post_op_type PostOpType value to be converted
190 *
191 * @return String representing the corresponding PostOpType
192 */
193inline std::string to_string(experimental::PostOpType post_op_type)
194{
195 std::stringstream str;
196 str << post_op_type;
197 return str.str();
198}
199/** Formatted output of the @ref experimental::IPostOp type.
200 *
201 * @param[out] os Output stream.
202 * @param[in] post_op Type to output.
203 *
204 * @return Modified output stream.
205 */
206template <typename T>
207inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
208{
209 os << "<";
210 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100211 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100212 switch(post_op.type())
213 {
214 case experimental::PostOpType::Activation:
215 {
216 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
217 os << "act_info=" << &(_post_op->_act_info);
218 break;
219 }
220 case experimental::PostOpType::Eltwise_Add:
221 {
222 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
223 os << "convert_policy=" << _post_op->_policy;
224 break;
225 }
ramelg016049eda2021-10-29 10:52:53 +0100226 case experimental::PostOpType::Eltwise_PRelu:
227 {
228 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
229 os << "convert_policy=" << _post_op->_policy;
230 break;
231 }
SiCongLi1af54162021-10-06 15:25:57 +0100232 default:
233 {
234 ARM_COMPUTE_ERROR("Unsupported PostOpType");
235 break;
236 }
237 }
238 os << ">";
239 return os;
240}
241/** Converts an @ref experimental::IPostOp to string
242 *
243 * @param[in] post_op IPostOp value to be converted
244 *
245 * @return String representing the corresponding IPostOp
246 */
247template <typename T>
248inline std::string to_string(const experimental::IPostOp<T> &post_op)
249{
250 std::stringstream str;
251 str << post_op;
252 return str.str();
253}
254/** Formatted output of the @ref experimental::PostOpList type.
255 *
256 * @param[out] os Output stream.
257 * @param[in] post_ops Type to output.
258 *
259 * @return Modified output stream.
260 */
261template <typename T>
262inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
263{
264 os << "[";
265 for(const auto &post_op : post_ops.get_list())
266 {
267 os << *post_op << ",";
268 }
269 os << "]";
270 return os;
271}
272/** Converts a @ref experimental::PostOpList to string
273 *
274 * @param[in] post_ops PostOpList value to be converted
275 *
276 * @return String representing the corresponding PostOpList
277 */
278template <typename T>
279inline std::string to_string(const experimental::PostOpList<T> &post_ops)
280{
281 std::stringstream str;
282 str << post_ops;
283 return str.str();
284}
285/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
286
Alex Gildayc357c472018-03-21 13:54:09 +0000287/** Formatted output of the Dimensions type.
288 *
289 * @param[out] os Output stream.
290 * @param[in] dimensions Type to output.
291 *
292 * @return Modified output stream.
293 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100294template <typename T>
295inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
296{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100297 if(dimensions.num_dimensions() > 0)
298 {
299 os << dimensions[0];
300
301 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
302 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100303 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100304 }
305 }
306
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100307 return os;
308}
309
Alex Gildayc357c472018-03-21 13:54:09 +0000310/** Formatted output of the RoundingPolicy type.
311 *
312 * @param[out] os Output stream.
313 * @param[in] rounding_policy Type to output.
314 *
315 * @return Modified output stream.
316 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100317inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100318{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100319 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100320 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100321 case RoundingPolicy::TO_ZERO:
322 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100323 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100324 case RoundingPolicy::TO_NEAREST_UP:
325 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100326 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100327 case RoundingPolicy::TO_NEAREST_EVEN:
328 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100329 break;
330 default:
331 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
332 }
333
334 return os;
335}
336
Alex Gildayc357c472018-03-21 13:54:09 +0000337/** Formatted output of the WeightsInfo type.
338 *
339 * @param[out] os Output stream.
340 * @param[in] weights_info Type to output.
341 *
342 * @return Modified output stream.
343 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100344inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100345{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100346 os << weights_info.are_reshaped() << ";";
347 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100348
349 return os;
350}
351
Alex Gildayc357c472018-03-21 13:54:09 +0000352/** Formatted output of the ROIPoolingInfo type.
353 *
354 * @param[out] os Output stream.
355 * @param[in] pool_info Type to output.
356 *
357 * @return Modified output stream.
358 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100359inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100360{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100361 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100362 return os;
363}
364
giuros0118870812018-09-13 09:31:40 +0100365/** Formatted output of the ROIPoolingInfo type.
366 *
367 * @param[in] pool_info Type to output.
368 *
369 * @return Formatted string.
370 */
371inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
372{
373 std::stringstream str;
374 str << pool_info;
375 return str.str();
376}
377
morgolockaba2f912020-05-05 16:28:19 +0100378/** Formatted output of the GEMMKernelInfo type.
379 *
380 * @param[out] os Output stream.
381 * @param[in] gemm_info Type to output.
382 *
383 * @return Modified output stream.
384 */
385inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
386{
SiCongLi579ca842021-10-18 09:38:33 +0100387 os << "( m=" << gemm_info.m;
388 os << " n=" << gemm_info.n;
389 os << " k=" << gemm_info.k;
390 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
391 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
392 os << " broadcast_bias=" << gemm_info.broadcast_bias;
393 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
394 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
395 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
396 os << " a_offset=" << gemm_info.a_offset;
397 os << " b_offset=" << gemm_info.b_offset;
398 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100399 os << ")";
400 return os;
401}
402
403/** Formatted output of the GEMMLHSMatrixInfo type.
404 *
405 * @param[out] os Output stream.
406 * @param[in] gemm_info Type to output.
407 *
408 * @return Modified output stream.
409 */
410inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
411{
SiCongLi579ca842021-10-18 09:38:33 +0100412 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 +0100413 return os;
414}
415
416/** Formatted output of the GEMMRHSMatrixInfo type.
417 *
418 * @param[out] os Output stream.
419 * @param[in] gemm_info Type to output.
420 *
421 * @return Modified output stream.
422 */
423inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
424{
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +0000425 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=" <<
426 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100427 return os;
428}
429
430/** Formatted output of the GEMMRHSMatrixInfo type.
431 *
432 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
433 *
434 * @return Formatted string.
435 */
436inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
437{
438 std::stringstream str;
439 str << gemm_info;
440 return str.str();
441}
442
443/** Formatted output of the GEMMLHSMatrixInfo type.
444 *
445 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
446 *
447 * @return Formatted string.
448 */
449inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
450{
451 std::stringstream str;
452 str << gemm_info;
453 return str.str();
454}
455
456/** Formatted output of the GEMMKernelInfo type.
457 *
458 * @param[in] gemm_info GEMMKernelInfo Type to output.
459 *
460 * @return Formatted string.
461 */
462inline std::string to_string(const GEMMKernelInfo &gemm_info)
463{
464 std::stringstream str;
465 str << gemm_info;
466 return str.str();
467}
468
giuros01c04a0e82018-10-03 12:44:35 +0100469/** Formatted output of the BoundingBoxTransformInfo type.
470 *
471 * @param[out] os Output stream.
472 * @param[in] bbox_info Type to output.
473 *
474 * @return Modified output stream.
475 */
476inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
477{
478 auto weights = bbox_info.weights();
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +0000479 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
480 "})";
giuros01c04a0e82018-10-03 12:44:35 +0100481 return os;
482}
483
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100484#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100485inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100486{
487 std::stringstream str;
Pablo Marquez Tello6bcdc572023-01-11 09:54:00 +0000488 str << v;
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100489 os << str.str();
490 return os;
491}
Ramy Elgammal91780022022-07-20 14:57:37 +0100492#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100493
giuros01c04a0e82018-10-03 12:44:35 +0100494/** Formatted output of the BoundingBoxTransformInfo type.
495 *
496 * @param[in] bbox_info Type to output.
497 *
498 * @return Formatted string.
499 */
500inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
501{
502 std::stringstream str;
503 str << bbox_info;
504 return str.str();
505}
506
Manuel Bottini5209be52019-02-13 16:34:56 +0000507/** Formatted output of the ComputeAnchorsInfo type.
508 *
509 * @param[out] os Output stream.
510 * @param[in] anchors_info Type to output.
511 *
512 * @return Modified output stream.
513 */
514inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
515{
516 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
517 return os;
518}
519
520/** Formatted output of the ComputeAnchorsInfo type.
521 *
522 * @param[in] anchors_info Type to output.
523 *
524 * @return Formatted string.
525 */
526inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
527{
528 std::stringstream str;
529 str << anchors_info;
530 return str.str();
531}
532
533/** Formatted output of the GenerateProposalsInfo type.
534 *
535 * @param[out] os Output stream.
536 * @param[in] proposals_info Type to output.
537 *
538 * @return Modified output stream.
539 */
540inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
541{
542 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
543 return os;
544}
545
546/** Formatted output of the GenerateProposalsInfo type.
547 *
548 * @param[in] proposals_info Type to output.
549 *
550 * @return Formatted string.
551 */
552inline std::string to_string(const GenerateProposalsInfo &proposals_info)
553{
554 std::stringstream str;
555 str << proposals_info;
556 return str.str();
557}
558
Alex Gildayc357c472018-03-21 13:54:09 +0000559/** Formatted output of the QuantizationInfo type.
560 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100561 * @param[out] os Output stream.
562 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000563 *
564 * @return Modified output stream.
565 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100566inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700567{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100568 const UniformQuantizationInfo uqinfo = qinfo.uniform();
569 os << "Scale:" << uqinfo.scale << "~";
570 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700571 return os;
572}
573
Alex Gildayc357c472018-03-21 13:54:09 +0000574/** Formatted output of the QuantizationInfo type.
575 *
576 * @param[in] quantization_info Type to output.
577 *
578 * @return Formatted string.
579 */
Chunosovd621bca2017-11-03 17:33:15 +0700580inline std::string to_string(const QuantizationInfo &quantization_info)
581{
582 std::stringstream str;
583 str << quantization_info;
584 return str.str();
585}
586
Alex Gildayc357c472018-03-21 13:54:09 +0000587/** Formatted output of the activation function type.
588 *
589 * @param[out] os Output stream.
590 * @param[in] act_function Type to output.
591 *
592 * @return Modified output stream.
593 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100594inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
595{
596 switch(act_function)
597 {
598 case ActivationLayerInfo::ActivationFunction::ABS:
599 os << "ABS";
600 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100601 case ActivationLayerInfo::ActivationFunction::LINEAR:
602 os << "LINEAR";
603 break;
604 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
605 os << "LOGISTIC";
606 break;
607 case ActivationLayerInfo::ActivationFunction::RELU:
608 os << "RELU";
609 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100610 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
611 os << "BOUNDED_RELU";
612 break;
613 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
614 os << "LEAKY_RELU";
615 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100616 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
617 os << "SOFT_RELU";
618 break;
619 case ActivationLayerInfo::ActivationFunction::SQRT:
620 os << "SQRT";
621 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100622 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
623 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000624 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100625 case ActivationLayerInfo::ActivationFunction::ELU:
626 os << "ELU";
627 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100628 case ActivationLayerInfo::ActivationFunction::SQUARE:
629 os << "SQUARE";
630 break;
631 case ActivationLayerInfo::ActivationFunction::TANH:
632 os << "TANH";
633 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100634 case ActivationLayerInfo::ActivationFunction::IDENTITY:
635 os << "IDENTITY";
636 break;
morgolock07df3d42020-02-27 11:46:28 +0000637 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
638 os << "HARD_SWISH";
639 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100640 case ActivationLayerInfo::ActivationFunction::SWISH:
641 os << "SWISH";
642 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400643 case ActivationLayerInfo::ActivationFunction::GELU:
644 os << "GELU";
645 break;
morgolock07df3d42020-02-27 11:46:28 +0000646
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100647 default:
648 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
649 }
650
651 return os;
652}
653
Alex Gildayc357c472018-03-21 13:54:09 +0000654/** Formatted output of the activation function info type.
655 *
SiCongLi1af54162021-10-06 15:25:57 +0100656 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000657 *
658 * @return Formatted string.
659 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100660inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100661{
662 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000663 if(info.enabled())
664 {
665 str << info.activation();
666 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100667 return str.str();
668}
669
SiCongLi1af54162021-10-06 15:25:57 +0100670/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100671 *
SiCongLi1af54162021-10-06 15:25:57 +0100672 * @param[out] os Output stream.
673 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100674 *
675 * @return Formatted string.
676 */
SiCongLi1af54162021-10-06 15:25:57 +0100677inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100678{
ramelg013ae3d882021-09-12 23:07:47 +0100679 if(info != nullptr)
680 {
ramelg013ae3d882021-09-12 23:07:47 +0100681 if(info->enabled())
682 {
SiCongLi1af54162021-10-06 15:25:57 +0100683 os << info->activation();
684 os << "(";
685 os << "VAL_A=" << info->a() << ",";
686 os << "VAL_B=" << info->b();
687 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100688 }
SiCongLi1af54162021-10-06 15:25:57 +0100689 else
690 {
691 os << "disabled";
692 }
ramelg013ae3d882021-09-12 23:07:47 +0100693 }
SiCongLi1af54162021-10-06 15:25:57 +0100694 else
695 {
696 os << "nullptr";
697 }
698 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100699}
700
Alex Gildayc357c472018-03-21 13:54:09 +0000701/** Formatted output of the activation function type.
702 *
703 * @param[in] function Type to output.
704 *
705 * @return Formatted string.
706 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100707inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
708{
709 std::stringstream str;
710 str << function;
711 return str.str();
712}
713
Alex Gildayc357c472018-03-21 13:54:09 +0000714/** Formatted output of the NormType type.
715 *
716 * @param[out] os Output stream.
717 * @param[in] norm_type Type to output.
718 *
719 * @return Modified output stream.
720 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100721inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
722{
723 switch(norm_type)
724 {
725 case NormType::CROSS_MAP:
726 os << "CROSS_MAP";
727 break;
728 case NormType::IN_MAP_1D:
729 os << "IN_MAP_1D";
730 break;
731 case NormType::IN_MAP_2D:
732 os << "IN_MAP_2D";
733 break;
734 default:
735 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
736 }
737
738 return os;
739}
740
Alex Gildayc357c472018-03-21 13:54:09 +0000741/** Formatted output of @ref NormalizationLayerInfo.
742 *
743 * @param[in] info Type to output.
744 *
745 * @return Formatted string.
746 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100747inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100748{
749 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000750 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100751 return str.str();
752}
753
Alex Gildayc357c472018-03-21 13:54:09 +0000754/** Formatted output of @ref NormalizationLayerInfo.
755 *
756 * @param[out] os Output stream.
757 * @param[in] info Type to output.
758 *
759 * @return Modified output stream.
760 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100761inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
762{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000763 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100764 return os;
765}
766
Alex Gildayc357c472018-03-21 13:54:09 +0000767/** Formatted output of the PoolingType type.
768 *
769 * @param[out] os Output stream.
770 * @param[in] pool_type Type to output.
771 *
772 * @return Modified output stream.
773 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100774inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
775{
776 switch(pool_type)
777 {
778 case PoolingType::AVG:
779 os << "AVG";
780 break;
781 case PoolingType::MAX:
782 os << "MAX";
783 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100784 case PoolingType::L2:
785 os << "L2";
786 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100787 default:
788 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
789 }
790
791 return os;
792}
793
Alex Gildayc357c472018-03-21 13:54:09 +0000794/** Formatted output of @ref PoolingLayerInfo.
795 *
796 * @param[out] os Output stream.
797 * @param[in] info Type to output.
798 *
799 * @return Modified output stream.
800 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100801inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
802{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000803 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100804
805 return os;
806}
807
Alex Gildayc357c472018-03-21 13:54:09 +0000808/** Formatted output of @ref RoundingPolicy.
809 *
810 * @param[in] rounding_policy Type to output.
811 *
812 * @return Formatted string.
813 */
John Richardsondd715f22017-09-18 16:10:48 +0100814inline std::string to_string(const RoundingPolicy &rounding_policy)
815{
816 std::stringstream str;
817 str << rounding_policy;
818 return str.str();
819}
820
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000821/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000822/** Formatted output of the DataLayout type.
823 *
824 * @param[out] os Output stream.
825 * @param[in] data_layout Type to output.
826 *
827 * @return Modified output stream.
828 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000829inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
830{
831 switch(data_layout)
832 {
833 case DataLayout::UNKNOWN:
834 os << "UNKNOWN";
835 break;
836 case DataLayout::NHWC:
837 os << "NHWC";
838 break;
839 case DataLayout::NCHW:
840 os << "NCHW";
841 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100842 case DataLayout::NDHWC:
843 os << "NDHWC";
844 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100845 case DataLayout::NCDHW:
846 os << "NCDHW";
847 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000848 default:
849 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
850 }
851
852 return os;
853}
854
Alex Gildayc357c472018-03-21 13:54:09 +0000855/** Formatted output of the DataLayout type.
856 *
857 * @param[in] data_layout Type to output.
858 *
859 * @return Formatted string.
860 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000861inline std::string to_string(const arm_compute::DataLayout &data_layout)
862{
863 std::stringstream str;
864 str << data_layout;
865 return str.str();
866}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000867/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000868
Georgios Pinitase2220552018-07-20 13:23:44 +0100869/** Formatted output of the DataLayoutDimension type.
870 *
871 * @param[out] os Output stream.
872 * @param[in] data_layout_dim Data layout dimension to print.
873 *
874 * @return Modified output stream.
875 */
876inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
877{
878 switch(data_layout_dim)
879 {
880 case DataLayoutDimension::WIDTH:
881 os << "WIDTH";
882 break;
883 case DataLayoutDimension::HEIGHT:
884 os << "HEIGHT";
885 break;
886 case DataLayoutDimension::CHANNEL:
887 os << "CHANNEL";
888 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100889 case DataLayoutDimension::DEPTH:
890 os << "DEPTH";
891 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100892 case DataLayoutDimension::BATCHES:
893 os << "BATCHES";
894 break;
895 default:
896 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
897 }
898 return os;
899}
900
Alex Gildayc357c472018-03-21 13:54:09 +0000901/** Formatted output of the DataType type.
902 *
903 * @param[out] os Output stream.
904 * @param[in] data_type Type to output.
905 *
906 * @return Modified output stream.
907 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100908inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
909{
910 switch(data_type)
911 {
912 case DataType::UNKNOWN:
913 os << "UNKNOWN";
914 break;
915 case DataType::U8:
916 os << "U8";
917 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100918 case DataType::QSYMM8:
919 os << "QSYMM8";
920 break;
Chunosovd621bca2017-11-03 17:33:15 +0700921 case DataType::QASYMM8:
922 os << "QASYMM8";
923 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000924 case DataType::QASYMM8_SIGNED:
925 os << "QASYMM8_SIGNED";
926 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100927 case DataType::QSYMM8_PER_CHANNEL:
928 os << "QSYMM8_PER_CHANNEL";
929 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100930 case DataType::S8:
931 os << "S8";
932 break;
933 case DataType::U16:
934 os << "U16";
935 break;
936 case DataType::S16:
937 os << "S16";
938 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100939 case DataType::QSYMM16:
940 os << "QSYMM16";
941 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100942 case DataType::QASYMM16:
943 os << "QASYMM16";
944 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100945 case DataType::U32:
946 os << "U32";
947 break;
948 case DataType::S32:
949 os << "S32";
950 break;
951 case DataType::U64:
952 os << "U64";
953 break;
954 case DataType::S64:
955 os << "S64";
956 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000957 case DataType::BFLOAT16:
958 os << "BFLOAT16";
959 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100960 case DataType::F16:
961 os << "F16";
962 break;
963 case DataType::F32:
964 os << "F32";
965 break;
966 case DataType::F64:
967 os << "F64";
968 break;
969 case DataType::SIZET:
970 os << "SIZET";
971 break;
972 default:
973 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
974 }
975
976 return os;
977}
978
Alex Gildayc357c472018-03-21 13:54:09 +0000979/** Formatted output of the DataType type.
980 *
981 * @param[in] data_type Type to output.
982 *
983 * @return Formatted string.
984 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100985inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100986{
987 std::stringstream str;
988 str << data_type;
989 return str.str();
990}
991
Alex Gildayc357c472018-03-21 13:54:09 +0000992/** Formatted output of the Format type.
993 *
994 * @param[out] os Output stream.
995 * @param[in] format Type to output.
996 *
997 * @return Modified output stream.
998 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100999inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
1000{
1001 switch(format)
1002 {
1003 case Format::UNKNOWN:
1004 os << "UNKNOWN";
1005 break;
1006 case Format::U8:
1007 os << "U8";
1008 break;
1009 case Format::S16:
1010 os << "S16";
1011 break;
1012 case Format::U16:
1013 os << "U16";
1014 break;
1015 case Format::S32:
1016 os << "S32";
1017 break;
1018 case Format::U32:
1019 os << "U32";
1020 break;
1021 case Format::F16:
1022 os << "F16";
1023 break;
1024 case Format::F32:
1025 os << "F32";
1026 break;
1027 case Format::UV88:
1028 os << "UV88";
1029 break;
1030 case Format::RGB888:
1031 os << "RGB888";
1032 break;
1033 case Format::RGBA8888:
1034 os << "RGBA8888";
1035 break;
1036 case Format::YUV444:
1037 os << "YUV444";
1038 break;
1039 case Format::YUYV422:
1040 os << "YUYV422";
1041 break;
1042 case Format::NV12:
1043 os << "NV12";
1044 break;
1045 case Format::NV21:
1046 os << "NV21";
1047 break;
1048 case Format::IYUV:
1049 os << "IYUV";
1050 break;
1051 case Format::UYVY422:
1052 os << "UYVY422";
1053 break;
1054 default:
1055 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1056 }
1057
1058 return os;
1059}
1060
Alex Gildayc357c472018-03-21 13:54:09 +00001061/** Formatted output of the Format type.
1062 *
1063 * @param[in] format Type to output.
1064 *
1065 * @return Formatted string.
1066 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001067inline std::string to_string(const Format &format)
1068{
1069 std::stringstream str;
1070 str << format;
1071 return str.str();
1072}
1073
Alex Gildayc357c472018-03-21 13:54:09 +00001074/** Formatted output of the Channel type.
1075 *
1076 * @param[out] os Output stream.
1077 * @param[in] channel Type to output.
1078 *
1079 * @return Modified output stream.
1080 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001081inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1082{
1083 switch(channel)
1084 {
1085 case Channel::UNKNOWN:
1086 os << "UNKNOWN";
1087 break;
1088 case Channel::C0:
1089 os << "C0";
1090 break;
1091 case Channel::C1:
1092 os << "C1";
1093 break;
1094 case Channel::C2:
1095 os << "C2";
1096 break;
1097 case Channel::C3:
1098 os << "C3";
1099 break;
1100 case Channel::R:
1101 os << "R";
1102 break;
1103 case Channel::G:
1104 os << "G";
1105 break;
1106 case Channel::B:
1107 os << "B";
1108 break;
1109 case Channel::A:
1110 os << "A";
1111 break;
1112 case Channel::Y:
1113 os << "Y";
1114 break;
1115 case Channel::U:
1116 os << "U";
1117 break;
1118 case Channel::V:
1119 os << "V";
1120 break;
1121 default:
1122 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1123 }
1124
1125 return os;
1126}
1127
Alex Gildayc357c472018-03-21 13:54:09 +00001128/** Formatted output of the Channel type.
1129 *
1130 * @param[in] channel Type to output.
1131 *
1132 * @return Formatted string.
1133 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001134inline std::string to_string(const Channel &channel)
1135{
1136 std::stringstream str;
1137 str << channel;
1138 return str.str();
1139}
1140
Alex Gildayc357c472018-03-21 13:54:09 +00001141/** Formatted output of the BorderMode type.
1142 *
1143 * @param[out] os Output stream.
1144 * @param[in] mode Type to output.
1145 *
1146 * @return Modified output stream.
1147 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001148inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1149{
1150 switch(mode)
1151 {
1152 case BorderMode::UNDEFINED:
1153 os << "UNDEFINED";
1154 break;
1155 case BorderMode::CONSTANT:
1156 os << "CONSTANT";
1157 break;
1158 case BorderMode::REPLICATE:
1159 os << "REPLICATE";
1160 break;
1161 default:
1162 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1163 }
1164
1165 return os;
1166}
1167
Alex Gildayc357c472018-03-21 13:54:09 +00001168/** Formatted output of the BorderSize type.
1169 *
1170 * @param[out] os Output stream.
1171 * @param[in] border Type to output.
1172 *
1173 * @return Modified output stream.
1174 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001175inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1176{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001177 os << border.top << ","
1178 << border.right << ","
1179 << border.bottom << ","
1180 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001181
1182 return os;
1183}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001184
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001185/** Formatted output of the PaddingList type.
1186 *
1187 * @param[out] os Output stream.
1188 * @param[in] padding Type to output.
1189 *
1190 * @return Modified output stream.
1191 */
1192inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1193{
1194 os << "{";
1195 for(auto const &p : padding)
1196 {
1197 os << "{" << p.first << "," << p.second << "}";
1198 }
1199 os << "}";
1200 return os;
1201}
1202
giuros013175fcf2018-11-21 09:59:17 +00001203/** Formatted output of the Multiples type.
1204 *
1205 * @param[out] os Output stream.
1206 * @param[in] multiples Type to output.
1207 *
1208 * @return Modified output stream.
1209 */
1210inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1211{
1212 os << "(";
1213 for(size_t i = 0; i < multiples.size() - 1; i++)
1214 {
1215 os << multiples[i] << ", ";
1216 }
1217 os << multiples.back() << ")";
1218 return os;
1219}
1220
Alex Gildayc357c472018-03-21 13:54:09 +00001221/** Formatted output of the InterpolationPolicy type.
1222 *
1223 * @param[out] os Output stream.
1224 * @param[in] policy Type to output.
1225 *
1226 * @return Modified output stream.
1227 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001228inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1229{
1230 switch(policy)
1231 {
1232 case InterpolationPolicy::NEAREST_NEIGHBOR:
1233 os << "NEAREST_NEIGHBOR";
1234 break;
1235 case InterpolationPolicy::BILINEAR:
1236 os << "BILINEAR";
1237 break;
1238 case InterpolationPolicy::AREA:
1239 os << "AREA";
1240 break;
1241 default:
1242 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1243 }
1244
1245 return os;
1246}
1247
Alex Gildayc357c472018-03-21 13:54:09 +00001248/** Formatted output of the SamplingPolicy type.
1249 *
1250 * @param[out] os Output stream.
1251 * @param[in] policy Type to output.
1252 *
1253 * @return Modified output stream.
1254 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001255inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1256{
1257 switch(policy)
1258 {
1259 case SamplingPolicy::CENTER:
1260 os << "CENTER";
1261 break;
1262 case SamplingPolicy::TOP_LEFT:
1263 os << "TOP_LEFT";
1264 break;
1265 default:
1266 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1267 }
1268
1269 return os;
1270}
1271
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001272/** Formatted output of the ITensorInfo type.
1273 *
1274 * @param[out] os Output stream.
1275 * @param[in] info Tensor information.
1276 *
1277 * @return Modified output stream.
1278 */
1279inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1280{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001281 const DataType data_type = info->data_type();
1282 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001283
1284 os << "Shape=" << info->tensor_shape() << ","
1285 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001286 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001287
1288 if(is_data_type_quantized(data_type))
1289 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001290 const QuantizationInfo qinfo = info->quantization_info();
1291 const auto scales = qinfo.scale();
1292 const auto offsets = qinfo.offset();
1293
ramelg014a6d9e82021-10-02 14:34:36 +01001294 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001295 << "scales.size=" << scales.size()
1296 << ", scale(s)=" << scales << ", ";
1297
1298 os << "offsets.size=" << offsets.size()
1299 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001300 }
1301 return os;
1302}
1303
ramelg013ae3d882021-09-12 23:07:47 +01001304/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001305 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001306 * @param[out] os Output stream.
1307 * @param[in] info Type to output.
1308 *
1309 * @return Modified output stream.
1310 */
1311inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1312{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001313 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001314 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001315}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001316
ramelg013ae3d882021-09-12 23:07:47 +01001317/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001318 *
Alex Gildayc357c472018-03-21 13:54:09 +00001319 * @param[in] info Type to output.
1320 *
1321 * @return Formatted string.
1322 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001323inline std::string to_string(const TensorInfo &info)
1324{
1325 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001326 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001327 return str.str();
1328}
1329
ramelg013ae3d882021-09-12 23:07:47 +01001330/** Formatted output of the const ITensorInfo& type.
1331 *
1332 * @param[in] info Type to output.
1333 *
1334 * @return Formatted string.
1335 */
1336inline std::string to_string(const ITensorInfo &info)
1337{
1338 std::stringstream str;
1339 str << &info;
1340 return str.str();
1341}
1342
ramelg013ae3d882021-09-12 23:07:47 +01001343/** Formatted output of the const ITensorInfo* type.
1344 *
1345 * @param[in] info Type to output.
1346 *
1347 * @return Formatted string.
1348 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001349inline std::string to_string(const ITensorInfo *info)
1350{
ramelg013ae3d882021-09-12 23:07:47 +01001351 std::string ret_str = "nullptr";
1352 if(info != nullptr)
1353 {
1354 std::stringstream str;
1355 str << info;
1356 ret_str = str.str();
1357 }
1358 return ret_str;
1359}
1360
ramelg01cbbb0382021-09-17 17:36:57 +01001361/** Formatted output of the ITensorInfo* type.
1362 *
1363 * @param[in] info Type to output.
1364 *
1365 * @return Formatted string.
1366 */
1367inline std::string to_string(ITensorInfo *info)
1368{
1369 return to_string(static_cast<const ITensorInfo *>(info));
1370}
1371
1372/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001373 *
1374 * @param[in] tensor Type to output.
1375 *
1376 * @return Formatted string.
1377 */
1378inline std::string to_string(const ITensor *tensor)
1379{
1380 std::string ret_str = "nullptr";
1381 if(tensor != nullptr)
1382 {
1383 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001384 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001385 ret_str = str.str();
1386 }
1387 return ret_str;
1388}
1389
ramelg01cbbb0382021-09-17 17:36:57 +01001390/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001391 *
1392 * @param[in] tensor Type to output.
1393 *
1394 * @return Formatted string.
1395 */
1396inline std::string to_string(ITensor *tensor)
1397{
ramelg01cbbb0382021-09-17 17:36:57 +01001398 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001399}
1400
ramelg01cbbb0382021-09-17 17:36:57 +01001401/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001402 *
1403 * @param[in] tensor Type to output.
1404 *
1405 * @return Formatted string.
1406 */
1407inline std::string to_string(ITensor &tensor)
1408{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001409 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001410 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001411 return str.str();
1412}
1413
ramelg01cbbb0382021-09-17 17:36:57 +01001414#ifdef ARM_COMPUTE_OPENCL_ENABLED
1415/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1416 *
1417 * @param[in] cl_tensor Type to output.
1418 *
1419 * @return Formatted string.
1420 */
1421inline std::string to_string(const ICLTensor *cl_tensor)
1422{
1423 std::string ret_str = "nullptr";
1424 if(cl_tensor != nullptr)
1425 {
1426 std::stringstream str;
1427 str << "ICLTensor->info(): " << cl_tensor->info();
1428 ret_str = str.str();
1429 }
1430 return ret_str;
1431}
1432
1433/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1434 *
1435 * @param[in] cl_tensor Type to output.
1436 *
1437 * @return Formatted string.
1438 */
1439inline std::string to_string(ICLTensor *cl_tensor)
1440{
1441 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1442}
SiCong Li47f177e2023-02-22 17:24:09 +00001443
1444/** Formatted output of the cl::NDRange type.
1445 *
1446 * @param[out] os Output stream.
1447 * @param[in] nd_range cl::NDRange to output.
1448 *
1449 * @return Modified output stream.
1450 */
1451inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1452{
1453 os << "{"
1454 << nd_range[0] << ","
1455 << nd_range[1] << ","
1456 << nd_range[2]
1457 << "}";
1458 return os;
1459}
1460
1461/** Formatted output of the cl::NDRange type
1462 *
1463 * @param[in] nd_Range Type to output.
1464 *
1465 * @return Formatted string.
1466 */
1467inline std::string to_string(const cl::NDRange &nd_range)
1468{
1469 std::stringstream str;
1470 str << nd_range;
1471 return str.str();
1472}
ramelg01cbbb0382021-09-17 17:36:57 +01001473#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1474
Alex Gildayc357c472018-03-21 13:54:09 +00001475/** Formatted output of the Dimensions type.
1476 *
1477 * @param[in] dimensions Type to output.
1478 *
1479 * @return Formatted string.
1480 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001481template <typename T>
1482inline std::string to_string(const Dimensions<T> &dimensions)
1483{
1484 std::stringstream str;
1485 str << dimensions;
1486 return str.str();
1487}
1488
Alex Gildayc357c472018-03-21 13:54:09 +00001489/** Formatted output of the Strides type.
1490 *
1491 * @param[in] stride Type to output.
1492 *
1493 * @return Formatted string.
1494 */
John Richardsona36eae12017-09-26 16:55:59 +01001495inline std::string to_string(const Strides &stride)
1496{
1497 std::stringstream str;
1498 str << stride;
1499 return str.str();
1500}
1501
Alex Gildayc357c472018-03-21 13:54:09 +00001502/** Formatted output of the TensorShape type.
1503 *
1504 * @param[in] shape Type to output.
1505 *
1506 * @return Formatted string.
1507 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001508inline std::string to_string(const TensorShape &shape)
1509{
1510 std::stringstream str;
1511 str << shape;
1512 return str.str();
1513}
1514
Alex Gildayc357c472018-03-21 13:54:09 +00001515/** Formatted output of the Coordinates type.
1516 *
1517 * @param[in] coord Type to output.
1518 *
1519 * @return Formatted string.
1520 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001521inline std::string to_string(const Coordinates &coord)
1522{
1523 std::stringstream str;
1524 str << coord;
1525 return str.str();
1526}
1527
Anthony Barbierb940fd62018-06-04 14:14:32 +01001528/** Formatted output of the GEMMReshapeInfo type.
1529 *
1530 * @param[out] os Output stream.
1531 * @param[in] info Type to output.
1532 *
1533 * @return Modified output stream.
1534 */
1535inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1536{
1537 os << "{m=" << info.m() << ",";
1538 os << "n=" << info.n() << ",";
1539 os << "k=" << info.k() << ",";
1540 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1541 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1542 os << "}";
1543
1544 return os;
1545}
1546
1547/** Formatted output of the GEMMInfo type.
1548 *
1549 * @param[out] os Output stream.
1550 * @param[in] info Type to output.
1551 *
1552 * @return Modified output stream.
1553 */
1554inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1555{
1556 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1557 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1558 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001559 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1560 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1561 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1562 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1563 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001564 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001565 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001566
1567 return os;
1568}
1569
1570/** Formatted output of the Window::Dimension type.
1571 *
1572 * @param[out] os Output stream.
1573 * @param[in] dim Type to output.
1574 *
1575 * @return Modified output stream.
1576 */
1577inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1578{
1579 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1580
1581 return os;
1582}
1583/** Formatted output of the Window type.
1584 *
1585 * @param[out] os Output stream.
1586 * @param[in] win Type to output.
1587 *
1588 * @return Modified output stream.
1589 */
1590inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1591{
1592 os << "{";
1593 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1594 {
1595 if(i > 0)
1596 {
1597 os << ", ";
1598 }
1599 os << win[i];
1600 }
1601 os << "}";
1602
1603 return os;
1604}
1605
1606/** Formatted output of the WeightsInfo type.
1607 *
1608 * @param[in] info Type to output.
1609 *
1610 * @return Formatted string.
1611 */
1612inline std::string to_string(const WeightsInfo &info)
1613{
1614 std::stringstream str;
1615 str << info;
1616 return str.str();
1617}
1618
1619/** Formatted output of the GEMMReshapeInfo type.
1620 *
1621 * @param[in] info Type to output.
1622 *
1623 * @return Formatted string.
1624 */
1625inline std::string to_string(const GEMMReshapeInfo &info)
1626{
1627 std::stringstream str;
1628 str << info;
1629 return str.str();
1630}
1631
1632/** Formatted output of the GEMMInfo type.
1633 *
1634 * @param[in] info Type to output.
1635 *
1636 * @return Formatted string.
1637 */
1638inline std::string to_string(const GEMMInfo &info)
1639{
1640 std::stringstream str;
1641 str << info;
1642 return str.str();
1643}
1644
1645/** Formatted output of the Window::Dimension type.
1646 *
1647 * @param[in] dim Type to output.
1648 *
1649 * @return Formatted string.
1650 */
1651inline std::string to_string(const Window::Dimension &dim)
1652{
1653 std::stringstream str;
1654 str << dim;
1655 return str.str();
1656}
ramelg01cbbb0382021-09-17 17:36:57 +01001657/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001658 *
1659 * @param[in] win Type to output.
1660 *
1661 * @return Formatted string.
1662 */
1663inline std::string to_string(const Window &win)
1664{
1665 std::stringstream str;
1666 str << win;
1667 return str.str();
1668}
1669
ramelg01cbbb0382021-09-17 17:36:57 +01001670/** Formatted output of the Window* type.
1671 *
1672 * @param[in] win Type to output.
1673 *
1674 * @return Formatted string.
1675 */
1676inline std::string to_string(Window *win)
1677{
1678 std::string ret_str = "nullptr";
1679 if(win != nullptr)
1680 {
1681 std::stringstream str;
1682 str << *win;
1683 ret_str = str.str();
1684 }
1685 return ret_str;
1686}
1687
Alex Gildayc357c472018-03-21 13:54:09 +00001688/** Formatted output of the Rectangle type.
1689 *
1690 * @param[out] os Output stream.
1691 * @param[in] rect 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 Rectangle &rect)
1696{
1697 os << rect.width << "x" << rect.height;
1698 os << "+" << rect.x << "+" << rect.y;
1699
1700 return os;
1701}
1702
Usama Arif8cf8c112019-03-14 15:36:54 +00001703/** Formatted output of the PaddingMode type.
1704 *
1705 * @param[out] os Output stream.
1706 * @param[in] mode Type to output.
1707 *
1708 * @return Modified output stream.
1709 */
1710inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1711{
1712 switch(mode)
1713 {
1714 case PaddingMode::CONSTANT:
1715 os << "CONSTANT";
1716 break;
1717 case PaddingMode::REFLECT:
1718 os << "REFLECT";
1719 break;
1720 case PaddingMode::SYMMETRIC:
1721 os << "SYMMETRIC";
1722 break;
1723 default:
1724 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1725 }
1726
1727 return os;
1728}
1729
1730/** Formatted output of the PaddingMode type.
1731 *
1732 * @param[in] mode Type to output.
1733 *
1734 * @return Formatted string.
1735 */
1736inline std::string to_string(const PaddingMode &mode)
1737{
1738 std::stringstream str;
1739 str << mode;
1740 return str.str();
1741}
1742
Alex Gildayc357c472018-03-21 13:54:09 +00001743/** Formatted output of the PadStrideInfo type.
1744 *
1745 * @param[out] os Output stream.
1746 * @param[in] pad_stride_info Type to output.
1747 *
1748 * @return Modified output stream.
1749 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001750inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1751{
1752 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1753 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001754 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1755 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001756
1757 return os;
1758}
1759
Alex Gildayc357c472018-03-21 13:54:09 +00001760/** Formatted output of the PadStrideInfo type.
1761 *
1762 * @param[in] pad_stride_info Type to output.
1763 *
1764 * @return Formatted string.
1765 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001766inline std::string to_string(const PadStrideInfo &pad_stride_info)
1767{
1768 std::stringstream str;
1769 str << pad_stride_info;
1770 return str.str();
1771}
1772
Alex Gildayc357c472018-03-21 13:54:09 +00001773/** Formatted output of the BorderMode type.
1774 *
1775 * @param[in] mode Type to output.
1776 *
1777 * @return Formatted string.
1778 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001779inline std::string to_string(const BorderMode &mode)
1780{
1781 std::stringstream str;
1782 str << mode;
1783 return str.str();
1784}
1785
Alex Gildayc357c472018-03-21 13:54:09 +00001786/** Formatted output of the BorderSize type.
1787 *
1788 * @param[in] border Type to output.
1789 *
1790 * @return Formatted string.
1791 */
John Richardsonb482ce12017-09-18 12:44:01 +01001792inline std::string to_string(const BorderSize &border)
1793{
1794 std::stringstream str;
1795 str << border;
1796 return str.str();
1797}
1798
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001799/** Formatted output of the PaddingList type.
1800 *
1801 * @param[in] padding Type to output.
1802 *
1803 * @return Formatted string.
1804 */
1805inline std::string to_string(const PaddingList &padding)
1806{
1807 std::stringstream str;
1808 str << padding;
1809 return str.str();
1810}
1811
giuros013175fcf2018-11-21 09:59:17 +00001812/** Formatted output of the Multiples type.
1813 *
1814 * @param[in] multiples Type to output.
1815 *
1816 * @return Formatted string.
1817 */
1818inline std::string to_string(const Multiples &multiples)
1819{
1820 std::stringstream str;
1821 str << multiples;
1822 return str.str();
1823}
1824
Alex Gildayc357c472018-03-21 13:54:09 +00001825/** Formatted output of the InterpolationPolicy type.
1826 *
1827 * @param[in] policy Type to output.
1828 *
1829 * @return Formatted string.
1830 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001831inline std::string to_string(const InterpolationPolicy &policy)
1832{
1833 std::stringstream str;
1834 str << policy;
1835 return str.str();
1836}
1837
Alex Gildayc357c472018-03-21 13:54:09 +00001838/** Formatted output of the SamplingPolicy type.
1839 *
1840 * @param[in] policy Type to output.
1841 *
1842 * @return Formatted string.
1843 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001844inline std::string to_string(const SamplingPolicy &policy)
1845{
1846 std::stringstream str;
1847 str << policy;
1848 return str.str();
1849}
1850
Alex Gildayc357c472018-03-21 13:54:09 +00001851/** Formatted output of the ConvertPolicy type.
1852 *
1853 * @param[out] os Output stream.
1854 * @param[in] policy Type to output.
1855 *
1856 * @return Modified output stream.
1857 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001858inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1859{
1860 switch(policy)
1861 {
1862 case ConvertPolicy::WRAP:
1863 os << "WRAP";
1864 break;
1865 case ConvertPolicy::SATURATE:
1866 os << "SATURATE";
1867 break;
1868 default:
1869 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1870 }
1871
1872 return os;
1873}
1874
1875inline std::string to_string(const ConvertPolicy &policy)
1876{
1877 std::stringstream str;
1878 str << policy;
1879 return str.str();
1880}
1881
giuros01164a2722018-11-20 18:34:46 +00001882/** Formatted output of the ArithmeticOperation type.
1883 *
1884 * @param[out] os Output stream.
1885 * @param[in] op Operation to output.
1886 *
1887 * @return Modified output stream.
1888 */
1889inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1890{
1891 switch(op)
1892 {
1893 case ArithmeticOperation::ADD:
1894 os << "ADD";
1895 break;
1896 case ArithmeticOperation::SUB:
1897 os << "SUB";
1898 break;
1899 case ArithmeticOperation::DIV:
1900 os << "DIV";
1901 break;
1902 case ArithmeticOperation::MAX:
1903 os << "MAX";
1904 break;
1905 case ArithmeticOperation::MIN:
1906 os << "MIN";
1907 break;
1908 case ArithmeticOperation::SQUARED_DIFF:
1909 os << "SQUARED_DIFF";
1910 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001911 case ArithmeticOperation::POWER:
1912 os << "POWER";
1913 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001914 case ArithmeticOperation::PRELU:
1915 os << "PRELU";
1916 break;
giuros01164a2722018-11-20 18:34:46 +00001917 default:
1918 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1919 }
1920
1921 return os;
1922}
1923
1924/** Formatted output of the Arithmetic Operation
1925 *
1926 * @param[in] op Type to output.
1927 *
1928 * @return Formatted string.
1929 */
1930inline std::string to_string(const ArithmeticOperation &op)
1931{
1932 std::stringstream str;
1933 str << op;
1934 return str.str();
1935}
1936
Alex Gildayc357c472018-03-21 13:54:09 +00001937/** Formatted output of the Reduction Operations.
1938 *
1939 * @param[out] os Output stream.
1940 * @param[in] op Type to output.
1941 *
1942 * @return Modified output stream.
1943 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001944inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1945{
1946 switch(op)
1947 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001948 case ReductionOperation::SUM:
1949 os << "SUM";
1950 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001951 case ReductionOperation::SUM_SQUARE:
1952 os << "SUM_SQUARE";
1953 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001954 case ReductionOperation::MEAN_SUM:
1955 os << "MEAN_SUM";
1956 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001957 case ReductionOperation::ARG_IDX_MAX:
1958 os << "ARG_IDX_MAX";
1959 break;
1960 case ReductionOperation::ARG_IDX_MIN:
1961 os << "ARG_IDX_MIN";
1962 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001963 case ReductionOperation::PROD:
1964 os << "PROD";
1965 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001966 case ReductionOperation::MIN:
1967 os << "MIN";
1968 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001969 case ReductionOperation::MAX:
1970 os << "MAX";
1971 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001972 default:
1973 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1974 }
1975
1976 return os;
1977}
1978
Alex Gildayc357c472018-03-21 13:54:09 +00001979/** Formatted output of the Reduction Operations.
1980 *
1981 * @param[in] op Type to output.
1982 *
1983 * @return Formatted string.
1984 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001985inline std::string to_string(const ReductionOperation &op)
1986{
1987 std::stringstream str;
1988 str << op;
1989 return str.str();
1990}
1991
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001992/** Formatted output of the Comparison Operations.
1993 *
1994 * @param[out] os Output stream.
1995 * @param[in] op Type to output.
1996 *
1997 * @return Modified output stream.
1998 */
1999inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
2000{
2001 switch(op)
2002 {
2003 case ComparisonOperation::Equal:
2004 os << "Equal";
2005 break;
2006 case ComparisonOperation::NotEqual:
2007 os << "NotEqual";
2008 break;
2009 case ComparisonOperation::Greater:
2010 os << "Greater";
2011 break;
2012 case ComparisonOperation::GreaterEqual:
2013 os << "GreaterEqual";
2014 break;
2015 case ComparisonOperation::Less:
2016 os << "Less";
2017 break;
2018 case ComparisonOperation::LessEqual:
2019 os << "LessEqual";
2020 break;
2021 default:
2022 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2023 }
2024
2025 return os;
2026}
2027
Michalis Spyroue9362622018-11-23 17:41:37 +00002028/** Formatted output of the Elementwise unary Operations.
2029 *
2030 * @param[out] os Output stream.
2031 * @param[in] op Type to output.
2032 *
2033 * @return Modified output stream.
2034 */
2035inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
2036{
2037 switch(op)
2038 {
2039 case ElementWiseUnary::RSQRT:
2040 os << "RSQRT";
2041 break;
2042 case ElementWiseUnary::EXP:
2043 os << "EXP";
2044 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002045 case ElementWiseUnary::NEG:
2046 os << "NEG";
2047 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002048 case ElementWiseUnary::LOG:
2049 os << "LOG";
2050 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002051 case ElementWiseUnary::SIN:
2052 os << "SIN";
2053 break;
2054 case ElementWiseUnary::ABS:
2055 os << "ABS";
2056 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002057 case ElementWiseUnary::ROUND:
2058 os << "ROUND";
2059 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002060 case ElementWiseUnary::LOGICAL_NOT:
2061 os << "LOGICAL_NOT";
2062 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002063 default:
2064 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2065 }
2066
2067 return os;
2068}
2069
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002070/** Formatted output of the Comparison Operations.
2071 *
2072 * @param[in] op Type to output.
2073 *
2074 * @return Formatted string.
2075 */
2076inline std::string to_string(const ComparisonOperation &op)
2077{
2078 std::stringstream str;
2079 str << op;
2080 return str.str();
2081}
2082
Michalis Spyroue9362622018-11-23 17:41:37 +00002083/** Formatted output of the Elementwise unary Operations.
2084 *
2085 * @param[in] op Type to output.
2086 *
2087 * @return Formatted string.
2088 */
2089inline std::string to_string(const ElementWiseUnary &op)
2090{
2091 std::stringstream str;
2092 str << op;
2093 return str.str();
2094}
2095
Alex Gildayc357c472018-03-21 13:54:09 +00002096/** Formatted output of the Norm Type.
2097 *
2098 * @param[in] type Type to output.
2099 *
2100 * @return Formatted string.
2101 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002102inline std::string to_string(const NormType &type)
2103{
2104 std::stringstream str;
2105 str << type;
2106 return str.str();
2107}
2108
Alex Gildayc357c472018-03-21 13:54:09 +00002109/** Formatted output of the Pooling Type.
2110 *
2111 * @param[in] type Type to output.
2112 *
2113 * @return Formatted string.
2114 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002115inline std::string to_string(const PoolingType &type)
2116{
2117 std::stringstream str;
2118 str << type;
2119 return str.str();
2120}
2121
Alex Gildayc357c472018-03-21 13:54:09 +00002122/** Formatted output of the Pooling Layer Info.
2123 *
2124 * @param[in] info Type to output.
2125 *
2126 * @return Formatted string.
2127 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002128inline std::string to_string(const PoolingLayerInfo &info)
2129{
2130 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002131 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002132 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002133 << "IsGlobalPooling=" << info.is_global_pooling;
2134 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002135 {
2136 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002137 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2138 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002139 }
2140 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002141 return str.str();
2142}
2143
ramelg0137515692022-02-26 22:06:20 +00002144/** Formatted output of the Size3D type.
2145 *
2146 * @param[out] os Output stream
2147 * @param[in] size Type to output
2148 *
2149 * @return Modified output stream.
2150 */
2151inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2152{
2153 os << size.width << "x" << size.height << "x" << size.depth;
2154
2155 return os;
2156}
2157
2158/** Formatted output of the Size3D type.
2159 *
2160 * @param[in] type Type to output
2161 *
2162 * @return Formatted string.
2163 */
2164inline std::string to_string(const Size3D &type)
2165{
2166 std::stringstream str;
2167 str << type;
2168 return str.str();
2169}
2170
2171/** Formatted output of the Padding3D type.
2172 *
2173 * @param[out] os Output stream.
2174 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2175 *
2176 * @return Modified output stream.
2177 */
2178inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2179{
2180 os << padding3d.left << "," << padding3d.right << ","
2181 << padding3d.top << "," << padding3d.bottom << ","
2182 << padding3d.front << "," << padding3d.back;
2183 return os;
2184}
2185
2186/** Converts a @ref Padding3D to string
2187 *
2188 * @param[in] padding3d Padding3D value to be converted
2189 *
2190 * @return String representing the corresponding Padding3D
2191 */
2192inline std::string to_string(const Padding3D &padding3d)
2193{
2194 std::stringstream str;
2195 str << padding3d;
2196 return str.str();
2197}
2198
2199/** Formatted output of the DimensionRoundingType type.
2200 *
2201 * @param[out] os Output stream.
2202 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2203 *
2204 * @return Modified output stream.
2205 */
2206inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2207{
2208 switch(rounding_type)
2209 {
2210 case DimensionRoundingType::CEIL:
2211 os << "CEIL";
2212 break;
2213 case DimensionRoundingType::FLOOR:
2214 os << "FLOOR";
2215 break;
2216 default:
2217 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2218 }
2219 return os;
2220}
2221
2222/** Formatted output of the Pooling 3d Layer Info.
2223 *
2224 * @param[out] os Output stream.
2225 * @param[in] info Pooling 3D layer info to print to output stream.
2226 *
2227 * @return Modified output stream.
2228 */
2229inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2230{
2231 os << "{Type=" << info.pool_type << ","
2232 << "IsGlobalPooling=" << info.is_global_pooling;
2233 if(!info.is_global_pooling)
2234 {
2235 os << ","
2236 << "PoolSize=" << info.pool_size << ", "
2237 << "Stride=" << info.stride << ", "
2238 << "Padding=" << info.padding << ", "
2239 << "Exclude Padding=" << info.exclude_padding << ", "
2240 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2241 << "DimensionRoundingType=" << info.round_type;
2242 }
2243 os << "}";
2244 return os;
2245}
2246
2247/** Formatted output of the Pooling 3d Layer Info.
2248 *
2249 * @param[in] info Type to output.
2250 *
2251 * @return Formatted string.
2252 */
2253inline std::string to_string(const Pooling3dLayerInfo &info)
2254{
2255 std::stringstream str;
2256 str << info;
2257 return str.str();
2258}
2259
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002260/** Formatted output of the PriorBoxLayerInfo.
2261 *
2262 * @param[in] info Type to output.
2263 *
2264 * @return Formatted string.
2265 */
2266inline std::string to_string(const PriorBoxLayerInfo &info)
2267{
2268 std::stringstream str;
2269 str << "{";
2270 str << "Clip:" << info.clip()
2271 << "Flip:" << info.flip()
2272 << "StepX:" << info.steps()[0]
2273 << "StepY:" << info.steps()[1]
2274 << "MinSizes:" << info.min_sizes().size()
2275 << "MaxSizes:" << info.max_sizes().size()
2276 << "ImgSizeX:" << info.img_size().x
2277 << "ImgSizeY:" << info.img_size().y
2278 << "Offset:" << info.offset()
2279 << "Variances:" << info.variances().size();
2280 str << "}";
2281 return str.str();
2282}
2283
Alex Gildayc357c472018-03-21 13:54:09 +00002284/** Formatted output of the Size2D type.
2285 *
2286 * @param[out] os Output stream
2287 * @param[in] size Type to output
2288 *
2289 * @return Modified output stream.
2290 */
John Richardson25f23682017-11-27 14:35:09 +00002291inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2292{
2293 os << size.width << "x" << size.height;
2294
2295 return os;
2296}
2297
Alex Gildayc357c472018-03-21 13:54:09 +00002298/** Formatted output of the Size2D type.
2299 *
2300 * @param[in] type Type to output
2301 *
2302 * @return Formatted string.
2303 */
John Richardson25f23682017-11-27 14:35:09 +00002304inline std::string to_string(const Size2D &type)
2305{
2306 std::stringstream str;
2307 str << type;
2308 return str.str();
2309}
2310
Alex Gildayc357c472018-03-21 13:54:09 +00002311/** Formatted output of the ConvolutionMethod type.
2312 *
2313 * @param[out] os Output stream
2314 * @param[in] conv_method Type to output
2315 *
2316 * @return Modified output stream.
2317 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002318inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2319{
2320 switch(conv_method)
2321 {
2322 case ConvolutionMethod::GEMM:
2323 os << "GEMM";
2324 break;
2325 case ConvolutionMethod::DIRECT:
2326 os << "DIRECT";
2327 break;
2328 case ConvolutionMethod::WINOGRAD:
2329 os << "WINOGRAD";
2330 break;
SiCongLid9287352021-11-03 19:01:22 +00002331 case ConvolutionMethod::FFT:
2332 os << "FFT";
2333 break;
2334 case ConvolutionMethod::GEMM_CONV2D:
2335 os << "GEMM_CONV2D";
2336 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002337 default:
2338 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2339 }
2340
2341 return os;
2342}
2343
Alex Gildayc357c472018-03-21 13:54:09 +00002344/** Formatted output of the ConvolutionMethod type.
2345 *
2346 * @param[in] conv_method Type to output
2347 *
2348 * @return Formatted string.
2349 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002350inline std::string to_string(const ConvolutionMethod &conv_method)
2351{
2352 std::stringstream str;
2353 str << conv_method;
2354 return str.str();
2355}
2356
Alex Gildayc357c472018-03-21 13:54:09 +00002357/** Formatted output of the GPUTarget type.
2358 *
2359 * @param[out] os Output stream
2360 * @param[in] gpu_target Type to output
2361 *
2362 * @return Modified output stream.
2363 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002364inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2365{
2366 switch(gpu_target)
2367 {
2368 case GPUTarget::GPU_ARCH_MASK:
2369 os << "GPU_ARCH_MASK";
2370 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002371 case GPUTarget::GPU_GENERATION_MASK:
2372 os << "GPU_GENERATION_MASK";
2373 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002374 case GPUTarget::MIDGARD:
2375 os << "MIDGARD";
2376 break;
2377 case GPUTarget::BIFROST:
2378 os << "BIFROST";
2379 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002380 case GPUTarget::VALHALL:
2381 os << "VALHALL";
2382 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002383 case GPUTarget::T600:
2384 os << "T600";
2385 break;
2386 case GPUTarget::T700:
2387 os << "T700";
2388 break;
2389 case GPUTarget::T800:
2390 os << "T800";
2391 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002392 case GPUTarget::G71:
2393 os << "G71";
2394 break;
2395 case GPUTarget::G72:
2396 os << "G72";
2397 break;
2398 case GPUTarget::G51:
2399 os << "G51";
2400 break;
2401 case GPUTarget::G51BIG:
2402 os << "G51BIG";
2403 break;
2404 case GPUTarget::G51LIT:
2405 os << "G51LIT";
2406 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002407 case GPUTarget::G31:
2408 os << "G31";
2409 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002410 case GPUTarget::G76:
2411 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002412 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002413 case GPUTarget::G52:
2414 os << "G52";
2415 break;
2416 case GPUTarget::G52LIT:
2417 os << "G52LIT";
2418 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002419 case GPUTarget::G77:
2420 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002421 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002422 case GPUTarget::G57:
2423 os << "G57";
2424 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002425 case GPUTarget::G78:
2426 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002427 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002428 case GPUTarget::G68:
2429 os << "G68";
2430 break;
2431 case GPUTarget::G78AE:
2432 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002433 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002434 case GPUTarget::G710:
2435 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002436 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002437 case GPUTarget::G610:
2438 os << "G610";
2439 break;
2440 case GPUTarget::G510:
2441 os << "G510";
2442 break;
2443 case GPUTarget::G310:
2444 os << "G310";
2445 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002446 case GPUTarget::G715:
2447 os << "G715";
2448 break;
2449 case GPUTarget::G615:
2450 os << "G615";
2451 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002452 default:
2453 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2454 }
2455
2456 return os;
2457}
2458
Alex Gildayc357c472018-03-21 13:54:09 +00002459/** Formatted output of the GPUTarget type.
2460 *
2461 * @param[in] gpu_target Type to output
2462 *
2463 * @return Formatted string.
2464 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002465inline std::string to_string(const GPUTarget &gpu_target)
2466{
2467 std::stringstream str;
2468 str << gpu_target;
2469 return str.str();
2470}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002471
John Richardson8de92612018-02-22 14:09:31 +00002472/** Formatted output of the DetectionWindow type.
2473 *
2474 * @param[out] os Output stream
2475 * @param[in] detection_window Type to output
2476 *
2477 * @return Modified output stream.
2478 */
John Richardson684cb0f2018-01-09 11:17:00 +00002479inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2480{
2481 os << "{x=" << detection_window.x << ","
2482 << "y=" << detection_window.y << ","
2483 << "width=" << detection_window.width << ","
2484 << "height=" << detection_window.height << ","
2485 << "idx_class=" << detection_window.idx_class << ","
2486 << "score=" << detection_window.score << "}";
2487
2488 return os;
2489}
2490
Isabella Gottardi05e56442018-11-16 11:26:52 +00002491/** Formatted output of the DetectionOutputLayerCodeType type.
2492 *
2493 * @param[out] os Output stream
2494 * @param[in] detection_code Type to output
2495 *
2496 * @return Modified output stream.
2497 */
2498inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2499{
2500 switch(detection_code)
2501 {
2502 case DetectionOutputLayerCodeType::CENTER_SIZE:
2503 os << "CENTER_SIZE";
2504 break;
2505 case DetectionOutputLayerCodeType::CORNER:
2506 os << "CORNER";
2507 break;
2508 case DetectionOutputLayerCodeType::CORNER_SIZE:
2509 os << "CORNER_SIZE";
2510 break;
2511 case DetectionOutputLayerCodeType::TF_CENTER:
2512 os << "TF_CENTER";
2513 break;
2514 default:
2515 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2516 }
2517
2518 return os;
2519}
2520/** Formatted output of the DetectionOutputLayerCodeType type.
2521 *
2522 * @param[in] detection_code Type to output
2523 *
2524 * @return Formatted string.
2525 */
2526inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2527{
2528 std::stringstream str;
2529 str << detection_code;
2530 return str.str();
2531}
2532
2533/** Formatted output of the DetectionOutputLayerInfo type.
2534 *
2535 * @param[out] os Output stream
2536 * @param[in] detection_info Type to output
2537 *
2538 * @return Modified output stream.
2539 */
2540inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2541{
2542 os << "{Classes=" << detection_info.num_classes() << ","
2543 << "ShareLocation=" << detection_info.share_location() << ","
2544 << "CodeType=" << detection_info.code_type() << ","
2545 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2546 << "KeepTopK=" << detection_info.keep_top_k() << ","
2547 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2548 << "Eta=" << detection_info.eta() << ","
2549 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2550 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2551 << "TopK=" << detection_info.top_k() << ","
2552 << "NumLocClasses=" << detection_info.num_loc_classes()
2553 << "}";
2554
2555 return os;
2556}
2557
2558/** Formatted output of the DetectionOutputLayerInfo type.
2559 *
2560 * @param[in] detection_info Type to output
2561 *
2562 * @return Formatted string.
2563 */
2564inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2565{
2566 std::stringstream str;
2567 str << detection_info;
2568 return str.str();
2569}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002570/** Formatted output of the DetectionPostProcessLayerInfo type.
2571 *
2572 * @param[out] os Output stream
2573 * @param[in] detection_info Type to output
2574 *
2575 * @return Modified output stream.
2576 */
2577inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2578{
2579 os << "{MaxDetections=" << detection_info.max_detections() << ","
2580 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2581 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2582 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2583 << "NumClasses=" << detection_info.num_classes() << ","
2584 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2585 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2586 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2587 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2588 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2589 << "DetectionPerClass=" << detection_info.detection_per_class()
2590 << "}";
2591
2592 return os;
2593}
2594
2595/** Formatted output of the DetectionPostProcessLayerInfo type.
2596 *
2597 * @param[in] detection_info Type to output
2598 *
2599 * @return Formatted string.
2600 */
2601inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2602{
2603 std::stringstream str;
2604 str << detection_info;
2605 return str.str();
2606}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002607
John Richardson8de92612018-02-22 14:09:31 +00002608/** Formatted output of the DetectionWindow type.
2609 *
2610 * @param[in] detection_window Type to output
2611 *
2612 * @return Formatted string.
2613 */
2614inline std::string to_string(const DetectionWindow &detection_window)
2615{
2616 std::stringstream str;
2617 str << detection_window;
2618 return str.str();
2619}
2620
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002621/** Formatted output of @ref PriorBoxLayerInfo.
2622 *
2623 * @param[out] os Output stream.
2624 * @param[in] info Type to output.
2625 *
2626 * @return Modified output stream.
2627 */
2628inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2629{
2630 os << "Clip:" << info.clip()
2631 << "Flip:" << info.flip()
2632 << "StepX:" << info.steps()[0]
2633 << "StepY:" << info.steps()[1]
2634 << "MinSizes:" << info.min_sizes()
2635 << "MaxSizes:" << info.max_sizes()
2636 << "ImgSizeX:" << info.img_size().x
2637 << "ImgSizeY:" << info.img_size().y
2638 << "Offset:" << info.offset()
2639 << "Variances:" << info.variances();
2640
2641 return os;
2642}
2643
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002644/** Formatted output of the WinogradInfo type. */
2645inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2646{
2647 os << "{OutputTileSize=" << info.output_tile_size << ","
2648 << "KernelSize=" << info.kernel_size << ","
2649 << "PadStride=" << info.convolution_info << ","
2650 << "OutputDataLayout=" << info.output_data_layout << "}";
2651
2652 return os;
2653}
2654
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002655inline std::string to_string(const WinogradInfo &type)
2656{
2657 std::stringstream str;
2658 str << type;
2659 return str.str();
2660}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002661
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002662/** Convert a CLTunerMode value to a string
2663 *
2664 * @param val CLTunerMode value to be converted
2665 *
2666 * @return String representing the corresponding CLTunerMode.
2667 */
2668inline std::string to_string(const CLTunerMode val)
2669{
2670 switch(val)
2671 {
2672 case CLTunerMode::EXHAUSTIVE:
2673 {
2674 return std::string("Exhaustive");
2675 }
2676 case CLTunerMode::NORMAL:
2677 {
2678 return std::string("Normal");
2679 }
2680 case CLTunerMode::RAPID:
2681 {
2682 return std::string("Rapid");
2683 }
2684 default:
2685 {
2686 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2687 return std::string("UNDEFINED");
2688 }
2689 }
2690}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002691/** Converts a @ref CLGEMMKernelType to string
2692 *
2693 * @param[in] val CLGEMMKernelType value to be converted
2694 *
2695 * @return String representing the corresponding CLGEMMKernelType
2696 */
2697inline std::string to_string(CLGEMMKernelType val)
2698{
2699 switch(val)
2700 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002701 case CLGEMMKernelType::NATIVE:
2702 {
2703 return "Native";
2704 }
2705 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2706 {
2707 return "Reshaped_Only_RHS";
2708 }
2709 case CLGEMMKernelType::RESHAPED:
2710 {
2711 return "Reshaped";
2712 }
2713 default:
2714 {
2715 return "Unknown";
2716 }
2717 }
2718}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002719/** [Print CLTunerMode type] **/
2720/** Formatted output of the CLTunerMode type.
2721 *
2722 * @param[out] os Output stream.
2723 * @param[in] val CLTunerMode to output.
2724 *
2725 * @return Modified output stream.
2726 */
2727inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2728{
2729 os << to_string(val);
2730 return os;
2731}
2732
ramelg013ae3d882021-09-12 23:07:47 +01002733/** Formatted output of the ConvolutionInfo type.
2734 *
2735 * @param[out] os Output stream.
2736 * @param[in] conv_info ConvolutionInfo to output.
2737 *
2738 * @return Modified output stream.
2739 */
2740inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2741{
SiCongLi579ca842021-10-18 09:38:33 +01002742 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2743 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2744 << "act_info=" << to_string(conv_info.act_info) << ", "
2745 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002746 return os;
2747}
2748
2749/** Converts a @ref ConvolutionInfo to string
2750 *
2751 * @param[in] info ConvolutionInfo value to be converted
2752 *
2753 * @return String representing the corresponding ConvolutionInfo
2754 */
2755inline std::string to_string(const ConvolutionInfo &info)
2756{
2757 std::stringstream str;
2758 str << info;
2759 return str.str();
2760}
2761
2762/** Formatted output of the FullyConnectedLayerInfo type.
2763 *
2764 * @param[out] os Output stream.
2765 * @param[in] layer_info FullyConnectedLayerInfo to output.
2766 *
2767 * @return Modified output stream.
2768 */
2769inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2770{
SiCongLi579ca842021-10-18 09:38:33 +01002771 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2772 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2773 << "transpose_weights=" << layer_info.transpose_weights << ", "
2774 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2775 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
SiCongLi579ca842021-10-18 09:38:33 +01002776 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002777 return os;
2778}
2779
2780/** Converts a @ref FullyConnectedLayerInfo to string
2781 *
2782 * @param[in] info FullyConnectedLayerInfo value to be converted
2783 *
2784 * @return String representing the corresponding FullyConnectedLayerInfo
2785 */
2786inline std::string to_string(const FullyConnectedLayerInfo &info)
2787{
2788 std::stringstream str;
2789 str << info;
2790 return str.str();
2791}
2792
2793/** Formatted output of the GEMMLowpOutputStageType type.
2794 *
2795 * @param[out] os Output stream.
2796 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2797 *
2798 * @return Modified output stream.
2799 */
2800inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2801{
2802 switch(gemm_type)
2803 {
2804 case GEMMLowpOutputStageType::NONE:
2805 os << "NONE";
2806 break;
2807 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2808 os << "QUANTIZE_DOWN";
2809 break;
2810 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2811 os << "QUANTIZE_DOWN_FIXEDPOINT";
2812 break;
2813 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2814 os << "QUANTIZE_DOWN_FLOAT";
2815 break;
2816 default:
2817 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2818 }
2819 return os;
2820}
2821
2822/** Converts a @ref GEMMLowpOutputStageType to string
2823 *
2824 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2825 *
2826 * @return String representing the corresponding GEMMLowpOutputStageType
2827 */
2828inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2829{
2830 std::stringstream str;
2831 str << gemm_type;
2832 return str.str();
2833}
2834
2835/** Formatted output of the GEMMLowpOutputStageInfo type.
2836 *
2837 * @param[out] os Output stream.
2838 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2839 *
2840 * @return Modified output stream.
2841 */
2842inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2843{
SiCongLi579ca842021-10-18 09:38:33 +01002844 os << "{type=" << gemm_info.type << ", "
2845 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2846 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2847 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2848 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2849 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2850 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2851 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2852 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2853 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2854 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002855 return os;
2856}
2857
2858/** Converts a @ref GEMMLowpOutputStageInfo to string
2859 *
2860 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2861 *
2862 * @return String representing the corresponding GEMMLowpOutputStageInfo
2863 */
2864inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2865{
2866 std::stringstream str;
2867 str << gemm_info;
2868 return str.str();
2869}
2870
2871/** Formatted output of the Conv2dInfo type.
2872 *
2873 * @param[out] os Output stream.
2874 * @param[in] conv_info Conv2dInfo to output.
2875 *
2876 * @return Modified output stream.
2877 */
2878inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2879{
SiCongLi579ca842021-10-18 09:38:33 +01002880 os << "{conv_info=" << conv_info.conv_info << ", "
2881 << "dilation=" << conv_info.dilation << ", "
2882 << "act_info=" << to_string(conv_info.act_info) << ", "
2883 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2884 << "num_groups=" << conv_info.num_groups << ","
2885 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002886 return os;
2887}
2888
2889/** Converts a @ref Conv2dInfo to string
2890 *
2891 * @param[in] conv_info Conv2dInfo value to be converted
2892 *
2893 * @return String representing the corresponding Conv2dInfo
2894 */
2895inline std::string to_string(const Conv2dInfo &conv_info)
2896{
2897 std::stringstream str;
2898 str << conv_info;
2899 return str.str();
2900}
2901
2902/** Formatted output of the PixelValue type.
2903 *
2904 * @param[out] os Output stream.
2905 * @param[in] pixel_value PixelValue to output.
2906 *
2907 * @return Modified output stream.
2908 */
2909inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2910{
SiCongLi579ca842021-10-18 09:38:33 +01002911 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002912 return os;
2913}
2914
2915/** Converts a @ref PixelValue to string
2916 *
2917 * @param[in] pixel_value PixelValue value to be converted
2918 *
2919 * @return String representing the corresponding PixelValue
2920 */
2921inline std::string to_string(const PixelValue &pixel_value)
2922{
2923 std::stringstream str;
2924 str << pixel_value;
2925 return str.str();
2926}
2927
2928/** Formatted output of the ScaleKernelInfo type.
2929 *
2930 * @param[out] os Output stream.
2931 * @param[in] scale_info ScaleKernelInfo to output.
2932 *
2933 * @return Modified output stream.
2934 */
2935inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2936{
SiCongLi579ca842021-10-18 09:38:33 +01002937 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2938 << "BorderMode=" << scale_info.border_mode << ", "
2939 << "PixelValue=" << scale_info.constant_border_value << ", "
2940 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2941 << "use_padding=" << scale_info.use_padding << ", "
2942 << "align_corners=" << scale_info.align_corners << ", "
2943 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002944 return os;
2945}
2946
2947/** Converts a @ref ScaleKernelInfo to string
2948 *
2949 * @param[in] scale_info ScaleKernelInfo value to be converted
2950 *
2951 * @return String representing the corresponding ScaleKernelInfo
2952 */
2953inline std::string to_string(const ScaleKernelInfo &scale_info)
2954{
2955 std::stringstream str;
2956 str << scale_info;
2957 return str.str();
2958}
2959
2960/** Formatted output of the FFTDirection type.
2961 *
2962 * @param[out] os Output stream.
2963 * @param[in] fft_dir FFTDirection to output.
2964 *
2965 * @return Modified output stream.
2966 */
2967inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2968{
2969 switch(fft_dir)
2970 {
2971 case FFTDirection::Forward:
2972 os << "Forward";
2973 break;
2974 case FFTDirection::Inverse:
2975 os << "Inverse";
2976 break;
2977 default:
2978 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2979 }
2980 return os;
2981}
2982
2983/** Converts a @ref FFT1DInfo to string
2984 *
2985 * @param[in] fft_dir FFT1DInfo value to be converted
2986 *
2987 * @return String representing the corresponding FFT1DInfo
2988 */
2989inline std::string to_string(const FFTDirection &fft_dir)
2990{
2991 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002992 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002993 return str.str();
2994}
2995
2996/** Formatted output of the FFT1DInfo type.
2997 *
2998 * @param[out] os Output stream.
2999 * @param[in] fft1d_info FFT1DInfo to output.
3000 *
3001 * @return Modified output stream.
3002 */
3003inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
3004{
SiCongLi579ca842021-10-18 09:38:33 +01003005 os << "{axis=" << fft1d_info.axis << ", "
3006 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003007 return os;
3008}
3009
3010/** Converts a @ref FFT1DInfo to string
3011 *
3012 * @param[in] fft1d_info FFT1DInfo value to be converted
3013 *
3014 * @return String representing the corresponding FFT1DInfo
3015 */
3016inline std::string to_string(const FFT1DInfo &fft1d_info)
3017{
3018 std::stringstream str;
3019 str << fft1d_info;
3020 return str.str();
3021}
3022
3023/** Formatted output of the FFT2DInfo type.
3024 *
3025 * @param[out] os Output stream.
3026 * @param[in] fft2d_info FFT2DInfo to output.
3027 *
3028 * @return Modified output stream.
3029 */
3030inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
3031{
SiCongLi579ca842021-10-18 09:38:33 +01003032 os << "{axis=" << fft2d_info.axis0 << ", "
3033 << "axis=" << fft2d_info.axis1 << ", "
3034 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003035 return os;
3036}
3037
3038/** Converts a @ref FFT2DInfo to string
3039 *
3040 * @param[in] fft2d_info FFT2DInfo value to be converted
3041 *
3042 * @return String representing the corresponding FFT2DInfo
3043 */
3044inline std::string to_string(const FFT2DInfo &fft2d_info)
3045{
3046 std::stringstream str;
3047 str << fft2d_info;
3048 return str.str();
3049}
3050
3051/** Formatted output of the Coordinates2D type.
3052 *
3053 * @param[out] os Output stream.
3054 * @param[in] coord_2d Coordinates2D to output.
3055 *
3056 * @return Modified output stream.
3057 */
3058inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3059{
SiCongLi579ca842021-10-18 09:38:33 +01003060 os << "{x=" << coord_2d.x << ", "
3061 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003062 return os;
3063}
3064
3065/** Converts a @ref Coordinates2D to string
3066 *
3067 * @param[in] coord_2d Coordinates2D value to be converted
3068 *
3069 * @return String representing the corresponding Coordinates2D
3070 */
3071inline std::string to_string(const Coordinates2D &coord_2d)
3072{
3073 std::stringstream str;
3074 str << coord_2d;
3075 return str.str();
3076}
3077
3078/** Formatted output of the FuseBatchNormalizationType type.
3079 *
3080 * @param[out] os Output stream.
3081 * @param[in] fuse_type FuseBatchNormalizationType to output.
3082 *
3083 * @return Modified output stream.
3084 */
3085inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3086{
3087 switch(fuse_type)
3088 {
3089 case FuseBatchNormalizationType::CONVOLUTION:
3090 os << "CONVOLUTION";
3091 break;
3092 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3093 os << "DEPTHWISECONVOLUTION";
3094 break;
3095 default:
3096 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3097 }
3098 return os;
3099}
3100
3101/** Converts a @ref FuseBatchNormalizationType to string
3102 *
3103 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3104 *
3105 * @return String representing the corresponding FuseBatchNormalizationType
3106 */
3107inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3108{
3109 std::stringstream str;
3110 str << fuse_type;
3111 return str.str();
3112}
3113
ramelg01cbbb0382021-09-17 17:36:57 +01003114/** Formatted output of the SoftmaxKernelInfo type.
3115 *
3116 * @param[out] os Output stream.
3117 * @param[in] info SoftmaxKernelInfo to output.
3118 *
3119 * @return Modified output stream.
3120 */
3121inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3122{
SiCongLi579ca842021-10-18 09:38:33 +01003123 os << "{beta=" << info.beta << ", "
3124 << "is_log=" << info.is_log << ", "
3125 << "input_data_type=" << info.input_data_type << ", "
3126 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003127 return os;
3128}
3129
3130/** Converts a @ref SoftmaxKernelInfo to string
3131 *
3132 * @param[in] info SoftmaxKernelInfo value to be converted
3133 *
3134 * @return String representing the corresponding SoftmaxKernelInfo
3135 */
3136inline std::string to_string(const SoftmaxKernelInfo &info)
3137{
3138 std::stringstream str;
3139 str << info;
3140 return str.str();
3141}
3142
3143/** Formatted output of the ScaleKernelInfo type.
3144 *
3145 * @param[out] os Output stream.
3146 * @param[in] lstm_params LSTMParams to output.
3147 *
3148 * @return Modified output stream.
3149 */
3150template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003151::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003152{
ramelg014a6d9e82021-10-02 14:34:36 +01003153 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3154 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3155 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3156 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3157 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3158 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3159 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3160 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3161 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3162 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3163 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3164 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003165 << "cell_clip=" << lstm_params.cell_clip() << ", "
3166 << "projection_clip=" << lstm_params.projection_clip() << ", "
3167 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3168 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3169 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3170 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3171 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3172 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3173 << "has_projection=" << lstm_params.has_projection() << ", "
3174 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3175 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3176 return os;
3177}
3178
3179/** Converts a @ref LSTMParams to string
3180 *
3181 * @param[in] lstm_params LSTMParams<T> value to be converted
3182 *
3183 * @return String representing the corresponding LSTMParams
3184 */
3185template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003186std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003187{
3188 std::stringstream str;
3189 str << lstm_params;
3190 return str.str();
3191}
3192
3193/** Converts a @ref LSTMParams to string
3194 *
3195 * @param[in] num uint8_t value to be converted
3196 *
3197 * @return String representing the corresponding uint8_t
3198 */
3199inline std::string to_string(const uint8_t num)
3200{
3201 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3202 return ::std::to_string(static_cast<int>(num));
3203}
3204
ramelg014a6d9e82021-10-02 14:34:36 +01003205/** Available non maxima suppression types */
3206/** Formatted output of the NMSType type.
3207 *
3208 * @param[out] os Output stream.
3209 * @param[in] nms_type NMSType to output.
3210 *
3211 * @return Modified output stream.
3212 */
3213inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3214{
3215 switch(nms_type)
3216 {
3217 case NMSType::LINEAR:
3218 os << "LINEAR";
3219 break;
3220 case NMSType::GAUSSIAN:
3221 os << "GAUSSIAN";
3222 break;
3223 case NMSType::ORIGINAL:
3224 os << "ORIGINAL";
3225 break;
3226 default:
3227 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3228 }
3229 return os;
3230}
3231
3232/** Converts a @ref NMSType to string
3233 *
3234 * @param[in] nms_type NMSType value to be converted
3235 *
3236 * @return String representing the corresponding NMSType
3237 */
3238inline std::string to_string(const NMSType nms_type)
3239{
3240 std::stringstream str;
3241 str << nms_type;
3242 return str.str();
3243}
3244
3245/** Formatted output of the BoxNMSLimitInfo type.
3246 *
3247 * @param[out] os Output stream.
3248 * @param[in] info BoxNMSLimitInfo to output.
3249 *
3250 * @return Modified output stream.
3251 */
3252inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3253{
SiCongLi579ca842021-10-18 09:38:33 +01003254 os << "{score_thresh=" << info.score_thresh() << ", "
3255 << "nms=" << info.nms() << ", "
3256 << "detections_per_im=" << info.detections_per_im() << ", "
3257 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3258 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3259 << "suppress_size=" << info.suppress_size() << ", "
3260 << "min_size=" << info.min_size() << ", "
3261 << "im_width=" << info.im_width() << ", "
3262 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003263 return os;
3264}
3265
3266/** Converts a @ref BoxNMSLimitInfo to string
3267 *
3268 * @param[in] info BoxNMSLimitInfo value to be converted
3269 *
3270 * @return String representing the corresponding BoxNMSLimitInfo
3271 */
3272inline std::string to_string(const BoxNMSLimitInfo &info)
3273{
3274 std::stringstream str;
3275 str << info;
3276 return str.str();
3277}
3278
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003279/** Converts a @ref DimensionRoundingType to string
3280 *
3281 * @param[in] rounding_type DimensionRoundingType value to be converted
3282 *
3283 * @return String representing the corresponding DimensionRoundingType
3284 */
3285inline std::string to_string(const DimensionRoundingType &rounding_type)
3286{
3287 std::stringstream str;
3288 str << rounding_type;
3289 return str.str();
3290}
3291
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003292/** Formatted output of the Conv3dInfo type.
3293 *
3294 * @param[out] os Output stream.
3295 * @param[in] conv3d_info Type to output.
3296 *
3297 * @return Modified output stream.
3298 */
3299inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3300{
3301 os << conv3d_info.stride;
3302 os << ";";
3303 os << conv3d_info.padding;
3304 os << ";";
3305 os << to_string(conv3d_info.act_info);
3306 os << ";";
3307 os << conv3d_info.dilation;
3308 os << ";";
3309 os << conv3d_info.round_type;
3310 os << ";";
3311 os << conv3d_info.enable_fast_math;
3312
3313 return os;
3314}
3315
3316/** Formatted output of the Conv3dInfo type.
3317 *
3318 * @param[in] conv3d_info Type to output.
3319 *
3320 * @return Formatted string.
3321 */
3322inline std::string to_string(const Conv3dInfo &conv3d_info)
3323{
3324 std::stringstream str;
3325 str << conv3d_info;
3326 return str.str();
3327}
3328
Ramy Elgammal91780022022-07-20 14:57:37 +01003329/** Formatted output of the arm_compute::WeightFormat type.
3330 *
3331 * @param[in] wf arm_compute::WeightFormat Type to output.
3332 *
3333 * @return Formatted string.
3334 */
3335inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003336{
Ramy Elgammal91780022022-07-20 14:57:37 +01003337#define __CASE_WEIGHT_FORMAT(wf) \
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003338case WeightFormat::wf: \
3339 return #wf;
Ramy Elgammal91780022022-07-20 14:57:37 +01003340 switch(wf)
3341 {
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003342 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3343 __CASE_WEIGHT_FORMAT(ANY)
3344 __CASE_WEIGHT_FORMAT(OHWI)
3345 __CASE_WEIGHT_FORMAT(OHWIo2)
3346 __CASE_WEIGHT_FORMAT(OHWIo4)
3347 __CASE_WEIGHT_FORMAT(OHWIo8)
3348 __CASE_WEIGHT_FORMAT(OHWIo16)
3349 __CASE_WEIGHT_FORMAT(OHWIo32)
3350 __CASE_WEIGHT_FORMAT(OHWIo64)
3351 __CASE_WEIGHT_FORMAT(OHWIo128)
3352 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3353 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3354 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3355 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3356 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3357 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3358 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3359 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3360 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3361 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3362 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3363 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3364 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3365 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3366 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3367 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3368 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3369 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3370 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3371 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3372 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3373 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3374 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3375 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3376 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3377 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003378 default:
3379 return "invalid value";
3380 }
3381#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003382}
3383
Ramy Elgammal91780022022-07-20 14:57:37 +01003384/** Formatted output of the arm_compute::WeightFormat type.
3385 *
3386 * @param[out] os Output stream.
3387 * @param[in] wf WeightFormat to output.
3388 *
3389 * @return Modified output stream.
3390 */
3391inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3392{
3393 os << to_string(wf);
3394 return os;
3395}
3396
3397/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3398 *
3399 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3400 *
3401 * @return Formatted string.
3402 */
3403inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003404{
3405 std::stringstream str;
3406 str << "[Input shape = " << std::get<0>(values);
3407 str << ", ";
3408 str << "Expected output shape = " << std::get<1>(values);
3409
3410 str << ", ";
3411 str << "WeightFormat = " << std::get<2>(values) << "]";
3412 return str.str();
3413}
3414
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003415/** Formatted output of the Padding2D type.
3416 *
3417 * @param[out] os Output stream.
3418 * @param[in] padding2d Padding info for 2D dimension shape.
3419 *
3420 * @return Modified output stream.
3421 */
3422inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3423{
3424 os << padding2d.left << "," << padding2d.right << ","
3425 << padding2d.top << "," << padding2d.bottom;
3426 return os;
3427}
3428
3429/** Converts a @ref Padding2D to string
3430 *
3431 * @param[in] padding2d Padding2D value to be converted
3432 *
3433 * @return String representing the corresponding Padding2D
3434 */
3435inline std::string to_string(const Padding2D &padding2d)
3436{
3437 std::stringstream str;
3438 str << padding2d;
3439 return str.str();
3440}
3441
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003442/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3443 *
3444 * @param[out] os Output stream.
3445 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3446 *
3447 * @return Modified output stream.
3448 */
3449inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3450{
3451 os << "Pool2dAttributes="
3452 << "["
3453 << "PoolingType=" << pool2d_attr.pool_type() << ","
3454 << "PoolSize=" << pool2d_attr.pool_size() << ","
3455 << "Padding=" << pool2d_attr.pad() << ","
3456 << "Stride=" << pool2d_attr.stride() << ","
3457 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3458
3459 return os;
3460}
3461
3462/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3463 *
3464 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3465 *
3466 * @return Formatted string.
3467 */
3468inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3469{
3470 std::stringstream str;
3471 str << pool2d_attr;
3472 return str.str();
3473}
3474
3475/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3476 *
3477 * @param[out] os Output stream
3478 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3479 */
3480inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3481{
3482 os << "Settings="
3483 << "["
3484 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3485 return os;
3486}
3487
3488/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3489 *
3490 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3491 *
3492 * @return Formatted string.
3493 */
3494inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3495{
3496 std::stringstream str;
3497 str << settings;
3498 return str.str();
3499}
3500
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003501/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3502 *
3503 * @param[out] os Output stream.
3504 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3505 *
3506 * @return Modified output stream.
3507 */
3508inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3509{
3510 os << "Conv2dAttributes="
3511 << "["
3512 << "Padding=" << conv2d_attr.pad() << ", "
3513 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003514 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003515
3516 return os;
3517}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003518
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003519/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3520 *
3521 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3522 *
3523 * @return Formatted string.
3524 */
3525inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3526{
3527 std::stringstream str;
3528 str << conv2d_attr;
3529 return str.str();
3530}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003531
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003532/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3533 *
3534 * @param[out] os Output stream.
3535 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3536 *
3537 * @return Modified output stream.
3538 */
3539inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3540{
3541 os << "CastAttributes="
3542 << "["
3543 << "Data Type=" << cast_attr.data_type() << ", "
3544 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3545
3546 return os;
3547}
3548/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3549 *
3550 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3551 *
3552 * @return Formatted string.
3553 */
3554inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3555{
3556 std::stringstream str;
3557 str << cast_attr;
3558 return str.str();
3559}
3560
Gunes Bayir7dc02342022-11-21 21:46:50 +00003561/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3562 *
3563 * @param[out] os Output stream.
3564 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3565 *
3566 * @return Modified output stream.
3567 */
3568inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3569{
3570 os << "DepthwiseConv2dAttributes="
3571 << "["
3572 << "Padding=" << dw_conv2d_attr.pad() << ", "
3573 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3574 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3575 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3576 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3577
3578 return os;
3579}
3580/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3581 *
3582 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3583 *
3584 * @return Formatted string.
3585 */
3586inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3587{
3588 std::stringstream str;
3589 str << dw_conv2d_attr;
3590 return str.str();
3591}
3592
Jakub Sujak32741722022-11-25 16:43:18 +00003593/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3594 *
3595 * @param[out] os Output stream.
3596 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3597 *
3598 * @return Modified output stream.
3599 */
3600inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3601{
3602 os << "ClampAttributes="
3603 << "["
3604 << "Min value=" << clamp_attr.min_val() << ", "
3605 << "Max value=" << clamp_attr.max_val() << "]";
3606 return os;
3607}
3608/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3609 *
3610 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3611 *
3612 * @return Formatted string.
3613 */
3614inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3615{
3616 std::stringstream str;
3617 str << clamp_attr;
3618 return str.str();
3619}
3620
Jakub Sujak8ae57142022-12-02 16:09:06 +00003621/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3622 *
3623 * @param[out] os Output stream.
3624 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3625 *
3626 * @return Modified output stream.
3627 */
3628inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3629{
3630 os << "ResizeAttributes="
3631 << "["
3632 << "AlignCorners=" << resize_attr.align_corners() << ", "
3633 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3634 << "OutputHeight=" << resize_attr.output_height() << ", "
3635 << "OutputWidth=" << resize_attr.output_width() << ", "
3636 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3637 return os;
3638}
3639
3640/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3641 *
3642 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3643 *
3644 * @return Formatted string.
3645 */
3646inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3647{
3648 std::stringstream str;
3649 str << resize_attr;
3650 return str.str();
3651}
3652
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003653/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3654 *
3655 * @param[out] os Output stream.
3656 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3657 *
3658 * @return Modified output stream.
3659 */
3660inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3661{
Jakub Sujak7359a872023-01-05 14:24:13 +00003662 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003663 << "["
3664 << "Beta=" << softmax_attr.beta() << ", "
3665 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3666 << "Axis=" << softmax_attr.axis() << "]";
3667 return os;
3668}
3669/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3670 *
3671 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3672 *
3673 * @return Formatted string.
3674 */
3675inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3676{
3677 std::stringstream str;
3678 str << softmax_attr;
3679 return str.str();
3680}
Ramy Elgammalf26ea2f2023-03-24 11:42:03 +00003681/** Formatted output of the arm_compute::MatMulInfo type.
3682 *
3683 * @param[out] os Output stream.
3684 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3685 *
3686 * @return Modified output stream.
3687 */
3688inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulInfo &matmul_info)
3689{
3690 os << "MatMulKernelInfo="
3691 << "["
3692 << "adj_lhs=" << matmul_info.adj_lhs() << ", "
3693 << "adj_rhs=" << matmul_info.adj_rhs() << ", "
3694 << "fused_activation=" << matmul_info.fused_activation().activation() << "]";
3695
3696 return os;
3697}
3698/** Formatted output of the arm_compute::MatMulInfo type.
3699 *
3700 * @param[in] matmul_info arm_compute::MatMulInfo type to output.
3701 *
3702 * @return Formatted string.
3703 */
3704inline std::string to_string(const arm_compute::MatMulInfo &matmul_info)
3705{
3706 std::stringstream str;
3707 str << matmul_info;
3708 return str.str();
3709}
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003710
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00003711/** Formatted output of the arm_compute::MatMulKernelInfo type.
3712 *
3713 * @param[out] os Output stream.
3714 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3715 *
3716 * @return Modified output stream.
3717 */
3718inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::MatMulKernelInfo &matmul_info)
3719{
3720 os << "MatMulKernelInfo="
3721 << "["
3722 << "adj_lhs=" << matmul_info.adj_lhs << ", "
3723 << "adj_rhs=" << matmul_info.adj_rhs << ", "
3724 << "M0=" << matmul_info.m0 << ", "
3725 << "N0=" << matmul_info.n0 << ", "
3726 << "K0=" << matmul_info.k0 << ", "
3727 << "export_rhs_to_cl_image=" << matmul_info.export_rhs_to_cl_image
3728 << "]";
3729
3730 return os;
3731}
3732/** Formatted output of the arm_compute::MatMulKernelInfo type.
3733 *
3734 * @param[in] matmul_info arm_compute::MatMulKernelInfo type to output.
3735 *
3736 * @return Formatted string.
3737 */
3738inline std::string to_string(const arm_compute::MatMulKernelInfo &matmul_info)
3739{
3740 std::stringstream str;
3741 str << matmul_info;
3742 return str.str();
3743}
3744
Mohammed Suhail Munshia1b1e412023-03-23 22:21:31 +00003745/** Formatted output of the arm_compute::CpuMatMulSettings type.
3746 *
3747 * @param[out] os Output stream.
3748 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3749 *
3750 * @return Modified output stream.
3751 */
3752inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::CpuMatMulSettings &settings)
3753{
3754 os << "CpuMatMulSettings="
3755 << "["
3756 << "fast_math=" << settings.fast_math()
3757 << "]";
3758
3759 return os;
3760}
3761/** Formatted output of the arm_compute::CpuMatMulSettings type.
3762 *
3763 * @param[in] settings arm_compute::CpuMatMulSettings type to output.
3764 *
3765 * @return Formatted string.
3766 */
3767inline std::string to_string(const arm_compute::CpuMatMulSettings &settings)
3768{
3769 std::stringstream str;
3770 str << settings;
3771 return str.str();
3772}
3773
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003774} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003775
3776#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */