blob: c3641028a6002f67bea9b36b70e8f8a46a5c5e75 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
SiCong Lidb4a6c12021-02-05 09:30:57 +00002 * Copyright (c) 2017-2021 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"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010039#include "arm_compute/runtime/CL/CLTunerTypes.h"
SiCong Lidb4a6c12021-02-05 09:30:57 +000040#include "arm_compute/runtime/CL/CLTypes.h"
ramelg013ae3d882021-09-12 23:07:47 +010041#include "arm_compute/runtime/FunctionDescriptors.h"
ramelg01cbbb0382021-09-17 17:36:57 +010042#include "arm_compute/runtime/common/LSTMParams.h"
Matthew Bentham758b5ba2020-03-05 23:37:48 +000043#include "support/StringSupport.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010044
45#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010046#include <sstream>
47#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010048
49namespace arm_compute
50{
Anthony Barbierb940fd62018-06-04 14:14:32 +010051/** Formatted output if arg is not null
52 *
53 * @param[in] arg Object to print
54 *
55 * @return String representing arg.
56 */
57template <typename T>
58std::string to_string_if_not_null(T *arg)
59{
60 if(arg == nullptr)
61 {
62 return "nullptr";
63 }
64 else
65 {
66 return to_string(*arg);
67 }
68}
Anthony Barbierb4670212018-05-18 16:55:39 +010069
Alex Gildayc357c472018-03-21 13:54:09 +000070/** Formatted output of the Dimensions type.
71 *
72 * @param[out] os Output stream.
73 * @param[in] dimensions Type to output.
74 *
75 * @return Modified output stream.
76 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010077template <typename T>
78inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
79{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010080 if(dimensions.num_dimensions() > 0)
81 {
82 os << dimensions[0];
83
84 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
85 {
Freddie Liardetdd23f2a2021-06-17 13:30:11 +010086 os << "," << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +010087 }
88 }
89
Anthony Barbier6ff3b192017-09-04 18:44:23 +010090 return os;
91}
92
Alex Gildayc357c472018-03-21 13:54:09 +000093/** Formatted output of the RoundingPolicy type.
94 *
95 * @param[out] os Output stream.
96 * @param[in] rounding_policy Type to output.
97 *
98 * @return Modified output stream.
99 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100100inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100101{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100102 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100103 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100104 case RoundingPolicy::TO_ZERO:
105 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100106 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100107 case RoundingPolicy::TO_NEAREST_UP:
108 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100109 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100110 case RoundingPolicy::TO_NEAREST_EVEN:
111 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100112 break;
113 default:
114 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
115 }
116
117 return os;
118}
119
Alex Gildayc357c472018-03-21 13:54:09 +0000120/** Formatted output of the WeightsInfo type.
121 *
122 * @param[out] os Output stream.
123 * @param[in] weights_info Type to output.
124 *
125 * @return Modified output stream.
126 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100127inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100128{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100129 os << weights_info.are_reshaped() << ";";
130 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100131
132 return os;
133}
134
Alex Gildayc357c472018-03-21 13:54:09 +0000135/** Formatted output of the ROIPoolingInfo type.
136 *
137 * @param[out] os Output stream.
138 * @param[in] pool_info Type to output.
139 *
140 * @return Modified output stream.
141 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100142inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100143{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100144 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100145 return os;
146}
147
giuros0118870812018-09-13 09:31:40 +0100148/** Formatted output of the ROIPoolingInfo type.
149 *
150 * @param[in] pool_info Type to output.
151 *
152 * @return Formatted string.
153 */
154inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
155{
156 std::stringstream str;
157 str << pool_info;
158 return str.str();
159}
160
morgolockaba2f912020-05-05 16:28:19 +0100161/** Formatted output of the GEMMKernelInfo type.
162 *
163 * @param[out] os Output stream.
164 * @param[in] gemm_info Type to output.
165 *
166 * @return Modified output stream.
167 */
168inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
169{
170 os << "( m= " << gemm_info.m;
171 os << " n= " << gemm_info.n;
172 os << " k= " << gemm_info.k;
173 os << " depth_output_gemm3d= " << gemm_info.depth_output_gemm3d;
174 os << " reinterpret_input_as_3d= " << gemm_info.reinterpret_input_as_3d;
175 os << " broadcast_bias= " << gemm_info.broadcast_bias;
176 os << " fp_mixed_precision= " << gemm_info.fp_mixed_precision;
177 os << " mult_transpose1xW_width= " << gemm_info.mult_transpose1xW_width;
178 os << " mult_interleave4x4_height= " << gemm_info.mult_interleave4x4_height;
179 os << " a_offset = " << gemm_info.a_offset;
180 os << " b_offset = " << gemm_info.b_offset;
181 os << ")";
182 return os;
183}
184
185/** Formatted output of the GEMMLHSMatrixInfo type.
186 *
187 * @param[out] os Output stream.
188 * @param[in] gemm_info Type to output.
189 *
190 * @return Modified output stream.
191 */
192inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
193{
194 os << "( m0= " << (unsigned int)gemm_info.m0 << " k0= " << gemm_info.k0 << " v0= " << gemm_info.v0 << " trans= " << gemm_info.transpose << " inter= " << gemm_info.interleave << "})";
195 return os;
196}
197
198/** Formatted output of the GEMMRHSMatrixInfo type.
199 *
200 * @param[out] os Output stream.
201 * @param[in] gemm_info Type to output.
202 *
203 * @return Modified output stream.
204 */
205inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
206{
SiCong Lidb4a6c12021-02-05 09:30:57 +0000207 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=" <<
208 gemm_info.export_to_cl_image << "})";
morgolockaba2f912020-05-05 16:28:19 +0100209 return os;
210}
211
212/** Formatted output of the GEMMRHSMatrixInfo type.
213 *
214 * @param[in] gemm_info GEMMRHSMatrixInfo to output.
215 *
216 * @return Formatted string.
217 */
218inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
219{
220 std::stringstream str;
221 str << gemm_info;
222 return str.str();
223}
224
225/** Formatted output of the GEMMLHSMatrixInfo type.
226 *
227 * @param[in] gemm_info GEMMLHSMatrixInfo to output.
228 *
229 * @return Formatted string.
230 */
231inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
232{
233 std::stringstream str;
234 str << gemm_info;
235 return str.str();
236}
237
238/** Formatted output of the GEMMKernelInfo type.
239 *
240 * @param[in] gemm_info GEMMKernelInfo Type to output.
241 *
242 * @return Formatted string.
243 */
244inline std::string to_string(const GEMMKernelInfo &gemm_info)
245{
246 std::stringstream str;
247 str << gemm_info;
248 return str.str();
249}
250
giuros01c04a0e82018-10-03 12:44:35 +0100251/** Formatted output of the BoundingBoxTransformInfo type.
252 *
253 * @param[out] os Output stream.
254 * @param[in] bbox_info Type to output.
255 *
256 * @return Modified output stream.
257 */
258inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
259{
260 auto weights = bbox_info.weights();
261 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights = {" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
262 "})";
263 return os;
264}
265
266/** Formatted output of the BoundingBoxTransformInfo type.
267 *
268 * @param[in] bbox_info Type to output.
269 *
270 * @return Formatted string.
271 */
272inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
273{
274 std::stringstream str;
275 str << bbox_info;
276 return str.str();
277}
278
Manuel Bottini5209be52019-02-13 16:34:56 +0000279/** Formatted output of the ComputeAnchorsInfo type.
280 *
281 * @param[out] os Output stream.
282 * @param[in] anchors_info Type to output.
283 *
284 * @return Modified output stream.
285 */
286inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
287{
288 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
289 return os;
290}
291
292/** Formatted output of the ComputeAnchorsInfo type.
293 *
294 * @param[in] anchors_info Type to output.
295 *
296 * @return Formatted string.
297 */
298inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
299{
300 std::stringstream str;
301 str << anchors_info;
302 return str.str();
303}
304
305/** Formatted output of the GenerateProposalsInfo type.
306 *
307 * @param[out] os Output stream.
308 * @param[in] proposals_info Type to output.
309 *
310 * @return Modified output stream.
311 */
312inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
313{
314 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
315 return os;
316}
317
318/** Formatted output of the GenerateProposalsInfo type.
319 *
320 * @param[in] proposals_info Type to output.
321 *
322 * @return Formatted string.
323 */
324inline std::string to_string(const GenerateProposalsInfo &proposals_info)
325{
326 std::stringstream str;
327 str << proposals_info;
328 return str.str();
329}
330
Alex Gildayc357c472018-03-21 13:54:09 +0000331/** Formatted output of the QuantizationInfo type.
332 *
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100333 * @param[out] os Output stream.
334 * @param[in] qinfo Type to output.
Alex Gildayc357c472018-03-21 13:54:09 +0000335 *
336 * @return Modified output stream.
337 */
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100338inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
Chunosovd621bca2017-11-03 17:33:15 +0700339{
Georgios Pinitas3d13af82019-06-04 13:04:16 +0100340 const UniformQuantizationInfo uqinfo = qinfo.uniform();
341 os << "Scale:" << uqinfo.scale << "~";
342 os << "Offset:" << uqinfo.offset;
Chunosovd621bca2017-11-03 17:33:15 +0700343 return os;
344}
345
Alex Gildayc357c472018-03-21 13:54:09 +0000346/** Formatted output of the QuantizationInfo type.
347 *
348 * @param[in] quantization_info Type to output.
349 *
350 * @return Formatted string.
351 */
Chunosovd621bca2017-11-03 17:33:15 +0700352inline std::string to_string(const QuantizationInfo &quantization_info)
353{
354 std::stringstream str;
355 str << quantization_info;
356 return str.str();
357}
358
Alex Gildayc357c472018-03-21 13:54:09 +0000359/** Formatted output of the activation function type.
360 *
361 * @param[out] os Output stream.
362 * @param[in] act_function Type to output.
363 *
364 * @return Modified output stream.
365 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100366inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
367{
368 switch(act_function)
369 {
370 case ActivationLayerInfo::ActivationFunction::ABS:
371 os << "ABS";
372 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100373 case ActivationLayerInfo::ActivationFunction::LINEAR:
374 os << "LINEAR";
375 break;
376 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
377 os << "LOGISTIC";
378 break;
379 case ActivationLayerInfo::ActivationFunction::RELU:
380 os << "RELU";
381 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100382 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
383 os << "BOUNDED_RELU";
384 break;
385 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
386 os << "LEAKY_RELU";
387 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100388 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
389 os << "SOFT_RELU";
390 break;
391 case ActivationLayerInfo::ActivationFunction::SQRT:
392 os << "SQRT";
393 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100394 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
395 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000396 break;
Georgios Pinitasfb0fdcd2019-08-22 17:10:04 +0100397 case ActivationLayerInfo::ActivationFunction::ELU:
398 os << "ELU";
399 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100400 case ActivationLayerInfo::ActivationFunction::SQUARE:
401 os << "SQUARE";
402 break;
403 case ActivationLayerInfo::ActivationFunction::TANH:
404 os << "TANH";
405 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100406 case ActivationLayerInfo::ActivationFunction::IDENTITY:
407 os << "IDENTITY";
408 break;
morgolock07df3d42020-02-27 11:46:28 +0000409 case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
410 os << "HARD_SWISH";
411 break;
412
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100413 default:
414 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
415 }
416
417 return os;
418}
419
Alex Gildayc357c472018-03-21 13:54:09 +0000420/** Formatted output of the activation function info type.
421 *
422 * @param[in] info Type to output.
423 *
424 * @return Formatted string.
425 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100426inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100427{
428 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000429 if(info.enabled())
430 {
431 str << info.activation();
432 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100433 return str.str();
434}
435
ramelg013ae3d882021-09-12 23:07:47 +0100436/** Formatted output of the activation function info type.
437 *
438 * @param[in] info Type to output.
439 *
440 * @return Formatted string.
441 */
442inline std::string to_string(const arm_compute::ActivationLayerInfo *info)
443{
444 std::string ret_str = "nullptr";
445 if(info != nullptr)
446 {
447 std::stringstream str;
448 if(info->enabled())
449 {
450 str << info->activation();
451 }
452 ret_str = str.str();
453 }
454 return ret_str;
455}
456
Alex Gildayc357c472018-03-21 13:54:09 +0000457/** Formatted output of the activation function type.
458 *
459 * @param[in] function Type to output.
460 *
461 * @return Formatted string.
462 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100463inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
464{
465 std::stringstream str;
466 str << function;
467 return str.str();
468}
469
Alex Gildayc357c472018-03-21 13:54:09 +0000470/** Formatted output of the NormType type.
471 *
472 * @param[out] os Output stream.
473 * @param[in] norm_type Type to output.
474 *
475 * @return Modified output stream.
476 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100477inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
478{
479 switch(norm_type)
480 {
481 case NormType::CROSS_MAP:
482 os << "CROSS_MAP";
483 break;
484 case NormType::IN_MAP_1D:
485 os << "IN_MAP_1D";
486 break;
487 case NormType::IN_MAP_2D:
488 os << "IN_MAP_2D";
489 break;
490 default:
491 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
492 }
493
494 return os;
495}
496
Alex Gildayc357c472018-03-21 13:54:09 +0000497/** Formatted output of @ref NormalizationLayerInfo.
498 *
499 * @param[in] info Type to output.
500 *
501 * @return Formatted string.
502 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100503inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100504{
505 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000506 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100507 return str.str();
508}
509
Alex Gildayc357c472018-03-21 13:54:09 +0000510/** Formatted output of @ref NormalizationLayerInfo.
511 *
512 * @param[out] os Output stream.
513 * @param[in] info Type to output.
514 *
515 * @return Modified output stream.
516 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100517inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
518{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000519 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100520 return os;
521}
522
Alex Gildayc357c472018-03-21 13:54:09 +0000523/** Formatted output of the PoolingType type.
524 *
525 * @param[out] os Output stream.
526 * @param[in] pool_type Type to output.
527 *
528 * @return Modified output stream.
529 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100530inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
531{
532 switch(pool_type)
533 {
534 case PoolingType::AVG:
535 os << "AVG";
536 break;
537 case PoolingType::MAX:
538 os << "MAX";
539 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100540 case PoolingType::L2:
541 os << "L2";
542 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100543 default:
544 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
545 }
546
547 return os;
548}
549
Alex Gildayc357c472018-03-21 13:54:09 +0000550/** Formatted output of @ref PoolingLayerInfo.
551 *
552 * @param[out] os Output stream.
553 * @param[in] info Type to output.
554 *
555 * @return Modified output stream.
556 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100557inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
558{
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +0000559 os << info.pool_type;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100560
561 return os;
562}
563
Alex Gildayc357c472018-03-21 13:54:09 +0000564/** Formatted output of @ref RoundingPolicy.
565 *
566 * @param[in] rounding_policy Type to output.
567 *
568 * @return Formatted string.
569 */
John Richardsondd715f22017-09-18 16:10:48 +0100570inline std::string to_string(const RoundingPolicy &rounding_policy)
571{
572 std::stringstream str;
573 str << rounding_policy;
574 return str.str();
575}
576
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000577/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000578/** Formatted output of the DataLayout type.
579 *
580 * @param[out] os Output stream.
581 * @param[in] data_layout Type to output.
582 *
583 * @return Modified output stream.
584 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000585inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
586{
587 switch(data_layout)
588 {
589 case DataLayout::UNKNOWN:
590 os << "UNKNOWN";
591 break;
592 case DataLayout::NHWC:
593 os << "NHWC";
594 break;
595 case DataLayout::NCHW:
596 os << "NCHW";
597 break;
Adnan AlSinane4563a02021-09-01 15:32:03 +0100598 case DataLayout::NDHWC:
599 os << "NDHWC";
600 break;
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000601 default:
602 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
603 }
604
605 return os;
606}
607
Alex Gildayc357c472018-03-21 13:54:09 +0000608/** Formatted output of the DataLayout type.
609 *
610 * @param[in] data_layout Type to output.
611 *
612 * @return Formatted string.
613 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000614inline std::string to_string(const arm_compute::DataLayout &data_layout)
615{
616 std::stringstream str;
617 str << data_layout;
618 return str.str();
619}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000620/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000621
Georgios Pinitase2220552018-07-20 13:23:44 +0100622/** Formatted output of the DataLayoutDimension type.
623 *
624 * @param[out] os Output stream.
625 * @param[in] data_layout_dim Data layout dimension to print.
626 *
627 * @return Modified output stream.
628 */
629inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
630{
631 switch(data_layout_dim)
632 {
633 case DataLayoutDimension::WIDTH:
634 os << "WIDTH";
635 break;
636 case DataLayoutDimension::HEIGHT:
637 os << "HEIGHT";
638 break;
639 case DataLayoutDimension::CHANNEL:
640 os << "CHANNEL";
641 break;
642 case DataLayoutDimension::BATCHES:
643 os << "BATCHES";
644 break;
645 default:
646 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
647 }
648 return os;
649}
650
Alex Gildayc357c472018-03-21 13:54:09 +0000651/** Formatted output of the DataType type.
652 *
653 * @param[out] os Output stream.
654 * @param[in] data_type Type to output.
655 *
656 * @return Modified output stream.
657 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100658inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
659{
660 switch(data_type)
661 {
662 case DataType::UNKNOWN:
663 os << "UNKNOWN";
664 break;
665 case DataType::U8:
666 os << "U8";
667 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100668 case DataType::QSYMM8:
669 os << "QSYMM8";
670 break;
Chunosovd621bca2017-11-03 17:33:15 +0700671 case DataType::QASYMM8:
672 os << "QASYMM8";
673 break;
Georgios Pinitas448a81f2019-11-21 14:10:25 +0000674 case DataType::QASYMM8_SIGNED:
675 os << "QASYMM8_SIGNED";
676 break;
Georgios Pinitas4c5469b2019-05-21 13:32:43 +0100677 case DataType::QSYMM8_PER_CHANNEL:
678 os << "QSYMM8_PER_CHANNEL";
679 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100680 case DataType::S8:
681 os << "S8";
682 break;
683 case DataType::U16:
684 os << "U16";
685 break;
686 case DataType::S16:
687 os << "S16";
688 break;
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100689 case DataType::QSYMM16:
690 os << "QSYMM16";
691 break;
Michele Di Giorgio35ea9a72019-08-23 12:02:06 +0100692 case DataType::QASYMM16:
693 os << "QASYMM16";
694 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100695 case DataType::U32:
696 os << "U32";
697 break;
698 case DataType::S32:
699 os << "S32";
700 break;
701 case DataType::U64:
702 os << "U64";
703 break;
704 case DataType::S64:
705 os << "S64";
706 break;
Georgios Pinitase8291ac2020-02-26 09:58:13 +0000707 case DataType::BFLOAT16:
708 os << "BFLOAT16";
709 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100710 case DataType::F16:
711 os << "F16";
712 break;
713 case DataType::F32:
714 os << "F32";
715 break;
716 case DataType::F64:
717 os << "F64";
718 break;
719 case DataType::SIZET:
720 os << "SIZET";
721 break;
722 default:
723 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
724 }
725
726 return os;
727}
728
Alex Gildayc357c472018-03-21 13:54:09 +0000729/** Formatted output of the DataType type.
730 *
731 * @param[in] data_type Type to output.
732 *
733 * @return Formatted string.
734 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100735inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100736{
737 std::stringstream str;
738 str << data_type;
739 return str.str();
740}
741
Alex Gildayc357c472018-03-21 13:54:09 +0000742/** Formatted output of the Format type.
743 *
744 * @param[out] os Output stream.
745 * @param[in] format Type to output.
746 *
747 * @return Modified output stream.
748 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100749inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
750{
751 switch(format)
752 {
753 case Format::UNKNOWN:
754 os << "UNKNOWN";
755 break;
756 case Format::U8:
757 os << "U8";
758 break;
759 case Format::S16:
760 os << "S16";
761 break;
762 case Format::U16:
763 os << "U16";
764 break;
765 case Format::S32:
766 os << "S32";
767 break;
768 case Format::U32:
769 os << "U32";
770 break;
771 case Format::F16:
772 os << "F16";
773 break;
774 case Format::F32:
775 os << "F32";
776 break;
777 case Format::UV88:
778 os << "UV88";
779 break;
780 case Format::RGB888:
781 os << "RGB888";
782 break;
783 case Format::RGBA8888:
784 os << "RGBA8888";
785 break;
786 case Format::YUV444:
787 os << "YUV444";
788 break;
789 case Format::YUYV422:
790 os << "YUYV422";
791 break;
792 case Format::NV12:
793 os << "NV12";
794 break;
795 case Format::NV21:
796 os << "NV21";
797 break;
798 case Format::IYUV:
799 os << "IYUV";
800 break;
801 case Format::UYVY422:
802 os << "UYVY422";
803 break;
804 default:
805 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
806 }
807
808 return os;
809}
810
Alex Gildayc357c472018-03-21 13:54:09 +0000811/** Formatted output of the Format type.
812 *
813 * @param[in] format Type to output.
814 *
815 * @return Formatted string.
816 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100817inline std::string to_string(const Format &format)
818{
819 std::stringstream str;
820 str << format;
821 return str.str();
822}
823
Alex Gildayc357c472018-03-21 13:54:09 +0000824/** Formatted output of the Channel type.
825 *
826 * @param[out] os Output stream.
827 * @param[in] channel Type to output.
828 *
829 * @return Modified output stream.
830 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100831inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
832{
833 switch(channel)
834 {
835 case Channel::UNKNOWN:
836 os << "UNKNOWN";
837 break;
838 case Channel::C0:
839 os << "C0";
840 break;
841 case Channel::C1:
842 os << "C1";
843 break;
844 case Channel::C2:
845 os << "C2";
846 break;
847 case Channel::C3:
848 os << "C3";
849 break;
850 case Channel::R:
851 os << "R";
852 break;
853 case Channel::G:
854 os << "G";
855 break;
856 case Channel::B:
857 os << "B";
858 break;
859 case Channel::A:
860 os << "A";
861 break;
862 case Channel::Y:
863 os << "Y";
864 break;
865 case Channel::U:
866 os << "U";
867 break;
868 case Channel::V:
869 os << "V";
870 break;
871 default:
872 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
873 }
874
875 return os;
876}
877
Alex Gildayc357c472018-03-21 13:54:09 +0000878/** Formatted output of the Channel type.
879 *
880 * @param[in] channel Type to output.
881 *
882 * @return Formatted string.
883 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +0100884inline std::string to_string(const Channel &channel)
885{
886 std::stringstream str;
887 str << channel;
888 return str.str();
889}
890
Alex Gildayc357c472018-03-21 13:54:09 +0000891/** Formatted output of the BorderMode type.
892 *
893 * @param[out] os Output stream.
894 * @param[in] mode Type to output.
895 *
896 * @return Modified output stream.
897 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100898inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
899{
900 switch(mode)
901 {
902 case BorderMode::UNDEFINED:
903 os << "UNDEFINED";
904 break;
905 case BorderMode::CONSTANT:
906 os << "CONSTANT";
907 break;
908 case BorderMode::REPLICATE:
909 os << "REPLICATE";
910 break;
911 default:
912 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
913 }
914
915 return os;
916}
917
Alex Gildayc357c472018-03-21 13:54:09 +0000918/** Formatted output of the BorderSize type.
919 *
920 * @param[out] os Output stream.
921 * @param[in] border Type to output.
922 *
923 * @return Modified output stream.
924 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100925inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
926{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +0100927 os << border.top << ","
928 << border.right << ","
929 << border.bottom << ","
930 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100931
932 return os;
933}
Anthony Barbier2a07e182017-08-04 18:20:27 +0100934
Giuseppe Rossinid7647d42018-07-17 18:13:13 +0100935/** Formatted output of the PaddingList type.
936 *
937 * @param[out] os Output stream.
938 * @param[in] padding Type to output.
939 *
940 * @return Modified output stream.
941 */
942inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
943{
944 os << "{";
945 for(auto const &p : padding)
946 {
947 os << "{" << p.first << "," << p.second << "}";
948 }
949 os << "}";
950 return os;
951}
952
giuros013175fcf2018-11-21 09:59:17 +0000953/** Formatted output of the Multiples type.
954 *
955 * @param[out] os Output stream.
956 * @param[in] multiples Type to output.
957 *
958 * @return Modified output stream.
959 */
960inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
961{
962 os << "(";
963 for(size_t i = 0; i < multiples.size() - 1; i++)
964 {
965 os << multiples[i] << ", ";
966 }
967 os << multiples.back() << ")";
968 return os;
969}
970
Alex Gildayc357c472018-03-21 13:54:09 +0000971/** Formatted output of the InterpolationPolicy type.
972 *
973 * @param[out] os Output stream.
974 * @param[in] policy Type to output.
975 *
976 * @return Modified output stream.
977 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100978inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
979{
980 switch(policy)
981 {
982 case InterpolationPolicy::NEAREST_NEIGHBOR:
983 os << "NEAREST_NEIGHBOR";
984 break;
985 case InterpolationPolicy::BILINEAR:
986 os << "BILINEAR";
987 break;
988 case InterpolationPolicy::AREA:
989 os << "AREA";
990 break;
991 default:
992 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
993 }
994
995 return os;
996}
997
Alex Gildayc357c472018-03-21 13:54:09 +0000998/** Formatted output of the SamplingPolicy type.
999 *
1000 * @param[out] os Output stream.
1001 * @param[in] policy Type to output.
1002 *
1003 * @return Modified output stream.
1004 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001005inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1006{
1007 switch(policy)
1008 {
1009 case SamplingPolicy::CENTER:
1010 os << "CENTER";
1011 break;
1012 case SamplingPolicy::TOP_LEFT:
1013 os << "TOP_LEFT";
1014 break;
1015 default:
1016 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1017 }
1018
1019 return os;
1020}
1021
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001022/** Formatted output of the ITensorInfo type.
1023 *
1024 * @param[out] os Output stream.
1025 * @param[in] info Tensor information.
1026 *
1027 * @return Modified output stream.
1028 */
1029inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1030{
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001031 const DataType data_type = info->data_type();
1032 const DataLayout data_layout = info->data_layout();
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001033
1034 os << "Shape=" << info->tensor_shape() << ","
1035 << "DataLayout=" << string_from_data_layout(data_layout) << ","
1036 << "DataType=" << string_from_data_type(data_type) << ",";
1037
1038 if(is_data_type_quantized(data_type))
1039 {
1040 const QuantizationInfo qinfo = info->quantization_info();
1041 os << "QuantizationInfo=";
1042 if(is_data_type_quantized_per_channel(data_type))
1043 {
1044 os << "[";
1045 const auto scales = qinfo.scale();
1046 const auto offsets = qinfo.offset();
1047 os << "(" << scales[0] << ", " << offsets[0] << ")";
1048 for(size_t i = 1; i < scales.size(); ++i)
1049 {
1050 os << ",(" << scales[i] << ", " << offsets[i] << ")";
1051 }
1052 os << "]";
1053 }
1054 else
1055 {
1056 os << "(" << qinfo.uniform().scale << ", "
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001057 << qinfo.uniform().offset << ")";
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001058 }
1059 }
1060 return os;
1061}
1062
ramelg013ae3d882021-09-12 23:07:47 +01001063/** Formatted output of the const TensorInfo& type.
Alex Gildayc357c472018-03-21 13:54:09 +00001064 *
Anthony Barbier366628a2018-08-01 13:55:03 +01001065 * @param[out] os Output stream.
1066 * @param[in] info Type to output.
1067 *
1068 * @return Modified output stream.
1069 */
1070inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1071{
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001072 os << &info;
Georgios Pinitasc6f95102021-03-30 10:03:01 +01001073 return os;
Anthony Barbier366628a2018-08-01 13:55:03 +01001074}
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001075
ramelg013ae3d882021-09-12 23:07:47 +01001076/** Formatted output of the const TensorInfo& type.
Anthony Barbier366628a2018-08-01 13:55:03 +01001077 *
Alex Gildayc357c472018-03-21 13:54:09 +00001078 * @param[in] info Type to output.
1079 *
1080 * @return Formatted string.
1081 */
Georgios Pinitas3faea252017-10-30 14:13:50 +00001082inline std::string to_string(const TensorInfo &info)
1083{
1084 std::stringstream str;
Michele Di Giorgioc22eb1b2021-02-01 10:39:06 +00001085 str << &info;
Georgios Pinitas3faea252017-10-30 14:13:50 +00001086 return str.str();
1087}
1088
ramelg013ae3d882021-09-12 23:07:47 +01001089/** Formatted output of the const ITensorInfo& type.
1090 *
1091 * @param[in] info Type to output.
1092 *
1093 * @return Formatted string.
1094 */
1095inline std::string to_string(const ITensorInfo &info)
1096{
1097 std::stringstream str;
1098 str << &info;
1099 return str.str();
1100}
1101
ramelg013ae3d882021-09-12 23:07:47 +01001102/** Formatted output of the const ITensorInfo* type.
1103 *
1104 * @param[in] info Type to output.
1105 *
1106 * @return Formatted string.
1107 */
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001108inline std::string to_string(const ITensorInfo *info)
1109{
ramelg013ae3d882021-09-12 23:07:47 +01001110 std::string ret_str = "nullptr";
1111 if(info != nullptr)
1112 {
1113 std::stringstream str;
1114 str << info;
1115 ret_str = str.str();
1116 }
1117 return ret_str;
1118}
1119
ramelg01cbbb0382021-09-17 17:36:57 +01001120/** Formatted output of the ITensorInfo* type.
1121 *
1122 * @param[in] info Type to output.
1123 *
1124 * @return Formatted string.
1125 */
1126inline std::string to_string(ITensorInfo *info)
1127{
1128 return to_string(static_cast<const ITensorInfo *>(info));
1129}
1130
1131/** Formatted output of the ITensorInfo type obtained from const ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001132 *
1133 * @param[in] tensor Type to output.
1134 *
1135 * @return Formatted string.
1136 */
1137inline std::string to_string(const ITensor *tensor)
1138{
1139 std::string ret_str = "nullptr";
1140 if(tensor != nullptr)
1141 {
1142 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001143 str << "ITensor->info(): " << tensor->info();
ramelg013ae3d882021-09-12 23:07:47 +01001144 ret_str = str.str();
1145 }
1146 return ret_str;
1147}
1148
ramelg01cbbb0382021-09-17 17:36:57 +01001149/** Formatted output of the ITensorInfo type obtained from the ITensor* type.
ramelg013ae3d882021-09-12 23:07:47 +01001150 *
1151 * @param[in] tensor Type to output.
1152 *
1153 * @return Formatted string.
1154 */
1155inline std::string to_string(ITensor *tensor)
1156{
ramelg01cbbb0382021-09-17 17:36:57 +01001157 return to_string(static_cast<const ITensor *>(tensor));
ramelg013ae3d882021-09-12 23:07:47 +01001158}
1159
ramelg01cbbb0382021-09-17 17:36:57 +01001160/** Formatted output of the ITensorInfo type obtained from the ITensor& type.
ramelg013ae3d882021-09-12 23:07:47 +01001161 *
1162 * @param[in] tensor Type to output.
1163 *
1164 * @return Formatted string.
1165 */
1166inline std::string to_string(ITensor &tensor)
1167{
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001168 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01001169 str << "ITensor.info(): " << tensor.info();
Ramy Elgammale920d6a2021-08-19 22:10:30 +01001170 return str.str();
1171}
1172
ramelg01cbbb0382021-09-17 17:36:57 +01001173#ifdef ARM_COMPUTE_OPENCL_ENABLED
1174/** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1175 *
1176 * @param[in] cl_tensor Type to output.
1177 *
1178 * @return Formatted string.
1179 */
1180inline std::string to_string(const ICLTensor *cl_tensor)
1181{
1182 std::string ret_str = "nullptr";
1183 if(cl_tensor != nullptr)
1184 {
1185 std::stringstream str;
1186 str << "ICLTensor->info(): " << cl_tensor->info();
1187 ret_str = str.str();
1188 }
1189 return ret_str;
1190}
1191
1192/** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1193 *
1194 * @param[in] cl_tensor Type to output.
1195 *
1196 * @return Formatted string.
1197 */
1198inline std::string to_string(ICLTensor *cl_tensor)
1199{
1200 return to_string(static_cast<const ICLTensor *>(cl_tensor));
1201}
1202#endif /* ARM_COMPUTE_OPENCL_ENABLED */
1203
Alex Gildayc357c472018-03-21 13:54:09 +00001204/** Formatted output of the Dimensions type.
1205 *
1206 * @param[in] dimensions Type to output.
1207 *
1208 * @return Formatted string.
1209 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001210template <typename T>
1211inline std::string to_string(const Dimensions<T> &dimensions)
1212{
1213 std::stringstream str;
1214 str << dimensions;
1215 return str.str();
1216}
1217
Alex Gildayc357c472018-03-21 13:54:09 +00001218/** Formatted output of the Strides type.
1219 *
1220 * @param[in] stride Type to output.
1221 *
1222 * @return Formatted string.
1223 */
John Richardsona36eae12017-09-26 16:55:59 +01001224inline std::string to_string(const Strides &stride)
1225{
1226 std::stringstream str;
1227 str << stride;
1228 return str.str();
1229}
1230
Alex Gildayc357c472018-03-21 13:54:09 +00001231/** Formatted output of the TensorShape type.
1232 *
1233 * @param[in] shape Type to output.
1234 *
1235 * @return Formatted string.
1236 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001237inline std::string to_string(const TensorShape &shape)
1238{
1239 std::stringstream str;
1240 str << shape;
1241 return str.str();
1242}
1243
Alex Gildayc357c472018-03-21 13:54:09 +00001244/** Formatted output of the Coordinates type.
1245 *
1246 * @param[in] coord Type to output.
1247 *
1248 * @return Formatted string.
1249 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001250inline std::string to_string(const Coordinates &coord)
1251{
1252 std::stringstream str;
1253 str << coord;
1254 return str.str();
1255}
1256
Anthony Barbierb940fd62018-06-04 14:14:32 +01001257/** Formatted output of the GEMMReshapeInfo type.
1258 *
1259 * @param[out] os Output stream.
1260 * @param[in] info Type to output.
1261 *
1262 * @return Modified output stream.
1263 */
1264inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1265{
1266 os << "{m=" << info.m() << ",";
1267 os << "n=" << info.n() << ",";
1268 os << "k=" << info.k() << ",";
1269 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1270 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1271 os << "}";
1272
1273 return os;
1274}
1275
1276/** Formatted output of the GEMMInfo type.
1277 *
1278 * @param[out] os Output stream.
1279 * @param[in] info Type to output.
1280 *
1281 * @return Modified output stream.
1282 */
1283inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1284{
1285 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1286 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1287 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb4670212018-05-18 16:55:39 +01001288 os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1289 os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1290 os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1291 os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1292 os << "broadcast_bias=" << info.broadcast_bias() << ",";
ramelg01cbbb0382021-09-17 17:36:57 +01001293 os << "pretranspose_B=" << info.pretranspose_B() << ",";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001294
1295 return os;
1296}
1297
1298/** Formatted output of the Window::Dimension type.
1299 *
1300 * @param[out] os Output stream.
1301 * @param[in] dim Type to output.
1302 *
1303 * @return Modified output stream.
1304 */
1305inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1306{
1307 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1308
1309 return os;
1310}
1311/** Formatted output of the Window type.
1312 *
1313 * @param[out] os Output stream.
1314 * @param[in] win Type to output.
1315 *
1316 * @return Modified output stream.
1317 */
1318inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1319{
1320 os << "{";
1321 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1322 {
1323 if(i > 0)
1324 {
1325 os << ", ";
1326 }
1327 os << win[i];
1328 }
1329 os << "}";
1330
1331 return os;
1332}
1333
1334/** Formatted output of the WeightsInfo type.
1335 *
1336 * @param[in] info Type to output.
1337 *
1338 * @return Formatted string.
1339 */
1340inline std::string to_string(const WeightsInfo &info)
1341{
1342 std::stringstream str;
1343 str << info;
1344 return str.str();
1345}
1346
1347/** Formatted output of the GEMMReshapeInfo type.
1348 *
1349 * @param[in] info Type to output.
1350 *
1351 * @return Formatted string.
1352 */
1353inline std::string to_string(const GEMMReshapeInfo &info)
1354{
1355 std::stringstream str;
1356 str << info;
1357 return str.str();
1358}
1359
1360/** Formatted output of the GEMMInfo type.
1361 *
1362 * @param[in] info Type to output.
1363 *
1364 * @return Formatted string.
1365 */
1366inline std::string to_string(const GEMMInfo &info)
1367{
1368 std::stringstream str;
1369 str << info;
1370 return str.str();
1371}
1372
1373/** Formatted output of the Window::Dimension type.
1374 *
1375 * @param[in] dim Type to output.
1376 *
1377 * @return Formatted string.
1378 */
1379inline std::string to_string(const Window::Dimension &dim)
1380{
1381 std::stringstream str;
1382 str << dim;
1383 return str.str();
1384}
ramelg01cbbb0382021-09-17 17:36:57 +01001385/** Formatted output of the Window& type.
Anthony Barbierb940fd62018-06-04 14:14:32 +01001386 *
1387 * @param[in] win Type to output.
1388 *
1389 * @return Formatted string.
1390 */
1391inline std::string to_string(const Window &win)
1392{
1393 std::stringstream str;
1394 str << win;
1395 return str.str();
1396}
1397
ramelg01cbbb0382021-09-17 17:36:57 +01001398/** Formatted output of the Window* type.
1399 *
1400 * @param[in] win Type to output.
1401 *
1402 * @return Formatted string.
1403 */
1404inline std::string to_string(Window *win)
1405{
1406 std::string ret_str = "nullptr";
1407 if(win != nullptr)
1408 {
1409 std::stringstream str;
1410 str << *win;
1411 ret_str = str.str();
1412 }
1413 return ret_str;
1414}
1415
Alex Gildayc357c472018-03-21 13:54:09 +00001416/** Formatted output of the Rectangle type.
1417 *
1418 * @param[out] os Output stream.
1419 * @param[in] rect Type to output.
1420 *
1421 * @return Modified output stream.
1422 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001423inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1424{
1425 os << rect.width << "x" << rect.height;
1426 os << "+" << rect.x << "+" << rect.y;
1427
1428 return os;
1429}
1430
Usama Arif8cf8c112019-03-14 15:36:54 +00001431/** Formatted output of the PaddingMode type.
1432 *
1433 * @param[out] os Output stream.
1434 * @param[in] mode Type to output.
1435 *
1436 * @return Modified output stream.
1437 */
1438inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1439{
1440 switch(mode)
1441 {
1442 case PaddingMode::CONSTANT:
1443 os << "CONSTANT";
1444 break;
1445 case PaddingMode::REFLECT:
1446 os << "REFLECT";
1447 break;
1448 case PaddingMode::SYMMETRIC:
1449 os << "SYMMETRIC";
1450 break;
1451 default:
1452 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1453 }
1454
1455 return os;
1456}
1457
1458/** Formatted output of the PaddingMode type.
1459 *
1460 * @param[in] mode Type to output.
1461 *
1462 * @return Formatted string.
1463 */
1464inline std::string to_string(const PaddingMode &mode)
1465{
1466 std::stringstream str;
1467 str << mode;
1468 return str.str();
1469}
1470
Alex Gildayc357c472018-03-21 13:54:09 +00001471/** Formatted output of the PadStrideInfo type.
1472 *
1473 * @param[out] os Output stream.
1474 * @param[in] pad_stride_info Type to output.
1475 *
1476 * @return Modified output stream.
1477 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001478inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1479{
1480 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1481 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001482 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1483 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001484
1485 return os;
1486}
1487
Alex Gildayc357c472018-03-21 13:54:09 +00001488/** Formatted output of the PadStrideInfo type.
1489 *
1490 * @param[in] pad_stride_info Type to output.
1491 *
1492 * @return Formatted string.
1493 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001494inline std::string to_string(const PadStrideInfo &pad_stride_info)
1495{
1496 std::stringstream str;
1497 str << pad_stride_info;
1498 return str.str();
1499}
1500
Alex Gildayc357c472018-03-21 13:54:09 +00001501/** Formatted output of the BorderMode type.
1502 *
1503 * @param[in] mode Type to output.
1504 *
1505 * @return Formatted string.
1506 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001507inline std::string to_string(const BorderMode &mode)
1508{
1509 std::stringstream str;
1510 str << mode;
1511 return str.str();
1512}
1513
Alex Gildayc357c472018-03-21 13:54:09 +00001514/** Formatted output of the BorderSize type.
1515 *
1516 * @param[in] border Type to output.
1517 *
1518 * @return Formatted string.
1519 */
John Richardsonb482ce12017-09-18 12:44:01 +01001520inline std::string to_string(const BorderSize &border)
1521{
1522 std::stringstream str;
1523 str << border;
1524 return str.str();
1525}
1526
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001527/** Formatted output of the PaddingList type.
1528 *
1529 * @param[in] padding Type to output.
1530 *
1531 * @return Formatted string.
1532 */
1533inline std::string to_string(const PaddingList &padding)
1534{
1535 std::stringstream str;
1536 str << padding;
1537 return str.str();
1538}
1539
giuros013175fcf2018-11-21 09:59:17 +00001540/** Formatted output of the Multiples type.
1541 *
1542 * @param[in] multiples Type to output.
1543 *
1544 * @return Formatted string.
1545 */
1546inline std::string to_string(const Multiples &multiples)
1547{
1548 std::stringstream str;
1549 str << multiples;
1550 return str.str();
1551}
1552
Alex Gildayc357c472018-03-21 13:54:09 +00001553/** Formatted output of the InterpolationPolicy type.
1554 *
1555 * @param[in] policy Type to output.
1556 *
1557 * @return Formatted string.
1558 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001559inline std::string to_string(const InterpolationPolicy &policy)
1560{
1561 std::stringstream str;
1562 str << policy;
1563 return str.str();
1564}
1565
Alex Gildayc357c472018-03-21 13:54:09 +00001566/** Formatted output of the SamplingPolicy type.
1567 *
1568 * @param[in] policy Type to output.
1569 *
1570 * @return Formatted string.
1571 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001572inline std::string to_string(const SamplingPolicy &policy)
1573{
1574 std::stringstream str;
1575 str << policy;
1576 return str.str();
1577}
1578
Alex Gildayc357c472018-03-21 13:54:09 +00001579/** Formatted output of the ConvertPolicy type.
1580 *
1581 * @param[out] os Output stream.
1582 * @param[in] policy Type to output.
1583 *
1584 * @return Modified output stream.
1585 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001586inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1587{
1588 switch(policy)
1589 {
1590 case ConvertPolicy::WRAP:
1591 os << "WRAP";
1592 break;
1593 case ConvertPolicy::SATURATE:
1594 os << "SATURATE";
1595 break;
1596 default:
1597 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1598 }
1599
1600 return os;
1601}
1602
1603inline std::string to_string(const ConvertPolicy &policy)
1604{
1605 std::stringstream str;
1606 str << policy;
1607 return str.str();
1608}
1609
giuros01164a2722018-11-20 18:34:46 +00001610/** Formatted output of the ArithmeticOperation type.
1611 *
1612 * @param[out] os Output stream.
1613 * @param[in] op Operation to output.
1614 *
1615 * @return Modified output stream.
1616 */
1617inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1618{
1619 switch(op)
1620 {
1621 case ArithmeticOperation::ADD:
1622 os << "ADD";
1623 break;
1624 case ArithmeticOperation::SUB:
1625 os << "SUB";
1626 break;
1627 case ArithmeticOperation::DIV:
1628 os << "DIV";
1629 break;
1630 case ArithmeticOperation::MAX:
1631 os << "MAX";
1632 break;
1633 case ArithmeticOperation::MIN:
1634 os << "MIN";
1635 break;
1636 case ArithmeticOperation::SQUARED_DIFF:
1637 os << "SQUARED_DIFF";
1638 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001639 case ArithmeticOperation::POWER:
1640 os << "POWER";
1641 break;
giuros01164a2722018-11-20 18:34:46 +00001642 default:
1643 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1644 }
1645
1646 return os;
1647}
1648
1649/** Formatted output of the Arithmetic Operation
1650 *
1651 * @param[in] op Type to output.
1652 *
1653 * @return Formatted string.
1654 */
1655inline std::string to_string(const ArithmeticOperation &op)
1656{
1657 std::stringstream str;
1658 str << op;
1659 return str.str();
1660}
1661
Alex Gildayc357c472018-03-21 13:54:09 +00001662/** Formatted output of the Reduction Operations.
1663 *
1664 * @param[out] os Output stream.
1665 * @param[in] op Type to output.
1666 *
1667 * @return Modified output stream.
1668 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001669inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1670{
1671 switch(op)
1672 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001673 case ReductionOperation::SUM:
1674 os << "SUM";
1675 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001676 case ReductionOperation::SUM_SQUARE:
1677 os << "SUM_SQUARE";
1678 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001679 case ReductionOperation::MEAN_SUM:
1680 os << "MEAN_SUM";
1681 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001682 case ReductionOperation::ARG_IDX_MAX:
1683 os << "ARG_IDX_MAX";
1684 break;
1685 case ReductionOperation::ARG_IDX_MIN:
1686 os << "ARG_IDX_MIN";
1687 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001688 case ReductionOperation::PROD:
1689 os << "PROD";
1690 break;
Usama Arifa4a08ad2019-05-20 12:38:33 +01001691 case ReductionOperation::MIN:
1692 os << "MIN";
1693 break;
Usama Arif28f0dd92019-05-20 13:44:34 +01001694 case ReductionOperation::MAX:
1695 os << "MAX";
1696 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001697 default:
1698 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1699 }
1700
1701 return os;
1702}
1703
Alex Gildayc357c472018-03-21 13:54:09 +00001704/** Formatted output of the Reduction Operations.
1705 *
1706 * @param[in] op Type to output.
1707 *
1708 * @return Formatted string.
1709 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001710inline std::string to_string(const ReductionOperation &op)
1711{
1712 std::stringstream str;
1713 str << op;
1714 return str.str();
1715}
1716
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001717/** Formatted output of the Comparison Operations.
1718 *
1719 * @param[out] os Output stream.
1720 * @param[in] op Type to output.
1721 *
1722 * @return Modified output stream.
1723 */
1724inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1725{
1726 switch(op)
1727 {
1728 case ComparisonOperation::Equal:
1729 os << "Equal";
1730 break;
1731 case ComparisonOperation::NotEqual:
1732 os << "NotEqual";
1733 break;
1734 case ComparisonOperation::Greater:
1735 os << "Greater";
1736 break;
1737 case ComparisonOperation::GreaterEqual:
1738 os << "GreaterEqual";
1739 break;
1740 case ComparisonOperation::Less:
1741 os << "Less";
1742 break;
1743 case ComparisonOperation::LessEqual:
1744 os << "LessEqual";
1745 break;
1746 default:
1747 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1748 }
1749
1750 return os;
1751}
1752
Michalis Spyroue9362622018-11-23 17:41:37 +00001753/** Formatted output of the Elementwise unary Operations.
1754 *
1755 * @param[out] os Output stream.
1756 * @param[in] op Type to output.
1757 *
1758 * @return Modified output stream.
1759 */
1760inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1761{
1762 switch(op)
1763 {
1764 case ElementWiseUnary::RSQRT:
1765 os << "RSQRT";
1766 break;
1767 case ElementWiseUnary::EXP:
1768 os << "EXP";
1769 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001770 case ElementWiseUnary::NEG:
1771 os << "NEG";
1772 break;
Usama Arifac33d7e2019-05-20 14:21:40 +01001773 case ElementWiseUnary::LOG:
1774 os << "LOG";
1775 break;
Usama Arif6a4d5422019-05-24 14:53:59 +01001776 case ElementWiseUnary::ROUND:
1777 os << "ROUND";
1778 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00001779 default:
1780 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1781 }
1782
1783 return os;
1784}
1785
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001786/** Formatted output of the Comparison Operations.
1787 *
1788 * @param[in] op Type to output.
1789 *
1790 * @return Formatted string.
1791 */
1792inline std::string to_string(const ComparisonOperation &op)
1793{
1794 std::stringstream str;
1795 str << op;
1796 return str.str();
1797}
1798
Michalis Spyroue9362622018-11-23 17:41:37 +00001799/** Formatted output of the Elementwise unary Operations.
1800 *
1801 * @param[in] op Type to output.
1802 *
1803 * @return Formatted string.
1804 */
1805inline std::string to_string(const ElementWiseUnary &op)
1806{
1807 std::stringstream str;
1808 str << op;
1809 return str.str();
1810}
1811
Alex Gildayc357c472018-03-21 13:54:09 +00001812/** Formatted output of the Norm Type.
1813 *
1814 * @param[in] type Type to output.
1815 *
1816 * @return Formatted string.
1817 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001818inline std::string to_string(const NormType &type)
1819{
1820 std::stringstream str;
1821 str << type;
1822 return str.str();
1823}
1824
Alex Gildayc357c472018-03-21 13:54:09 +00001825/** Formatted output of the Pooling Type.
1826 *
1827 * @param[in] type Type to output.
1828 *
1829 * @return Formatted string.
1830 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001831inline std::string to_string(const PoolingType &type)
1832{
1833 std::stringstream str;
1834 str << type;
1835 return str.str();
1836}
1837
Alex Gildayc357c472018-03-21 13:54:09 +00001838/** Formatted output of the Pooling Layer Info.
1839 *
1840 * @param[in] info Type to output.
1841 *
1842 * @return Formatted string.
1843 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001844inline std::string to_string(const PoolingLayerInfo &info)
1845{
1846 std::stringstream str;
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001847 str << "{Type=" << info.pool_type << ","
Sang-Hoon Park11fedda2020-01-15 14:44:04 +00001848 << "DataLayout=" << info.data_layout << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001849 << "IsGlobalPooling=" << info.is_global_pooling;
1850 if(!info.is_global_pooling)
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001851 {
1852 str << ","
Sang-Hoon Park0cb3da62020-01-15 12:39:56 +00001853 << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
1854 << "PadStride=" << info.pad_stride_info;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001855 }
1856 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001857 return str.str();
1858}
1859
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01001860/** Formatted output of the PriorBoxLayerInfo.
1861 *
1862 * @param[in] info Type to output.
1863 *
1864 * @return Formatted string.
1865 */
1866inline std::string to_string(const PriorBoxLayerInfo &info)
1867{
1868 std::stringstream str;
1869 str << "{";
1870 str << "Clip:" << info.clip()
1871 << "Flip:" << info.flip()
1872 << "StepX:" << info.steps()[0]
1873 << "StepY:" << info.steps()[1]
1874 << "MinSizes:" << info.min_sizes().size()
1875 << "MaxSizes:" << info.max_sizes().size()
1876 << "ImgSizeX:" << info.img_size().x
1877 << "ImgSizeY:" << info.img_size().y
1878 << "Offset:" << info.offset()
1879 << "Variances:" << info.variances().size();
1880 str << "}";
1881 return str.str();
1882}
1883
Alex Gildayc357c472018-03-21 13:54:09 +00001884/** Formatted output of the Size2D type.
1885 *
1886 * @param[out] os Output stream
1887 * @param[in] size Type to output
1888 *
1889 * @return Modified output stream.
1890 */
John Richardson25f23682017-11-27 14:35:09 +00001891inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
1892{
1893 os << size.width << "x" << size.height;
1894
1895 return os;
1896}
1897
Alex Gildayc357c472018-03-21 13:54:09 +00001898/** Formatted output of the Size2D type.
1899 *
1900 * @param[in] type Type to output
1901 *
1902 * @return Formatted string.
1903 */
John Richardson25f23682017-11-27 14:35:09 +00001904inline std::string to_string(const Size2D &type)
1905{
1906 std::stringstream str;
1907 str << type;
1908 return str.str();
1909}
1910
Alex Gildayc357c472018-03-21 13:54:09 +00001911/** Formatted output of the ConvolutionMethod type.
1912 *
1913 * @param[out] os Output stream
1914 * @param[in] conv_method Type to output
1915 *
1916 * @return Modified output stream.
1917 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001918inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
1919{
1920 switch(conv_method)
1921 {
1922 case ConvolutionMethod::GEMM:
1923 os << "GEMM";
1924 break;
1925 case ConvolutionMethod::DIRECT:
1926 os << "DIRECT";
1927 break;
1928 case ConvolutionMethod::WINOGRAD:
1929 os << "WINOGRAD";
1930 break;
1931 default:
1932 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1933 }
1934
1935 return os;
1936}
1937
Alex Gildayc357c472018-03-21 13:54:09 +00001938/** Formatted output of the ConvolutionMethod type.
1939 *
1940 * @param[in] conv_method Type to output
1941 *
1942 * @return Formatted string.
1943 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001944inline std::string to_string(const ConvolutionMethod &conv_method)
1945{
1946 std::stringstream str;
1947 str << conv_method;
1948 return str.str();
1949}
1950
Alex Gildayc357c472018-03-21 13:54:09 +00001951/** Formatted output of the GPUTarget type.
1952 *
1953 * @param[out] os Output stream
1954 * @param[in] gpu_target Type to output
1955 *
1956 * @return Modified output stream.
1957 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001958inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
1959{
1960 switch(gpu_target)
1961 {
1962 case GPUTarget::GPU_ARCH_MASK:
1963 os << "GPU_ARCH_MASK";
1964 break;
1965 case GPUTarget::MIDGARD:
1966 os << "MIDGARD";
1967 break;
1968 case GPUTarget::BIFROST:
1969 os << "BIFROST";
1970 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01001971 case GPUTarget::VALHALL:
1972 os << "VALHALL";
1973 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001974 case GPUTarget::T600:
1975 os << "T600";
1976 break;
1977 case GPUTarget::T700:
1978 os << "T700";
1979 break;
1980 case GPUTarget::T800:
1981 os << "T800";
1982 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00001983 case GPUTarget::G71:
1984 os << "G71";
1985 break;
1986 case GPUTarget::G72:
1987 os << "G72";
1988 break;
1989 case GPUTarget::G51:
1990 os << "G51";
1991 break;
1992 case GPUTarget::G51BIG:
1993 os << "G51BIG";
1994 break;
1995 case GPUTarget::G51LIT:
1996 os << "G51LIT";
1997 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01001998 case GPUTarget::G76:
1999 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00002000 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002001 case GPUTarget::G77:
2002 os << "G77";
Michalis Spyroua9676112018-02-22 18:07:43 +00002003 break;
Georgios Pinitas4ffc42a2020-12-01 16:28:24 +00002004 case GPUTarget::G78:
2005 os << "G78";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002006 break;
Pablo Marquez Tellob1496e62021-06-25 14:49:37 +01002007 case GPUTarget::G31:
2008 os << "G31";
2009 break;
Georgios Pinitasd5462ff2019-07-03 19:33:57 +01002010 case GPUTarget::TODX:
2011 os << "TODX";
2012 break;
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002013 default:
2014 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2015 }
2016
2017 return os;
2018}
2019
Alex Gildayc357c472018-03-21 13:54:09 +00002020/** Formatted output of the GPUTarget type.
2021 *
2022 * @param[in] gpu_target Type to output
2023 *
2024 * @return Formatted string.
2025 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00002026inline std::string to_string(const GPUTarget &gpu_target)
2027{
2028 std::stringstream str;
2029 str << gpu_target;
2030 return str.str();
2031}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002032
John Richardson8de92612018-02-22 14:09:31 +00002033/** Formatted output of the DetectionWindow type.
2034 *
2035 * @param[out] os Output stream
2036 * @param[in] detection_window Type to output
2037 *
2038 * @return Modified output stream.
2039 */
John Richardson684cb0f2018-01-09 11:17:00 +00002040inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2041{
2042 os << "{x=" << detection_window.x << ","
2043 << "y=" << detection_window.y << ","
2044 << "width=" << detection_window.width << ","
2045 << "height=" << detection_window.height << ","
2046 << "idx_class=" << detection_window.idx_class << ","
2047 << "score=" << detection_window.score << "}";
2048
2049 return os;
2050}
2051
Isabella Gottardi05e56442018-11-16 11:26:52 +00002052/** Formatted output of the DetectionOutputLayerCodeType type.
2053 *
2054 * @param[out] os Output stream
2055 * @param[in] detection_code Type to output
2056 *
2057 * @return Modified output stream.
2058 */
2059inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2060{
2061 switch(detection_code)
2062 {
2063 case DetectionOutputLayerCodeType::CENTER_SIZE:
2064 os << "CENTER_SIZE";
2065 break;
2066 case DetectionOutputLayerCodeType::CORNER:
2067 os << "CORNER";
2068 break;
2069 case DetectionOutputLayerCodeType::CORNER_SIZE:
2070 os << "CORNER_SIZE";
2071 break;
2072 case DetectionOutputLayerCodeType::TF_CENTER:
2073 os << "TF_CENTER";
2074 break;
2075 default:
2076 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2077 }
2078
2079 return os;
2080}
2081/** Formatted output of the DetectionOutputLayerCodeType type.
2082 *
2083 * @param[in] detection_code Type to output
2084 *
2085 * @return Formatted string.
2086 */
2087inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2088{
2089 std::stringstream str;
2090 str << detection_code;
2091 return str.str();
2092}
2093
2094/** Formatted output of the DetectionOutputLayerInfo type.
2095 *
2096 * @param[out] os Output stream
2097 * @param[in] detection_info Type to output
2098 *
2099 * @return Modified output stream.
2100 */
2101inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2102{
2103 os << "{Classes=" << detection_info.num_classes() << ","
2104 << "ShareLocation=" << detection_info.share_location() << ","
2105 << "CodeType=" << detection_info.code_type() << ","
2106 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2107 << "KeepTopK=" << detection_info.keep_top_k() << ","
2108 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2109 << "Eta=" << detection_info.eta() << ","
2110 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2111 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2112 << "TopK=" << detection_info.top_k() << ","
2113 << "NumLocClasses=" << detection_info.num_loc_classes()
2114 << "}";
2115
2116 return os;
2117}
2118
2119/** Formatted output of the DetectionOutputLayerInfo type.
2120 *
2121 * @param[in] detection_info Type to output
2122 *
2123 * @return Formatted string.
2124 */
2125inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2126{
2127 std::stringstream str;
2128 str << detection_info;
2129 return str.str();
2130}
Isabella Gottardia7acb3c2019-01-08 13:48:44 +00002131/** Formatted output of the DetectionPostProcessLayerInfo type.
2132 *
2133 * @param[out] os Output stream
2134 * @param[in] detection_info Type to output
2135 *
2136 * @return Modified output stream.
2137 */
2138inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2139{
2140 os << "{MaxDetections=" << detection_info.max_detections() << ","
2141 << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2142 << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2143 << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2144 << "NumClasses=" << detection_info.num_classes() << ","
2145 << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2146 << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2147 << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2148 << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2149 << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2150 << "DetectionPerClass=" << detection_info.detection_per_class()
2151 << "}";
2152
2153 return os;
2154}
2155
2156/** Formatted output of the DetectionPostProcessLayerInfo type.
2157 *
2158 * @param[in] detection_info Type to output
2159 *
2160 * @return Formatted string.
2161 */
2162inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2163{
2164 std::stringstream str;
2165 str << detection_info;
2166 return str.str();
2167}
Georgios Pinitasc6f95102021-03-30 10:03:01 +01002168
John Richardson8de92612018-02-22 14:09:31 +00002169/** Formatted output of the DetectionWindow type.
2170 *
2171 * @param[in] detection_window Type to output
2172 *
2173 * @return Formatted string.
2174 */
2175inline std::string to_string(const DetectionWindow &detection_window)
2176{
2177 std::stringstream str;
2178 str << detection_window;
2179 return str.str();
2180}
2181
Anthony Barbier671a11e2018-07-06 15:11:36 +01002182/** Formatted output of a vector of objects.
2183 *
2184 * @param[out] os Output stream
2185 * @param[in] args Vector of objects to print
2186 *
2187 * @return Modified output stream.
2188 */
2189template <typename T>
2190inline ::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
2191{
2192 os << "[";
2193 bool first = true;
2194 for(auto &arg : args)
2195 {
2196 if(first)
2197 {
2198 first = false;
2199 }
2200 else
2201 {
2202 os << ", ";
2203 }
2204 os << arg;
2205 }
2206 os << "]";
2207 return os;
2208}
2209
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002210/** Formatted output of @ref PriorBoxLayerInfo.
2211 *
2212 * @param[out] os Output stream.
2213 * @param[in] info Type to output.
2214 *
2215 * @return Modified output stream.
2216 */
2217inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2218{
2219 os << "Clip:" << info.clip()
2220 << "Flip:" << info.flip()
2221 << "StepX:" << info.steps()[0]
2222 << "StepY:" << info.steps()[1]
2223 << "MinSizes:" << info.min_sizes()
2224 << "MaxSizes:" << info.max_sizes()
2225 << "ImgSizeX:" << info.img_size().x
2226 << "ImgSizeY:" << info.img_size().y
2227 << "Offset:" << info.offset()
2228 << "Variances:" << info.variances();
2229
2230 return os;
2231}
2232
Anthony Barbier671a11e2018-07-06 15:11:36 +01002233/** Formatted output of a vector of objects.
2234 *
2235 * @param[in] args Vector of objects to print
2236 *
2237 * @return String representing args.
2238 */
2239template <typename T>
2240std::string to_string(const std::vector<T> &args)
2241{
2242 std::stringstream str;
2243 str << args;
2244 return str.str();
2245}
2246
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002247/** Formatted output of the WinogradInfo type. */
2248inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2249{
2250 os << "{OutputTileSize=" << info.output_tile_size << ","
2251 << "KernelSize=" << info.kernel_size << ","
2252 << "PadStride=" << info.convolution_info << ","
2253 << "OutputDataLayout=" << info.output_data_layout << "}";
2254
2255 return os;
2256}
2257
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002258inline std::string to_string(const WinogradInfo &type)
2259{
2260 std::stringstream str;
2261 str << type;
2262 return str.str();
2263}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002264
2265/** Fallback method: try to use std::to_string:
2266 *
2267 * @param[in] val Value to convert to string
2268 *
2269 * @return String representing val.
2270 */
2271template <typename T>
2272inline std::string to_string(const T &val)
2273{
2274 return support::cpp11::to_string(val);
2275}
2276
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002277/** Convert a CLTunerMode value to a string
2278 *
2279 * @param val CLTunerMode value to be converted
2280 *
2281 * @return String representing the corresponding CLTunerMode.
2282 */
2283inline std::string to_string(const CLTunerMode val)
2284{
2285 switch(val)
2286 {
2287 case CLTunerMode::EXHAUSTIVE:
2288 {
2289 return std::string("Exhaustive");
2290 }
2291 case CLTunerMode::NORMAL:
2292 {
2293 return std::string("Normal");
2294 }
2295 case CLTunerMode::RAPID:
2296 {
2297 return std::string("Rapid");
2298 }
2299 default:
2300 {
2301 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2302 return std::string("UNDEFINED");
2303 }
2304 }
2305}
SiCong Lidb4a6c12021-02-05 09:30:57 +00002306/** Converts a @ref CLGEMMKernelType to string
2307 *
2308 * @param[in] val CLGEMMKernelType value to be converted
2309 *
2310 * @return String representing the corresponding CLGEMMKernelType
2311 */
2312inline std::string to_string(CLGEMMKernelType val)
2313{
2314 switch(val)
2315 {
2316 case CLGEMMKernelType::NATIVE_V1:
2317 {
2318 return "Native_V1";
2319 }
2320 case CLGEMMKernelType::RESHAPED_V1:
2321 {
2322 return "Reshaped_V1";
2323 }
2324 case CLGEMMKernelType::NATIVE:
2325 {
2326 return "Native";
2327 }
2328 case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2329 {
2330 return "Reshaped_Only_RHS";
2331 }
2332 case CLGEMMKernelType::RESHAPED:
2333 {
2334 return "Reshaped";
2335 }
2336 default:
2337 {
2338 return "Unknown";
2339 }
2340 }
2341}
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002342/** [Print CLTunerMode type] **/
2343/** Formatted output of the CLTunerMode type.
2344 *
2345 * @param[out] os Output stream.
2346 * @param[in] val CLTunerMode to output.
2347 *
2348 * @return Modified output stream.
2349 */
2350inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2351{
2352 os << to_string(val);
2353 return os;
2354}
2355
ramelg013ae3d882021-09-12 23:07:47 +01002356/** Formatted output of the ConvolutionInfo type.
2357 *
2358 * @param[out] os Output stream.
2359 * @param[in] conv_info ConvolutionInfo to output.
2360 *
2361 * @return Modified output stream.
2362 */
2363inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2364{
ramelg01cbbb0382021-09-17 17:36:57 +01002365 os << "{PadStrideInfo = " << conv_info.pad_stride_info << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002366 << "depth_multiplier = " << conv_info.depth_multiplier << ", "
2367 << "act_info = " << to_string(conv_info.act_info) << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002368 << "dilation = " << conv_info.dilation << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002369 return os;
2370}
2371
2372/** Converts a @ref ConvolutionInfo to string
2373 *
2374 * @param[in] info ConvolutionInfo value to be converted
2375 *
2376 * @return String representing the corresponding ConvolutionInfo
2377 */
2378inline std::string to_string(const ConvolutionInfo &info)
2379{
2380 std::stringstream str;
2381 str << info;
2382 return str.str();
2383}
2384
2385/** Formatted output of the FullyConnectedLayerInfo type.
2386 *
2387 * @param[out] os Output stream.
2388 * @param[in] layer_info FullyConnectedLayerInfo to output.
2389 *
2390 * @return Modified output stream.
2391 */
2392inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2393{
ramelg01cbbb0382021-09-17 17:36:57 +01002394 os << "{activation_info = " << to_string(layer_info.activation_info) << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002395 << "weights_trained_layout = " << layer_info.weights_trained_layout << ", "
2396 << "transpose_weights = " << layer_info.transpose_weights << ", "
2397 << "are_weights_reshaped = " << layer_info.are_weights_reshaped << ", "
2398 << "retain_internal_weights = " << layer_info.retain_internal_weights << ", "
2399 << "constant_weights = " << layer_info.transpose_weights << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002400 << "fp_mixed_precision = " << layer_info.fp_mixed_precision << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002401 return os;
2402}
2403
2404/** Converts a @ref FullyConnectedLayerInfo to string
2405 *
2406 * @param[in] info FullyConnectedLayerInfo value to be converted
2407 *
2408 * @return String representing the corresponding FullyConnectedLayerInfo
2409 */
2410inline std::string to_string(const FullyConnectedLayerInfo &info)
2411{
2412 std::stringstream str;
2413 str << info;
2414 return str.str();
2415}
2416
2417/** Formatted output of the GEMMLowpOutputStageType type.
2418 *
2419 * @param[out] os Output stream.
2420 * @param[in] gemm_type GEMMLowpOutputStageType to output.
2421 *
2422 * @return Modified output stream.
2423 */
2424inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2425{
2426 switch(gemm_type)
2427 {
2428 case GEMMLowpOutputStageType::NONE:
2429 os << "NONE";
2430 break;
2431 case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2432 os << "QUANTIZE_DOWN";
2433 break;
2434 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2435 os << "QUANTIZE_DOWN_FIXEDPOINT";
2436 break;
2437 case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2438 os << "QUANTIZE_DOWN_FLOAT";
2439 break;
2440 default:
2441 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2442 }
2443 return os;
2444}
2445
2446/** Converts a @ref GEMMLowpOutputStageType to string
2447 *
2448 * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2449 *
2450 * @return String representing the corresponding GEMMLowpOutputStageType
2451 */
2452inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2453{
2454 std::stringstream str;
2455 str << gemm_type;
2456 return str.str();
2457}
2458
2459/** Formatted output of the GEMMLowpOutputStageInfo type.
2460 *
2461 * @param[out] os Output stream.
2462 * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2463 *
2464 * @return Modified output stream.
2465 */
2466inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2467{
ramelg01cbbb0382021-09-17 17:36:57 +01002468 os << "{type = " << gemm_info.type << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002469 << "gemlowp_offset = " << gemm_info.gemmlowp_offset << ", "
2470 << "gemmlowp_multiplier" << gemm_info.gemmlowp_multiplier << ", "
2471 << "gemmlowp_shift = " << gemm_info.gemmlowp_shift << ", "
2472 << "gemmlowp_min_bound = " << gemm_info.gemmlowp_min_bound << ", "
2473 << "gemmlowp_max_bound = " << gemm_info.gemmlowp_max_bound << ", "
2474 << "gemmlowp_multipliers = " << gemm_info.gemmlowp_multiplier << ", "
2475 << "gemmlowp_shifts = " << gemm_info.gemmlowp_shift << ", "
2476 << "gemmlowp_real_multiplier = " << gemm_info.gemmlowp_real_multiplier << ", "
2477 << "is_quantized_per_channel = " << gemm_info.is_quantized_per_channel << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002478 << "output_data_type = " << gemm_info.output_data_type << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002479 return os;
2480}
2481
2482/** Converts a @ref GEMMLowpOutputStageInfo to string
2483 *
2484 * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2485 *
2486 * @return String representing the corresponding GEMMLowpOutputStageInfo
2487 */
2488inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2489{
2490 std::stringstream str;
2491 str << gemm_info;
2492 return str.str();
2493}
2494
2495/** Formatted output of the Conv2dInfo type.
2496 *
2497 * @param[out] os Output stream.
2498 * @param[in] conv_info Conv2dInfo to output.
2499 *
2500 * @return Modified output stream.
2501 */
2502inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2503{
ramelg01cbbb0382021-09-17 17:36:57 +01002504 os << "{conv_info = " << conv_info.conv_info << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002505 << "dilation = " << conv_info.dilation << ", "
2506 << "act_info = " << to_string(conv_info.act_info) << ", "
2507 << "enable_fast_math = " << conv_info.enable_fast_math << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002508 << "num_groups = " << conv_info.num_groups << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002509 return os;
2510}
2511
2512/** Converts a @ref Conv2dInfo to string
2513 *
2514 * @param[in] conv_info Conv2dInfo value to be converted
2515 *
2516 * @return String representing the corresponding Conv2dInfo
2517 */
2518inline std::string to_string(const Conv2dInfo &conv_info)
2519{
2520 std::stringstream str;
2521 str << conv_info;
2522 return str.str();
2523}
2524
2525/** Formatted output of the PixelValue type.
2526 *
2527 * @param[out] os Output stream.
2528 * @param[in] pixel_value PixelValue to output.
2529 *
2530 * @return Modified output stream.
2531 */
2532inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2533{
ramelg01cbbb0382021-09-17 17:36:57 +01002534 os << "{value.u64= " << pixel_value.get<uint64_t>() << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002535 return os;
2536}
2537
2538/** Converts a @ref PixelValue to string
2539 *
2540 * @param[in] pixel_value PixelValue value to be converted
2541 *
2542 * @return String representing the corresponding PixelValue
2543 */
2544inline std::string to_string(const PixelValue &pixel_value)
2545{
2546 std::stringstream str;
2547 str << pixel_value;
2548 return str.str();
2549}
2550
2551/** Formatted output of the ScaleKernelInfo type.
2552 *
2553 * @param[out] os Output stream.
2554 * @param[in] scale_info ScaleKernelInfo to output.
2555 *
2556 * @return Modified output stream.
2557 */
2558inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2559{
ramelg01cbbb0382021-09-17 17:36:57 +01002560 os << "{interpolation_policy = " << scale_info.interpolation_policy << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002561 << "BorderMode = " << scale_info.border_mode << ", "
2562 << "PixelValue = " << scale_info.constant_border_value << ", "
2563 << "SamplingPolicy = " << scale_info.sampling_policy << ", "
2564 << "use_padding = " << scale_info.use_padding << ", "
2565 << "align_corners = " << scale_info.align_corners << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002566 << "data_layout = " << scale_info.data_layout << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002567 return os;
2568}
2569
2570/** Converts a @ref ScaleKernelInfo to string
2571 *
2572 * @param[in] scale_info ScaleKernelInfo value to be converted
2573 *
2574 * @return String representing the corresponding ScaleKernelInfo
2575 */
2576inline std::string to_string(const ScaleKernelInfo &scale_info)
2577{
2578 std::stringstream str;
2579 str << scale_info;
2580 return str.str();
2581}
2582
2583/** Formatted output of the FFTDirection type.
2584 *
2585 * @param[out] os Output stream.
2586 * @param[in] fft_dir FFTDirection to output.
2587 *
2588 * @return Modified output stream.
2589 */
2590inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2591{
2592 switch(fft_dir)
2593 {
2594 case FFTDirection::Forward:
2595 os << "Forward";
2596 break;
2597 case FFTDirection::Inverse:
2598 os << "Inverse";
2599 break;
2600 default:
2601 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2602 }
2603 return os;
2604}
2605
2606/** Converts a @ref FFT1DInfo to string
2607 *
2608 * @param[in] fft_dir FFT1DInfo value to be converted
2609 *
2610 * @return String representing the corresponding FFT1DInfo
2611 */
2612inline std::string to_string(const FFTDirection &fft_dir)
2613{
2614 std::stringstream str;
ramelg01cbbb0382021-09-17 17:36:57 +01002615 str << "{" << fft_dir << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002616 return str.str();
2617}
2618
2619/** Formatted output of the FFT1DInfo type.
2620 *
2621 * @param[out] os Output stream.
2622 * @param[in] fft1d_info FFT1DInfo to output.
2623 *
2624 * @return Modified output stream.
2625 */
2626inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2627{
ramelg01cbbb0382021-09-17 17:36:57 +01002628 os << "{axis = " << fft1d_info.axis << ", "
2629 << "direction = " << fft1d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002630 return os;
2631}
2632
2633/** Converts a @ref FFT1DInfo to string
2634 *
2635 * @param[in] fft1d_info FFT1DInfo value to be converted
2636 *
2637 * @return String representing the corresponding FFT1DInfo
2638 */
2639inline std::string to_string(const FFT1DInfo &fft1d_info)
2640{
2641 std::stringstream str;
2642 str << fft1d_info;
2643 return str.str();
2644}
2645
2646/** Formatted output of the FFT2DInfo type.
2647 *
2648 * @param[out] os Output stream.
2649 * @param[in] fft2d_info FFT2DInfo to output.
2650 *
2651 * @return Modified output stream.
2652 */
2653inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2654{
ramelg01cbbb0382021-09-17 17:36:57 +01002655 os << "{axis = " << fft2d_info.axis0 << ", "
ramelg013ae3d882021-09-12 23:07:47 +01002656 << "axis = " << fft2d_info.axis1 << ", "
ramelg01cbbb0382021-09-17 17:36:57 +01002657 << "direction = " << fft2d_info.direction << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002658 return os;
2659}
2660
2661/** Converts a @ref FFT2DInfo to string
2662 *
2663 * @param[in] fft2d_info FFT2DInfo value to be converted
2664 *
2665 * @return String representing the corresponding FFT2DInfo
2666 */
2667inline std::string to_string(const FFT2DInfo &fft2d_info)
2668{
2669 std::stringstream str;
2670 str << fft2d_info;
2671 return str.str();
2672}
2673
2674/** Formatted output of the Coordinates2D type.
2675 *
2676 * @param[out] os Output stream.
2677 * @param[in] coord_2d Coordinates2D to output.
2678 *
2679 * @return Modified output stream.
2680 */
2681inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2682{
ramelg01cbbb0382021-09-17 17:36:57 +01002683 os << "{x = " << coord_2d.x << ", "
2684 << "y = " << coord_2d.y << "}";
ramelg013ae3d882021-09-12 23:07:47 +01002685 return os;
2686}
2687
2688/** Converts a @ref Coordinates2D to string
2689 *
2690 * @param[in] coord_2d Coordinates2D value to be converted
2691 *
2692 * @return String representing the corresponding Coordinates2D
2693 */
2694inline std::string to_string(const Coordinates2D &coord_2d)
2695{
2696 std::stringstream str;
2697 str << coord_2d;
2698 return str.str();
2699}
2700
2701/** Formatted output of the FuseBatchNormalizationType type.
2702 *
2703 * @param[out] os Output stream.
2704 * @param[in] fuse_type FuseBatchNormalizationType to output.
2705 *
2706 * @return Modified output stream.
2707 */
2708inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2709{
2710 switch(fuse_type)
2711 {
2712 case FuseBatchNormalizationType::CONVOLUTION:
2713 os << "CONVOLUTION";
2714 break;
2715 case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
2716 os << "DEPTHWISECONVOLUTION";
2717 break;
2718 default:
2719 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2720 }
2721 return os;
2722}
2723
2724/** Converts a @ref FuseBatchNormalizationType to string
2725 *
2726 * @param[in] fuse_type FuseBatchNormalizationType value to be converted
2727 *
2728 * @return String representing the corresponding FuseBatchNormalizationType
2729 */
2730inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
2731{
2732 std::stringstream str;
2733 str << fuse_type;
2734 return str.str();
2735}
2736
ramelg01cbbb0382021-09-17 17:36:57 +01002737/** Formatted output of the SoftmaxKernelInfo type.
2738 *
2739 * @param[out] os Output stream.
2740 * @param[in] info SoftmaxKernelInfo to output.
2741 *
2742 * @return Modified output stream.
2743 */
2744inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
2745{
2746 os << "{beta = " << info.beta << ", "
2747 << "is_log = " << info.is_log << ", "
2748 << "input_data_type = " << info.input_data_type << ", "
2749 << "axis = " << info.axis << "}";
2750 return os;
2751}
2752
2753/** Converts a @ref SoftmaxKernelInfo to string
2754 *
2755 * @param[in] info SoftmaxKernelInfo value to be converted
2756 *
2757 * @return String representing the corresponding SoftmaxKernelInfo
2758 */
2759inline std::string to_string(const SoftmaxKernelInfo &info)
2760{
2761 std::stringstream str;
2762 str << info;
2763 return str.str();
2764}
2765
2766/** Formatted output of the ScaleKernelInfo type.
2767 *
2768 * @param[out] os Output stream.
2769 * @param[in] lstm_params LSTMParams to output.
2770 *
2771 * @return Modified output stream.
2772 */
2773template <typename T>
2774inline ::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
2775{
2776 os << "{input_to_input_weights=" << lstm_params.input_to_input_weights() << ", "
2777 << "recurrent_to_input_weights=" << lstm_params.recurrent_to_input_weights() << ", "
2778 << "cell_to_input_weights=" << lstm_params.cell_to_input_weights() << ", "
2779 << "input_gate_bias=" << lstm_params.input_gate_bias() << ", "
2780 << "cell_to_forget_weights=" << lstm_params.cell_to_forget_weights() << ", "
2781 << "cell_to_output_weights=" << lstm_params.cell_to_output_weights() << ", "
2782 << "projection_weights=" << lstm_params.projection_weights() << ", "
2783 << "projection_bias=" << lstm_params.projection_bias() << ", "
2784 << "input_layer_norm_weights=" << lstm_params.input_layer_norm_weights() << ", "
2785 << "forget_layer_norm_weights=" << lstm_params.forget_layer_norm_weights() << ", "
2786 << "cell_layer_norm_weights=" << lstm_params.cell_layer_norm_weights() << ", "
2787 << "output_layer_norm_weights=" << lstm_params.output_layer_norm_weights() << ", "
2788 << "cell_clip=" << lstm_params.cell_clip() << ", "
2789 << "projection_clip=" << lstm_params.projection_clip() << ", "
2790 << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
2791 << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
2792 << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
2793 << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
2794 << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
2795 << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
2796 << "has_projection=" << lstm_params.has_projection() << ", "
2797 << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
2798 << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
2799 return os;
2800}
2801
2802/** Converts a @ref LSTMParams to string
2803 *
2804 * @param[in] lstm_params LSTMParams<T> value to be converted
2805 *
2806 * @return String representing the corresponding LSTMParams
2807 */
2808template <typename T>
2809inline std::string to_string(const LSTMParams<T> &lstm_params)
2810{
2811 std::stringstream str;
2812 str << lstm_params;
2813 return str.str();
2814}
2815
2816/** Converts a @ref LSTMParams to string
2817 *
2818 * @param[in] num uint8_t value to be converted
2819 *
2820 * @return String representing the corresponding uint8_t
2821 */
2822inline std::string to_string(const uint8_t num)
2823{
2824 // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
2825 return ::std::to_string(static_cast<int>(num));
2826}
2827
Anthony Barbier6ff3b192017-09-04 18:44:23 +01002828} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01002829
2830#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */