blob: 448f1844325ea2e60662afabe7b15107f5da1cac [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}
1440#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1441
Alex Gildayc357c472018-03-21 13:54:09 +00001442/** Formatted output of the Dimensions type.
1443 *
1444 * @param[in] dimensions Type to output.
1445 *
1446 * @return Formatted string.
1447 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001448template <typename T>
1449inline std::string to_string(const Dimensions<T> &dimensions)
1450{
1451 std::stringstream str;
1452 str << dimensions;
1453 return str.str();
1454}
1455
Alex Gildayc357c472018-03-21 13:54:09 +00001456/** Formatted output of the Strides type.
1457 *
1458 * @param[in] stride Type to output.
1459 *
1460 * @return Formatted string.
1461 */
John Richardsona36eae12017-09-26 16:55:59 +01001462inline std::string to_string(const Strides &stride)
1463{
1464 std::stringstream str;
1465 str << stride;
1466 return str.str();
1467}
1468
Alex Gildayc357c472018-03-21 13:54:09 +00001469/** Formatted output of the TensorShape type.
1470 *
1471 * @param[in] shape Type to output.
1472 *
1473 * @return Formatted string.
1474 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001475inline std::string to_string(const TensorShape &shape)
1476{
1477 std::stringstream str;
1478 str << shape;
1479 return str.str();
1480}
1481
Alex Gildayc357c472018-03-21 13:54:09 +00001482/** Formatted output of the Coordinates type.
1483 *
1484 * @param[in] coord Type to output.
1485 *
1486 * @return Formatted string.
1487 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001488inline std::string to_string(const Coordinates &coord)
1489{
1490 std::stringstream str;
1491 str << coord;
1492 return str.str();
1493}
1494
Anthony Barbierb940fd62018-06-04 14:14:32 +01001495/** Formatted output of the GEMMReshapeInfo type.
1496 *
1497 * @param[out] os Output stream.
1498 * @param[in] info Type to output.
1499 *
1500 * @return Modified output stream.
1501 */
1502inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1503{
1504 os << "{m=" << info.m() << ",";
1505 os << "n=" << info.n() << ",";
1506 os << "k=" << info.k() << ",";
1507 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1508 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1509 os << "}";
1510
1511 return os;
1512}
1513
1514/** Formatted output of the GEMMInfo type.
1515 *
1516 * @param[out] os Output stream.
1517 * @param[in] info Type to output.
1518 *
1519 * @return Modified output stream.
1520 */
1521inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1522{
1523 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1524 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1525 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001526 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1527 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1528 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1529 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1530 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001531 os << "pretranspose_B=" << info.pretranspose_B() << ",";
SiCongLi579ca842021-10-18 09:38:33 +01001532 os << "post_ops=" << info.post_ops() << "}";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001533
1534 return os;
1535}
1536
1537/** Formatted output of the Window::Dimension type.
1538 *
1539 * @param[out] os Output stream.
1540 * @param[in] dim Type to output.
1541 *
1542 * @return Modified output stream.
1543 */
1544inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1545{
1546 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1547
1548 return os;
1549}
1550/** Formatted output of the Window type.
1551 *
1552 * @param[out] os Output stream.
1553 * @param[in] win Type to output.
1554 *
1555 * @return Modified output stream.
1556 */
1557inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1558{
1559 os << "{";
1560 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1561 {
1562 if(i > 0)
1563 {
1564 os << ", ";
1565 }
1566 os << win[i];
1567 }
1568 os << "}";
1569
1570 return os;
1571}
1572
1573/** Formatted output of the WeightsInfo type.
1574 *
1575 * @param[in] info Type to output.
1576 *
1577 * @return Formatted string.
1578 */
1579inline std::string to_string(const WeightsInfo &info)
1580{
1581 std::stringstream str;
1582 str << info;
1583 return str.str();
1584}
1585
1586/** Formatted output of the GEMMReshapeInfo type.
1587 *
1588 * @param[in] info Type to output.
1589 *
1590 * @return Formatted string.
1591 */
1592inline std::string to_string(const GEMMReshapeInfo &info)
1593{
1594 std::stringstream str;
1595 str << info;
1596 return str.str();
1597}
1598
1599/** Formatted output of the GEMMInfo type.
1600 *
1601 * @param[in] info Type to output.
1602 *
1603 * @return Formatted string.
1604 */
1605inline std::string to_string(const GEMMInfo &info)
1606{
1607 std::stringstream str;
1608 str << info;
1609 return str.str();
1610}
1611
1612/** Formatted output of the Window::Dimension type.
1613 *
1614 * @param[in] dim Type to output.
1615 *
1616 * @return Formatted string.
1617 */
1618inline std::string to_string(const Window::Dimension &dim)
1619{
1620 std::stringstream str;
1621 str << dim;
1622 return str.str();
1623}
ramelg01cbbb0382021-09-17 17:36:57 +01001624/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001625 *
1626 * @param[in] win Type to output.
1627 *
1628 * @return Formatted string.
1629 */
1630inline std::string to_string(const Window &win)
1631{
1632 std::stringstream str;
1633 str << win;
1634 return str.str();
1635}
1636
ramelg01cbbb0382021-09-17 17:36:57 +01001637/** Formatted output of the Window* type.
1638 *
1639 * @param[in] win Type to output.
1640 *
1641 * @return Formatted string.
1642 */
1643inline std::string to_string(Window *win)
1644{
1645 std::string ret_str = "nullptr";
1646 if(win != nullptr)
1647 {
1648 std::stringstream str;
1649 str << *win;
1650 ret_str = str.str();
1651 }
1652 return ret_str;
1653}
1654
Alex Gildayc357c472018-03-21 13:54:09 +00001655/** Formatted output of the Rectangle type.
1656 *
1657 * @param[out] os Output stream.
1658 * @param[in] rect Type to output.
1659 *
1660 * @return Modified output stream.
1661 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001662inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1663{
1664 os << rect.width << "x" << rect.height;
1665 os << "+" << rect.x << "+" << rect.y;
1666
1667 return os;
1668}
1669
Usama Arif8cf8c112019-03-14 15:36:54 +00001670/** Formatted output of the PaddingMode type.
1671 *
1672 * @param[out] os Output stream.
1673 * @param[in] mode Type to output.
1674 *
1675 * @return Modified output stream.
1676 */
1677inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1678{
1679 switch(mode)
1680 {
1681 case PaddingMode::CONSTANT:
1682 os << "CONSTANT";
1683 break;
1684 case PaddingMode::REFLECT:
1685 os << "REFLECT";
1686 break;
1687 case PaddingMode::SYMMETRIC:
1688 os << "SYMMETRIC";
1689 break;
1690 default:
1691 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1692 }
1693
1694 return os;
1695}
1696
1697/** Formatted output of the PaddingMode type.
1698 *
1699 * @param[in] mode Type to output.
1700 *
1701 * @return Formatted string.
1702 */
1703inline std::string to_string(const PaddingMode &mode)
1704{
1705 std::stringstream str;
1706 str << mode;
1707 return str.str();
1708}
1709
Alex Gildayc357c472018-03-21 13:54:09 +00001710/** Formatted output of the PadStrideInfo type.
1711 *
1712 * @param[out] os Output stream.
1713 * @param[in] pad_stride_info Type to output.
1714 *
1715 * @return Modified output stream.
1716 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001717inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1718{
1719 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1720 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001721 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1722 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001723
1724 return os;
1725}
1726
Alex Gildayc357c472018-03-21 13:54:09 +00001727/** Formatted output of the PadStrideInfo type.
1728 *
1729 * @param[in] pad_stride_info Type to output.
1730 *
1731 * @return Formatted string.
1732 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001733inline std::string to_string(const PadStrideInfo &pad_stride_info)
1734{
1735 std::stringstream str;
1736 str << pad_stride_info;
1737 return str.str();
1738}
1739
Alex Gildayc357c472018-03-21 13:54:09 +00001740/** Formatted output of the BorderMode type.
1741 *
1742 * @param[in] mode Type to output.
1743 *
1744 * @return Formatted string.
1745 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001746inline std::string to_string(const BorderMode &mode)
1747{
1748 std::stringstream str;
1749 str << mode;
1750 return str.str();
1751}
1752
Alex Gildayc357c472018-03-21 13:54:09 +00001753/** Formatted output of the BorderSize type.
1754 *
1755 * @param[in] border Type to output.
1756 *
1757 * @return Formatted string.
1758 */
John Richardsonb482ce12017-09-18 12:44:01 +01001759inline std::string to_string(const BorderSize &border)
1760{
1761 std::stringstream str;
1762 str << border;
1763 return str.str();
1764}
1765
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001766/** Formatted output of the PaddingList type.
1767 *
1768 * @param[in] padding Type to output.
1769 *
1770 * @return Formatted string.
1771 */
1772inline std::string to_string(const PaddingList &padding)
1773{
1774 std::stringstream str;
1775 str << padding;
1776 return str.str();
1777}
1778
giuros013175fcf2018-11-21 09:59:17 +00001779/** Formatted output of the Multiples type.
1780 *
1781 * @param[in] multiples Type to output.
1782 *
1783 * @return Formatted string.
1784 */
1785inline std::string to_string(const Multiples &multiples)
1786{
1787 std::stringstream str;
1788 str << multiples;
1789 return str.str();
1790}
1791
Alex Gildayc357c472018-03-21 13:54:09 +00001792/** Formatted output of the InterpolationPolicy type.
1793 *
1794 * @param[in] policy Type to output.
1795 *
1796 * @return Formatted string.
1797 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001798inline std::string to_string(const InterpolationPolicy &policy)
1799{
1800 std::stringstream str;
1801 str << policy;
1802 return str.str();
1803}
1804
Alex Gildayc357c472018-03-21 13:54:09 +00001805/** Formatted output of the SamplingPolicy type.
1806 *
1807 * @param[in] policy Type to output.
1808 *
1809 * @return Formatted string.
1810 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001811inline std::string to_string(const SamplingPolicy &policy)
1812{
1813 std::stringstream str;
1814 str << policy;
1815 return str.str();
1816}
1817
Alex Gildayc357c472018-03-21 13:54:09 +00001818/** Formatted output of the ConvertPolicy type.
1819 *
1820 * @param[out] os Output stream.
1821 * @param[in] policy Type to output.
1822 *
1823 * @return Modified output stream.
1824 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001825inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1826{
1827 switch(policy)
1828 {
1829 case ConvertPolicy::WRAP:
1830 os << "WRAP";
1831 break;
1832 case ConvertPolicy::SATURATE:
1833 os << "SATURATE";
1834 break;
1835 default:
1836 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1837 }
1838
1839 return os;
1840}
1841
1842inline std::string to_string(const ConvertPolicy &policy)
1843{
1844 std::stringstream str;
1845 str << policy;
1846 return str.str();
1847}
1848
giuros01164a2722018-11-20 18:34:46 +00001849/** Formatted output of the ArithmeticOperation type.
1850 *
1851 * @param[out] os Output stream.
1852 * @param[in] op Operation to output.
1853 *
1854 * @return Modified output stream.
1855 */
1856inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1857{
1858 switch(op)
1859 {
1860 case ArithmeticOperation::ADD:
1861 os << "ADD";
1862 break;
1863 case ArithmeticOperation::SUB:
1864 os << "SUB";
1865 break;
1866 case ArithmeticOperation::DIV:
1867 os << "DIV";
1868 break;
1869 case ArithmeticOperation::MAX:
1870 os << "MAX";
1871 break;
1872 case ArithmeticOperation::MIN:
1873 os << "MIN";
1874 break;
1875 case ArithmeticOperation::SQUARED_DIFF:
1876 os << "SQUARED_DIFF";
1877 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001878 case ArithmeticOperation::POWER:
1879 os << "POWER";
1880 break;
Ramy Elgammal404462a2022-11-08 02:14:46 +00001881 case ArithmeticOperation::PRELU:
1882 os << "PRELU";
1883 break;
giuros01164a2722018-11-20 18:34:46 +00001884 default:
1885 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1886 }
1887
1888 return os;
1889}
1890
1891/** Formatted output of the Arithmetic Operation
1892 *
1893 * @param[in] op Type to output.
1894 *
1895 * @return Formatted string.
1896 */
1897inline std::string to_string(const ArithmeticOperation &op)
1898{
1899 std::stringstream str;
1900 str << op;
1901 return str.str();
1902}
1903
Alex Gildayc357c472018-03-21 13:54:09 +00001904/** Formatted output of the Reduction Operations.
1905 *
1906 * @param[out] os Output stream.
1907 * @param[in] op Type to output.
1908 *
1909 * @return Modified output stream.
1910 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001911inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1912{
1913 switch(op)
1914 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001915 case ReductionOperation::SUM:
1916 os << "SUM";
1917 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001918 case ReductionOperation::SUM_SQUARE:
1919 os << "SUM_SQUARE";
1920 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001921 case ReductionOperation::MEAN_SUM:
1922 os << "MEAN_SUM";
1923 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001924 case ReductionOperation::ARG_IDX_MAX:
1925 os << "ARG_IDX_MAX";
1926 break;
1927 case ReductionOperation::ARG_IDX_MIN:
1928 os << "ARG_IDX_MIN";
1929 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001930 case ReductionOperation::PROD:
1931 os << "PROD";
1932 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001933 case ReductionOperation::MIN:
1934 os << "MIN";
1935 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001936 case ReductionOperation::MAX:
1937 os << "MAX";
1938 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001939 default:
1940 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1941 }
1942
1943 return os;
1944}
1945
Alex Gildayc357c472018-03-21 13:54:09 +00001946/** Formatted output of the Reduction Operations.
1947 *
1948 * @param[in] op Type to output.
1949 *
1950 * @return Formatted string.
1951 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001952inline std::string to_string(const ReductionOperation &op)
1953{
1954 std::stringstream str;
1955 str << op;
1956 return str.str();
1957}
1958
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001959/** Formatted output of the Comparison Operations.
1960 *
1961 * @param[out] os Output stream.
1962 * @param[in] op Type to output.
1963 *
1964 * @return Modified output stream.
1965 */
1966inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1967{
1968 switch(op)
1969 {
1970 case ComparisonOperation::Equal:
1971 os << "Equal";
1972 break;
1973 case ComparisonOperation::NotEqual:
1974 os << "NotEqual";
1975 break;
1976 case ComparisonOperation::Greater:
1977 os << "Greater";
1978 break;
1979 case ComparisonOperation::GreaterEqual:
1980 os << "GreaterEqual";
1981 break;
1982 case ComparisonOperation::Less:
1983 os << "Less";
1984 break;
1985 case ComparisonOperation::LessEqual:
1986 os << "LessEqual";
1987 break;
1988 default:
1989 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1990 }
1991
1992 return os;
1993}
1994
Michalis Spyroue9362622018-11-23 17:41:37 +00001995/** Formatted output of the Elementwise unary Operations.
1996 *
1997 * @param[out] os Output stream.
1998 * @param[in] op Type to output.
1999 *
2000 * @return Modified output stream.
2001 */
2002inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
2003{
2004 switch(op)
2005 {
2006 case ElementWiseUnary::RSQRT:
2007 os << "RSQRT";
2008 break;
2009 case ElementWiseUnary::EXP:
2010 os << "EXP";
2011 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01002012 case ElementWiseUnary::NEG:
2013 os << "NEG";
2014 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01002015 case ElementWiseUnary::LOG:
2016 os << "LOG";
2017 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002018 case ElementWiseUnary::SIN:
2019 os << "SIN";
2020 break;
2021 case ElementWiseUnary::ABS:
2022 os << "ABS";
2023 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01002024 case ElementWiseUnary::ROUND:
2025 os << "ROUND";
2026 break;
ramelg01b1ba1e32021-09-25 11:53:26 +01002027 case ElementWiseUnary::LOGICAL_NOT:
2028 os << "LOGICAL_NOT";
2029 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00002030 default:
2031 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2032 }
2033
2034 return os;
2035}
2036
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00002037/** Formatted output of the Comparison Operations.
2038 *
2039 * @param[in] op Type to output.
2040 *
2041 * @return Formatted string.
2042 */
2043inline std::string to_string(const ComparisonOperation &op)
2044{
2045 std::stringstream str;
2046 str << op;
2047 return str.str();
2048}
2049
Michalis Spyroue9362622018-11-23 17:41:37 +00002050/** Formatted output of the Elementwise unary Operations.
2051 *
2052 * @param[in] op Type to output.
2053 *
2054 * @return Formatted string.
2055 */
2056inline std::string to_string(const ElementWiseUnary &op)
2057{
2058 std::stringstream str;
2059 str << op;
2060 return str.str();
2061}
2062
Alex Gildayc357c472018-03-21 13:54:09 +00002063/** Formatted output of the Norm Type.
2064 *
2065 * @param[in] type Type to output.
2066 *
2067 * @return Formatted string.
2068 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002069inline std::string to_string(const NormType &type)
2070{
2071 std::stringstream str;
2072 str << type;
2073 return str.str();
2074}
2075
Alex Gildayc357c472018-03-21 13:54:09 +00002076/** Formatted output of the Pooling Type.
2077 *
2078 * @param[in] type Type to output.
2079 *
2080 * @return Formatted string.
2081 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002082inline std::string to_string(const PoolingType &type)
2083{
2084 std::stringstream str;
2085 str << type;
2086 return str.str();
2087}
2088
Alex Gildayc357c472018-03-21 13:54:09 +00002089/** Formatted output of the Pooling Layer Info.
2090 *
2091 * @param[in] info Type to output.
2092 *
2093 * @return Formatted string.
2094 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01002095inline std::string to_string(const PoolingLayerInfo &info)
2096{
2097 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002098 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00002099 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002100 << "IsGlobalPooling=" << info.is_global_pooling;
2101 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002102 {
2103 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00002104 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2105 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00002106 }
2107 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01002108 return str.str();
2109}
2110
ramelg0137515692022-02-26 22:06:20 +00002111/** Formatted output of the Size3D type.
2112 *
2113 * @param[out] os Output stream
2114 * @param[in] size Type to output
2115 *
2116 * @return Modified output stream.
2117 */
2118inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2119{
2120 os << size.width << "x" << size.height << "x" << size.depth;
2121
2122 return os;
2123}
2124
2125/** Formatted output of the Size3D type.
2126 *
2127 * @param[in] type Type to output
2128 *
2129 * @return Formatted string.
2130 */
2131inline std::string to_string(const Size3D &type)
2132{
2133 std::stringstream str;
2134 str << type;
2135 return str.str();
2136}
2137
2138/** Formatted output of the Padding3D type.
2139 *
2140 * @param[out] os Output stream.
2141 * @param[in] padding3d Padding info for 3D spatial dimension shape.
2142 *
2143 * @return Modified output stream.
2144 */
2145inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2146{
2147 os << padding3d.left << "," << padding3d.right << ","
2148 << padding3d.top << "," << padding3d.bottom << ","
2149 << padding3d.front << "," << padding3d.back;
2150 return os;
2151}
2152
2153/** Converts a @ref Padding3D to string
2154 *
2155 * @param[in] padding3d Padding3D value to be converted
2156 *
2157 * @return String representing the corresponding Padding3D
2158 */
2159inline std::string to_string(const Padding3D &padding3d)
2160{
2161 std::stringstream str;
2162 str << padding3d;
2163 return str.str();
2164}
2165
2166/** Formatted output of the DimensionRoundingType type.
2167 *
2168 * @param[out] os Output stream.
2169 * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2170 *
2171 * @return Modified output stream.
2172 */
2173inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2174{
2175 switch(rounding_type)
2176 {
2177 case DimensionRoundingType::CEIL:
2178 os << "CEIL";
2179 break;
2180 case DimensionRoundingType::FLOOR:
2181 os << "FLOOR";
2182 break;
2183 default:
2184 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2185 }
2186 return os;
2187}
2188
2189/** Formatted output of the Pooling 3d Layer Info.
2190 *
2191 * @param[out] os Output stream.
2192 * @param[in] info Pooling 3D layer info to print to output stream.
2193 *
2194 * @return Modified output stream.
2195 */
2196inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2197{
2198 os << "{Type=" << info.pool_type << ","
2199 << "IsGlobalPooling=" << info.is_global_pooling;
2200 if(!info.is_global_pooling)
2201 {
2202 os << ","
2203 << "PoolSize=" << info.pool_size << ", "
2204 << "Stride=" << info.stride << ", "
2205 << "Padding=" << info.padding << ", "
2206 << "Exclude Padding=" << info.exclude_padding << ", "
2207 << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2208 << "DimensionRoundingType=" << info.round_type;
2209 }
2210 os << "}";
2211 return os;
2212}
2213
2214/** Formatted output of the Pooling 3d Layer Info.
2215 *
2216 * @param[in] info Type to output.
2217 *
2218 * @return Formatted string.
2219 */
2220inline std::string to_string(const Pooling3dLayerInfo &info)
2221{
2222 std::stringstream str;
2223 str << info;
2224 return str.str();
2225}
2226
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002227/** Formatted output of the PriorBoxLayerInfo.
2228 *
2229 * @param[in] info Type to output.
2230 *
2231 * @return Formatted string.
2232 */
2233inline std::string to_string(const PriorBoxLayerInfo &info)
2234{
2235 std::stringstream str;
2236 str << "{";
2237 str << "Clip:" << info.clip()
2238 << "Flip:" << info.flip()
2239 << "StepX:" << info.steps()[0]
2240 << "StepY:" << info.steps()[1]
2241 << "MinSizes:" << info.min_sizes().size()
2242 << "MaxSizes:" << info.max_sizes().size()
2243 << "ImgSizeX:" << info.img_size().x
2244 << "ImgSizeY:" << info.img_size().y
2245 << "Offset:" << info.offset()
2246 << "Variances:" << info.variances().size();
2247 str << "}";
2248 return str.str();
2249}
2250
Alex Gildayc357c472018-03-21 13:54:09 +00002251/** Formatted output of the Size2D type.
2252 *
2253 * @param[out] os Output stream
2254 * @param[in] size Type to output
2255 *
2256 * @return Modified output stream.
2257 */
John Richardson25f23682017-11-27 14:35:09 +00002258inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2259{
2260 os << size.width << "x" << size.height;
2261
2262 return os;
2263}
2264
Alex Gildayc357c472018-03-21 13:54:09 +00002265/** Formatted output of the Size2D type.
2266 *
2267 * @param[in] type Type to output
2268 *
2269 * @return Formatted string.
2270 */
John Richardson25f23682017-11-27 14:35:09 +00002271inline std::string to_string(const Size2D &type)
2272{
2273 std::stringstream str;
2274 str << type;
2275 return str.str();
2276}
2277
Alex Gildayc357c472018-03-21 13:54:09 +00002278/** Formatted output of the ConvolutionMethod type.
2279 *
2280 * @param[out] os Output stream
2281 * @param[in] conv_method Type to output
2282 *
2283 * @return Modified output stream.
2284 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002285inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2286{
2287 switch(conv_method)
2288 {
2289 case ConvolutionMethod::GEMM:
2290 os << "GEMM";
2291 break;
2292 case ConvolutionMethod::DIRECT:
2293 os << "DIRECT";
2294 break;
2295 case ConvolutionMethod::WINOGRAD:
2296 os << "WINOGRAD";
2297 break;
SiCongLid9287352021-11-03 19:01:22 +00002298 case ConvolutionMethod::FFT:
2299 os << "FFT";
2300 break;
2301 case ConvolutionMethod::GEMM_CONV2D:
2302 os << "GEMM_CONV2D";
2303 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002304 default:
2305 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2306 }
2307
2308 return os;
2309}
2310
Alex Gildayc357c472018-03-21 13:54:09 +00002311/** Formatted output of the ConvolutionMethod type.
2312 *
2313 * @param[in] conv_method Type to output
2314 *
2315 * @return Formatted string.
2316 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002317inline std::string to_string(const ConvolutionMethod &conv_method)
2318{
2319 std::stringstream str;
2320 str << conv_method;
2321 return str.str();
2322}
2323
Alex Gildayc357c472018-03-21 13:54:09 +00002324/** Formatted output of the GPUTarget type.
2325 *
2326 * @param[out] os Output stream
2327 * @param[in] gpu_target Type to output
2328 *
2329 * @return Modified output stream.
2330 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002331inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2332{
2333 switch(gpu_target)
2334 {
2335 case GPUTarget::GPU_ARCH_MASK:
2336 os << "GPU_ARCH_MASK";
2337 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002338 case GPUTarget::GPU_GENERATION_MASK:
2339 os << "GPU_GENERATION_MASK";
2340 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002341 case GPUTarget::MIDGARD:
2342 os << "MIDGARD";
2343 break;
2344 case GPUTarget::BIFROST:
2345 os << "BIFROST";
2346 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002347 case GPUTarget::VALHALL:
2348 os << "VALHALL";
2349 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002350 case GPUTarget::T600:
2351 os << "T600";
2352 break;
2353 case GPUTarget::T700:
2354 os << "T700";
2355 break;
2356 case GPUTarget::T800:
2357 os << "T800";
2358 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00002359 case GPUTarget::G71:
2360 os << "G71";
2361 break;
2362 case GPUTarget::G72:
2363 os << "G72";
2364 break;
2365 case GPUTarget::G51:
2366 os << "G51";
2367 break;
2368 case GPUTarget::G51BIG:
2369 os << "G51BIG";
2370 break;
2371 case GPUTarget::G51LIT:
2372 os << "G51LIT";
2373 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002374 case GPUTarget::G31:
2375 os << "G31";
2376 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01002377 case GPUTarget::G76:
2378 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002379 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002380 case GPUTarget::G52:
2381 os << "G52";
2382 break;
2383 case GPUTarget::G52LIT:
2384 os << "G52LIT";
2385 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002386 case GPUTarget::G77:
2387 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002388 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002389 case GPUTarget::G57:
2390 os << "G57";
2391 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002392 case GPUTarget::G78:
2393 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002394 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002395 case GPUTarget::G68:
2396 os << "G68";
2397 break;
2398 case GPUTarget::G78AE:
2399 os << "G78AE";
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002400 break;
Gian Marco Iodiceab2bc732022-01-19 10:06:45 +00002401 case GPUTarget::G710:
2402 os << "G710";
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002403 break;
Gian Marco Iodice3c4d0852022-07-11 12:09:45 +01002404 case GPUTarget::G610:
2405 os << "G610";
2406 break;
2407 case GPUTarget::G510:
2408 os << "G510";
2409 break;
2410 case GPUTarget::G310:
2411 os << "G310";
2412 break;
Gunes Bayir4bfc70e2021-12-10 16:17:56 +00002413 case GPUTarget::G715:
2414 os << "G715";
2415 break;
2416 case GPUTarget::G615:
2417 os << "G615";
2418 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002419 default:
2420 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2421 }
2422
2423 return os;
2424}
2425
Alex Gildayc357c472018-03-21 13:54:09 +00002426/** Formatted output of the GPUTarget type.
2427 *
2428 * @param[in] gpu_target Type to output
2429 *
2430 * @return Formatted string.
2431 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002432inline std::string to_string(const GPUTarget &gpu_target)
2433{
2434 std::stringstream str;
2435 str << gpu_target;
2436 return str.str();
2437}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002438
John Richardson8de92612018-02-22 14:09:31 +00002439/** Formatted output of the DetectionWindow type.
2440 *
2441 * @param[out] os Output stream
2442 * @param[in] detection_window Type to output
2443 *
2444 * @return Modified output stream.
2445 */
John Richardson684cb0f2018-01-09 11:17:00 +00002446inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2447{
2448 os << "{x=" << detection_window.x << ","
2449 << "y=" << detection_window.y << ","
2450 << "width=" << detection_window.width << ","
2451 << "height=" << detection_window.height << ","
2452 << "idx_class=" << detection_window.idx_class << ","
2453 << "score=" << detection_window.score << "}";
2454
2455 return os;
2456}
2457
Isabella Gottardi05e56442018-11-16 11:26:52 +00002458/** Formatted output of the DetectionOutputLayerCodeType type.
2459 *
2460 * @param[out] os Output stream
2461 * @param[in] detection_code Type to output
2462 *
2463 * @return Modified output stream.
2464 */
2465inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2466{
2467 switch(detection_code)
2468 {
2469 case DetectionOutputLayerCodeType::CENTER_SIZE:
2470 os << "CENTER_SIZE";
2471 break;
2472 case DetectionOutputLayerCodeType::CORNER:
2473 os << "CORNER";
2474 break;
2475 case DetectionOutputLayerCodeType::CORNER_SIZE:
2476 os << "CORNER_SIZE";
2477 break;
2478 case DetectionOutputLayerCodeType::TF_CENTER:
2479 os << "TF_CENTER";
2480 break;
2481 default:
2482 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2483 }
2484
2485 return os;
2486}
2487/** Formatted output of the DetectionOutputLayerCodeType type.
2488 *
2489 * @param[in] detection_code Type to output
2490 *
2491 * @return Formatted string.
2492 */
2493inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2494{
2495 std::stringstream str;
2496 str << detection_code;
2497 return str.str();
2498}
2499
2500/** Formatted output of the DetectionOutputLayerInfo type.
2501 *
2502 * @param[out] os Output stream
2503 * @param[in] detection_info Type to output
2504 *
2505 * @return Modified output stream.
2506 */
2507inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2508{
2509 os << "{Classes=" << detection_info.num_classes() << ","
2510 << "ShareLocation=" << detection_info.share_location() << ","
2511 << "CodeType=" << detection_info.code_type() << ","
2512 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2513 << "KeepTopK=" << detection_info.keep_top_k() << ","
2514 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2515 << "Eta=" << detection_info.eta() << ","
2516 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2517 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2518 << "TopK=" << detection_info.top_k() << ","
2519 << "NumLocClasses=" << detection_info.num_loc_classes()
2520 << "}";
2521
2522 return os;
2523}
2524
2525/** Formatted output of the DetectionOutputLayerInfo type.
2526 *
2527 * @param[in] detection_info Type to output
2528 *
2529 * @return Formatted string.
2530 */
2531inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2532{
2533 std::stringstream str;
2534 str << detection_info;
2535 return str.str();
2536}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002537/** Formatted output of the DetectionPostProcessLayerInfo type.
2538 *
2539 * @param[out] os Output stream
2540 * @param[in] detection_info Type to output
2541 *
2542 * @return Modified output stream.
2543 */
2544inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2545{
2546 os << "{MaxDetections=" << detection_info.max_detections() << ","
2547 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2548 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2549 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2550 << "NumClasses=" << detection_info.num_classes() << ","
2551 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2552 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2553 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2554 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2555 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2556 << "DetectionPerClass=" << detection_info.detection_per_class()
2557 << "}";
2558
2559 return os;
2560}
2561
2562/** Formatted output of the DetectionPostProcessLayerInfo type.
2563 *
2564 * @param[in] detection_info Type to output
2565 *
2566 * @return Formatted string.
2567 */
2568inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2569{
2570 std::stringstream str;
2571 str << detection_info;
2572 return str.str();
2573}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002574
John Richardson8de92612018-02-22 14:09:31 +00002575/** Formatted output of the DetectionWindow type.
2576 *
2577 * @param[in] detection_window Type to output
2578 *
2579 * @return Formatted string.
2580 */
2581inline std::string to_string(const DetectionWindow &detection_window)
2582{
2583 std::stringstream str;
2584 str << detection_window;
2585 return str.str();
2586}
2587
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002588/** Formatted output of @ref PriorBoxLayerInfo.
2589 *
2590 * @param[out] os Output stream.
2591 * @param[in] info Type to output.
2592 *
2593 * @return Modified output stream.
2594 */
2595inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2596{
2597 os << "Clip:" << info.clip()
2598 << "Flip:" << info.flip()
2599 << "StepX:" << info.steps()[0]
2600 << "StepY:" << info.steps()[1]
2601 << "MinSizes:" << info.min_sizes()
2602 << "MaxSizes:" << info.max_sizes()
2603 << "ImgSizeX:" << info.img_size().x
2604 << "ImgSizeY:" << info.img_size().y
2605 << "Offset:" << info.offset()
2606 << "Variances:" << info.variances();
2607
2608 return os;
2609}
2610
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002611/** Formatted output of the WinogradInfo type. */
2612inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2613{
2614 os << "{OutputTileSize=" << info.output_tile_size << ","
2615 << "KernelSize=" << info.kernel_size << ","
2616 << "PadStride=" << info.convolution_info << ","
2617 << "OutputDataLayout=" << info.output_data_layout << "}";
2618
2619 return os;
2620}
2621
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002622inline std::string to_string(const WinogradInfo &type)
2623{
2624 std::stringstream str;
2625 str << type;
2626 return str.str();
2627}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002628
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002629/** Convert a CLTunerMode value to a string
2630 *
2631 * @param val CLTunerMode value to be converted
2632 *
2633 * @return String representing the corresponding CLTunerMode.
2634 */
2635inline std::string to_string(const CLTunerMode val)
2636{
2637 switch(val)
2638 {
2639 case CLTunerMode::EXHAUSTIVE:
2640 {
2641 return std::string("Exhaustive");
2642 }
2643 case CLTunerMode::NORMAL:
2644 {
2645 return std::string("Normal");
2646 }
2647 case CLTunerMode::RAPID:
2648 {
2649 return std::string("Rapid");
2650 }
2651 default:
2652 {
2653 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2654 return std::string("UNDEFINED");
2655 }
2656 }
2657}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002658/** Converts a @ref CLGEMMKernelType to string
2659 *
2660 * @param[in] val CLGEMMKernelType value to be converted
2661 *
2662 * @return String representing the corresponding CLGEMMKernelType
2663 */
2664inline std::string to_string(CLGEMMKernelType val)
2665{
2666 switch(val)
2667 {
SiCong Lidb4a6c12021-02-05 09:30:57 +00002668 case CLGEMMKernelType::NATIVE:
2669 {
2670 return "Native";
2671 }
2672 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2673 {
2674 return "Reshaped_Only_RHS";
2675 }
2676 case CLGEMMKernelType::RESHAPED:
2677 {
2678 return "Reshaped";
2679 }
2680 default:
2681 {
2682 return "Unknown";
2683 }
2684 }
2685}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002686/** [Print CLTunerMode type] **/
2687/** Formatted output of the CLTunerMode type.
2688 *
2689 * @param[out] os Output stream.
2690 * @param[in] val CLTunerMode to output.
2691 *
2692 * @return Modified output stream.
2693 */
2694inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2695{
2696 os << to_string(val);
2697 return os;
2698}
2699
ramelg013ae3d882021-09-12 23:07:47 +01002700/** Formatted output of the ConvolutionInfo type.
2701 *
2702 * @param[out] os Output stream.
2703 * @param[in] conv_info ConvolutionInfo to output.
2704 *
2705 * @return Modified output stream.
2706 */
2707inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2708{
SiCongLi579ca842021-10-18 09:38:33 +01002709 os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2710 << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2711 << "act_info=" << to_string(conv_info.act_info) << ", "
2712 << "dilation=" << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002713 return os;
2714}
2715
2716/** Converts a @ref ConvolutionInfo to string
2717 *
2718 * @param[in] info ConvolutionInfo value to be converted
2719 *
2720 * @return String representing the corresponding ConvolutionInfo
2721 */
2722inline std::string to_string(const ConvolutionInfo &info)
2723{
2724 std::stringstream str;
2725 str << info;
2726 return str.str();
2727}
2728
2729/** Formatted output of the FullyConnectedLayerInfo type.
2730 *
2731 * @param[out] os Output stream.
2732 * @param[in] layer_info FullyConnectedLayerInfo to output.
2733 *
2734 * @return Modified output stream.
2735 */
2736inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2737{
SiCongLi579ca842021-10-18 09:38:33 +01002738 os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2739 << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2740 << "transpose_weights=" << layer_info.transpose_weights << ", "
2741 << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2742 << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2743 << "constant_weights=" << layer_info.transpose_weights << ", "
2744 << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002745 return os;
2746}
2747
2748/** Converts a @ref FullyConnectedLayerInfo to string
2749 *
2750 * @param[in] info FullyConnectedLayerInfo value to be converted
2751 *
2752 * @return String representing the corresponding FullyConnectedLayerInfo
2753 */
2754inline std::string to_string(const FullyConnectedLayerInfo &info)
2755{
2756 std::stringstream str;
2757 str << info;
2758 return str.str();
2759}
2760
2761/** Formatted output of the GEMMLowpOutputStageType type.
2762 *
2763 * @param[out] os Output stream.
2764 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2765 *
2766 * @return Modified output stream.
2767 */
2768inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2769{
2770 switch(gemm_type)
2771 {
2772 case GEMMLowpOutputStageType::NONE:
2773 os << "NONE";
2774 break;
2775 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2776 os << "QUANTIZE_DOWN";
2777 break;
2778 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2779 os << "QUANTIZE_DOWN_FIXEDPOINT";
2780 break;
2781 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2782 os << "QUANTIZE_DOWN_FLOAT";
2783 break;
2784 default:
2785 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2786 }
2787 return os;
2788}
2789
2790/** Converts a @ref GEMMLowpOutputStageType to string
2791 *
2792 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2793 *
2794 * @return String representing the corresponding GEMMLowpOutputStageType
2795 */
2796inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2797{
2798 std::stringstream str;
2799 str << gemm_type;
2800 return str.str();
2801}
2802
2803/** Formatted output of the GEMMLowpOutputStageInfo type.
2804 *
2805 * @param[out] os Output stream.
2806 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2807 *
2808 * @return Modified output stream.
2809 */
2810inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2811{
SiCongLi579ca842021-10-18 09:38:33 +01002812 os << "{type=" << gemm_info.type << ", "
2813 << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2814 << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2815 << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2816 << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2817 << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2818 << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2819 << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2820 << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2821 << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2822 << "output_data_type=" << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002823 return os;
2824}
2825
2826/** Converts a @ref GEMMLowpOutputStageInfo to string
2827 *
2828 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2829 *
2830 * @return String representing the corresponding GEMMLowpOutputStageInfo
2831 */
2832inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2833{
2834 std::stringstream str;
2835 str << gemm_info;
2836 return str.str();
2837}
2838
2839/** Formatted output of the Conv2dInfo type.
2840 *
2841 * @param[out] os Output stream.
2842 * @param[in] conv_info Conv2dInfo to output.
2843 *
2844 * @return Modified output stream.
2845 */
2846inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2847{
SiCongLi579ca842021-10-18 09:38:33 +01002848 os << "{conv_info=" << conv_info.conv_info << ", "
2849 << "dilation=" << conv_info.dilation << ", "
2850 << "act_info=" << to_string(conv_info.act_info) << ", "
2851 << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2852 << "num_groups=" << conv_info.num_groups << ","
2853 << "post_ops=" << conv_info.post_ops << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002854 return os;
2855}
2856
2857/** Converts a @ref Conv2dInfo to string
2858 *
2859 * @param[in] conv_info Conv2dInfo value to be converted
2860 *
2861 * @return String representing the corresponding Conv2dInfo
2862 */
2863inline std::string to_string(const Conv2dInfo &conv_info)
2864{
2865 std::stringstream str;
2866 str << conv_info;
2867 return str.str();
2868}
2869
2870/** Formatted output of the PixelValue type.
2871 *
2872 * @param[out] os Output stream.
2873 * @param[in] pixel_value PixelValue to output.
2874 *
2875 * @return Modified output stream.
2876 */
2877inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2878{
SiCongLi579ca842021-10-18 09:38:33 +01002879 os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002880 return os;
2881}
2882
2883/** Converts a @ref PixelValue to string
2884 *
2885 * @param[in] pixel_value PixelValue value to be converted
2886 *
2887 * @return String representing the corresponding PixelValue
2888 */
2889inline std::string to_string(const PixelValue &pixel_value)
2890{
2891 std::stringstream str;
2892 str << pixel_value;
2893 return str.str();
2894}
2895
2896/** Formatted output of the ScaleKernelInfo type.
2897 *
2898 * @param[out] os Output stream.
2899 * @param[in] scale_info ScaleKernelInfo to output.
2900 *
2901 * @return Modified output stream.
2902 */
2903inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2904{
SiCongLi579ca842021-10-18 09:38:33 +01002905 os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2906 << "BorderMode=" << scale_info.border_mode << ", "
2907 << "PixelValue=" << scale_info.constant_border_value << ", "
2908 << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2909 << "use_padding=" << scale_info.use_padding << ", "
2910 << "align_corners=" << scale_info.align_corners << ", "
2911 << "data_layout=" << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002912 return os;
2913}
2914
2915/** Converts a @ref ScaleKernelInfo to string
2916 *
2917 * @param[in] scale_info ScaleKernelInfo value to be converted
2918 *
2919 * @return String representing the corresponding ScaleKernelInfo
2920 */
2921inline std::string to_string(const ScaleKernelInfo &scale_info)
2922{
2923 std::stringstream str;
2924 str << scale_info;
2925 return str.str();
2926}
2927
2928/** Formatted output of the FFTDirection type.
2929 *
2930 * @param[out] os Output stream.
2931 * @param[in] fft_dir FFTDirection to output.
2932 *
2933 * @return Modified output stream.
2934 */
2935inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2936{
2937 switch(fft_dir)
2938 {
2939 case FFTDirection::Forward:
2940 os << "Forward";
2941 break;
2942 case FFTDirection::Inverse:
2943 os << "Inverse";
2944 break;
2945 default:
2946 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2947 }
2948 return os;
2949}
2950
2951/** Converts a @ref FFT1DInfo to string
2952 *
2953 * @param[in] fft_dir FFT1DInfo value to be converted
2954 *
2955 * @return String representing the corresponding FFT1DInfo
2956 */
2957inline std::string to_string(const FFTDirection &fft_dir)
2958{
2959 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002960 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002961 return str.str();
2962}
2963
2964/** Formatted output of the FFT1DInfo type.
2965 *
2966 * @param[out] os Output stream.
2967 * @param[in] fft1d_info FFT1DInfo to output.
2968 *
2969 * @return Modified output stream.
2970 */
2971inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2972{
SiCongLi579ca842021-10-18 09:38:33 +01002973 os << "{axis=" << fft1d_info.axis << ", "
2974 << "direction=" << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002975 return os;
2976}
2977
2978/** Converts a @ref FFT1DInfo to string
2979 *
2980 * @param[in] fft1d_info FFT1DInfo value to be converted
2981 *
2982 * @return String representing the corresponding FFT1DInfo
2983 */
2984inline std::string to_string(const FFT1DInfo &fft1d_info)
2985{
2986 std::stringstream str;
2987 str << fft1d_info;
2988 return str.str();
2989}
2990
2991/** Formatted output of the FFT2DInfo type.
2992 *
2993 * @param[out] os Output stream.
2994 * @param[in] fft2d_info FFT2DInfo to output.
2995 *
2996 * @return Modified output stream.
2997 */
2998inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2999{
SiCongLi579ca842021-10-18 09:38:33 +01003000 os << "{axis=" << fft2d_info.axis0 << ", "
3001 << "axis=" << fft2d_info.axis1 << ", "
3002 << "direction=" << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003003 return os;
3004}
3005
3006/** Converts a @ref FFT2DInfo to string
3007 *
3008 * @param[in] fft2d_info FFT2DInfo value to be converted
3009 *
3010 * @return String representing the corresponding FFT2DInfo
3011 */
3012inline std::string to_string(const FFT2DInfo &fft2d_info)
3013{
3014 std::stringstream str;
3015 str << fft2d_info;
3016 return str.str();
3017}
3018
3019/** Formatted output of the Coordinates2D type.
3020 *
3021 * @param[out] os Output stream.
3022 * @param[in] coord_2d Coordinates2D to output.
3023 *
3024 * @return Modified output stream.
3025 */
3026inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
3027{
SiCongLi579ca842021-10-18 09:38:33 +01003028 os << "{x=" << coord_2d.x << ", "
3029 << "y=" << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01003030 return os;
3031}
3032
3033/** Converts a @ref Coordinates2D to string
3034 *
3035 * @param[in] coord_2d Coordinates2D value to be converted
3036 *
3037 * @return String representing the corresponding Coordinates2D
3038 */
3039inline std::string to_string(const Coordinates2D &coord_2d)
3040{
3041 std::stringstream str;
3042 str << coord_2d;
3043 return str.str();
3044}
3045
3046/** Formatted output of the FuseBatchNormalizationType type.
3047 *
3048 * @param[out] os Output stream.
3049 * @param[in] fuse_type FuseBatchNormalizationType to output.
3050 *
3051 * @return Modified output stream.
3052 */
3053inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
3054{
3055 switch(fuse_type)
3056 {
3057 case FuseBatchNormalizationType::CONVOLUTION:
3058 os << "CONVOLUTION";
3059 break;
3060 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3061 os << "DEPTHWISECONVOLUTION";
3062 break;
3063 default:
3064 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3065 }
3066 return os;
3067}
3068
3069/** Converts a @ref FuseBatchNormalizationType to string
3070 *
3071 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3072 *
3073 * @return String representing the corresponding FuseBatchNormalizationType
3074 */
3075inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3076{
3077 std::stringstream str;
3078 str << fuse_type;
3079 return str.str();
3080}
3081
ramelg01cbbb0382021-09-17 17:36:57 +01003082/** Formatted output of the SoftmaxKernelInfo type.
3083 *
3084 * @param[out] os Output stream.
3085 * @param[in] info SoftmaxKernelInfo to output.
3086 *
3087 * @return Modified output stream.
3088 */
3089inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3090{
SiCongLi579ca842021-10-18 09:38:33 +01003091 os << "{beta=" << info.beta << ", "
3092 << "is_log=" << info.is_log << ", "
3093 << "input_data_type=" << info.input_data_type << ", "
3094 << "axis=" << info.axis << "}";
ramelg01cbbb0382021-09-17 17:36:57 +01003095 return os;
3096}
3097
3098/** Converts a @ref SoftmaxKernelInfo to string
3099 *
3100 * @param[in] info SoftmaxKernelInfo value to be converted
3101 *
3102 * @return String representing the corresponding SoftmaxKernelInfo
3103 */
3104inline std::string to_string(const SoftmaxKernelInfo &info)
3105{
3106 std::stringstream str;
3107 str << info;
3108 return str.str();
3109}
3110
3111/** Formatted output of the ScaleKernelInfo type.
3112 *
3113 * @param[out] os Output stream.
3114 * @param[in] lstm_params LSTMParams to output.
3115 *
3116 * @return Modified output stream.
3117 */
3118template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003119::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003120{
ramelg014a6d9e82021-10-02 14:34:36 +01003121 os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3122 << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3123 << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3124 << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3125 << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3126 << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3127 << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3128 << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3129 << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3130 << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3131 << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3132 << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01003133 << "cell_clip=" << lstm_params.cell_clip() << ", "
3134 << "projection_clip=" << lstm_params.projection_clip() << ", "
3135 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3136 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3137 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3138 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3139 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3140 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3141 << "has_projection=" << lstm_params.has_projection() << ", "
3142 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3143 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3144 return os;
3145}
3146
3147/** Converts a @ref LSTMParams to string
3148 *
3149 * @param[in] lstm_params LSTMParams<T> value to be converted
3150 *
3151 * @return String representing the corresponding LSTMParams
3152 */
3153template <typename T>
ramelg014a6d9e82021-10-02 14:34:36 +01003154std::string to_string(const LSTMParams<T> &lstm_params)
ramelg01cbbb0382021-09-17 17:36:57 +01003155{
3156 std::stringstream str;
3157 str << lstm_params;
3158 return str.str();
3159}
3160
3161/** Converts a @ref LSTMParams to string
3162 *
3163 * @param[in] num uint8_t value to be converted
3164 *
3165 * @return String representing the corresponding uint8_t
3166 */
3167inline std::string to_string(const uint8_t num)
3168{
3169 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3170 return ::std::to_string(static_cast<int>(num));
3171}
3172
ramelg014a6d9e82021-10-02 14:34:36 +01003173/** Available non maxima suppression types */
3174/** Formatted output of the NMSType type.
3175 *
3176 * @param[out] os Output stream.
3177 * @param[in] nms_type NMSType to output.
3178 *
3179 * @return Modified output stream.
3180 */
3181inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3182{
3183 switch(nms_type)
3184 {
3185 case NMSType::LINEAR:
3186 os << "LINEAR";
3187 break;
3188 case NMSType::GAUSSIAN:
3189 os << "GAUSSIAN";
3190 break;
3191 case NMSType::ORIGINAL:
3192 os << "ORIGINAL";
3193 break;
3194 default:
3195 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3196 }
3197 return os;
3198}
3199
3200/** Converts a @ref NMSType to string
3201 *
3202 * @param[in] nms_type NMSType value to be converted
3203 *
3204 * @return String representing the corresponding NMSType
3205 */
3206inline std::string to_string(const NMSType nms_type)
3207{
3208 std::stringstream str;
3209 str << nms_type;
3210 return str.str();
3211}
3212
3213/** Formatted output of the BoxNMSLimitInfo type.
3214 *
3215 * @param[out] os Output stream.
3216 * @param[in] info BoxNMSLimitInfo to output.
3217 *
3218 * @return Modified output stream.
3219 */
3220inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3221{
SiCongLi579ca842021-10-18 09:38:33 +01003222 os << "{score_thresh=" << info.score_thresh() << ", "
3223 << "nms=" << info.nms() << ", "
3224 << "detections_per_im=" << info.detections_per_im() << ", "
3225 << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3226 << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3227 << "suppress_size=" << info.suppress_size() << ", "
3228 << "min_size=" << info.min_size() << ", "
3229 << "im_width=" << info.im_width() << ", "
3230 << "im_height=" << info.im_height() << "}";
ramelg014a6d9e82021-10-02 14:34:36 +01003231 return os;
3232}
3233
3234/** Converts a @ref BoxNMSLimitInfo to string
3235 *
3236 * @param[in] info BoxNMSLimitInfo value to be converted
3237 *
3238 * @return String representing the corresponding BoxNMSLimitInfo
3239 */
3240inline std::string to_string(const BoxNMSLimitInfo &info)
3241{
3242 std::stringstream str;
3243 str << info;
3244 return str.str();
3245}
3246
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003247/** Converts a @ref DimensionRoundingType to string
3248 *
3249 * @param[in] rounding_type DimensionRoundingType value to be converted
3250 *
3251 * @return String representing the corresponding DimensionRoundingType
3252 */
3253inline std::string to_string(const DimensionRoundingType &rounding_type)
3254{
3255 std::stringstream str;
3256 str << rounding_type;
3257 return str.str();
3258}
3259
Giorgio Arena945ae9e2021-10-13 11:13:04 +01003260/** Formatted output of the Conv3dInfo type.
3261 *
3262 * @param[out] os Output stream.
3263 * @param[in] conv3d_info Type to output.
3264 *
3265 * @return Modified output stream.
3266 */
3267inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3268{
3269 os << conv3d_info.stride;
3270 os << ";";
3271 os << conv3d_info.padding;
3272 os << ";";
3273 os << to_string(conv3d_info.act_info);
3274 os << ";";
3275 os << conv3d_info.dilation;
3276 os << ";";
3277 os << conv3d_info.round_type;
3278 os << ";";
3279 os << conv3d_info.enable_fast_math;
3280
3281 return os;
3282}
3283
3284/** Formatted output of the Conv3dInfo type.
3285 *
3286 * @param[in] conv3d_info Type to output.
3287 *
3288 * @return Formatted string.
3289 */
3290inline std::string to_string(const Conv3dInfo &conv3d_info)
3291{
3292 std::stringstream str;
3293 str << conv3d_info;
3294 return str.str();
3295}
3296
Ramy Elgammal91780022022-07-20 14:57:37 +01003297/** Formatted output of the arm_compute::WeightFormat type.
3298 *
3299 * @param[in] wf arm_compute::WeightFormat Type to output.
3300 *
3301 * @return Formatted string.
3302 */
3303inline std::string to_string(const WeightFormat wf)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003304{
Ramy Elgammal91780022022-07-20 14:57:37 +01003305#define __CASE_WEIGHT_FORMAT(wf) \
Jakub Sujak7359a872023-01-05 14:24:13 +00003306 case WeightFormat::wf: \
3307 return #wf;
Ramy Elgammal91780022022-07-20 14:57:37 +01003308 switch(wf)
3309 {
Jakub Sujak7359a872023-01-05 14:24:13 +00003310 __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3311 __CASE_WEIGHT_FORMAT(ANY)
3312 __CASE_WEIGHT_FORMAT(OHWI)
3313 __CASE_WEIGHT_FORMAT(OHWIo2)
3314 __CASE_WEIGHT_FORMAT(OHWIo4)
3315 __CASE_WEIGHT_FORMAT(OHWIo8)
3316 __CASE_WEIGHT_FORMAT(OHWIo16)
3317 __CASE_WEIGHT_FORMAT(OHWIo32)
3318 __CASE_WEIGHT_FORMAT(OHWIo64)
3319 __CASE_WEIGHT_FORMAT(OHWIo128)
3320 __CASE_WEIGHT_FORMAT(OHWIo4i2)
3321 __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3322 __CASE_WEIGHT_FORMAT(OHWIo8i2)
3323 __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3324 __CASE_WEIGHT_FORMAT(OHWIo16i2)
3325 __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3326 __CASE_WEIGHT_FORMAT(OHWIo32i2)
3327 __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3328 __CASE_WEIGHT_FORMAT(OHWIo64i2)
3329 __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3330 __CASE_WEIGHT_FORMAT(OHWIo4i4)
3331 __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3332 __CASE_WEIGHT_FORMAT(OHWIo8i4)
3333 __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3334 __CASE_WEIGHT_FORMAT(OHWIo16i4)
3335 __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3336 __CASE_WEIGHT_FORMAT(OHWIo32i4)
3337 __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3338 __CASE_WEIGHT_FORMAT(OHWIo64i4)
3339 __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3340 __CASE_WEIGHT_FORMAT(OHWIo2i8)
3341 __CASE_WEIGHT_FORMAT(OHWIo4i8)
3342 __CASE_WEIGHT_FORMAT(OHWIo8i8)
3343 __CASE_WEIGHT_FORMAT(OHWIo16i8)
3344 __CASE_WEIGHT_FORMAT(OHWIo32i8)
3345 __CASE_WEIGHT_FORMAT(OHWIo64i8)
Ramy Elgammal91780022022-07-20 14:57:37 +01003346 default:
3347 return "invalid value";
3348 }
3349#undef __CASE_WEIGHT_FORMAT
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003350}
3351
Ramy Elgammal91780022022-07-20 14:57:37 +01003352/** Formatted output of the arm_compute::WeightFormat type.
3353 *
3354 * @param[out] os Output stream.
3355 * @param[in] wf WeightFormat to output.
3356 *
3357 * @return Modified output stream.
3358 */
3359inline ::std::ostream &operator<<(::std::ostream &os, const arm_compute::WeightFormat &wf)
3360{
3361 os << to_string(wf);
3362 return os;
3363}
3364
3365/** Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.
3366 *
3367 * @param[in] values tuple of input and output tensor shapes and WeightFormat used.
3368 *
3369 * @return Formatted string.
3370 */
3371inline std::string to_string(const std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> values)
Francesco Petrogalli553f6952022-06-30 10:22:01 +00003372{
3373 std::stringstream str;
3374 str << "[Input shape = " << std::get<0>(values);
3375 str << ", ";
3376 str << "Expected output shape = " << std::get<1>(values);
3377
3378 str << ", ";
3379 str << "WeightFormat = " << std::get<2>(values) << "]";
3380 return str.str();
3381}
3382
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003383/** Formatted output of the Padding2D type.
3384 *
3385 * @param[out] os Output stream.
3386 * @param[in] padding2d Padding info for 2D dimension shape.
3387 *
3388 * @return Modified output stream.
3389 */
3390inline ::std::ostream &operator<<(::std::ostream &os, const Padding2D &padding2d)
3391{
3392 os << padding2d.left << "," << padding2d.right << ","
3393 << padding2d.top << "," << padding2d.bottom;
3394 return os;
3395}
3396
3397/** Converts a @ref Padding2D to string
3398 *
3399 * @param[in] padding2d Padding2D value to be converted
3400 *
3401 * @return String representing the corresponding Padding2D
3402 */
3403inline std::string to_string(const Padding2D &padding2d)
3404{
3405 std::stringstream str;
3406 str << padding2d;
3407 return str.str();
3408}
3409
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003410/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3411 *
3412 * @param[out] os Output stream.
3413 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3414 *
3415 * @return Modified output stream.
3416 */
3417inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3418{
3419 os << "Pool2dAttributes="
3420 << "["
3421 << "PoolingType=" << pool2d_attr.pool_type() << ","
3422 << "PoolSize=" << pool2d_attr.pool_size() << ","
3423 << "Padding=" << pool2d_attr.pad() << ","
3424 << "Stride=" << pool2d_attr.stride() << ","
3425 << "ExcludePadding" << pool2d_attr.exclude_padding() << "]";
3426
3427 return os;
3428}
3429
3430/** Formatted output of the arm_compute::experimental::dynamic_fusion::Pool2dAttributes type.
3431 *
3432 * @param[in] pool2d_attr arm_compute::experimental::dynamic_fusion::Pool2dAttributes type to output.
3433 *
3434 * @return Formatted string.
3435 */
3436inline std::string to_string(const experimental::dynamic_fusion::Pool2dAttributes &pool2d_attr)
3437{
3438 std::stringstream str;
3439 str << pool2d_attr;
3440 return str.str();
3441}
3442
3443/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type
3444 *
3445 * @param[out] os Output stream
3446 * @param[in] settings arm_compute::dynamic_fusion::GpuPool2dSettings type to output
3447 */
3448inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3449{
3450 os << "Settings="
3451 << "["
3452 << "FPMixedPrecision=" << settings.mixed_precision() << "]";
3453 return os;
3454}
3455
3456/** Formatted output of the arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type.
3457 *
3458 * @param[in] settings arm_compute::experimental::dynamic_fusion::GpuPool2dSettings type to output.
3459 *
3460 * @return Formatted string.
3461 */
3462inline std::string to_string(const experimental::dynamic_fusion::GpuPool2dSettings &settings)
3463{
3464 std::stringstream str;
3465 str << settings;
3466 return str.str();
3467}
3468
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003469/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3470 *
3471 * @param[out] os Output stream.
3472 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3473 *
3474 * @return Modified output stream.
3475 */
3476inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3477{
3478 os << "Conv2dAttributes="
3479 << "["
3480 << "Padding=" << conv2d_attr.pad() << ", "
3481 << "Size2D=" << conv2d_attr.stride() << ", "
Ramy Elgammal404462a2022-11-08 02:14:46 +00003482 << "Dialation=" << conv2d_attr.dilation() << "]";
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003483
3484 return os;
3485}
Mohammed Suhail Munshia18d85c2023-01-03 10:16:16 +00003486
Ramy Elgammal73f19af2022-10-23 11:44:49 +01003487/** Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.
3488 *
3489 * @param[in] conv2d_attr arm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
3490 *
3491 * @return Formatted string.
3492 */
3493inline std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
3494{
3495 std::stringstream str;
3496 str << conv2d_attr;
3497 return str.str();
3498}
Gunes Bayir7dc02342022-11-21 21:46:50 +00003499
Gunes Bayir1dc6ff12022-12-06 20:48:31 +00003500/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3501 *
3502 * @param[out] os Output stream.
3503 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3504 *
3505 * @return Modified output stream.
3506 */
3507inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::CastAttributes &cast_attr)
3508{
3509 os << "CastAttributes="
3510 << "["
3511 << "Data Type=" << cast_attr.data_type() << ", "
3512 << "Convert Policy=" << cast_attr.convert_policy() << "]";
3513
3514 return os;
3515}
3516/** Formatted output of the arm_compute::experimental::dynamic_fusion::CastAttributes type.
3517 *
3518 * @param[in] cast_attr arm_compute::experimental::dynamic_fusion::CastAttributes type to output.
3519 *
3520 * @return Formatted string.
3521 */
3522inline std::string to_string(const experimental::dynamic_fusion::CastAttributes &cast_attr)
3523{
3524 std::stringstream str;
3525 str << cast_attr;
3526 return str.str();
3527}
3528
Gunes Bayir7dc02342022-11-21 21:46:50 +00003529/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3530 *
3531 * @param[out] os Output stream.
3532 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3533 *
3534 * @return Modified output stream.
3535 */
3536inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3537{
3538 os << "DepthwiseConv2dAttributes="
3539 << "["
3540 << "Padding=" << dw_conv2d_attr.pad() << ", "
3541 << "Size2D=" << dw_conv2d_attr.stride() << ", "
3542 << "Depth Multiplier=" << dw_conv2d_attr.depth_multiplier() << ", "
3543 << "Dilation=" << dw_conv2d_attr.dilation() << ","
3544 << "DimensionRoundingType: " << dw_conv2d_attr.dimension_rounding_type() << "]";
3545
3546 return os;
3547}
3548/** Formatted output of the arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type.
3549 *
3550 * @param[in] dw_conv2d_attr arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes type to output.
3551 *
3552 * @return Formatted string.
3553 */
3554inline std::string to_string(const experimental::dynamic_fusion::DepthwiseConv2dAttributes &dw_conv2d_attr)
3555{
3556 std::stringstream str;
3557 str << dw_conv2d_attr;
3558 return str.str();
3559}
3560
Jakub Sujak32741722022-11-25 16:43:18 +00003561/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3562 *
3563 * @param[out] os Output stream.
3564 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3565 *
3566 * @return Modified output stream.
3567 */
3568inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3569{
3570 os << "ClampAttributes="
3571 << "["
3572 << "Min value=" << clamp_attr.min_val() << ", "
3573 << "Max value=" << clamp_attr.max_val() << "]";
3574 return os;
3575}
3576/** Formatted output of the arm_compute::experimental::dynamic_fusion::ClampAttributes type.
3577 *
3578 * @param[in] clamp_attr arm_compute::experimental::dynamic_fusion::ClampAttributes type to output.
3579 *
3580 * @return Formatted string.
3581 */
3582inline std::string to_string(const experimental::dynamic_fusion::ClampAttributes &clamp_attr)
3583{
3584 std::stringstream str;
3585 str << clamp_attr;
3586 return str.str();
3587}
3588
Jakub Sujak8ae57142022-12-02 16:09:06 +00003589/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3590 *
3591 * @param[out] os Output stream.
3592 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3593 *
3594 * @return Modified output stream.
3595 */
3596inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3597{
3598 os << "ResizeAttributes="
3599 << "["
3600 << "AlignCorners=" << resize_attr.align_corners() << ", "
3601 << "InterpolationPolicy=" << resize_attr.interpolation_policy() << ", "
3602 << "OutputHeight=" << resize_attr.output_height() << ", "
3603 << "OutputWidth=" << resize_attr.output_width() << ", "
3604 << "SamplingPolicy=" << resize_attr.sampling_policy() << "]";
3605 return os;
3606}
3607
3608/** Formatted output of the arm_compute::experimental::dynamic_fusion::ResizeAttributes type.
3609 *
3610 * @param[in] resize_attr arm_compute::experimental::dynamic_fusion::ResizeAttributes type to output.
3611 *
3612 * @return Formatted string.
3613 */
3614inline std::string to_string(const experimental::dynamic_fusion::ResizeAttributes &resize_attr)
3615{
3616 std::stringstream str;
3617 str << resize_attr;
3618 return str.str();
3619}
3620
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003621/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3622 *
3623 * @param[out] os Output stream.
3624 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3625 *
3626 * @return Modified output stream.
3627 */
3628inline ::std::ostream &operator<<(::std::ostream &os, const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3629{
Jakub Sujak7359a872023-01-05 14:24:13 +00003630 os << "SoftmaxAttributes="
Gunes Bayiraecb5d92022-12-18 21:31:29 +00003631 << "["
3632 << "Beta=" << softmax_attr.beta() << ", "
3633 << "Is Log Softmax=" << softmax_attr.is_log_softmax() << ", "
3634 << "Axis=" << softmax_attr.axis() << "]";
3635 return os;
3636}
3637/** Formatted output of the arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type.
3638 *
3639 * @param[in] softmax_attr arm_compute::experimental::dynamic_fusion::SoftmaxAttributes type to output.
3640 *
3641 * @return Formatted string.
3642 */
3643inline std::string to_string(const experimental::dynamic_fusion::SoftmaxAttributes &softmax_attr)
3644{
3645 std::stringstream str;
3646 str << softmax_attr;
3647 return str.str();
3648}
3649
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003650} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01003651
3652#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */