blob: db27ddccde9908352feb07a5e455d05c76e77b57 [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"
ramelg01cbbb0382021-09-17 17:36:57 +010052#include "arm_compute/runtime/common/LSTMParams.h"
SiCongLi31778612021-11-12 17:33:45 +000053#include "support/Cast.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000054#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010055#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010056#include <sstream>
57#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010058
59namespace arm_compute
60{
Anthony Barbierb940fd62018-06-04 14:14:32 +010061/** Formatted output if arg is not null
62 *
63 * @param[in] arg Object to print
64 *
65 * @return String representing arg.
66 */
67template <typename T>
68std::string to_string_if_not_null(T *arg)
69{
70 if(arg == nullptr)
71 {
72 return "nullptr";
73 }
74 else
75 {
76 return to_string(*arg);
77 }
78}
Anthony Barbierb4670212018-05-18 16:55:39 +010079
ramelg014a6d9e82021-10-02 14:34:36 +010080/** Fallback method: try to use std::to_string:
81 *
82 * @param[in] val Value to convert to string
83 *
84 * @return String representing val.
85 */
86template <typename T>
87inline std::string to_string(const T &val)
88{
89 return support::cpp11::to_string(val);
90}
91
ramelg01b1ba1e32021-09-25 11:53:26 +010092/** Formatted output of a vector of objects.
93 *
ramelg014a6d9e82021-10-02 14:34:36 +010094 * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
95 * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
96 *
ramelg01b1ba1e32021-09-25 11:53:26 +010097 * @param[out] os Output stream
98 * @param[in] args Vector of objects to print
99 *
100 * @return Modified output stream.
101 */
102template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +0100103::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
ramelg01b1ba1e32021-09-25 11:53:26 +0100104{
105 const size_t max_print_size = 5U;
106
107 os << "[";
108 bool first = true;
109 size_t i;
110 for(i = 0; i < args.size(); ++i)
111 {
112 if(i == max_print_size)
113 {
114 break;
115 }
116 if(first)
117 {
118 first = false;
119 }
120 else
121 {
122 os << ", ";
123 }
ramelg014a6d9e82021-10-02 14:34:36 +0100124 os << to_string(args[i]);
ramelg01b1ba1e32021-09-25 11:53:26 +0100125 }
126 if(i < args.size())
127 {
128 os << ", ...";
129 }
130 os << "]";
131 return os;
132}
133
ramelg014a6d9e82021-10-02 14:34:36 +0100134/** Formatted output of a vector of objects.
135 *
136 * @param[in] args Vector of objects to print
137 *
138 * @return String representing args.
139 */
140template <typename T>
141std::string to_string(const std::vector<T> &args)
142{
143 std::stringstream str;
144 str << args;
145 return str.str();
146}
147
SiCongLi1af54162021-10-06 15:25:57 +0100148/** @name (EXPERIMENTAL_POST_OPS)
149 * @{
150 */
151/** Formmated output of the @ref experimental::PostOpType type
152 *
153 * @param[out] os Output stream.
154 * @param[in] post_op_type Type to output.
155 *
156 * @return Modified output stream.
157 */
158inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
159{
160 os << "type=";
161 switch(post_op_type)
162 {
163 case experimental::PostOpType::Activation:
164 {
165 os << "Activation";
166 break;
167 }
168 case experimental::PostOpType::Eltwise_Add:
169 {
170 os << "Eltwise_Add";
171 break;
172 }
ramelg016049eda2021-10-29 10:52:53 +0100173 case experimental::PostOpType::Eltwise_PRelu:
174 {
175 os << "Eltwise_PRelu";
176 break;
177 }
SiCongLi1af54162021-10-06 15:25:57 +0100178 default:
179 {
180 ARM_COMPUTE_ERROR("Unsupported PostOpType");
181 break;
182 }
183 }
184 return os;
185}
186/** Converts a @ref experimental::PostOpType to string
187 *
188 * @param[in] post_op_type PostOpType value to be converted
189 *
190 * @return String representing the corresponding PostOpType
191 */
192inline std::string to_string(experimental::PostOpType post_op_type)
193{
194 std::stringstream str;
195 str << post_op_type;
196 return str.str();
197}
198/** Formatted output of the @ref experimental::IPostOp type.
199 *
200 * @param[out] os Output stream.
201 * @param[in] post_op Type to output.
202 *
203 * @return Modified output stream.
204 */
205template <typename T>
206inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
207{
208 os << "<";
209 os << post_op.type() << ",";
SiCongLieb8bd812021-10-29 15:05:49 +0100210 os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
SiCongLi1af54162021-10-06 15:25:57 +0100211 switch(post_op.type())
212 {
213 case experimental::PostOpType::Activation:
214 {
215 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
216 os << "act_info=" << &(_post_op->_act_info);
217 break;
218 }
219 case experimental::PostOpType::Eltwise_Add:
220 {
221 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
222 os << "convert_policy=" << _post_op->_policy;
223 break;
224 }
ramelg016049eda2021-10-29 10:52:53 +0100225 case experimental::PostOpType::Eltwise_PRelu:
226 {
227 const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
228 os << "convert_policy=" << _post_op->_policy;
229 break;
230 }
SiCongLi1af54162021-10-06 15:25:57 +0100231 default:
232 {
233 ARM_COMPUTE_ERROR("Unsupported PostOpType");
234 break;
235 }
236 }
237 os << ">";
238 return os;
239}
240/** Converts an @ref experimental::IPostOp to string
241 *
242 * @param[in] post_op IPostOp value to be converted
243 *
244 * @return String representing the corresponding IPostOp
245 */
246template <typename T>
247inline std::string to_string(const experimental::IPostOp<T> &post_op)
248{
249 std::stringstream str;
250 str << post_op;
251 return str.str();
252}
253/** Formatted output of the @ref experimental::PostOpList type.
254 *
255 * @param[out] os Output stream.
256 * @param[in] post_ops Type to output.
257 *
258 * @return Modified output stream.
259 */
260template <typename T>
261inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
262{
263 os << "[";
264 for(const auto &post_op : post_ops.get_list())
265 {
266 os << *post_op << ",";
267 }
268 os << "]";
269 return os;
270}
271/** Converts a @ref experimental::PostOpList to string
272 *
273 * @param[in] post_ops PostOpList value to be converted
274 *
275 * @return String representing the corresponding PostOpList
276 */
277template <typename T>
278inline std::string to_string(const experimental::PostOpList<T> &post_ops)
279{
280 std::stringstream str;
281 str << post_ops;
282 return str.str();
283}
284/** @} */ // end of group (EXPERIMENTAL_POST_OPS)
285
Alex Gildayc357c472018-03-21 13:54:09 +0000286/** Formatted output of the Dimensions type.
287 *
288 * @param[out] os Output stream.
289 * @param[in] dimensions Type to output.
290 *
291 * @return Modified output stream.
292 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100293template <typename T>
294inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
295{
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100296 if(dimensions.num_dimensions() > 0)
297 {
298 os << dimensions[0];
299
300 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
301 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +0100302 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100303 }
304 }
305
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100306 return os;
307}
308
Alex Gildayc357c472018-03-21 13:54:09 +0000309/** Formatted output of the RoundingPolicy type.
310 *
311 * @param[out] os Output stream.
312 * @param[in] rounding_policy Type to output.
313 *
314 * @return Modified output stream.
315 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100316inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100317{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100318 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100319 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100320 case RoundingPolicy::TO_ZERO:
321 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100322 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100323 case RoundingPolicy::TO_NEAREST_UP:
324 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100325 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100326 case RoundingPolicy::TO_NEAREST_EVEN:
327 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100328 break;
329 default:
330 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
331 }
332
333 return os;
334}
335
Alex Gildayc357c472018-03-21 13:54:09 +0000336/** Formatted output of the WeightsInfo type.
337 *
338 * @param[out] os Output stream.
339 * @param[in] weights_info Type to output.
340 *
341 * @return Modified output stream.
342 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100343inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100344{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100345 os << weights_info.are_reshaped() << ";";
346 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100347
348 return os;
349}
350
Alex Gildayc357c472018-03-21 13:54:09 +0000351/** Formatted output of the ROIPoolingInfo type.
352 *
353 * @param[out] os Output stream.
354 * @param[in] pool_info Type to output.
355 *
356 * @return Modified output stream.
357 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100358inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100359{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100360 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100361 return os;
362}
363
giuros0118870812018-09-13 09:31:40 +0100364/** Formatted output of the ROIPoolingInfo type.
365 *
366 * @param[in] pool_info Type to output.
367 *
368 * @return Formatted string.
369 */
370inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
371{
372 std::stringstream str;
373 str << pool_info;
374 return str.str();
375}
376
morgolockaba2f912020-05-05 16:28:19 +0100377/** Formatted output of the GEMMKernelInfo type.
378 *
379 * @param[out] os Output stream.
380 * @param[in] gemm_info Type to output.
381 *
382 * @return Modified output stream.
383 */
384inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
385{
SiCongLi579ca842021-10-18 09:38:33 +0100386 os << "( m=" << gemm_info.m;
387 os << " n=" << gemm_info.n;
388 os << " k=" << gemm_info.k;
389 os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
390 os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
391 os << " broadcast_bias=" << gemm_info.broadcast_bias;
392 os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
393 os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
394 os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
395 os << " a_offset=" << gemm_info.a_offset;
396 os << " b_offset=" << gemm_info.b_offset;
397 os << "post_ops=" << gemm_info.post_ops;
morgolockaba2f912020-05-05 16:28:19 +0100398 os << ")";
399 return os;
400}
401
402/** Formatted output of the GEMMLHSMatrixInfo type.
403 *
404 * @param[out] os Output stream.
405 * @param[in] gemm_info Type to output.
406 *
407 * @return Modified output stream.
408 */
409inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
410{
SiCongLi579ca842021-10-18 09:38:33 +0100411 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 +0100412 return os;
413}
414
415/** Formatted output of the GEMMRHSMatrixInfo type.
416 *
417 * @param[out] os Output stream.
418 * @param[in] gemm_info Type to output.
419 *
420 * @return Modified output stream.
421 */
422inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
423{
Jakub Sujak7359a872023-01-05 14:24:13 +0000424 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=" << gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100425 return os;
426}
427
428/** Formatted output of the GEMMRHSMatrixInfo type.
429 *
430 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
431 *
432 * @return Formatted string.
433 */
434inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
435{
436 std::stringstream str;
437 str << gemm_info;
438 return str.str();
439}
440
441/** Formatted output of the GEMMLHSMatrixInfo type.
442 *
443 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
444 *
445 * @return Formatted string.
446 */
447inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
448{
449 std::stringstream str;
450 str << gemm_info;
451 return str.str();
452}
453
454/** Formatted output of the GEMMKernelInfo type.
455 *
456 * @param[in] gemm_info GEMMKernelInfo Type to output.
457 *
458 * @return Formatted string.
459 */
460inline std::string to_string(const GEMMKernelInfo &gemm_info)
461{
462 std::stringstream str;
463 str << gemm_info;
464 return str.str();
465}
466
giuros01c04a0e82018-10-03 12:44:35 +0100467/** Formatted output of the BoundingBoxTransformInfo type.
468 *
469 * @param[out] os Output stream.
470 * @param[in] bbox_info Type to output.
471 *
472 * @return Modified output stream.
473 */
474inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
475{
476 auto weights = bbox_info.weights();
Jakub Sujak7359a872023-01-05 14:24:13 +0000477 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] << "})";
giuros01c04a0e82018-10-03 12:44:35 +0100478 return os;
479}
480
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100481#if defined(ARM_COMPUTE_ENABLE_BF16)
Ramy Elgammal91780022022-07-20 14:57:37 +0100482inline ::std::ostream &operator<<(::std::ostream &os, const bfloat16 &v)
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100483{
484 std::stringstream str;
Pablo Marquez Tello6bcdc572023-01-11 09:54:00 +0000485 str << v;
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100486 os << str.str();
487 return os;
488}
Ramy Elgammal91780022022-07-20 14:57:37 +0100489#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
Pablo Marquez Tellod208f4f2022-07-19 12:19:46 +0100490
giuros01c04a0e82018-10-03 12:44:35 +0100491/** Formatted output of the BoundingBoxTransformInfo type.
492 *
493 * @param[in] bbox_info Type to output.
494 *
495 * @return Formatted string.
496 */
497inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
498{
499 std::stringstream str;
500 str << bbox_info;
501 return str.str();
502}
503
Manuel Bottini5209be52019-02-13 16:34:56 +0000504/** Formatted output of the ComputeAnchorsInfo type.
505 *
506 * @param[out] os Output stream.
507 * @param[in] anchors_info Type to output.
508 *
509 * @return Modified output stream.
510 */
511inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
512{
513 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
514 return os;
515}
516
517/** Formatted output of the ComputeAnchorsInfo type.
518 *
519 * @param[in] anchors_info Type to output.
520 *
521 * @return Formatted string.
522 */
523inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
524{
525 std::stringstream str;
526 str << anchors_info;
527 return str.str();
528}
529
530/** Formatted output of the GenerateProposalsInfo type.
531 *
532 * @param[out] os Output stream.
533 * @param[in] proposals_info Type to output.
534 *
535 * @return Modified output stream.
536 */
537inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
538{
539 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
540 return os;
541}
542
543/** Formatted output of the GenerateProposalsInfo type.
544 *
545 * @param[in] proposals_info Type to output.
546 *
547 * @return Formatted string.
548 */
549inline std::string to_string(const GenerateProposalsInfo &proposals_info)
550{
551 std::stringstream str;
552 str << proposals_info;
553 return str.str();
554}
555
Alex Gildayc357c472018-03-21 13:54:09 +0000556/** Formatted output of the QuantizationInfo type.
557 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100558 * @param[out] os Output stream.
559 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000560 *
561 * @return Modified output stream.
562 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100563inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700564{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100565 const UniformQuantizationInfo uqinfo = qinfo.uniform();
566 os << "Scale:" << uqinfo.scale << "~";
567 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700568 return os;
569}
570
Alex Gildayc357c472018-03-21 13:54:09 +0000571/** Formatted output of the QuantizationInfo type.
572 *
573 * @param[in] quantization_info Type to output.
574 *
575 * @return Formatted string.
576 */
Chunosovd621bca2017-11-03 17:33:15 +0700577inline std::string to_string(const QuantizationInfo &quantization_info)
578{
579 std::stringstream str;
580 str << quantization_info;
581 return str.str();
582}
583
Alex Gildayc357c472018-03-21 13:54:09 +0000584/** Formatted output of the activation function type.
585 *
586 * @param[out] os Output stream.
587 * @param[in] act_function Type to output.
588 *
589 * @return Modified output stream.
590 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100591inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
592{
593 switch(act_function)
594 {
595 case ActivationLayerInfo::ActivationFunction::ABS:
596 os << "ABS";
597 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100598 case ActivationLayerInfo::ActivationFunction::LINEAR:
599 os << "LINEAR";
600 break;
601 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
602 os << "LOGISTIC";
603 break;
604 case ActivationLayerInfo::ActivationFunction::RELU:
605 os << "RELU";
606 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100607 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
608 os << "BOUNDED_RELU";
609 break;
610 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
611 os << "LEAKY_RELU";
612 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100613 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
614 os << "SOFT_RELU";
615 break;
616 case ActivationLayerInfo::ActivationFunction::SQRT:
617 os << "SQRT";
618 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100619 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
620 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000621 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100622 case ActivationLayerInfo::ActivationFunction::ELU:
623 os << "ELU";
624 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100625 case ActivationLayerInfo::ActivationFunction::SQUARE:
626 os << "SQUARE";
627 break;
628 case ActivationLayerInfo::ActivationFunction::TANH:
629 os << "TANH";
630 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100631 case ActivationLayerInfo::ActivationFunction::IDENTITY:
632 os << "IDENTITY";
633 break;
morgolock07df3d42020-02-27 11:46:28 +0000634 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
635 os << "HARD_SWISH";
636 break;
Jonathan Deakind6b8a712022-08-23 11:44:18 +0100637 case ActivationLayerInfo::ActivationFunction::SWISH:
638 os << "SWISH";
639 break;
Murray Kornelsen926f5022022-07-13 21:22:39 -0400640 case ActivationLayerInfo::ActivationFunction::GELU:
641 os << "GELU";
642 break;
morgolock07df3d42020-02-27 11:46:28 +0000643
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100644 default:
645 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
646 }
647
648 return os;
649}
650
Alex Gildayc357c472018-03-21 13:54:09 +0000651/** Formatted output of the activation function info type.
652 *
SiCongLi1af54162021-10-06 15:25:57 +0100653 * @param[in] info ActivationLayerInfo to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000654 *
655 * @return Formatted string.
656 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100657inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100658{
659 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000660 if(info.enabled())
661 {
662 str << info.activation();
663 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100664 return str.str();
665}
666
SiCongLi1af54162021-10-06 15:25:57 +0100667/** Formatted output of the activation function info.
ramelg013ae3d882021-09-12 23:07:47 +0100668 *
SiCongLi1af54162021-10-06 15:25:57 +0100669 * @param[out] os Output stream.
670 * @param[in] info ActivationLayerInfo to output.
ramelg013ae3d882021-09-12 23:07:47 +0100671 *
672 * @return Formatted string.
673 */
SiCongLi1af54162021-10-06 15:25:57 +0100674inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
ramelg013ae3d882021-09-12 23:07:47 +0100675{
ramelg013ae3d882021-09-12 23:07:47 +0100676 if(info != nullptr)
677 {
ramelg013ae3d882021-09-12 23:07:47 +0100678 if(info->enabled())
679 {
SiCongLi1af54162021-10-06 15:25:57 +0100680 os << info->activation();
681 os << "(";
682 os << "VAL_A=" << info->a() << ",";
683 os << "VAL_B=" << info->b();
684 os << ")";
ramelg013ae3d882021-09-12 23:07:47 +0100685 }
SiCongLi1af54162021-10-06 15:25:57 +0100686 else
687 {
688 os << "disabled";
689 }
ramelg013ae3d882021-09-12 23:07:47 +0100690 }
SiCongLi1af54162021-10-06 15:25:57 +0100691 else
692 {
693 os << "nullptr";
694 }
695 return os;
ramelg013ae3d882021-09-12 23:07:47 +0100696}
697
Alex Gildayc357c472018-03-21 13:54:09 +0000698/** Formatted output of the activation function type.
699 *
700 * @param[in] function Type to output.
701 *
702 * @return Formatted string.
703 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100704inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
705{
706 std::stringstream str;
707 str << function;
708 return str.str();
709}
710
Alex Gildayc357c472018-03-21 13:54:09 +0000711/** Formatted output of the NormType type.
712 *
713 * @param[out] os Output stream.
714 * @param[in] norm_type Type to output.
715 *
716 * @return Modified output stream.
717 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100718inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
719{
720 switch(norm_type)
721 {
722 case NormType::CROSS_MAP:
723 os << "CROSS_MAP";
724 break;
725 case NormType::IN_MAP_1D:
726 os << "IN_MAP_1D";
727 break;
728 case NormType::IN_MAP_2D:
729 os << "IN_MAP_2D";
730 break;
731 default:
732 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
733 }
734
735 return os;
736}
737
Alex Gildayc357c472018-03-21 13:54:09 +0000738/** Formatted output of @ref NormalizationLayerInfo.
739 *
740 * @param[in] info Type to output.
741 *
742 * @return Formatted string.
743 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100744inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100745{
746 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000747 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100748 return str.str();
749}
750
Alex Gildayc357c472018-03-21 13:54:09 +0000751/** Formatted output of @ref NormalizationLayerInfo.
752 *
753 * @param[out] os Output stream.
754 * @param[in] info Type to output.
755 *
756 * @return Modified output stream.
757 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100758inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
759{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000760 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100761 return os;
762}
763
Alex Gildayc357c472018-03-21 13:54:09 +0000764/** Formatted output of the PoolingType type.
765 *
766 * @param[out] os Output stream.
767 * @param[in] pool_type Type to output.
768 *
769 * @return Modified output stream.
770 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100771inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
772{
773 switch(pool_type)
774 {
775 case PoolingType::AVG:
776 os << "AVG";
777 break;
778 case PoolingType::MAX:
779 os << "MAX";
780 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100781 case PoolingType::L2:
782 os << "L2";
783 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100784 default:
785 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
786 }
787
788 return os;
789}
790
Alex Gildayc357c472018-03-21 13:54:09 +0000791/** Formatted output of @ref PoolingLayerInfo.
792 *
793 * @param[out] os Output stream.
794 * @param[in] info Type to output.
795 *
796 * @return Modified output stream.
797 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100798inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
799{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000800 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100801
802 return os;
803}
804
Alex Gildayc357c472018-03-21 13:54:09 +0000805/** Formatted output of @ref RoundingPolicy.
806 *
807 * @param[in] rounding_policy Type to output.
808 *
809 * @return Formatted string.
810 */
John Richardsondd715f22017-09-18 16:10:48 +0100811inline std::string to_string(const RoundingPolicy &rounding_policy)
812{
813 std::stringstream str;
814 str << rounding_policy;
815 return str.str();
816}
817
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000818/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000819/** Formatted output of the DataLayout type.
820 *
821 * @param[out] os Output stream.
822 * @param[in] data_layout Type to output.
823 *
824 * @return Modified output stream.
825 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000826inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
827{
828 switch(data_layout)
829 {
830 case DataLayout::UNKNOWN:
831 os << "UNKNOWN";
832 break;
833 case DataLayout::NHWC:
834 os << "NHWC";
835 break;
836 case DataLayout::NCHW:
837 os << "NCHW";
838 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100839 case DataLayout::NDHWC:
840 os << "NDHWC";
841 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100842 case DataLayout::NCDHW:
843 os << "NCDHW";
844 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000845 default:
846 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
847 }
848
849 return os;
850}
851
Alex Gildayc357c472018-03-21 13:54:09 +0000852/** Formatted output of the DataLayout type.
853 *
854 * @param[in] data_layout Type to output.
855 *
856 * @return Formatted string.
857 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000858inline std::string to_string(const arm_compute::DataLayout &data_layout)
859{
860 std::stringstream str;
861 str << data_layout;
862 return str.str();
863}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000864/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000865
Georgios Pinitase2220552018-07-20 13:23:44 +0100866/** Formatted output of the DataLayoutDimension type.
867 *
868 * @param[out] os Output stream.
869 * @param[in] data_layout_dim Data layout dimension to print.
870 *
871 * @return Modified output stream.
872 */
873inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
874{
875 switch(data_layout_dim)
876 {
877 case DataLayoutDimension::WIDTH:
878 os << "WIDTH";
879 break;
880 case DataLayoutDimension::HEIGHT:
881 os << "HEIGHT";
882 break;
883 case DataLayoutDimension::CHANNEL:
884 os << "CHANNEL";
885 break;
Giorgio Arenac9fe9fc2021-10-06 12:54:29 +0100886 case DataLayoutDimension::DEPTH:
887 os << "DEPTH";
888 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100889 case DataLayoutDimension::BATCHES:
890 os << "BATCHES";
891 break;
892 default:
893 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
894 }
895 return os;
896}
897
Alex Gildayc357c472018-03-21 13:54:09 +0000898/** Formatted output of the DataType type.
899 *
900 * @param[out] os Output stream.
901 * @param[in] data_type Type to output.
902 *
903 * @return Modified output stream.
904 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100905inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
906{
907 switch(data_type)
908 {
909 case DataType::UNKNOWN:
910 os << "UNKNOWN";
911 break;
912 case DataType::U8:
913 os << "U8";
914 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100915 case DataType::QSYMM8:
916 os << "QSYMM8";
917 break;
Chunosovd621bca2017-11-03 17:33:15 +0700918 case DataType::QASYMM8:
919 os << "QASYMM8";
920 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000921 case DataType::QASYMM8_SIGNED:
922 os << "QASYMM8_SIGNED";
923 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100924 case DataType::QSYMM8_PER_CHANNEL:
925 os << "QSYMM8_PER_CHANNEL";
926 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100927 case DataType::S8:
928 os << "S8";
929 break;
930 case DataType::U16:
931 os << "U16";
932 break;
933 case DataType::S16:
934 os << "S16";
935 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100936 case DataType::QSYMM16:
937 os << "QSYMM16";
938 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100939 case DataType::QASYMM16:
940 os << "QASYMM16";
941 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100942 case DataType::U32:
943 os << "U32";
944 break;
945 case DataType::S32:
946 os << "S32";
947 break;
948 case DataType::U64:
949 os << "U64";
950 break;
951 case DataType::S64:
952 os << "S64";
953 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000954 case DataType::BFLOAT16:
955 os << "BFLOAT16";
956 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100957 case DataType::F16:
958 os << "F16";
959 break;
960 case DataType::F32:
961 os << "F32";
962 break;
963 case DataType::F64:
964 os << "F64";
965 break;
966 case DataType::SIZET:
967 os << "SIZET";
968 break;
969 default:
970 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
971 }
972
973 return os;
974}
975
Alex Gildayc357c472018-03-21 13:54:09 +0000976/** Formatted output of the DataType type.
977 *
978 * @param[in] data_type Type to output.
979 *
980 * @return Formatted string.
981 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100982inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100983{
984 std::stringstream str;
985 str << data_type;
986 return str.str();
987}
988
Alex Gildayc357c472018-03-21 13:54:09 +0000989/** Formatted output of the Format type.
990 *
991 * @param[out] os Output stream.
992 * @param[in] format Type to output.
993 *
994 * @return Modified output stream.
995 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100996inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
997{
998 switch(format)
999 {
1000 case Format::UNKNOWN:
1001 os << "UNKNOWN";
1002 break;
1003 case Format::U8:
1004 os << "U8";
1005 break;
1006 case Format::S16:
1007 os << "S16";
1008 break;
1009 case Format::U16:
1010 os << "U16";
1011 break;
1012 case Format::S32:
1013 os << "S32";
1014 break;
1015 case Format::U32:
1016 os << "U32";
1017 break;
1018 case Format::F16:
1019 os << "F16";
1020 break;
1021 case Format::F32:
1022 os << "F32";
1023 break;
1024 case Format::UV88:
1025 os << "UV88";
1026 break;
1027 case Format::RGB888:
1028 os << "RGB888";
1029 break;
1030 case Format::RGBA8888:
1031 os << "RGBA8888";
1032 break;
1033 case Format::YUV444:
1034 os << "YUV444";
1035 break;
1036 case Format::YUYV422:
1037 os << "YUYV422";
1038 break;
1039 case Format::NV12:
1040 os << "NV12";
1041 break;
1042 case Format::NV21:
1043 os << "NV21";
1044 break;
1045 case Format::IYUV:
1046 os << "IYUV";
1047 break;
1048 case Format::UYVY422:
1049 os << "UYVY422";
1050 break;
1051 default:
1052 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1053 }
1054
1055 return os;
1056}
1057
Alex Gildayc357c472018-03-21 13:54:09 +00001058/** Formatted output of the Format type.
1059 *
1060 * @param[in] format Type to output.
1061 *
1062 * @return Formatted string.
1063 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +01001064inline std::string to_string(const Format &format)
1065{
1066 std::stringstream str;
1067 str << format;
1068 return str.str();
1069}
1070
Alex Gildayc357c472018-03-21 13:54:09 +00001071/** Formatted output of the Channel type.
1072 *
1073 * @param[out] os Output stream.
1074 * @param[in] channel Type to output.
1075 *
1076 * @return Modified output stream.
1077 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001078inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1079{
1080 switch(channel)
1081 {
1082 case Channel::UNKNOWN:
1083 os << "UNKNOWN";
1084 break;
1085 case Channel::C0:
1086 os << "C0";
1087 break;
1088 case Channel::C1:
1089 os << "C1";
1090 break;
1091 case Channel::C2:
1092 os << "C2";
1093 break;
1094 case Channel::C3:
1095 os << "C3";
1096 break;
1097 case Channel::R:
1098 os << "R";
1099 break;
1100 case Channel::G:
1101 os << "G";
1102 break;
1103 case Channel::B:
1104 os << "B";
1105 break;
1106 case Channel::A:
1107 os << "A";
1108 break;
1109 case Channel::Y:
1110 os << "Y";
1111 break;
1112 case Channel::U:
1113 os << "U";
1114 break;
1115 case Channel::V:
1116 os << "V";
1117 break;
1118 default:
1119 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1120 }
1121
1122 return os;
1123}
1124
Alex Gildayc357c472018-03-21 13:54:09 +00001125/** Formatted output of the Channel type.
1126 *
1127 * @param[in] channel Type to output.
1128 *
1129 * @return Formatted string.
1130 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +01001131inline std::string to_string(const Channel &channel)
1132{
1133 std::stringstream str;
1134 str << channel;
1135 return str.str();
1136}
1137
Alex Gildayc357c472018-03-21 13:54:09 +00001138/** Formatted output of the BorderMode type.
1139 *
1140 * @param[out] os Output stream.
1141 * @param[in] mode Type to output.
1142 *
1143 * @return Modified output stream.
1144 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001145inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1146{
1147 switch(mode)
1148 {
1149 case BorderMode::UNDEFINED:
1150 os << "UNDEFINED";
1151 break;
1152 case BorderMode::CONSTANT:
1153 os << "CONSTANT";
1154 break;
1155 case BorderMode::REPLICATE:
1156 os << "REPLICATE";
1157 break;
1158 default:
1159 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1160 }
1161
1162 return os;
1163}
1164
Alex Gildayc357c472018-03-21 13:54:09 +00001165/** Formatted output of the BorderSize type.
1166 *
1167 * @param[out] os Output stream.
1168 * @param[in] border Type to output.
1169 *
1170 * @return Modified output stream.
1171 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001172inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1173{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +01001174 os << border.top << ","
1175 << border.right << ","
1176 << border.bottom << ","
1177 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001178
1179 return os;
1180}
Anthony Barbier2a07e182017-08-04 18:20:27 +01001181
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001182/** Formatted output of the PaddingList type.
1183 *
1184 * @param[out] os Output stream.
1185 * @param[in] padding Type to output.
1186 *
1187 * @return Modified output stream.
1188 */
1189inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1190{
1191 os << "{";
1192 for(auto const &p : padding)
1193 {
1194 os << "{" << p.first << "," << p.second << "}";
1195 }
1196 os << "}";
1197 return os;
1198}
1199
giuros013175fcf2018-11-21 09:59:17 +00001200/** Formatted output of the Multiples type.
1201 *
1202 * @param[out] os Output stream.
1203 * @param[in] multiples Type to output.
1204 *
1205 * @return Modified output stream.
1206 */
1207inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1208{
1209 os << "(";
1210 for(size_t i = 0; i < multiples.size() - 1; i++)
1211 {
1212 os << multiples[i] << ", ";
1213 }
1214 os << multiples.back() << ")";
1215 return os;
1216}
1217
Alex Gildayc357c472018-03-21 13:54:09 +00001218/** Formatted output of the InterpolationPolicy type.
1219 *
1220 * @param[out] os Output stream.
1221 * @param[in] policy Type to output.
1222 *
1223 * @return Modified output stream.
1224 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001225inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1226{
1227 switch(policy)
1228 {
1229 case InterpolationPolicy::NEAREST_NEIGHBOR:
1230 os << "NEAREST_NEIGHBOR";
1231 break;
1232 case InterpolationPolicy::BILINEAR:
1233 os << "BILINEAR";
1234 break;
1235 case InterpolationPolicy::AREA:
1236 os << "AREA";
1237 break;
1238 default:
1239 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1240 }
1241
1242 return os;
1243}
1244
Alex Gildayc357c472018-03-21 13:54:09 +00001245/** Formatted output of the SamplingPolicy type.
1246 *
1247 * @param[out] os Output stream.
1248 * @param[in] policy Type to output.
1249 *
1250 * @return Modified output stream.
1251 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001252inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1253{
1254 switch(policy)
1255 {
1256 case SamplingPolicy::CENTER:
1257 os << "CENTER";
1258 break;
1259 case SamplingPolicy::TOP_LEFT:
1260 os << "TOP_LEFT";
1261 break;
1262 default:
1263 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1264 }
1265
1266 return os;
1267}
1268
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001269/** Formatted output of the ITensorInfo type.
1270 *
1271 * @param[out] os Output stream.
1272 * @param[in] info Tensor information.
1273 *
1274 * @return Modified output stream.
1275 */
1276inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1277{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001278 const DataType data_type = info->data_type();
1279 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001280
1281 os << "Shape=" << info->tensor_shape() << ","
1282 << "DataLayout=" << string_from_data_layout(data_layout) << ","
ramelg014a6d9e82021-10-02 14:34:36 +01001283 << "DataType=" << string_from_data_type(data_type);
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001284
1285 if(is_data_type_quantized(data_type))
1286 {
ramelg01b1ba1e32021-09-25 11:53:26 +01001287 const QuantizationInfo qinfo = info->quantization_info();
1288 const auto scales = qinfo.scale();
1289 const auto offsets = qinfo.offset();
1290
ramelg014a6d9e82021-10-02 14:34:36 +01001291 os << ", QuantizationInfo={"
ramelg01b1ba1e32021-09-25 11:53:26 +01001292 << "scales.size=" << scales.size()
1293 << ", scale(s)=" << scales << ", ";
1294
1295 os << "offsets.size=" << offsets.size()
1296 << ", offset(s)=" << offsets << "}";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001297 }
1298 return os;
1299}
1300
ramelg013ae3d882021-09-12 23:07:47 +01001301/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001302 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001303 * @param[out] os Output stream.
1304 * @param[in] info Type to output.
1305 *
1306 * @return Modified output stream.
1307 */
1308inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1309{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001310 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001311 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001312}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001313
ramelg013ae3d882021-09-12 23:07:47 +01001314/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001315 *
Alex Gildayc357c472018-03-21 13:54:09 +00001316 * @param[in] info Type to output.
1317 *
1318 * @return Formatted string.
1319 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001320inline std::string to_string(const TensorInfo &info)
1321{
1322 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001323 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001324 return str.str();
1325}
1326
ramelg013ae3d882021-09-12 23:07:47 +01001327/** Formatted output of the const ITensorInfo& type.
1328 *
1329 * @param[in] info Type to output.
1330 *
1331 * @return Formatted string.
1332 */
1333inline std::string to_string(const ITensorInfo &info)
1334{
1335 std::stringstream str;
1336 str << &info;
1337 return str.str();
1338}
1339
ramelg013ae3d882021-09-12 23:07:47 +01001340/** Formatted output of the const ITensorInfo* type.
1341 *
1342 * @param[in] info Type to output.
1343 *
1344 * @return Formatted string.
1345 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001346inline std::string to_string(const ITensorInfo *info)
1347{
ramelg013ae3d882021-09-12 23:07:47 +01001348 std::string ret_str = "nullptr";
1349 if(info != nullptr)
1350 {
1351 std::stringstream str;
1352 str << info;
1353 ret_str = str.str();
1354 }
1355 return ret_str;
1356}
1357
ramelg01cbbb0382021-09-17 17:36:57 +01001358/** Formatted output of the ITensorInfo* type.
1359 *
1360 * @param[in] info Type to output.
1361 *
1362 * @return Formatted string.
1363 */
1364inline std::string to_string(ITensorInfo *info)
1365{
1366 return to_string(static_cast<const ITensorInfo *>(info));
1367}
1368
1369/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001370 *
1371 * @param[in] tensor Type to output.
1372 *
1373 * @return Formatted string.
1374 */
1375inline std::string to_string(const ITensor *tensor)
1376{
1377 std::string ret_str = "nullptr";
1378 if(tensor != nullptr)
1379 {
1380 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001381 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001382 ret_str = str.str();
1383 }
1384 return ret_str;
1385}
1386
ramelg01cbbb0382021-09-17 17:36:57 +01001387/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001388 *
1389 * @param[in] tensor Type to output.
1390 *
1391 * @return Formatted string.
1392 */
1393inline std::string to_string(ITensor *tensor)
1394{
ramelg01cbbb0382021-09-17 17:36:57 +01001395 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001396}
1397
ramelg01cbbb0382021-09-17 17:36:57 +01001398/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001399 *
1400 * @param[in] tensor Type to output.
1401 *
1402 * @return Formatted string.
1403 */
1404inline std::string to_string(ITensor &tensor)
1405{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001406 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001407 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001408 return str.str();
1409}
1410
ramelg01cbbb0382021-09-17 17:36:57 +01001411#ifdef ARM_COMPUTE_OPENCL_ENABLED
1412/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1413 *
1414 * @param[in] cl_tensor Type to output.
1415 *
1416 * @return Formatted string.
1417 */
1418inline std::string to_string(const ICLTensor *cl_tensor)
1419{
1420 std::string ret_str = "nullptr";
1421 if(cl_tensor != nullptr)
1422 {
1423 std::stringstream str;
1424 str << "ICLTensor->info(): " << cl_tensor->info();
1425 ret_str = str.str();
1426 }
1427 return ret_str;
1428}
1429
1430/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1431 *
1432 * @param[in] cl_tensor Type to output.
1433 *
1434 * @return Formatted string.
1435 */
1436inline std::string to_string(ICLTensor *cl_tensor)
1437{
1438 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1439}
SiCong Li47f177e2023-02-22 17:24:09 +00001440
1441/** Formatted output of the cl::NDRange type.
1442 *
1443 * @param[out] os Output stream.
1444 * @param[in] nd_range cl::NDRange to output.
1445 *
1446 * @return Modified output stream.
1447 */
1448inline ::std::ostream &operator<<(::std::ostream &os, const cl::NDRange &nd_range)
1449{
1450 os << "{"
1451 << nd_range[0] << ","
1452 << nd_range[1] << ","
1453 << nd_range[2]
1454 << "}";
1455 return os;
1456}
1457
1458/** Formatted output of the cl::NDRange type
1459 *
1460 * @param[in] nd_Range Type to output.
1461 *
1462 * @return Formatted string.
1463 */
1464inline std::string to_string(const cl::NDRange &nd_range)
1465{
1466 std::stringstream str;
1467 str << nd_range;
1468 return str.str();
1469}
ramelg01cbbb0382021-09-17 17:36:57 +01001470#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1471
Alex Gildayc357c472018-03-21 13:54:09 +00001472/** Formatted output of the Dimensions type.
1473 *
1474 * @param[in] dimensions Type to output.
1475 *
1476 * @return Formatted string.
1477 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001478template <typename T>
1479inline std::string to_string(const Dimensions<T> &dimensions)
1480{
1481 std::stringstream str;
1482 str << dimensions;
1483 return str.str();
1484}
1485
Alex Gildayc357c472018-03-21 13:54:09 +00001486/** Formatted output of the Strides type.
1487 *
1488 * @param[in] stride Type to output.
1489 *
1490 * @return Formatted string.
1491 */
John Richardsona36eae12017-09-26 16:55:59 +01001492inline std::string to_string(const Strides &stride)
1493{
1494 std::stringstream str;
1495 str << stride;
1496 return str.str();
1497}
1498
Alex Gildayc357c472018-03-21 13:54:09 +00001499/** Formatted output of the TensorShape type.
1500 *
1501 * @param[in] shape Type to output.
1502 *
1503 * @return Formatted string.
1504 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001505inline std::string to_string(const TensorShape &shape)
1506{
1507 std::stringstream str;
1508 str << shape;
1509 return str.str();
1510}
1511
Alex Gildayc357c472018-03-21 13:54:09 +00001512/** Formatted output of the Coordinates type.
1513 *
1514 * @param[in] coord Type to output.
1515 *
1516 * @return Formatted string.
1517 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001518inline std::string to_string(const Coordinates &coord)
1519{
1520 std::stringstream str;
1521 str << coord;
1522 return str.str();
1523}
1524
Anthony Barbierb940fd62018-06-04 14:14:32 +01001525/** Formatted output of the GEMMReshapeInfo type.
1526 *
1527 * @param[out] os Output stream.
1528 * @param[in] info Type to output.
1529 *
1530 * @return Modified output stream.
1531 */
1532inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1533{
1534 os << "{m=" << info.m() << ",";
1535 os << "n=" << info.n() << ",";
1536 os << "k=" << info.k() << ",";
1537 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1538 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1539 os << "}";
1540
1541 return os;
1542}
1543
1544/** Formatted output of the GEMMInfo type.
1545 *
1546 * @param[out] os Output stream.
1547 * @param[in] info Type to output.
1548 *
1549 * @return Modified output stream.
1550 */
1551inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1552{
1553 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1554 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1555 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001556 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1557 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1558 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1559 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1560 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001561 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001562 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001563
1564 return os;
1565}
1566
1567/** Formatted output of the Window::Dimension type.
1568 *
1569 * @param[out] os Output stream.
1570 * @param[in] dim Type to output.
1571 *
1572 * @return Modified output stream.
1573 */
1574inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1575{
1576 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1577
1578 return os;
1579}
1580/** Formatted output of the Window type.
1581 *
1582 * @param[out] os Output stream.
1583 * @param[in] win Type to output.
1584 *
1585 * @return Modified output stream.
1586 */
1587inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1588{
1589 os << "{";
1590 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1591 {
1592 if(i > 0)
1593 {
1594 os << ", ";
1595 }
1596 os << win[i];
1597 }
1598 os << "}";
1599
1600 return os;
1601}
1602
1603/** Formatted output of the WeightsInfo type.
1604 *
1605 * @param[in] info Type to output.
1606 *
1607 * @return Formatted string.
1608 */
1609inline std::string to_string(const WeightsInfo &info)
1610{
1611 std::stringstream str;
1612 str << info;
1613 return str.str();
1614}
1615
1616/** Formatted output of the GEMMReshapeInfo type.
1617 *
1618 * @param[in] info Type to output.
1619 *
1620 * @return Formatted string.
1621 */
1622inline std::string to_string(const GEMMReshapeInfo &info)
1623{
1624 std::stringstream str;
1625 str << info;
1626 return str.str();
1627}
1628
1629/** Formatted output of the GEMMInfo type.
1630 *
1631 * @param[in] info Type to output.
1632 *
1633 * @return Formatted string.
1634 */
1635inline std::string to_string(const GEMMInfo &info)
1636{
1637 std::stringstream str;
1638 str << info;
1639 return str.str();
1640}
1641
1642/** Formatted output of the Window::Dimension type.
1643 *
1644 * @param[in] dim Type to output.
1645 *
1646 * @return Formatted string.
1647 */
1648inline std::string to_string(const Window::Dimension &dim)
1649{
1650 std::stringstream str;
1651 str << dim;
1652 return str.str();
1653}
ramelg01cbbb0382021-09-17 17:36:57 +01001654/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001655 *
1656 * @param[in] win Type to output.
1657 *
1658 * @return Formatted string.
1659 */
1660inline std::string to_string(const Window &win)
1661{
1662 std::stringstream str;
1663 str << win;
1664 return str.str();
1665}
1666
ramelg01cbbb0382021-09-17 17:36:57 +01001667/** Formatted output of the Window* type.
1668 *
1669 * @param[in] win Type to output.
1670 *
1671 * @return Formatted string.
1672 */
1673inline std::string to_string(Window *win)
1674{
1675 std::string ret_str = "nullptr";
1676 if(win != nullptr)
1677 {
1678 std::stringstream str;
1679 str << *win;
1680 ret_str = str.str();
1681 }
1682 return ret_str;
1683}
1684
Alex Gildayc357c472018-03-21 13:54:09 +00001685/** Formatted output of the Rectangle type.
1686 *
1687 * @param[out] os Output stream.
1688 * @param[in] rect Type to output.
1689 *
1690 * @return Modified output stream.
1691 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001692inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1693{
1694 os << rect.width << "x" << rect.height;
1695 os << "+" << rect.x << "+" << rect.y;
1696
1697 return os;
1698}
1699
Usama Arif8cf8c112019-03-14 15:36:54 +00001700/** Formatted output of the PaddingMode type.
1701 *
1702 * @param[out] os Output stream.
1703 * @param[in] mode Type to output.
1704 *
1705 * @return Modified output stream.
1706 */
1707inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1708{
1709 switch(mode)
1710 {
1711 case PaddingMode::CONSTANT:
1712 os << "CONSTANT";
1713 break;
1714 case PaddingMode::REFLECT:
1715 os << "REFLECT";
1716 break;
1717 case PaddingMode::SYMMETRIC:
1718 os << "SYMMETRIC";
1719 break;
1720 default:
1721 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1722 }
1723
1724 return os;
1725}
1726
1727/** Formatted output of the PaddingMode type.
1728 *
1729 * @param[in] mode Type to output.
1730 *
1731 * @return Formatted string.
1732 */
1733inline std::string to_string(const PaddingMode &mode)
1734{
1735 std::stringstream str;
1736 str << mode;
1737 return str.str();
1738}
1739
Alex Gildayc357c472018-03-21 13:54:09 +00001740/** Formatted output of the PadStrideInfo type.
1741 *
1742 * @param[out] os Output stream.
1743 * @param[in] pad_stride_info Type to output.
1744 *
1745 * @return Modified output stream.
1746 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001747inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1748{
1749 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1750 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001751 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1752 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001753
1754 return os;
1755}
1756
Alex Gildayc357c472018-03-21 13:54:09 +00001757/** Formatted output of the PadStrideInfo type.
1758 *
1759 * @param[in] pad_stride_info Type to output.
1760 *
1761 * @return Formatted string.
1762 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001763inline std::string to_string(const PadStrideInfo &pad_stride_info)
1764{
1765 std::stringstream str;
1766 str << pad_stride_info;
1767 return str.str();
1768}
1769
Alex Gildayc357c472018-03-21 13:54:09 +00001770/** Formatted output of the BorderMode type.
1771 *
1772 * @param[in] mode Type to output.
1773 *
1774 * @return Formatted string.
1775 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001776inline std::string to_string(const BorderMode &mode)
1777{
1778 std::stringstream str;
1779 str << mode;
1780 return str.str();
1781}
1782
Alex Gildayc357c472018-03-21 13:54:09 +00001783/** Formatted output of the BorderSize type.
1784 *
1785 * @param[in] border Type to output.
1786 *
1787 * @return Formatted string.
1788 */
John Richardsonb482ce12017-09-18 12:44:01 +01001789inline std::string to_string(const BorderSize &border)
1790{
1791 std::stringstream str;
1792 str << border;
1793 return str.str();
1794}
1795
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001796/** Formatted output of the PaddingList type.
1797 *
1798 * @param[in] padding Type to output.
1799 *
1800 * @return Formatted string.
1801 */
1802inline std::string to_string(const PaddingList &padding)
1803{
1804 std::stringstream str;
1805 str << padding;
1806 return str.str();
1807}
1808
giuros013175fcf2018-11-21 09:59:17 +00001809/** Formatted output of the Multiples type.
1810 *
1811 * @param[in] multiples Type to output.
1812 *
1813 * @return Formatted string.
1814 */
1815inline std::string to_string(const Multiples &multiples)
1816{
1817 std::stringstream str;
1818 str << multiples;
1819 return str.str();
1820}
1821
Alex Gildayc357c472018-03-21 13:54:09 +00001822/** Formatted output of the InterpolationPolicy type.
1823 *
1824 * @param[in] policy Type to output.
1825 *
1826 * @return Formatted string.
1827 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001828inline std::string to_string(const InterpolationPolicy &policy)
1829{
1830 std::stringstream str;
1831 str << policy;
1832 return str.str();
1833}
1834
Alex Gildayc357c472018-03-21 13:54:09 +00001835/** Formatted output of the SamplingPolicy type.
1836 *
1837 * @param[in] policy Type to output.
1838 *
1839 * @return Formatted string.
1840 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001841inline std::string to_string(const SamplingPolicy &policy)
1842{
1843 std::stringstream str;
1844 str << policy;
1845 return str.str();
1846}
1847
Alex Gildayc357c472018-03-21 13:54:09 +00001848/** Formatted output of the ConvertPolicy type.
1849 *
1850 * @param[out] os Output stream.
1851 * @param[in] policy Type to output.
1852 *
1853 * @return Modified output stream.
1854 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001855inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1856{
1857 switch(policy)
1858 {
1859 case ConvertPolicy::WRAP:
1860 os << "WRAP";
1861 break;
1862 case ConvertPolicy::SATURATE:
1863 os << "SATURATE";
1864 break;
1865 default:
1866 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1867 }
1868
1869 return os;
1870}
1871
1872inline std::string to_string(const ConvertPolicy &policy)
1873{
1874 std::stringstream str;
1875 str << policy;
1876 return str.str();
1877}
1878
giuros01164a2722018-11-20 18:34:46 +00001879/** Formatted output of the ArithmeticOperation type.
1880 *
1881 * @param[out] os Output stream.
1882 * @param[in] op Operation to output.
1883 *
1884 * @return Modified output stream.
1885 */
1886inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1887{
1888 switch(op)
1889 {
1890 case ArithmeticOperation::ADD:
1891 os << "ADD";
1892 break;
1893 case ArithmeticOperation::SUB:
1894 os << "SUB";
1895 break;
1896 case ArithmeticOperation::DIV:
1897 os << "DIV";
1898 break;
1899 case ArithmeticOperation::MAX:
1900 os << "MAX";
1901 break;
1902 case ArithmeticOperation::MIN:
1903 os << "MIN";
1904 break;
1905 case ArithmeticOperation::SQUARED_DIFF:
1906 os << "SQUARED_DIFF";
1907 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001908 case ArithmeticOperation::POWER:
1909 os << "POWER";
1910 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001911 case ArithmeticOperation::PRELU:
1912 os << "PRELU";
1913 break;
giuros01164a2722018-11-20 18:34:46 +00001914 default:
1915 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1916 }
1917
1918 return os;
1919}
1920
1921/** Formatted output of the Arithmetic Operation
1922 *
1923 * @param[in] op Type to output.
1924 *
1925 * @return Formatted string.
1926 */
1927inline std::string to_string(const ArithmeticOperation &op)
1928{
1929 std::stringstream str;
1930 str << op;
1931 return str.str();
1932}
1933
Alex Gildayc357c472018-03-21 13:54:09 +00001934/** Formatted output of the Reduction Operations.
1935 *
1936 * @param[out] os Output stream.
1937 * @param[in] op Type to output.
1938 *
1939 * @return Modified output stream.
1940 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001941inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1942{
1943 switch(op)
1944 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001945 case ReductionOperation::SUM:
1946 os << "SUM";
1947 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001948 case ReductionOperation::SUM_SQUARE:
1949 os << "SUM_SQUARE";
1950 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001951 case ReductionOperation::MEAN_SUM:
1952 os << "MEAN_SUM";
1953 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001954 case ReductionOperation::ARG_IDX_MAX:
1955 os << "ARG_IDX_MAX";
1956 break;
1957 case ReductionOperation::ARG_IDX_MIN:
1958 os << "ARG_IDX_MIN";
1959 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001960 case ReductionOperation::PROD:
1961 os << "PROD";
1962 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001963 case ReductionOperation::MIN:
1964 os << "MIN";
1965 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001966 case ReductionOperation::MAX:
1967 os << "MAX";
1968 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001969 default:
1970 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1971 }
1972
1973 return os;
1974}
1975
Alex Gildayc357c472018-03-21 13:54:09 +00001976/** Formatted output of the Reduction Operations.
1977 *
1978 * @param[in] op Type to output.
1979 *
1980 * @return Formatted string.
1981 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001982inline std::string to_string(const ReductionOperation &op)
1983{
1984 std::stringstream str;
1985 str << op;
1986 return str.str();
1987}
1988
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001989/** Formatted output of the Comparison Operations.
1990 *
1991 * @param[out] os Output stream.
1992 * @param[in] op Type to output.
1993 *
1994 * @return Modified output stream.
1995 */
1996inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1997{
1998 switch(op)
1999 {
2000 case ComparisonOperation::Equal:
2001 os << "Equal";
2002 break;
2003 case ComparisonOperation::NotEqual:
2004 os << "NotEqual";
2005 break;
2006 case ComparisonOperation::Greater:
2007 os << "Greater";
2008 break;
2009 case ComparisonOperation::GreaterEqual:
2010 os << "GreaterEqual";
2011 break;
2012 case ComparisonOperation::Less:
2013 os << "Less";
2014 break;
2015 case ComparisonOperation::LessEqual:
2016 os << "LessEqual";
2017 break;
2018 default:
2019 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2020 }
2021
2022 return os;
2023}
2024
Michalis Spyroue9362622018-11-23 17:41:37 +00002025/** Formatted output of the Elementwise unary Operations.
2026 *
2027 * @param[out] os Output stream.
2028 * @param[in] op Type to output.
2029 *
2030 * @return Modified output stream.
2031 */
2032inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
2033{
2034 switch(op)
2035 {
2036 case ElementWiseUnary::RSQRT:
2037 os << "RSQRT";
2038 break;
2039 case ElementWiseUnary::EXP:
2040 os << "EXP";
2041 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002042 case ElementWiseUnary::NEG:
2043 os << "NEG";
2044 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002045 case ElementWiseUnary::LOG:
2046 os << "LOG";
2047 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002048 case ElementWiseUnary::SIN:
2049 os << "SIN";
2050 break;
2051 case ElementWiseUnary::ABS:
2052 os << "ABS";
2053 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002054 case ElementWiseUnary::ROUND:
2055 os << "ROUND";
2056 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002057 case ElementWiseUnary::LOGICAL_NOT:
2058 os << "LOGICAL_NOT";
2059 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002060 default:
2061 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2062 }
2063
2064 return os;
2065}
2066
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002067/** Formatted output of the Comparison Operations.
2068 *
2069 * @param[in] op Type to output.
2070 *
2071 * @return Formatted string.
2072 */
2073inline std::string to_string(const ComparisonOperation &op)
2074{
2075 std::stringstream str;
2076 str << op;
2077 return str.str();
2078}
2079
Michalis Spyroue9362622018-11-23 17:41:37 +00002080/** Formatted output of the Elementwise unary Operations.
2081 *
2082 * @param[in] op Type to output.
2083 *
2084 * @return Formatted string.
2085 */
2086inline std::string to_string(const ElementWiseUnary &op)
2087{
2088 std::stringstream str;
2089 str << op;
2090 return str.str();
2091}
2092
Alex Gildayc357c472018-03-21 13:54:09 +00002093/** Formatted output of the Norm Type.
2094 *
2095 * @param[in] type Type to output.
2096 *
2097 * @return Formatted string.
2098 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002099inline std::string to_string(const NormType &type)
2100{
2101 std::stringstream str;
2102 str << type;
2103 return str.str();
2104}
2105
Alex Gildayc357c472018-03-21 13:54:09 +00002106/** Formatted output of the Pooling Type.
2107 *
2108 * @param[in] type Type to output.
2109 *
2110 * @return Formatted string.
2111 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002112inline std::string to_string(const PoolingType &type)
2113{
2114 std::stringstream str;
2115 str << type;
2116 return str.str();
2117}
2118
Alex Gildayc357c472018-03-21 13:54:09 +00002119/** Formatted output of the Pooling Layer Info.
2120 *
2121 * @param[in] info Type to output.
2122 *
2123 * @return Formatted string.
2124 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002125inline std::string to_string(const PoolingLayerInfo &info)
2126{
2127 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002128 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002129 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002130 << "IsGlobalPooling=" << info.is_global_pooling;
2131 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002132 {
2133 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002134 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2135 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002136 }
2137 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002138 return str.str();
2139}
2140
ramelg0137515692022-02-26 22:06:20 +00002141/** Formatted output of the Size3D type.
2142 *
2143 * @param[out] os Output stream
2144 * @param[in] size Type to output
2145 *
2146 * @return Modified output stream.
2147 */
2148inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2149{
2150 os << size.width << "x" << size.height << "x" << size.depth;
2151
2152 return os;
2153}
2154
2155/** Formatted output of the Size3D type.
2156 *
2157 * @param[in] type Type to output
2158 *
2159 * @return Formatted string.
2160 */
2161inline std::string to_string(const Size3D &type)
2162{
2163 std::stringstream str;
2164 str << type;
2165 return str.str();
2166}
2167
2168/** Formatted output of the Padding3D type.
2169 *
2170 * @param[out] os Output stream.
2171 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2172 *
2173 * @return Modified output stream.
2174 */
2175inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2176{
2177 os << padding3d.left << "," << padding3d.right << ","
2178 << padding3d.top << "," << padding3d.bottom << ","
2179 << padding3d.front << "," << padding3d.back;
2180 return os;
2181}
2182
2183/** Converts a @ref Padding3D to string
2184 *
2185 * @param[in] padding3d Padding3D value to be converted
2186 *
2187 * @return String representing the corresponding Padding3D
2188 */
2189inline std::string to_string(const Padding3D &padding3d)
2190{
2191 std::stringstream str;
2192 str << padding3d;
2193 return str.str();
2194}
2195
2196/** Formatted output of the DimensionRoundingType type.
2197 *
2198 * @param[out] os Output stream.
2199 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2200 *
2201 * @return Modified output stream.
2202 */
2203inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2204{
2205 switch(rounding_type)
2206 {
2207 case DimensionRoundingType::CEIL:
2208 os << "CEIL";
2209 break;
2210 case DimensionRoundingType::FLOOR:
2211 os << "FLOOR";
2212 break;
2213 default:
2214 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2215 }
2216 return os;
2217}
2218
2219/** Formatted output of the Pooling 3d Layer Info.
2220 *
2221 * @param[out] os Output stream.
2222 * @param[in] info Pooling 3D layer info to print to output stream.
2223 *
2224 * @return Modified output stream.
2225 */
2226inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2227{
2228 os << "{Type=" << info.pool_type << ","
2229 << "IsGlobalPooling=" << info.is_global_pooling;
2230 if(!info.is_global_pooling)
2231 {
2232 os << ","
2233 << "PoolSize=" << info.pool_size << ", "
2234 << "Stride=" << info.stride << ", "
2235 << "Padding=" << info.padding << ", "
2236 << "Exclude Padding=" << info.exclude_padding << ", "
2237 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2238 << "DimensionRoundingType=" << info.round_type;
2239 }
2240 os << "}";
2241 return os;
2242}
2243
2244/** Formatted output of the Pooling 3d Layer Info.
2245 *
2246 * @param[in] info Type to output.
2247 *
2248 * @return Formatted string.
2249 */
2250inline std::string to_string(const Pooling3dLayerInfo &info)
2251{
2252 std::stringstream str;
2253 str << info;
2254 return str.str();
2255}
2256
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002257/** Formatted output of the PriorBoxLayerInfo.
2258 *
2259 * @param[in] info Type to output.
2260 *
2261 * @return Formatted string.
2262 */
2263inline std::string to_string(const PriorBoxLayerInfo &info)
2264{
2265 std::stringstream str;
2266 str << "{";
2267 str << "Clip:" << info.clip()
2268 << "Flip:" << info.flip()
2269 << "StepX:" << info.steps()[0]
2270 << "StepY:" << info.steps()[1]
2271 << "MinSizes:" << info.min_sizes().size()
2272 << "MaxSizes:" << info.max_sizes().size()
2273 << "ImgSizeX:" << info.img_size().x
2274 << "ImgSizeY:" << info.img_size().y
2275 << "Offset:" << info.offset()
2276 << "Variances:" << info.variances().size();
2277 str << "}";
2278 return str.str();
2279}
2280
Alex Gildayc357c472018-03-21 13:54:09 +00002281/** Formatted output of the Size2D type.
2282 *
2283 * @param[out] os Output stream
2284 * @param[in] size Type to output
2285 *
2286 * @return Modified output stream.
2287 */
John Richardson25f23682017-11-27 14:35:09 +00002288inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2289{
2290 os << size.width << "x" << size.height;
2291
2292 return os;
2293}
2294
Alex Gildayc357c472018-03-21 13:54:09 +00002295/** Formatted output of the Size2D type.
2296 *
2297 * @param[in] type Type to output
2298 *
2299 * @return Formatted string.
2300 */
John Richardson25f23682017-11-27 14:35:09 +00002301inline std::string to_string(const Size2D &type)
2302{
2303 std::stringstream str;
2304 str << type;
2305 return str.str();
2306}
2307
Alex Gildayc357c472018-03-21 13:54:09 +00002308/** Formatted output of the ConvolutionMethod type.
2309 *
2310 * @param[out] os Output stream
2311 * @param[in] conv_method Type to output
2312 *
2313 * @return Modified output stream.
2314 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002315inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2316{
2317 switch(conv_method)
2318 {
2319 case ConvolutionMethod::GEMM:
2320 os << "GEMM";
2321 break;
2322 case ConvolutionMethod::DIRECT:
2323 os << "DIRECT";
2324 break;
2325 case ConvolutionMethod::WINOGRAD:
2326 os << "WINOGRAD";
2327 break;
SiCongLid9287352021-11-03 19:01:22 +00002328 case ConvolutionMethod::FFT:
2329 os << "FFT";
2330 break;
2331 case ConvolutionMethod::GEMM_CONV2D:
2332 os << "GEMM_CONV2D";
2333 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002334 default:
2335 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2336 }
2337
2338 return os;
2339}
2340
Alex Gildayc357c472018-03-21 13:54:09 +00002341/** Formatted output of the ConvolutionMethod type.
2342 *
2343 * @param[in] conv_method Type to output
2344 *
2345 * @return Formatted string.
2346 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002347inline std::string to_string(const ConvolutionMethod &conv_method)
2348{
2349 std::stringstream str;
2350 str << conv_method;
2351 return str.str();
2352}
2353
Alex Gildayc357c472018-03-21 13:54:09 +00002354/** Formatted output of the GPUTarget type.
2355 *
2356 * @param[out] os Output stream
2357 * @param[in] gpu_target Type to output
2358 *
2359 * @return Modified output stream.
2360 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002361inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2362{
2363 switch(gpu_target)
2364 {
2365 case GPUTarget::GPU_ARCH_MASK:
2366 os << "GPU_ARCH_MASK";
2367 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002368 case GPUTarget::GPU_GENERATION_MASK:
2369 os << "GPU_GENERATION_MASK";
2370 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002371 case GPUTarget::MIDGARD:
2372 os << "MIDGARD";
2373 break;
2374 case GPUTarget::BIFROST:
2375 os << "BIFROST";
2376 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002377 case GPUTarget::VALHALL:
2378 os << "VALHALL";
2379 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002380 case GPUTarget::T600:
2381 os << "T600";
2382 break;
2383 case GPUTarget::T700:
2384 os << "T700";
2385 break;
2386 case GPUTarget::T800:
2387 os << "T800";
2388 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002389 case GPUTarget::G71:
2390 os << "G71";
2391 break;
2392 case GPUTarget::G72:
2393 os << "G72";
2394 break;
2395 case GPUTarget::G51:
2396 os << "G51";
2397 break;
2398 case GPUTarget::G51BIG:
2399 os << "G51BIG";
2400 break;
2401 case GPUTarget::G51LIT:
2402 os << "G51LIT";
2403 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002404 case GPUTarget::G31:
2405 os << "G31";
2406 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002407 case GPUTarget::G76:
2408 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002409 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002410 case GPUTarget::G52:
2411 os << "G52";
2412 break;
2413 case GPUTarget::G52LIT:
2414 os << "G52LIT";
2415 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002416 case GPUTarget::G77:
2417 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002418 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002419 case GPUTarget::G57:
2420 os << "G57";
2421 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002422 case GPUTarget::G78:
2423 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002424 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002425 case GPUTarget::G68:
2426 os << "G68";
2427 break;
2428 case GPUTarget::G78AE:
2429 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002430 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002431 case GPUTarget::G710:
2432 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002433 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002434 case GPUTarget::G610:
2435 os << "G610";
2436 break;
2437 case GPUTarget::G510:
2438 os << "G510";
2439 break;
2440 case GPUTarget::G310:
2441 os << "G310";
2442 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002443 case GPUTarget::G715:
2444 os << "G715";
2445 break;
2446 case GPUTarget::G615:
2447 os << "G615";
2448 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002449 default:
2450 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2451 }
2452
2453 return os;
2454}
2455
Alex Gildayc357c472018-03-21 13:54:09 +00002456/** Formatted output of the GPUTarget type.
2457 *
2458 * @param[in] gpu_target Type to output
2459 *
2460 * @return Formatted string.
2461 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002462inline std::string to_string(const GPUTarget &gpu_target)
2463{
2464 std::stringstream str;
2465 str << gpu_target;
2466 return str.str();
2467}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002468
John Richardson8de92612018-02-22 14:09:31 +00002469/** Formatted output of the DetectionWindow type.
2470 *
2471 * @param[out] os Output stream
2472 * @param[in] detection_window Type to output
2473 *
2474 * @return Modified output stream.
2475 */
John Richardson684cb0f2018-01-09 11:17:00 +00002476inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2477{
2478 os << "{x=" << detection_window.x << ","
2479 << "y=" << detection_window.y << ","
2480 << "width=" << detection_window.width << ","
2481 << "height=" << detection_window.height << ","
2482 << "idx_class=" << detection_window.idx_class << ","
2483 << "score=" << detection_window.score << "}";
2484
2485 return os;
2486}
2487
Isabella Gottardi05e56442018-11-16 11:26:52 +00002488/** Formatted output of the DetectionOutputLayerCodeType type.
2489 *
2490 * @param[out] os Output stream
2491 * @param[in] detection_code Type to output
2492 *
2493 * @return Modified output stream.
2494 */
2495inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2496{
2497 switch(detection_code)
2498 {
2499 case DetectionOutputLayerCodeType::CENTER_SIZE:
2500 os << "CENTER_SIZE";
2501 break;
2502 case DetectionOutputLayerCodeType::CORNER:
2503 os << "CORNER";
2504 break;
2505 case DetectionOutputLayerCodeType::CORNER_SIZE:
2506 os << "CORNER_SIZE";
2507 break;
2508 case DetectionOutputLayerCodeType::TF_CENTER:
2509 os << "TF_CENTER";
2510 break;
2511 default:
2512 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2513 }
2514
2515 return os;
2516}
2517/** Formatted output of the DetectionOutputLayerCodeType type.
2518 *
2519 * @param[in] detection_code Type to output
2520 *
2521 * @return Formatted string.
2522 */
2523inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2524{
2525 std::stringstream str;
2526 str << detection_code;
2527 return str.str();
2528}
2529
2530/** Formatted output of the DetectionOutputLayerInfo type.
2531 *
2532 * @param[out] os Output stream
2533 * @param[in] detection_info Type to output
2534 *
2535 * @return Modified output stream.
2536 */
2537inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2538{
2539 os << "{Classes=" << detection_info.num_classes() << ","
2540 << "ShareLocation=" << detection_info.share_location() << ","
2541 << "CodeType=" << detection_info.code_type() << ","
2542 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2543 << "KeepTopK=" << detection_info.keep_top_k() << ","
2544 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2545 << "Eta=" << detection_info.eta() << ","
2546 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2547 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2548 << "TopK=" << detection_info.top_k() << ","
2549 << "NumLocClasses=" << detection_info.num_loc_classes()
2550 << "}";
2551
2552 return os;
2553}
2554
2555/** Formatted output of the DetectionOutputLayerInfo type.
2556 *
2557 * @param[in] detection_info Type to output
2558 *
2559 * @return Formatted string.
2560 */
2561inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2562{
2563 std::stringstream str;
2564 str << detection_info;
2565 return str.str();
2566}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002567/** Formatted output of the DetectionPostProcessLayerInfo type.
2568 *
2569 * @param[out] os Output stream
2570 * @param[in] detection_info Type to output
2571 *
2572 * @return Modified output stream.
2573 */
2574inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2575{
2576 os << "{MaxDetections=" << detection_info.max_detections() << ","
2577 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2578 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2579 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2580 << "NumClasses=" << detection_info.num_classes() << ","
2581 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2582 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2583 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2584 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2585 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2586 << "DetectionPerClass=" << detection_info.detection_per_class()
2587 << "}";
2588
2589 return os;
2590}
2591
2592/** Formatted output of the DetectionPostProcessLayerInfo type.
2593 *
2594 * @param[in] detection_info Type to output
2595 *
2596 * @return Formatted string.
2597 */
2598inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2599{
2600 std::stringstream str;
2601 str << detection_info;
2602 return str.str();
2603}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002604
John Richardson8de92612018-02-22 14:09:31 +00002605/** Formatted output of the DetectionWindow type.
2606 *
2607 * @param[in] detection_window Type to output
2608 *
2609 * @return Formatted string.
2610 */
2611inline std::string to_string(const DetectionWindow &detection_window)
2612{
2613 std::stringstream str;
2614 str << detection_window;
2615 return str.str();
2616}
2617
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002618/** Formatted output of @ref PriorBoxLayerInfo.
2619 *
2620 * @param[out] os Output stream.
2621 * @param[in] info Type to output.
2622 *
2623 * @return Modified output stream.
2624 */
2625inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2626{
2627 os << "Clip:" << info.clip()
2628 << "Flip:" << info.flip()
2629 << "StepX:" << info.steps()[0]
2630 << "StepY:" << info.steps()[1]
2631 << "MinSizes:" << info.min_sizes()
2632 << "MaxSizes:" << info.max_sizes()
2633 << "ImgSizeX:" << info.img_size().x
2634 << "ImgSizeY:" << info.img_size().y
2635 << "Offset:" << info.offset()
2636 << "Variances:" << info.variances();
2637
2638 return os;
2639}
2640
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002641/** Formatted output of the WinogradInfo type. */
2642inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2643{
2644 os << "{OutputTileSize=" << info.output_tile_size << ","
2645 << "KernelSize=" << info.kernel_size << ","
2646 << "PadStride=" << info.convolution_info << ","
2647 << "OutputDataLayout=" << info.output_data_layout << "}";
2648
2649 return os;
2650}
2651
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002652inline std::string to_string(const WinogradInfo &type)
2653{
2654 std::stringstream str;
2655 str << type;
2656 return str.str();
2657}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002658
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002659/** Convert a CLTunerMode value to a string
2660 *
2661 * @param val CLTunerMode value to be converted
2662 *
2663 * @return String representing the corresponding CLTunerMode.
2664 */
2665inline std::string to_string(const CLTunerMode val)
2666{
2667 switch(val)
2668 {
2669 case CLTunerMode::EXHAUSTIVE:
2670 {
2671 return std::string("Exhaustive");
2672 }
2673 case CLTunerMode::NORMAL:
2674 {
2675 return std::string("Normal");
2676 }
2677 case CLTunerMode::RAPID:
2678 {
2679 return std::string("Rapid");
2680 }
2681 default:
2682 {
2683 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2684 return std::string("UNDEFINED");
2685 }
2686 }
2687}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002688/** Converts a @ref CLGEMMKernelType to string
2689 *
2690 * @param[in] val CLGEMMKernelType value to be converted
2691 *
2692 * @return String representing the corresponding CLGEMMKernelType
2693 */
2694inline std::string to_string(CLGEMMKernelType val)
2695{
2696 switch(val)
2697 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002698 case CLGEMMKernelType::NATIVE:
2699 {
2700 return "Native";
2701 }
2702 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2703 {
2704 return "Reshaped_Only_RHS";
2705 }
2706 case CLGEMMKernelType::RESHAPED:
2707 {
2708 return "Reshaped";
2709 }
2710 default:
2711 {
2712 return "Unknown";
2713 }
2714 }
2715}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002716/** [Print CLTunerMode type] **/
2717/** Formatted output of the CLTunerMode type.
2718 *
2719 * @param[out] os Output stream.
2720 * @param[in] val CLTunerMode to output.
2721 *
2722 * @return Modified output stream.
2723 */
2724inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2725{
2726 os << to_string(val);
2727 return os;
2728}
2729
ramelg013ae3d882021-09-12 23:07:47 +01002730/** Formatted output of the ConvolutionInfo type.
2731 *
2732 * @param[out] os Output stream.
2733 * @param[in] conv_info ConvolutionInfo to output.
2734 *
2735 * @return Modified output stream.
2736 */
2737inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2738{
SiCongLi579ca842021-10-18 09:38:33 +01002739 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2740 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2741 << "act_info=" << to_string(conv_info.act_info) << ", "
2742 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002743 return os;
2744}
2745
2746/** Converts a @ref ConvolutionInfo to string
2747 *
2748 * @param[in] info ConvolutionInfo value to be converted
2749 *
2750 * @return String representing the corresponding ConvolutionInfo
2751 */
2752inline std::string to_string(const ConvolutionInfo &info)
2753{
2754 std::stringstream str;
2755 str << info;
2756 return str.str();
2757}
2758
2759/** Formatted output of the FullyConnectedLayerInfo type.
2760 *
2761 * @param[out] os Output stream.
2762 * @param[in] layer_info FullyConnectedLayerInfo to output.
2763 *
2764 * @return Modified output stream.
2765 */
2766inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2767{
SiCongLi579ca842021-10-18 09:38:33 +01002768 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2769 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2770 << "transpose_weights=" << layer_info.transpose_weights << ", "
2771 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2772 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2773 << "constant_weights=" << layer_info.transpose_weights << ", "
2774 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002775 return os;
2776}
2777
2778/** Converts a @ref FullyConnectedLayerInfo to string
2779 *
2780 * @param[in] info FullyConnectedLayerInfo value to be converted
2781 *
2782 * @return String representing the corresponding FullyConnectedLayerInfo
2783 */
2784inline std::string to_string(const FullyConnectedLayerInfo &info)
2785{
2786 std::stringstream str;
2787 str << info;
2788 return str.str();
2789}
2790
2791/** Formatted output of the GEMMLowpOutputStageType type.
2792 *
2793 * @param[out] os Output stream.
2794 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2795 *
2796 * @return Modified output stream.
2797 */
2798inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2799{
2800 switch(gemm_type)
2801 {
2802 case GEMMLowpOutputStageType::NONE:
2803 os << "NONE";
2804 break;
2805 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2806 os << "QUANTIZE_DOWN";
2807 break;
2808 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2809 os << "QUANTIZE_DOWN_FIXEDPOINT";
2810 break;
2811 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2812 os << "QUANTIZE_DOWN_FLOAT";
2813 break;
2814 default:
2815 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2816 }
2817 return os;
2818}
2819
2820/** Converts a @ref GEMMLowpOutputStageType to string
2821 *
2822 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2823 *
2824 * @return String representing the corresponding GEMMLowpOutputStageType
2825 */
2826inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2827{
2828 std::stringstream str;
2829 str << gemm_type;
2830 return str.str();
2831}
2832
2833/** Formatted output of the GEMMLowpOutputStageInfo type.
2834 *
2835 * @param[out] os Output stream.
2836 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2837 *
2838 * @return Modified output stream.
2839 */
2840inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2841{
SiCongLi579ca842021-10-18 09:38:33 +01002842 os << "{type=" << gemm_info.type << ", "
2843 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2844 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2845 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2846 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2847 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2848 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2849 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2850 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2851 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2852 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002853 return os;
2854}
2855
2856/** Converts a @ref GEMMLowpOutputStageInfo to string
2857 *
2858 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2859 *
2860 * @return String representing the corresponding GEMMLowpOutputStageInfo
2861 */
2862inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2863{
2864 std::stringstream str;
2865 str << gemm_info;
2866 return str.str();
2867}
2868
2869/** Formatted output of the Conv2dInfo type.
2870 *
2871 * @param[out] os Output stream.
2872 * @param[in] conv_info Conv2dInfo to output.
2873 *
2874 * @return Modified output stream.
2875 */
2876inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2877{
SiCongLi579ca842021-10-18 09:38:33 +01002878 os << "{conv_info=" << conv_info.conv_info << ", "
2879 << "dilation=" << conv_info.dilation << ", "
2880 << "act_info=" << to_string(conv_info.act_info) << ", "
2881 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2882 << "num_groups=" << conv_info.num_groups << ","
2883 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002884 return os;
2885}
2886
2887/** Converts a @ref Conv2dInfo to string
2888 *
2889 * @param[in] conv_info Conv2dInfo value to be converted
2890 *
2891 * @return String representing the corresponding Conv2dInfo
2892 */
2893inline std::string to_string(const Conv2dInfo &conv_info)
2894{
2895 std::stringstream str;
2896 str << conv_info;
2897 return str.str();
2898}
2899
2900/** Formatted output of the PixelValue type.
2901 *
2902 * @param[out] os Output stream.
2903 * @param[in] pixel_value PixelValue to output.
2904 *
2905 * @return Modified output stream.
2906 */
2907inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2908{
SiCongLi579ca842021-10-18 09:38:33 +01002909 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002910 return os;
2911}
2912
2913/** Converts a @ref PixelValue to string
2914 *
2915 * @param[in] pixel_value PixelValue value to be converted
2916 *
2917 * @return String representing the corresponding PixelValue
2918 */
2919inline std::string to_string(const PixelValue &pixel_value)
2920{
2921 std::stringstream str;
2922 str << pixel_value;
2923 return str.str();
2924}
2925
2926/** Formatted output of the ScaleKernelInfo type.
2927 *
2928 * @param[out] os Output stream.
2929 * @param[in] scale_info ScaleKernelInfo to output.
2930 *
2931 * @return Modified output stream.
2932 */
2933inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2934{
SiCongLi579ca842021-10-18 09:38:33 +01002935 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2936 << "BorderMode=" << scale_info.border_mode << ", "
2937 << "PixelValue=" << scale_info.constant_border_value << ", "
2938 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2939 << "use_padding=" << scale_info.use_padding << ", "
2940 << "align_corners=" << scale_info.align_corners << ", "
2941 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002942 return os;
2943}
2944
2945/** Converts a @ref ScaleKernelInfo to string
2946 *
2947 * @param[in] scale_info ScaleKernelInfo value to be converted
2948 *
2949 * @return String representing the corresponding ScaleKernelInfo
2950 */
2951inline std::string to_string(const ScaleKernelInfo &scale_info)
2952{
2953 std::stringstream str;
2954 str << scale_info;
2955 return str.str();
2956}
2957
2958/** Formatted output of the FFTDirection type.
2959 *
2960 * @param[out] os Output stream.
2961 * @param[in] fft_dir FFTDirection to output.
2962 *
2963 * @return Modified output stream.
2964 */
2965inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2966{
2967 switch(fft_dir)
2968 {
2969 case FFTDirection::Forward:
2970 os << "Forward";
2971 break;
2972 case FFTDirection::Inverse:
2973 os << "Inverse";
2974 break;
2975 default:
2976 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2977 }
2978 return os;
2979}
2980
2981/** Converts a @ref FFT1DInfo to string
2982 *
2983 * @param[in] fft_dir FFT1DInfo value to be converted
2984 *
2985 * @return String representing the corresponding FFT1DInfo
2986 */
2987inline std::string to_string(const FFTDirection &fft_dir)
2988{
2989 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002990 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002991 return str.str();
2992}
2993
2994/** Formatted output of the FFT1DInfo type.
2995 *
2996 * @param[out] os Output stream.
2997 * @param[in] fft1d_info FFT1DInfo to output.
2998 *
2999 * @return Modified output stream.
3000 */
3001inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
3002{
SiCongLi579ca842021-10-18 09:38:33 +01003003 os << "{axis=" << fft1d_info.axis << ", "
3004 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003005 return os;
3006}
3007
3008/** Converts a @ref FFT1DInfo to string
3009 *
3010 * @param[in] fft1d_info FFT1DInfo value to be converted
3011 *
3012 * @return String representing the corresponding FFT1DInfo
3013 */
3014inline std::string to_string(const FFT1DInfo &fft1d_info)
3015{
3016 std::stringstream str;
3017 str << fft1d_info;
3018 return str.str();
3019}
3020
3021/** Formatted output of the FFT2DInfo type.
3022 *
3023 * @param[out] os Output stream.
3024 * @param[in] fft2d_info FFT2DInfo to output.
3025 *
3026 * @return Modified output stream.
3027 */
3028inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
3029{
SiCongLi579ca842021-10-18 09:38:33 +01003030 os << "{axis=" << fft2d_info.axis0 << ", "
3031 << "axis=" << fft2d_info.axis1 << ", "
3032 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003033 return os;
3034}
3035
3036/** Converts a @ref FFT2DInfo to string
3037 *
3038 * @param[in] fft2d_info FFT2DInfo value to be converted
3039 *
3040 * @return String representing the corresponding FFT2DInfo
3041 */
3042inline std::string to_string(const FFT2DInfo &fft2d_info)
3043{
3044 std::stringstream str;
3045 str << fft2d_info;
3046 return str.str();
3047}
3048
3049/** Formatted output of the Coordinates2D type.
3050 *
3051 * @param[out] os Output stream.
3052 * @param[in] coord_2d Coordinates2D to output.
3053 *
3054 * @return Modified output stream.
3055 */
3056inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3057{
SiCongLi579ca842021-10-18 09:38:33 +01003058 os << "{x=" << coord_2d.x << ", "
3059 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003060 return os;
3061}
3062
3063/** Converts a @ref Coordinates2D to string
3064 *
3065 * @param[in] coord_2d Coordinates2D value to be converted
3066 *
3067 * @return String representing the corresponding Coordinates2D
3068 */
3069inline std::string to_string(const Coordinates2D &coord_2d)
3070{
3071 std::stringstream str;
3072 str << coord_2d;
3073 return str.str();
3074}
3075
3076/** Formatted output of the FuseBatchNormalizationType type.
3077 *
3078 * @param[out] os Output stream.
3079 * @param[in] fuse_type FuseBatchNormalizationType to output.
3080 *
3081 * @return Modified output stream.
3082 */
3083inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3084{
3085 switch(fuse_type)
3086 {
3087 case FuseBatchNormalizationType::CONVOLUTION:
3088 os << "CONVOLUTION";
3089 break;
3090 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3091 os << "DEPTHWISECONVOLUTION";
3092 break;
3093 default:
3094 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3095 }
3096 return os;
3097}
3098
3099/** Converts a @ref FuseBatchNormalizationType to string
3100 *
3101 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3102 *
3103 * @return String representing the corresponding FuseBatchNormalizationType
3104 */
3105inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3106{
3107 std::stringstream str;
3108 str << fuse_type;
3109 return str.str();
3110}
3111
ramelg01cbbb0382021-09-17 17:36:57 +01003112/** Formatted output of the SoftmaxKernelInfo type.
3113 *
3114 * @param[out] os Output stream.
3115 * @param[in] info SoftmaxKernelInfo to output.
3116 *
3117 * @return Modified output stream.
3118 */
3119inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3120{
SiCongLi579ca842021-10-18 09:38:33 +01003121 os << "{beta=" << info.beta << ", "
3122 << "is_log=" << info.is_log << ", "
3123 << "input_data_type=" << info.input_data_type << ", "
3124 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003125 return os;
3126}
3127
3128/** Converts a @ref SoftmaxKernelInfo to string
3129 *
3130 * @param[in] info SoftmaxKernelInfo value to be converted
3131 *
3132 * @return String representing the corresponding SoftmaxKernelInfo
3133 */
3134inline std::string to_string(const SoftmaxKernelInfo &info)
3135{
3136 std::stringstream str;
3137 str << info;
3138 return str.str();
3139}
3140
3141/** Formatted output of the ScaleKernelInfo type.
3142 *
3143 * @param[out] os Output stream.
3144 * @param[in] lstm_params LSTMParams to output.
3145 *
3146 * @return Modified output stream.
3147 */
3148template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003149::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003150{
ramelg014a6d9e82021-10-02 14:34:36 +01003151 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3152 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3153 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3154 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3155 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3156 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3157 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3158 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3159 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3160 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3161 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3162 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003163 << "cell_clip=" << lstm_params.cell_clip() << ", "
3164 << "projection_clip=" << lstm_params.projection_clip() << ", "
3165 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3166 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3167 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3168 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3169 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3170 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3171 << "has_projection=" << lstm_params.has_projection() << ", "
3172 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3173 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3174 return os;
3175}
3176
3177/** Converts a @ref LSTMParams to string
3178 *
3179 * @param[in] lstm_params LSTMParams<T> value to be converted
3180 *
3181 * @return String representing the corresponding LSTMParams
3182 */
3183template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003184std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003185{
3186 std::stringstream str;
3187 str << lstm_params;
3188 return str.str();
3189}
3190
3191/** Converts a @ref LSTMParams to string
3192 *
3193 * @param[in] num uint8_t value to be converted
3194 *
3195 * @return String representing the corresponding uint8_t
3196 */
3197inline std::string to_string(const uint8_t num)
3198{
3199 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3200 return ::std::to_string(static_cast<int>(num));
3201}
3202
ramelg014a6d9e82021-10-02 14:34:36 +01003203/** Available non maxima suppression types */
3204/** Formatted output of the NMSType type.
3205 *
3206 * @param[out] os Output stream.
3207 * @param[in] nms_type NMSType to output.
3208 *
3209 * @return Modified output stream.
3210 */
3211inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3212{
3213 switch(nms_type)
3214 {
3215 case NMSType::LINEAR:
3216 os << "LINEAR";
3217 break;
3218 case NMSType::GAUSSIAN:
3219 os << "GAUSSIAN";
3220 break;
3221 case NMSType::ORIGINAL:
3222 os << "ORIGINAL";
3223 break;
3224 default:
3225 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3226 }
3227 return os;
3228}
3229
3230/** Converts a @ref NMSType to string
3231 *
3232 * @param[in] nms_type NMSType value to be converted
3233 *
3234 * @return String representing the corresponding NMSType
3235 */
3236inline std::string to_string(const NMSType nms_type)
3237{
3238 std::stringstream str;
3239 str << nms_type;
3240 return str.str();
3241}
3242
3243/** Formatted output of the BoxNMSLimitInfo type.
3244 *
3245 * @param[out] os Output stream.
3246 * @param[in] info BoxNMSLimitInfo to output.
3247 *
3248 * @return Modified output stream.
3249 */
3250inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3251{
SiCongLi579ca842021-10-18 09:38:33 +01003252 os << "{score_thresh=" << info.score_thresh() << ", "
3253 << "nms=" << info.nms() << ", "
3254 << "detections_per_im=" << info.detections_per_im() << ", "
3255 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3256 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3257 << "suppress_size=" << info.suppress_size() << ", "
3258 << "min_size=" << info.min_size() << ", "
3259 << "im_width=" << info.im_width() << ", "
3260 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003261 return os;
3262}
3263
3264/** Converts a @ref BoxNMSLimitInfo to string
3265 *
3266 * @param[in] info BoxNMSLimitInfo value to be converted
3267 *
3268 * @return String representing the corresponding BoxNMSLimitInfo
3269 */
3270inline std::string to_string(const BoxNMSLimitInfo &info)
3271{
3272 std::stringstream str;
3273 str << info;
3274 return str.str();
3275}
3276
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003277/** Converts a @ref DimensionRoundingType to string
3278 *
3279 * @param[in] rounding_type DimensionRoundingType value to be converted
3280 *
3281 * @return String representing the corresponding DimensionRoundingType
3282 */
3283inline std::string to_string(const DimensionRoundingType &rounding_type)
3284{
3285 std::stringstream str;
3286 str << rounding_type;
3287 return str.str();
3288}
3289
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003290/** Formatted output of the Conv3dInfo type.
3291 *
3292 * @param[out] os Output stream.
3293 * @param[in] conv3d_info Type to output.
3294 *
3295 * @return Modified output stream.
3296 */
3297inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3298{
3299 os << conv3d_info.stride;
3300 os << ";";
3301 os << conv3d_info.padding;
3302 os << ";";
3303 os << to_string(conv3d_info.act_info);
3304 os << ";";
3305 os << conv3d_info.dilation;
3306 os << ";";
3307 os << conv3d_info.round_type;
3308 os << ";";
3309 os << conv3d_info.enable_fast_math;
3310
3311 return os;
3312}
3313
3314/** Formatted output of the Conv3dInfo type.
3315 *
3316 * @param[in] conv3d_info Type to output.
3317 *
3318 * @return Formatted string.
3319 */
3320inline std::string to_string(const Conv3dInfo &conv3d_info)
3321{
3322 std::stringstream str;
3323 str << conv3d_info;
3324 return str.str();
3325}
3326
Ramy Elgammal91780022022-07-20 14:57:37 +01003327/** Formatted output of the arm_compute::WeightFormat type.
3328 *
3329 * @param[in] wf arm_compute::WeightFormat Type to output.
3330 *
3331 * @return Formatted string.
3332 */
3333inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003334{
Ramy Elgammal91780022022-07-20 14:57:37 +01003335#define __CASE_WEIGHT_FORMAT(wf) \
Jakub Sujak7359a872023-01-05 14:24:13 +00003336 case WeightFormat::wf: \
3337 return #wf;
Ramy Elgammal91780022022-07-20 14:57:37 +01003338 switch(wf)
3339 {
Jakub Sujak7359a872023-01-05 14:24:13 +00003340 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3341 __CASE_WEIGHT_FORMAT(ANY)
3342 __CASE_WEIGHT_FORMAT(OHWI)
3343 __CASE_WEIGHT_FORMAT(OHWIo2)
3344 __CASE_WEIGHT_FORMAT(OHWIo4)
3345 __CASE_WEIGHT_FORMAT(OHWIo8)
3346 __CASE_WEIGHT_FORMAT(OHWIo16)
3347 __CASE_WEIGHT_FORMAT(OHWIo32)
3348 __CASE_WEIGHT_FORMAT(OHWIo64)
3349 __CASE_WEIGHT_FORMAT(OHWIo128)
3350 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3351 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3352 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3353 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3354 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3355 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3356 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3357 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3358 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3359 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3360 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3361 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3362 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3363 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3364 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3365 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3366 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3367 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3368 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3369 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3370 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3371 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3372 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3373 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3374 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3375 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003376 default:
3377 return "invalid value";
3378 }
3379#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003380}
3381
Ramy Elgammal91780022022-07-20 14:57:37 +01003382/** Formatted output of the arm_compute::WeightFormat type.
3383 *
3384 * @param[out] os Output stream.
3385 * @param[in] wf WeightFormat to output.
3386 *
3387 * @return Modified output stream.
3388 */
3389inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3390{
3391 os << to_string(wf);
3392 return os;
3393}
3394
3395/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3396 *
3397 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3398 *
3399 * @return Formatted string.
3400 */
3401inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003402{
3403 std::stringstream str;
3404 str << "[Input shape = " << std::get<0>(values);
3405 str << ", ";
3406 str << "Expected output shape = " << std::get<1>(values);
3407
3408 str << ", ";
3409 str << "WeightFormat = " << std::get<2>(values) << "]";
3410 return str.str();
3411}
3412
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003413/** Formatted output of the Padding2D type.
3414 *
3415 * @param[out] os Output stream.
3416 * @param[in] padding2d Padding info for 2D dimension shape.
3417 *
3418 * @return Modified output stream.
3419 */
3420inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3421{
3422 os << padding2d.left << "," << padding2d.right << ","
3423 << padding2d.top << "," << padding2d.bottom;
3424 return os;
3425}
3426
3427/** Converts a @ref Padding2D to string
3428 *
3429 * @param[in] padding2d Padding2D value to be converted
3430 *
3431 * @return String representing the corresponding Padding2D
3432 */
3433inline std::string to_string(const Padding2D &padding2d)
3434{
3435 std::stringstream str;
3436 str << padding2d;
3437 return str.str();
3438}
3439
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003440/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3441 *
3442 * @param[out] os Output stream.
3443 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3444 *
3445 * @return Modified output stream.
3446 */
3447inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3448{
3449 os << "Pool2dAttributes="
3450 << "["
3451 << "PoolingType=" << pool2d_attr.pool_type() << ","
3452 << "PoolSize=" << pool2d_attr.pool_size() << ","
3453 << "Padding=" << pool2d_attr.pad() << ","
3454 << "Stride=" << pool2d_attr.stride() << ","
3455 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3456
3457 return os;
3458}
3459
3460/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3461 *
3462 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3463 *
3464 * @return Formatted string.
3465 */
3466inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3467{
3468 std::stringstream str;
3469 str << pool2d_attr;
3470 return str.str();
3471}
3472
3473/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3474 *
3475 * @param[out] os Output stream
3476 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3477 */
3478inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3479{
3480 os << "Settings="
3481 << "["
3482 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3483 return os;
3484}
3485
3486/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3487 *
3488 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3489 *
3490 * @return Formatted string.
3491 */
3492inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3493{
3494 std::stringstream str;
3495 str << settings;
3496 return str.str();
3497}
3498
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003499/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3500 *
3501 * @param[out] os Output stream.
3502 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3503 *
3504 * @return Modified output stream.
3505 */
3506inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3507{
3508 os << "Conv2dAttributes="
3509 << "["
3510 << "Padding=" << conv2d_attr.pad() << ", "
3511 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003512 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003513
3514 return os;
3515}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003516
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003517/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3518 *
3519 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3520 *
3521 * @return Formatted string.
3522 */
3523inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3524{
3525 std::stringstream str;
3526 str << conv2d_attr;
3527 return str.str();
3528}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003529
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003530/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3531 *
3532 * @param[out] os Output stream.
3533 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3534 *
3535 * @return Modified output stream.
3536 */
3537inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3538{
3539 os << "CastAttributes="
3540 << "["
3541 << "Data Type=" << cast_attr.data_type() << ", "
3542 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3543
3544 return os;
3545}
3546/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3547 *
3548 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3549 *
3550 * @return Formatted string.
3551 */
3552inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3553{
3554 std::stringstream str;
3555 str << cast_attr;
3556 return str.str();
3557}
3558
Gunes Bayir7dc02342022-11-21 21:46:50 +00003559/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3560 *
3561 * @param[out] os Output stream.
3562 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3563 *
3564 * @return Modified output stream.
3565 */
3566inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3567{
3568 os << "DepthwiseConv2dAttributes="
3569 << "["
3570 << "Padding=" << dw_conv2d_attr.pad() << ", "
3571 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3572 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3573 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3574 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3575
3576 return os;
3577}
3578/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3579 *
3580 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3581 *
3582 * @return Formatted string.
3583 */
3584inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3585{
3586 std::stringstream str;
3587 str << dw_conv2d_attr;
3588 return str.str();
3589}
3590
Jakub Sujak32741722022-11-25 16:43:18 +00003591/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3592 *
3593 * @param[out] os Output stream.
3594 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3595 *
3596 * @return Modified output stream.
3597 */
3598inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3599{
3600 os << "ClampAttributes="
3601 << "["
3602 << "Min value=" << clamp_attr.min_val() << ", "
3603 << "Max value=" << clamp_attr.max_val() << "]";
3604 return os;
3605}
3606/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3607 *
3608 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3609 *
3610 * @return Formatted string.
3611 */
3612inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3613{
3614 std::stringstream str;
3615 str << clamp_attr;
3616 return str.str();
3617}
3618
Jakub Sujak8ae57142022-12-02 16:09:06 +00003619/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3620 *
3621 * @param[out] os Output stream.
3622 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3623 *
3624 * @return Modified output stream.
3625 */
3626inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3627{
3628 os << "ResizeAttributes="
3629 << "["
3630 << "AlignCorners=" << resize_attr.align_corners() << ", "
3631 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3632 << "OutputHeight=" << resize_attr.output_height() << ", "
3633 << "OutputWidth=" << resize_attr.output_width() << ", "
3634 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3635 return os;
3636}
3637
3638/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3639 *
3640 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3641 *
3642 * @return Formatted string.
3643 */
3644inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3645{
3646 std::stringstream str;
3647 str << resize_attr;
3648 return str.str();
3649}
3650
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003651/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3652 *
3653 * @param[out] os Output stream.
3654 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3655 *
3656 * @return Modified output stream.
3657 */
3658inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3659{
Jakub Sujak7359a872023-01-05 14:24:13 +00003660 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003661 << "["
3662 << "Beta=" << softmax_attr.beta() << ", "
3663 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3664 << "Axis=" << softmax_attr.axis() << "]";
3665 return os;
3666}
3667/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3668 *
3669 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3670 *
3671 * @return Formatted string.
3672 */
3673inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3674{
3675 std::stringstream str;
3676 str << softmax_attr;
3677 return str.str();
3678}
3679
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003680} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003681
3682#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */