blob: 2f9f8cba6865e362050a2cb03cd4a8e06f1d038e [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Manuel Bottinib412fab2018-12-10 17:40:23 +00002 * Copyright (c) 2017-2019 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
Isabella Gottardif07d28d2018-02-06 14:52:43 +000027#include "arm_compute/core/CL/CLTypes.h"
Anthony Barbier8914e322018-08-10 15:28:25 +010028#include "arm_compute/core/CPP/CPPTypes.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029#include "arm_compute/core/Dimensions.h"
30#include "arm_compute/core/Error.h"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010031#include "arm_compute/core/GPUTarget.h"
John Richardson25f23682017-11-27 14:35:09 +000032#include "arm_compute/core/HOGInfo.h"
33#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010034#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000035#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036#include "arm_compute/core/Types.h"
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +010037#include "arm_compute/runtime/CL/CLTunerTypes.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038
39#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010040#include <sstream>
41#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010042
43namespace arm_compute
44{
Anthony Barbierb940fd62018-06-04 14:14:32 +010045/** Formatted output if arg is not null
46 *
47 * @param[in] arg Object to print
48 *
49 * @return String representing arg.
50 */
51template <typename T>
52std::string to_string_if_not_null(T *arg)
53{
54 if(arg == nullptr)
55 {
56 return "nullptr";
57 }
58 else
59 {
60 return to_string(*arg);
61 }
62}
Alex Gildayc357c472018-03-21 13:54:09 +000063/** Formatted output of the Dimensions type.
64 *
65 * @param[out] os Output stream.
66 * @param[in] dimensions Type to output.
67 *
68 * @return Modified output stream.
69 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010070template <typename T>
71inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
72{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010073 if(dimensions.num_dimensions() > 0)
74 {
75 os << dimensions[0];
76
77 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
78 {
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +010079 os << "x" << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +010080 }
81 }
82
Anthony Barbier6ff3b192017-09-04 18:44:23 +010083 return os;
84}
85
Alex Gildayc357c472018-03-21 13:54:09 +000086/** Formatted output of the NonLinearFilterFunction type.
87 *
88 * @param[out] os Output stream.
89 * @param[in] function Type to output.
90 *
91 * @return Modified output stream.
92 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +010093inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function)
94{
95 switch(function)
96 {
97 case NonLinearFilterFunction::MAX:
98 os << "MAX";
99 break;
100 case NonLinearFilterFunction::MEDIAN:
101 os << "MEDIAN";
102 break;
103 case NonLinearFilterFunction::MIN:
104 os << "MIN";
105 break;
106 default:
107 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
108 }
109
110 return os;
111}
112
Alex Gildayc357c472018-03-21 13:54:09 +0000113/** Formatted output of the NonLinearFilterFunction type.
114 *
115 * @param[in] function Type to output.
116 *
117 * @return Formatted string.
118 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100119inline std::string to_string(const NonLinearFilterFunction &function)
120{
121 std::stringstream str;
122 str << function;
123 return str.str();
124}
125
Alex Gildayc357c472018-03-21 13:54:09 +0000126/** Formatted output of the MatrixPattern type.
127 *
128 * @param[out] os Output stream.
129 * @param[in] pattern Type to output.
130 *
131 * @return Modified output stream.
132 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +0100133inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern)
134{
135 switch(pattern)
136 {
137 case MatrixPattern::BOX:
138 os << "BOX";
139 break;
140 case MatrixPattern::CROSS:
141 os << "CROSS";
142 break;
143 case MatrixPattern::DISK:
144 os << "DISK";
145 break;
146 case MatrixPattern::OTHER:
147 os << "OTHER";
148 break;
149 default:
150 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
151 }
152
153 return os;
154}
155
Alex Gildayc357c472018-03-21 13:54:09 +0000156/** Formatted output of the MatrixPattern type.
157 *
158 * @param[in] pattern Type to output.
159 *
160 * @return Formatted string.
161 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100162inline std::string to_string(const MatrixPattern &pattern)
163{
164 std::stringstream str;
165 str << pattern;
166 return str.str();
167}
168
Alex Gildayc357c472018-03-21 13:54:09 +0000169/** Formatted output of the RoundingPolicy type.
170 *
171 * @param[out] os Output stream.
172 * @param[in] rounding_policy Type to output.
173 *
174 * @return Modified output stream.
175 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100176inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100177{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100178 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100179 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100180 case RoundingPolicy::TO_ZERO:
181 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100182 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100183 case RoundingPolicy::TO_NEAREST_UP:
184 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100185 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100186 case RoundingPolicy::TO_NEAREST_EVEN:
187 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100188 break;
189 default:
190 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
191 }
192
193 return os;
194}
195
Alex Gildayc357c472018-03-21 13:54:09 +0000196/** Formatted output of the WeightsInfo type.
197 *
198 * @param[out] os Output stream.
199 * @param[in] weights_info Type to output.
200 *
201 * @return Modified output stream.
202 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100203inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100204{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100205 os << weights_info.are_reshaped() << ";";
206 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100207
208 return os;
209}
210
Alex Gildayc357c472018-03-21 13:54:09 +0000211/** Formatted output of the ROIPoolingInfo type.
212 *
213 * @param[out] os Output stream.
214 * @param[in] pool_info Type to output.
215 *
216 * @return Modified output stream.
217 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100218inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100219{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100220 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100221 return os;
222}
223
giuros0118870812018-09-13 09:31:40 +0100224/** Formatted output of the ROIPoolingInfo type.
225 *
226 * @param[in] pool_info Type to output.
227 *
228 * @return Formatted string.
229 */
230inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
231{
232 std::stringstream str;
233 str << pool_info;
234 return str.str();
235}
236
giuros01c04a0e82018-10-03 12:44:35 +0100237/** Formatted output of the BoundingBoxTransformInfo type.
238 *
239 * @param[out] os Output stream.
240 * @param[in] bbox_info Type to output.
241 *
242 * @return Modified output stream.
243 */
244inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
245{
246 auto weights = bbox_info.weights();
247 os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights = {" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
248 "})";
249 return os;
250}
251
252/** Formatted output of the BoundingBoxTransformInfo type.
253 *
254 * @param[in] bbox_info Type to output.
255 *
256 * @return Formatted string.
257 */
258inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
259{
260 std::stringstream str;
261 str << bbox_info;
262 return str.str();
263}
264
Manuel Bottini5209be52019-02-13 16:34:56 +0000265/** Formatted output of the ComputeAnchorsInfo type.
266 *
267 * @param[out] os Output stream.
268 * @param[in] anchors_info Type to output.
269 *
270 * @return Modified output stream.
271 */
272inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
273{
274 os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
275 return os;
276}
277
278/** Formatted output of the ComputeAnchorsInfo type.
279 *
280 * @param[in] anchors_info Type to output.
281 *
282 * @return Formatted string.
283 */
284inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
285{
286 std::stringstream str;
287 str << anchors_info;
288 return str.str();
289}
290
291/** Formatted output of the GenerateProposalsInfo type.
292 *
293 * @param[out] os Output stream.
294 * @param[in] proposals_info Type to output.
295 *
296 * @return Modified output stream.
297 */
298inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
299{
300 os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
301 return os;
302}
303
304/** Formatted output of the GenerateProposalsInfo type.
305 *
306 * @param[in] proposals_info Type to output.
307 *
308 * @return Formatted string.
309 */
310inline std::string to_string(const GenerateProposalsInfo &proposals_info)
311{
312 std::stringstream str;
313 str << proposals_info;
314 return str.str();
315}
316
Alex Gildayc357c472018-03-21 13:54:09 +0000317/** Formatted output of the QuantizationInfo type.
318 *
319 * @param[out] os Output stream.
320 * @param[in] quantization_info Type to output.
321 *
322 * @return Modified output stream.
323 */
Chunosovd621bca2017-11-03 17:33:15 +0700324inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info)
325{
326 os << "Scale:" << quantization_info.scale << "~"
327 << "Offset:" << quantization_info.offset;
328 return os;
329}
330
Alex Gildayc357c472018-03-21 13:54:09 +0000331/** Formatted output of the QuantizationInfo type.
332 *
333 * @param[in] quantization_info Type to output.
334 *
335 * @return Formatted string.
336 */
Chunosovd621bca2017-11-03 17:33:15 +0700337inline std::string to_string(const QuantizationInfo &quantization_info)
338{
339 std::stringstream str;
340 str << quantization_info;
341 return str.str();
342}
343
Alex Gildayc357c472018-03-21 13:54:09 +0000344/** Formatted output of the activation function type.
345 *
346 * @param[out] os Output stream.
347 * @param[in] act_function Type to output.
348 *
349 * @return Modified output stream.
350 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100351inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
352{
353 switch(act_function)
354 {
355 case ActivationLayerInfo::ActivationFunction::ABS:
356 os << "ABS";
357 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100358 case ActivationLayerInfo::ActivationFunction::LINEAR:
359 os << "LINEAR";
360 break;
361 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
362 os << "LOGISTIC";
363 break;
364 case ActivationLayerInfo::ActivationFunction::RELU:
365 os << "RELU";
366 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100367 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
368 os << "BOUNDED_RELU";
369 break;
370 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
371 os << "LEAKY_RELU";
372 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100373 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
374 os << "SOFT_RELU";
375 break;
376 case ActivationLayerInfo::ActivationFunction::SQRT:
377 os << "SQRT";
378 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100379 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
380 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000381 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100382 case ActivationLayerInfo::ActivationFunction::SQUARE:
383 os << "SQUARE";
384 break;
385 case ActivationLayerInfo::ActivationFunction::TANH:
386 os << "TANH";
387 break;
Usama Arif6a98a6e2019-05-10 17:07:27 +0100388 case ActivationLayerInfo::ActivationFunction::IDENTITY:
389 os << "IDENTITY";
390 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100391 default:
392 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
393 }
394
395 return os;
396}
397
Alex Gildayc357c472018-03-21 13:54:09 +0000398/** Formatted output of the activation function info type.
399 *
400 * @param[in] info Type to output.
401 *
402 * @return Formatted string.
403 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100404inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100405{
406 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000407 if(info.enabled())
408 {
409 str << info.activation();
410 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100411 return str.str();
412}
413
Alex Gildayc357c472018-03-21 13:54:09 +0000414/** Formatted output of the activation function type.
415 *
416 * @param[in] function Type to output.
417 *
418 * @return Formatted string.
419 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100420inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
421{
422 std::stringstream str;
423 str << function;
424 return str.str();
425}
426
Alex Gildayc357c472018-03-21 13:54:09 +0000427/** Formatted output of the NormType type.
428 *
429 * @param[out] os Output stream.
430 * @param[in] norm_type Type to output.
431 *
432 * @return Modified output stream.
433 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100434inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
435{
436 switch(norm_type)
437 {
438 case NormType::CROSS_MAP:
439 os << "CROSS_MAP";
440 break;
441 case NormType::IN_MAP_1D:
442 os << "IN_MAP_1D";
443 break;
444 case NormType::IN_MAP_2D:
445 os << "IN_MAP_2D";
446 break;
447 default:
448 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
449 }
450
451 return os;
452}
453
Alex Gildayc357c472018-03-21 13:54:09 +0000454/** Formatted output of @ref NormalizationLayerInfo.
455 *
456 * @param[in] info Type to output.
457 *
458 * @return Formatted string.
459 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100460inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100461{
462 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000463 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100464 return str.str();
465}
466
Alex Gildayc357c472018-03-21 13:54:09 +0000467/** Formatted output of @ref NormalizationLayerInfo.
468 *
469 * @param[out] os Output stream.
470 * @param[in] info Type to output.
471 *
472 * @return Modified output stream.
473 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100474inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
475{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000476 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100477 return os;
478}
479
Alex Gildayc357c472018-03-21 13:54:09 +0000480/** Formatted output of the PoolingType type.
481 *
482 * @param[out] os Output stream.
483 * @param[in] pool_type Type to output.
484 *
485 * @return Modified output stream.
486 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100487inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
488{
489 switch(pool_type)
490 {
491 case PoolingType::AVG:
492 os << "AVG";
493 break;
494 case PoolingType::MAX:
495 os << "MAX";
496 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100497 case PoolingType::L2:
498 os << "L2";
499 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100500 default:
501 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
502 }
503
504 return os;
505}
506
Alex Gildayc357c472018-03-21 13:54:09 +0000507/** Formatted output of @ref PoolingLayerInfo.
508 *
509 * @param[out] os Output stream.
510 * @param[in] info Type to output.
511 *
512 * @return Modified output stream.
513 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100514inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
515{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100516 os << info.pool_type();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100517
518 return os;
519}
520
Alex Gildayc357c472018-03-21 13:54:09 +0000521/** Formatted output of @ref RoundingPolicy.
522 *
523 * @param[in] rounding_policy Type to output.
524 *
525 * @return Formatted string.
526 */
John Richardsondd715f22017-09-18 16:10:48 +0100527inline std::string to_string(const RoundingPolicy &rounding_policy)
528{
529 std::stringstream str;
530 str << rounding_policy;
531 return str.str();
532}
533
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000534/** [Print DataLayout type] **/
Alex Gildayc357c472018-03-21 13:54:09 +0000535/** Formatted output of the DataLayout type.
536 *
537 * @param[out] os Output stream.
538 * @param[in] data_layout Type to output.
539 *
540 * @return Modified output stream.
541 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000542inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
543{
544 switch(data_layout)
545 {
546 case DataLayout::UNKNOWN:
547 os << "UNKNOWN";
548 break;
549 case DataLayout::NHWC:
550 os << "NHWC";
551 break;
552 case DataLayout::NCHW:
553 os << "NCHW";
554 break;
555 default:
556 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
557 }
558
559 return os;
560}
561
Alex Gildayc357c472018-03-21 13:54:09 +0000562/** Formatted output of the DataLayout type.
563 *
564 * @param[in] data_layout Type to output.
565 *
566 * @return Formatted string.
567 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000568inline std::string to_string(const arm_compute::DataLayout &data_layout)
569{
570 std::stringstream str;
571 str << data_layout;
572 return str.str();
573}
Vidhya Sudhan Loganathand646ae12018-11-19 15:18:20 +0000574/** [Print DataLayout type] **/
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000575
Georgios Pinitase2220552018-07-20 13:23:44 +0100576/** Formatted output of the DataLayoutDimension type.
577 *
578 * @param[out] os Output stream.
579 * @param[in] data_layout_dim Data layout dimension to print.
580 *
581 * @return Modified output stream.
582 */
583inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
584{
585 switch(data_layout_dim)
586 {
587 case DataLayoutDimension::WIDTH:
588 os << "WIDTH";
589 break;
590 case DataLayoutDimension::HEIGHT:
591 os << "HEIGHT";
592 break;
593 case DataLayoutDimension::CHANNEL:
594 os << "CHANNEL";
595 break;
596 case DataLayoutDimension::BATCHES:
597 os << "BATCHES";
598 break;
599 default:
600 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
601 }
602 return os;
603}
604
Alex Gildayc357c472018-03-21 13:54:09 +0000605/** Formatted output of the DataType type.
606 *
607 * @param[out] os Output stream.
608 * @param[in] data_type Type to output.
609 *
610 * @return Modified output stream.
611 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100612inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
613{
614 switch(data_type)
615 {
616 case DataType::UNKNOWN:
617 os << "UNKNOWN";
618 break;
619 case DataType::U8:
620 os << "U8";
621 break;
Chunosovd621bca2017-11-03 17:33:15 +0700622 case DataType::QASYMM8:
623 os << "QASYMM8";
624 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100625 case DataType::S8:
626 os << "S8";
627 break;
628 case DataType::U16:
629 os << "U16";
630 break;
631 case DataType::S16:
632 os << "S16";
633 break;
634 case DataType::U32:
635 os << "U32";
636 break;
637 case DataType::S32:
638 os << "S32";
639 break;
640 case DataType::U64:
641 os << "U64";
642 break;
643 case DataType::S64:
644 os << "S64";
645 break;
646 case DataType::F16:
647 os << "F16";
648 break;
649 case DataType::F32:
650 os << "F32";
651 break;
652 case DataType::F64:
653 os << "F64";
654 break;
655 case DataType::SIZET:
656 os << "SIZET";
657 break;
658 default:
659 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
660 }
661
662 return os;
663}
664
Alex Gildayc357c472018-03-21 13:54:09 +0000665/** Formatted output of the DataType type.
666 *
667 * @param[in] data_type Type to output.
668 *
669 * @return Formatted string.
670 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100671inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100672{
673 std::stringstream str;
674 str << data_type;
675 return str.str();
676}
677
Alex Gildayc357c472018-03-21 13:54:09 +0000678/** Formatted output of the Format type.
679 *
680 * @param[out] os Output stream.
681 * @param[in] format Type to output.
682 *
683 * @return Modified output stream.
684 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100685inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
686{
687 switch(format)
688 {
689 case Format::UNKNOWN:
690 os << "UNKNOWN";
691 break;
692 case Format::U8:
693 os << "U8";
694 break;
695 case Format::S16:
696 os << "S16";
697 break;
698 case Format::U16:
699 os << "U16";
700 break;
701 case Format::S32:
702 os << "S32";
703 break;
704 case Format::U32:
705 os << "U32";
706 break;
707 case Format::F16:
708 os << "F16";
709 break;
710 case Format::F32:
711 os << "F32";
712 break;
713 case Format::UV88:
714 os << "UV88";
715 break;
716 case Format::RGB888:
717 os << "RGB888";
718 break;
719 case Format::RGBA8888:
720 os << "RGBA8888";
721 break;
722 case Format::YUV444:
723 os << "YUV444";
724 break;
725 case Format::YUYV422:
726 os << "YUYV422";
727 break;
728 case Format::NV12:
729 os << "NV12";
730 break;
731 case Format::NV21:
732 os << "NV21";
733 break;
734 case Format::IYUV:
735 os << "IYUV";
736 break;
737 case Format::UYVY422:
738 os << "UYVY422";
739 break;
740 default:
741 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
742 }
743
744 return os;
745}
746
Alex Gildayc357c472018-03-21 13:54:09 +0000747/** Formatted output of the Format type.
748 *
749 * @param[in] format Type to output.
750 *
751 * @return Formatted string.
752 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100753inline std::string to_string(const Format &format)
754{
755 std::stringstream str;
756 str << format;
757 return str.str();
758}
759
Alex Gildayc357c472018-03-21 13:54:09 +0000760/** Formatted output of the Channel type.
761 *
762 * @param[out] os Output stream.
763 * @param[in] channel Type to output.
764 *
765 * @return Modified output stream.
766 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100767inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
768{
769 switch(channel)
770 {
771 case Channel::UNKNOWN:
772 os << "UNKNOWN";
773 break;
774 case Channel::C0:
775 os << "C0";
776 break;
777 case Channel::C1:
778 os << "C1";
779 break;
780 case Channel::C2:
781 os << "C2";
782 break;
783 case Channel::C3:
784 os << "C3";
785 break;
786 case Channel::R:
787 os << "R";
788 break;
789 case Channel::G:
790 os << "G";
791 break;
792 case Channel::B:
793 os << "B";
794 break;
795 case Channel::A:
796 os << "A";
797 break;
798 case Channel::Y:
799 os << "Y";
800 break;
801 case Channel::U:
802 os << "U";
803 break;
804 case Channel::V:
805 os << "V";
806 break;
807 default:
808 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
809 }
810
811 return os;
812}
813
Alex Gildayc357c472018-03-21 13:54:09 +0000814/** Formatted output of the Channel type.
815 *
816 * @param[in] channel Type to output.
817 *
818 * @return Formatted string.
819 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +0100820inline std::string to_string(const Channel &channel)
821{
822 std::stringstream str;
823 str << channel;
824 return str.str();
825}
826
Alex Gildayc357c472018-03-21 13:54:09 +0000827/** Formatted output of the BorderMode type.
828 *
829 * @param[out] os Output stream.
830 * @param[in] mode Type to output.
831 *
832 * @return Modified output stream.
833 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100834inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
835{
836 switch(mode)
837 {
838 case BorderMode::UNDEFINED:
839 os << "UNDEFINED";
840 break;
841 case BorderMode::CONSTANT:
842 os << "CONSTANT";
843 break;
844 case BorderMode::REPLICATE:
845 os << "REPLICATE";
846 break;
847 default:
848 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
849 }
850
851 return os;
852}
853
Alex Gildayc357c472018-03-21 13:54:09 +0000854/** Formatted output of the BorderSize type.
855 *
856 * @param[out] os Output stream.
857 * @param[in] border Type to output.
858 *
859 * @return Modified output stream.
860 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100861inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
862{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +0100863 os << border.top << ","
864 << border.right << ","
865 << border.bottom << ","
866 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100867
868 return os;
869}
Anthony Barbier2a07e182017-08-04 18:20:27 +0100870
Giuseppe Rossinid7647d42018-07-17 18:13:13 +0100871/** Formatted output of the PaddingList type.
872 *
873 * @param[out] os Output stream.
874 * @param[in] padding Type to output.
875 *
876 * @return Modified output stream.
877 */
878inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
879{
880 os << "{";
881 for(auto const &p : padding)
882 {
883 os << "{" << p.first << "," << p.second << "}";
884 }
885 os << "}";
886 return os;
887}
888
giuros013175fcf2018-11-21 09:59:17 +0000889/** Formatted output of the Multiples type.
890 *
891 * @param[out] os Output stream.
892 * @param[in] multiples Type to output.
893 *
894 * @return Modified output stream.
895 */
896inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
897{
898 os << "(";
899 for(size_t i = 0; i < multiples.size() - 1; i++)
900 {
901 os << multiples[i] << ", ";
902 }
903 os << multiples.back() << ")";
904 return os;
905}
906
Alex Gildayc357c472018-03-21 13:54:09 +0000907/** Formatted output of the InterpolationPolicy type.
908 *
909 * @param[out] os Output stream.
910 * @param[in] policy Type to output.
911 *
912 * @return Modified output stream.
913 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100914inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
915{
916 switch(policy)
917 {
918 case InterpolationPolicy::NEAREST_NEIGHBOR:
919 os << "NEAREST_NEIGHBOR";
920 break;
921 case InterpolationPolicy::BILINEAR:
922 os << "BILINEAR";
923 break;
924 case InterpolationPolicy::AREA:
925 os << "AREA";
926 break;
927 default:
928 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
929 }
930
931 return os;
932}
933
Alex Gildayc357c472018-03-21 13:54:09 +0000934/** Formatted output of the SamplingPolicy type.
935 *
936 * @param[out] os Output stream.
937 * @param[in] policy Type to output.
938 *
939 * @return Modified output stream.
940 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700941inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
942{
943 switch(policy)
944 {
945 case SamplingPolicy::CENTER:
946 os << "CENTER";
947 break;
948 case SamplingPolicy::TOP_LEFT:
949 os << "TOP_LEFT";
950 break;
951 default:
952 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
953 }
954
955 return os;
956}
957
Alex Gildayc357c472018-03-21 13:54:09 +0000958/** Formatted output of the TensorInfo type.
959 *
Anthony Barbier366628a2018-08-01 13:55:03 +0100960 * @param[out] os Output stream.
961 * @param[in] info Type to output.
962 *
963 * @return Modified output stream.
964 */
965inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
966{
967 os << "{Shape=" << info.tensor_shape() << ","
968 << "Type=" << info.data_type() << ","
969 << "Channels=" << info.num_channels() << "}";
970 return os;
971}
972/** Formatted output of the TensorInfo type.
973 *
Alex Gildayc357c472018-03-21 13:54:09 +0000974 * @param[in] info Type to output.
975 *
976 * @return Formatted string.
977 */
Georgios Pinitas3faea252017-10-30 14:13:50 +0000978inline std::string to_string(const TensorInfo &info)
979{
980 std::stringstream str;
Anthony Barbier366628a2018-08-01 13:55:03 +0100981 str << info;
Georgios Pinitas3faea252017-10-30 14:13:50 +0000982 return str.str();
983}
984
Alex Gildayc357c472018-03-21 13:54:09 +0000985/** Formatted output of the Dimensions type.
986 *
987 * @param[in] dimensions Type to output.
988 *
989 * @return Formatted string.
990 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100991template <typename T>
992inline std::string to_string(const Dimensions<T> &dimensions)
993{
994 std::stringstream str;
995 str << dimensions;
996 return str.str();
997}
998
Alex Gildayc357c472018-03-21 13:54:09 +0000999/** Formatted output of the Strides type.
1000 *
1001 * @param[in] stride Type to output.
1002 *
1003 * @return Formatted string.
1004 */
John Richardsona36eae12017-09-26 16:55:59 +01001005inline std::string to_string(const Strides &stride)
1006{
1007 std::stringstream str;
1008 str << stride;
1009 return str.str();
1010}
1011
Alex Gildayc357c472018-03-21 13:54:09 +00001012/** Formatted output of the TensorShape type.
1013 *
1014 * @param[in] shape Type to output.
1015 *
1016 * @return Formatted string.
1017 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001018inline std::string to_string(const TensorShape &shape)
1019{
1020 std::stringstream str;
1021 str << shape;
1022 return str.str();
1023}
1024
Alex Gildayc357c472018-03-21 13:54:09 +00001025/** Formatted output of the Coordinates type.
1026 *
1027 * @param[in] coord Type to output.
1028 *
1029 * @return Formatted string.
1030 */
Abe Mbise925ca0f2017-10-02 19:16:33 +01001031inline std::string to_string(const Coordinates &coord)
1032{
1033 std::stringstream str;
1034 str << coord;
1035 return str.str();
1036}
1037
Anthony Barbierb940fd62018-06-04 14:14:32 +01001038/** Formatted output of the GEMMReshapeInfo type.
1039 *
1040 * @param[out] os Output stream.
1041 * @param[in] info Type to output.
1042 *
1043 * @return Modified output stream.
1044 */
1045inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1046{
1047 os << "{m=" << info.m() << ",";
1048 os << "n=" << info.n() << ",";
1049 os << "k=" << info.k() << ",";
1050 os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1051 os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1052 os << "}";
1053
1054 return os;
1055}
1056
1057/** Formatted output of the GEMMInfo type.
1058 *
1059 * @param[out] os Output stream.
1060 * @param[in] info Type to output.
1061 *
1062 * @return Modified output stream.
1063 */
1064inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1065{
1066 os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1067 os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1068 os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
Anthony Barbierb940fd62018-06-04 14:14:32 +01001069 os << "}";
1070
1071 return os;
1072}
1073
1074/** Formatted output of the Window::Dimension type.
1075 *
1076 * @param[out] os Output stream.
1077 * @param[in] dim Type to output.
1078 *
1079 * @return Modified output stream.
1080 */
1081inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1082{
1083 os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1084
1085 return os;
1086}
1087/** Formatted output of the Window type.
1088 *
1089 * @param[out] os Output stream.
1090 * @param[in] win Type to output.
1091 *
1092 * @return Modified output stream.
1093 */
1094inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1095{
1096 os << "{";
1097 for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1098 {
1099 if(i > 0)
1100 {
1101 os << ", ";
1102 }
1103 os << win[i];
1104 }
1105 os << "}";
1106
1107 return os;
1108}
1109
1110/** Formatted output of the WeightsInfo type.
1111 *
1112 * @param[in] info Type to output.
1113 *
1114 * @return Formatted string.
1115 */
1116inline std::string to_string(const WeightsInfo &info)
1117{
1118 std::stringstream str;
1119 str << info;
1120 return str.str();
1121}
1122
1123/** Formatted output of the GEMMReshapeInfo type.
1124 *
1125 * @param[in] info Type to output.
1126 *
1127 * @return Formatted string.
1128 */
1129inline std::string to_string(const GEMMReshapeInfo &info)
1130{
1131 std::stringstream str;
1132 str << info;
1133 return str.str();
1134}
1135
1136/** Formatted output of the GEMMInfo type.
1137 *
1138 * @param[in] info Type to output.
1139 *
1140 * @return Formatted string.
1141 */
1142inline std::string to_string(const GEMMInfo &info)
1143{
1144 std::stringstream str;
1145 str << info;
1146 return str.str();
1147}
1148
1149/** Formatted output of the Window::Dimension type.
1150 *
1151 * @param[in] dim Type to output.
1152 *
1153 * @return Formatted string.
1154 */
1155inline std::string to_string(const Window::Dimension &dim)
1156{
1157 std::stringstream str;
1158 str << dim;
1159 return str.str();
1160}
1161/** Formatted output of the Window type.
1162 *
1163 * @param[in] win Type to output.
1164 *
1165 * @return Formatted string.
1166 */
1167inline std::string to_string(const Window &win)
1168{
1169 std::stringstream str;
1170 str << win;
1171 return str.str();
1172}
1173
Alex Gildayc357c472018-03-21 13:54:09 +00001174/** Formatted output of the Rectangle type.
1175 *
1176 * @param[out] os Output stream.
1177 * @param[in] rect Type to output.
1178 *
1179 * @return Modified output stream.
1180 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001181inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1182{
1183 os << rect.width << "x" << rect.height;
1184 os << "+" << rect.x << "+" << rect.y;
1185
1186 return os;
1187}
1188
Usama Arif8cf8c112019-03-14 15:36:54 +00001189/** Formatted output of the PaddingMode type.
1190 *
1191 * @param[out] os Output stream.
1192 * @param[in] mode Type to output.
1193 *
1194 * @return Modified output stream.
1195 */
1196inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1197{
1198 switch(mode)
1199 {
1200 case PaddingMode::CONSTANT:
1201 os << "CONSTANT";
1202 break;
1203 case PaddingMode::REFLECT:
1204 os << "REFLECT";
1205 break;
1206 case PaddingMode::SYMMETRIC:
1207 os << "SYMMETRIC";
1208 break;
1209 default:
1210 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1211 }
1212
1213 return os;
1214}
1215
1216/** Formatted output of the PaddingMode type.
1217 *
1218 * @param[in] mode Type to output.
1219 *
1220 * @return Formatted string.
1221 */
1222inline std::string to_string(const PaddingMode &mode)
1223{
1224 std::stringstream str;
1225 str << mode;
1226 return str.str();
1227}
1228
Alex Gildayc357c472018-03-21 13:54:09 +00001229/** Formatted output of the PadStrideInfo type.
1230 *
1231 * @param[out] os Output stream.
1232 * @param[in] pad_stride_info Type to output.
1233 *
1234 * @return Modified output stream.
1235 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001236inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1237{
1238 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1239 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +01001240 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1241 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +01001242
1243 return os;
1244}
1245
Alex Gildayc357c472018-03-21 13:54:09 +00001246/** Formatted output of the PadStrideInfo type.
1247 *
1248 * @param[in] pad_stride_info Type to output.
1249 *
1250 * @return Formatted string.
1251 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001252inline std::string to_string(const PadStrideInfo &pad_stride_info)
1253{
1254 std::stringstream str;
1255 str << pad_stride_info;
1256 return str.str();
1257}
1258
Alex Gildayc357c472018-03-21 13:54:09 +00001259/** Formatted output of the BorderMode type.
1260 *
1261 * @param[in] mode Type to output.
1262 *
1263 * @return Formatted string.
1264 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001265inline std::string to_string(const BorderMode &mode)
1266{
1267 std::stringstream str;
1268 str << mode;
1269 return str.str();
1270}
1271
Alex Gildayc357c472018-03-21 13:54:09 +00001272/** Formatted output of the BorderSize type.
1273 *
1274 * @param[in] border Type to output.
1275 *
1276 * @return Formatted string.
1277 */
John Richardsonb482ce12017-09-18 12:44:01 +01001278inline std::string to_string(const BorderSize &border)
1279{
1280 std::stringstream str;
1281 str << border;
1282 return str.str();
1283}
1284
Giuseppe Rossinid7647d42018-07-17 18:13:13 +01001285/** Formatted output of the PaddingList type.
1286 *
1287 * @param[in] padding Type to output.
1288 *
1289 * @return Formatted string.
1290 */
1291inline std::string to_string(const PaddingList &padding)
1292{
1293 std::stringstream str;
1294 str << padding;
1295 return str.str();
1296}
1297
giuros013175fcf2018-11-21 09:59:17 +00001298/** Formatted output of the Multiples type.
1299 *
1300 * @param[in] multiples Type to output.
1301 *
1302 * @return Formatted string.
1303 */
1304inline std::string to_string(const Multiples &multiples)
1305{
1306 std::stringstream str;
1307 str << multiples;
1308 return str.str();
1309}
1310
Alex Gildayc357c472018-03-21 13:54:09 +00001311/** Formatted output of the InterpolationPolicy type.
1312 *
1313 * @param[in] policy Type to output.
1314 *
1315 * @return Formatted string.
1316 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001317inline std::string to_string(const InterpolationPolicy &policy)
1318{
1319 std::stringstream str;
1320 str << policy;
1321 return str.str();
1322}
1323
Alex Gildayc357c472018-03-21 13:54:09 +00001324/** Formatted output of the SamplingPolicy type.
1325 *
1326 * @param[in] policy Type to output.
1327 *
1328 * @return Formatted string.
1329 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +07001330inline std::string to_string(const SamplingPolicy &policy)
1331{
1332 std::stringstream str;
1333 str << policy;
1334 return str.str();
1335}
1336
Alex Gildayc357c472018-03-21 13:54:09 +00001337/** Formatted output of the ConvertPolicy type.
1338 *
1339 * @param[out] os Output stream.
1340 * @param[in] policy Type to output.
1341 *
1342 * @return Modified output stream.
1343 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001344inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1345{
1346 switch(policy)
1347 {
1348 case ConvertPolicy::WRAP:
1349 os << "WRAP";
1350 break;
1351 case ConvertPolicy::SATURATE:
1352 os << "SATURATE";
1353 break;
1354 default:
1355 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1356 }
1357
1358 return os;
1359}
1360
1361inline std::string to_string(const ConvertPolicy &policy)
1362{
1363 std::stringstream str;
1364 str << policy;
1365 return str.str();
1366}
1367
giuros01164a2722018-11-20 18:34:46 +00001368/** Formatted output of the ArithmeticOperation type.
1369 *
1370 * @param[out] os Output stream.
1371 * @param[in] op Operation to output.
1372 *
1373 * @return Modified output stream.
1374 */
1375inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1376{
1377 switch(op)
1378 {
1379 case ArithmeticOperation::ADD:
1380 os << "ADD";
1381 break;
1382 case ArithmeticOperation::SUB:
1383 os << "SUB";
1384 break;
1385 case ArithmeticOperation::DIV:
1386 os << "DIV";
1387 break;
1388 case ArithmeticOperation::MAX:
1389 os << "MAX";
1390 break;
1391 case ArithmeticOperation::MIN:
1392 os << "MIN";
1393 break;
1394 case ArithmeticOperation::SQUARED_DIFF:
1395 os << "SQUARED_DIFF";
1396 break;
Usama Arif52c54f62019-05-14 10:22:36 +01001397 case ArithmeticOperation::POWER:
1398 os << "POWER";
1399 break;
giuros01164a2722018-11-20 18:34:46 +00001400 default:
1401 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1402 }
1403
1404 return os;
1405}
1406
1407/** Formatted output of the Arithmetic Operation
1408 *
1409 * @param[in] op Type to output.
1410 *
1411 * @return Formatted string.
1412 */
1413inline std::string to_string(const ArithmeticOperation &op)
1414{
1415 std::stringstream str;
1416 str << op;
1417 return str.str();
1418}
1419
Alex Gildayc357c472018-03-21 13:54:09 +00001420/** Formatted output of the Reduction Operations.
1421 *
1422 * @param[out] os Output stream.
1423 * @param[in] op Type to output.
1424 *
1425 * @return Modified output stream.
1426 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001427inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1428{
1429 switch(op)
1430 {
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001431 case ReductionOperation::SUM:
1432 os << "SUM";
1433 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001434 case ReductionOperation::SUM_SQUARE:
1435 os << "SUM_SQUARE";
1436 break;
Michalis Spyrou7e9391b2018-10-05 14:49:28 +01001437 case ReductionOperation::MEAN_SUM:
1438 os << "MEAN_SUM";
1439 break;
Michalis Spyrou7930db42018-11-22 17:36:28 +00001440 case ReductionOperation::ARG_IDX_MAX:
1441 os << "ARG_IDX_MAX";
1442 break;
1443 case ReductionOperation::ARG_IDX_MIN:
1444 os << "ARG_IDX_MIN";
1445 break;
Manuel Bottinib412fab2018-12-10 17:40:23 +00001446 case ReductionOperation::PROD:
1447 os << "PROD";
1448 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +01001449 default:
1450 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1451 }
1452
1453 return os;
1454}
1455
Alex Gildayc357c472018-03-21 13:54:09 +00001456/** Formatted output of the Reduction Operations.
1457 *
1458 * @param[in] op Type to output.
1459 *
1460 * @return Formatted string.
1461 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001462inline std::string to_string(const ReductionOperation &op)
1463{
1464 std::stringstream str;
1465 str << op;
1466 return str.str();
1467}
1468
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001469/** Formatted output of the Comparison Operations.
1470 *
1471 * @param[out] os Output stream.
1472 * @param[in] op Type to output.
1473 *
1474 * @return Modified output stream.
1475 */
1476inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1477{
1478 switch(op)
1479 {
1480 case ComparisonOperation::Equal:
1481 os << "Equal";
1482 break;
1483 case ComparisonOperation::NotEqual:
1484 os << "NotEqual";
1485 break;
1486 case ComparisonOperation::Greater:
1487 os << "Greater";
1488 break;
1489 case ComparisonOperation::GreaterEqual:
1490 os << "GreaterEqual";
1491 break;
1492 case ComparisonOperation::Less:
1493 os << "Less";
1494 break;
1495 case ComparisonOperation::LessEqual:
1496 os << "LessEqual";
1497 break;
1498 default:
1499 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1500 }
1501
1502 return os;
1503}
1504
Michalis Spyroue9362622018-11-23 17:41:37 +00001505/** Formatted output of the Elementwise unary Operations.
1506 *
1507 * @param[out] os Output stream.
1508 * @param[in] op Type to output.
1509 *
1510 * @return Modified output stream.
1511 */
1512inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1513{
1514 switch(op)
1515 {
1516 case ElementWiseUnary::RSQRT:
1517 os << "RSQRT";
1518 break;
1519 case ElementWiseUnary::EXP:
1520 os << "EXP";
1521 break;
Usama Arifeb312ef2019-05-13 17:45:54 +01001522 case ElementWiseUnary::NEG:
1523 os << "NEG";
1524 break;
Michalis Spyroue9362622018-11-23 17:41:37 +00001525 default:
1526 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1527 }
1528
1529 return os;
1530}
1531
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001532/** Formatted output of the Comparison Operations.
1533 *
1534 * @param[in] op Type to output.
1535 *
1536 * @return Formatted string.
1537 */
1538inline std::string to_string(const ComparisonOperation &op)
1539{
1540 std::stringstream str;
1541 str << op;
1542 return str.str();
1543}
1544
Michalis Spyroue9362622018-11-23 17:41:37 +00001545/** Formatted output of the Elementwise unary Operations.
1546 *
1547 * @param[in] op Type to output.
1548 *
1549 * @return Formatted string.
1550 */
1551inline std::string to_string(const ElementWiseUnary &op)
1552{
1553 std::stringstream str;
1554 str << op;
1555 return str.str();
1556}
1557
Alex Gildayc357c472018-03-21 13:54:09 +00001558/** Formatted output of the Norm Type.
1559 *
1560 * @param[in] type Type to output.
1561 *
1562 * @return Formatted string.
1563 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001564inline std::string to_string(const NormType &type)
1565{
1566 std::stringstream str;
1567 str << type;
1568 return str.str();
1569}
1570
Alex Gildayc357c472018-03-21 13:54:09 +00001571/** Formatted output of the Pooling Type.
1572 *
1573 * @param[in] type Type to output.
1574 *
1575 * @return Formatted string.
1576 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001577inline std::string to_string(const PoolingType &type)
1578{
1579 std::stringstream str;
1580 str << type;
1581 return str.str();
1582}
1583
Alex Gildayc357c472018-03-21 13:54:09 +00001584/** Formatted output of the Pooling Layer Info.
1585 *
1586 * @param[in] info Type to output.
1587 *
1588 * @return Formatted string.
1589 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001590inline std::string to_string(const PoolingLayerInfo &info)
1591{
1592 std::stringstream str;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001593 str << "{Type=" << info.pool_type() << ","
1594 << "IsGlobalPooling=" << info.is_global_pooling();
1595 if(!info.is_global_pooling())
1596 {
1597 str << ","
Isabella Gottardi6e464c32018-01-26 12:32:45 +00001598 << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << ","
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001599 << "PadStride=" << info.pad_stride_info();
1600 }
1601 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001602 return str.str();
1603}
1604
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01001605/** Formatted output of the PriorBoxLayerInfo.
1606 *
1607 * @param[in] info Type to output.
1608 *
1609 * @return Formatted string.
1610 */
1611inline std::string to_string(const PriorBoxLayerInfo &info)
1612{
1613 std::stringstream str;
1614 str << "{";
1615 str << "Clip:" << info.clip()
1616 << "Flip:" << info.flip()
1617 << "StepX:" << info.steps()[0]
1618 << "StepY:" << info.steps()[1]
1619 << "MinSizes:" << info.min_sizes().size()
1620 << "MaxSizes:" << info.max_sizes().size()
1621 << "ImgSizeX:" << info.img_size().x
1622 << "ImgSizeY:" << info.img_size().y
1623 << "Offset:" << info.offset()
1624 << "Variances:" << info.variances().size();
1625 str << "}";
1626 return str.str();
1627}
1628
Alex Gildayc357c472018-03-21 13:54:09 +00001629/** Formatted output of the KeyPoint type.
1630 *
1631 * @param[out] os Output stream
1632 * @param[in] point Type to output.
1633 *
1634 * @return Modified output stream.
1635 */
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01001636inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point)
1637{
1638 os << "{x=" << point.x << ","
1639 << "y=" << point.y << ","
1640 << "strength=" << point.strength << ","
1641 << "scale=" << point.scale << ","
1642 << "orientation=" << point.orientation << ","
1643 << "tracking_status=" << point.tracking_status << ","
1644 << "error=" << point.error << "}";
1645
1646 return os;
1647}
John Richardson63e50412017-10-13 20:51:42 +01001648
Alex Gildayc357c472018-03-21 13:54:09 +00001649/** Formatted output of the PhaseType type.
1650 *
1651 * @param[out] os Output stream
1652 * @param[in] phase_type Type to output.
1653 *
1654 * @return Modified output stream.
1655 */
John Richardson63e50412017-10-13 20:51:42 +01001656inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type)
1657{
1658 switch(phase_type)
1659 {
1660 case PhaseType::SIGNED:
1661 os << "SIGNED";
1662 break;
1663 case PhaseType::UNSIGNED:
1664 os << "UNSIGNED";
1665 break;
1666 default:
1667 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1668 }
1669
1670 return os;
1671}
1672
Alex Gildayc357c472018-03-21 13:54:09 +00001673/** Formatted output of the PhaseType type.
1674 *
1675 * @param[in] type Type to output.
1676 *
1677 * @return Formatted string.
1678 */
John Richardson63e50412017-10-13 20:51:42 +01001679inline std::string to_string(const arm_compute::PhaseType &type)
1680{
1681 std::stringstream str;
1682 str << type;
1683 return str.str();
1684}
John Richardson3c5f9492017-10-04 15:27:37 +01001685
Alex Gildayc357c472018-03-21 13:54:09 +00001686/** Formatted output of the MagnitudeType type.
1687 *
1688 * @param[out] os Output stream
1689 * @param[in] magnitude_type Type to output.
1690 *
1691 * @return Modified output stream.
1692 */
John Richardson3c5f9492017-10-04 15:27:37 +01001693inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type)
1694{
1695 switch(magnitude_type)
1696 {
1697 case MagnitudeType::L1NORM:
1698 os << "L1NORM";
1699 break;
1700 case MagnitudeType::L2NORM:
1701 os << "L2NORM";
1702 break;
1703 default:
1704 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1705 }
1706
1707 return os;
1708}
1709
Alex Gildayc357c472018-03-21 13:54:09 +00001710/** Formatted output of the MagnitudeType type.
1711 *
1712 * @param[in] type Type to output.
1713 *
1714 * @return Formatted string.
1715 */
John Richardson3c5f9492017-10-04 15:27:37 +01001716inline std::string to_string(const arm_compute::MagnitudeType &type)
1717{
1718 std::stringstream str;
1719 str << type;
1720 return str.str();
1721}
John Richardson1c529922017-11-01 10:57:48 +00001722
Alex Gildayc357c472018-03-21 13:54:09 +00001723/** Formatted output of the HOGNormType type.
1724 *
1725 * @param[out] os Output stream
1726 * @param[in] norm_type Type to output
1727 *
1728 * @return Modified output stream.
1729 */
John Richardson25f23682017-11-27 14:35:09 +00001730inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type)
1731{
1732 switch(norm_type)
1733 {
1734 case HOGNormType::L1_NORM:
1735 os << "L1_NORM";
1736 break;
1737 case HOGNormType::L2_NORM:
1738 os << "L2_NORM";
1739 break;
1740 case HOGNormType::L2HYS_NORM:
1741 os << "L2HYS_NORM";
1742 break;
1743 default:
1744 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1745 }
1746
1747 return os;
1748}
1749
Alex Gildayc357c472018-03-21 13:54:09 +00001750/** Formatted output of the HOGNormType type.
1751 *
1752 * @param[in] type Type to output
1753 *
1754 * @return Formatted string.
1755 */
John Richardson25f23682017-11-27 14:35:09 +00001756inline std::string to_string(const HOGNormType &type)
1757{
1758 std::stringstream str;
1759 str << type;
1760 return str.str();
1761}
1762
Alex Gildayc357c472018-03-21 13:54:09 +00001763/** Formatted output of the Size2D type.
1764 *
1765 * @param[out] os Output stream
1766 * @param[in] size Type to output
1767 *
1768 * @return Modified output stream.
1769 */
John Richardson25f23682017-11-27 14:35:09 +00001770inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
1771{
1772 os << size.width << "x" << size.height;
1773
1774 return os;
1775}
1776
Alex Gildayc357c472018-03-21 13:54:09 +00001777/** Formatted output of the Size2D type.
1778 *
1779 * @param[in] type Type to output
1780 *
1781 * @return Formatted string.
1782 */
John Richardson25f23682017-11-27 14:35:09 +00001783inline std::string to_string(const Size2D &type)
1784{
1785 std::stringstream str;
1786 str << type;
1787 return str.str();
1788}
1789
Alex Gildayc357c472018-03-21 13:54:09 +00001790/** Formatted output of the HOGInfo type.
1791 *
1792 * @param[out] os Output stream
1793 * @param[in] hog_info Type to output
1794 *
1795 * @return Modified output stream.
1796 */
John Richardson25f23682017-11-27 14:35:09 +00001797inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info)
1798{
1799 os << "{CellSize=" << hog_info.cell_size() << ","
1800 << "BlockSize=" << hog_info.block_size() << ","
1801 << "DetectionWindowSize=" << hog_info.detection_window_size() << ","
1802 << "BlockStride=" << hog_info.block_stride() << ","
1803 << "NumBins=" << hog_info.num_bins() << ","
1804 << "NormType=" << hog_info.normalization_type() << ","
1805 << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << ","
1806 << "PhaseType=" << hog_info.phase_type() << "}";
1807
1808 return os;
1809}
1810
Alex Gildayc357c472018-03-21 13:54:09 +00001811/** Formatted output of the HOGInfo type.
1812 *
1813 * @param[in] type Type to output
1814 *
1815 * @return Formatted string.
1816 */
John Richardson25f23682017-11-27 14:35:09 +00001817inline std::string to_string(const HOGInfo &type)
1818{
1819 std::stringstream str;
1820 str << type;
1821 return str.str();
1822}
1823
Alex Gildayc357c472018-03-21 13:54:09 +00001824/** Formatted output of the ConvolutionMethod type.
1825 *
1826 * @param[out] os Output stream
1827 * @param[in] conv_method Type to output
1828 *
1829 * @return Modified output stream.
1830 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001831inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
1832{
1833 switch(conv_method)
1834 {
1835 case ConvolutionMethod::GEMM:
1836 os << "GEMM";
1837 break;
1838 case ConvolutionMethod::DIRECT:
1839 os << "DIRECT";
1840 break;
1841 case ConvolutionMethod::WINOGRAD:
1842 os << "WINOGRAD";
1843 break;
1844 default:
1845 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1846 }
1847
1848 return os;
1849}
1850
Alex Gildayc357c472018-03-21 13:54:09 +00001851/** Formatted output of the ConvolutionMethod type.
1852 *
1853 * @param[in] conv_method Type to output
1854 *
1855 * @return Formatted string.
1856 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001857inline std::string to_string(const ConvolutionMethod &conv_method)
1858{
1859 std::stringstream str;
1860 str << conv_method;
1861 return str.str();
1862}
1863
Alex Gildayc357c472018-03-21 13:54:09 +00001864/** Formatted output of the GPUTarget type.
1865 *
1866 * @param[out] os Output stream
1867 * @param[in] gpu_target Type to output
1868 *
1869 * @return Modified output stream.
1870 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001871inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
1872{
1873 switch(gpu_target)
1874 {
1875 case GPUTarget::GPU_ARCH_MASK:
1876 os << "GPU_ARCH_MASK";
1877 break;
1878 case GPUTarget::MIDGARD:
1879 os << "MIDGARD";
1880 break;
1881 case GPUTarget::BIFROST:
1882 os << "BIFROST";
1883 break;
1884 case GPUTarget::T600:
1885 os << "T600";
1886 break;
1887 case GPUTarget::T700:
1888 os << "T700";
1889 break;
1890 case GPUTarget::T800:
1891 os << "T800";
1892 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00001893 case GPUTarget::G71:
1894 os << "G71";
1895 break;
1896 case GPUTarget::G72:
1897 os << "G72";
1898 break;
1899 case GPUTarget::G51:
1900 os << "G51";
1901 break;
1902 case GPUTarget::G51BIG:
1903 os << "G51BIG";
1904 break;
1905 case GPUTarget::G51LIT:
1906 os << "G51LIT";
1907 break;
Georgios Pinitasb03f7c52018-07-12 10:49:53 +01001908 case GPUTarget::G76:
1909 os << "G76";
Michalis Spyroua9676112018-02-22 18:07:43 +00001910 break;
1911 case GPUTarget::TTRX:
1912 os << "TTRX";
1913 break;
1914 case GPUTarget::TBOX:
1915 os << "TBOX";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001916 break;
1917 default:
1918 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1919 }
1920
1921 return os;
1922}
1923
Alex Gildayc357c472018-03-21 13:54:09 +00001924/** Formatted output of the GPUTarget type.
1925 *
1926 * @param[in] gpu_target Type to output
1927 *
1928 * @return Formatted string.
1929 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001930inline std::string to_string(const GPUTarget &gpu_target)
1931{
1932 std::stringstream str;
1933 str << gpu_target;
1934 return str.str();
1935}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00001936
John Richardson8de92612018-02-22 14:09:31 +00001937/** Formatted output of the DetectionWindow type.
1938 *
1939 * @param[out] os Output stream
1940 * @param[in] detection_window Type to output
1941 *
1942 * @return Modified output stream.
1943 */
John Richardson684cb0f2018-01-09 11:17:00 +00001944inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
1945{
1946 os << "{x=" << detection_window.x << ","
1947 << "y=" << detection_window.y << ","
1948 << "width=" << detection_window.width << ","
1949 << "height=" << detection_window.height << ","
1950 << "idx_class=" << detection_window.idx_class << ","
1951 << "score=" << detection_window.score << "}";
1952
1953 return os;
1954}
1955
Isabella Gottardi05e56442018-11-16 11:26:52 +00001956/** Formatted output of the DetectionOutputLayerCodeType type.
1957 *
1958 * @param[out] os Output stream
1959 * @param[in] detection_code Type to output
1960 *
1961 * @return Modified output stream.
1962 */
1963inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
1964{
1965 switch(detection_code)
1966 {
1967 case DetectionOutputLayerCodeType::CENTER_SIZE:
1968 os << "CENTER_SIZE";
1969 break;
1970 case DetectionOutputLayerCodeType::CORNER:
1971 os << "CORNER";
1972 break;
1973 case DetectionOutputLayerCodeType::CORNER_SIZE:
1974 os << "CORNER_SIZE";
1975 break;
1976 case DetectionOutputLayerCodeType::TF_CENTER:
1977 os << "TF_CENTER";
1978 break;
1979 default:
1980 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1981 }
1982
1983 return os;
1984}
1985/** Formatted output of the DetectionOutputLayerCodeType type.
1986 *
1987 * @param[in] detection_code Type to output
1988 *
1989 * @return Formatted string.
1990 */
1991inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
1992{
1993 std::stringstream str;
1994 str << detection_code;
1995 return str.str();
1996}
1997
1998/** Formatted output of the DetectionOutputLayerInfo type.
1999 *
2000 * @param[out] os Output stream
2001 * @param[in] detection_info Type to output
2002 *
2003 * @return Modified output stream.
2004 */
2005inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2006{
2007 os << "{Classes=" << detection_info.num_classes() << ","
2008 << "ShareLocation=" << detection_info.share_location() << ","
2009 << "CodeType=" << detection_info.code_type() << ","
2010 << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2011 << "KeepTopK=" << detection_info.keep_top_k() << ","
2012 << "NMSThreshold=" << detection_info.nms_threshold() << ","
2013 << "Eta=" << detection_info.eta() << ","
2014 << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2015 << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2016 << "TopK=" << detection_info.top_k() << ","
2017 << "NumLocClasses=" << detection_info.num_loc_classes()
2018 << "}";
2019
2020 return os;
2021}
2022
2023/** Formatted output of the DetectionOutputLayerInfo type.
2024 *
2025 * @param[in] detection_info Type to output
2026 *
2027 * @return Formatted string.
2028 */
2029inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2030{
2031 std::stringstream str;
2032 str << detection_info;
2033 return str.str();
2034}
John Richardson8de92612018-02-22 14:09:31 +00002035/** Formatted output of the DetectionWindow type.
2036 *
2037 * @param[in] detection_window Type to output
2038 *
2039 * @return Formatted string.
2040 */
2041inline std::string to_string(const DetectionWindow &detection_window)
2042{
2043 std::stringstream str;
2044 str << detection_window;
2045 return str.str();
2046}
2047
2048/** Formatted output of the Termination type.
2049 *
2050 * @param[out] os Output stream
2051 * @param[in] termination Type to output
2052 *
2053 * @return Modified output stream.
2054 */
2055inline ::std::ostream &operator<<(::std::ostream &os, const Termination &termination)
2056{
2057 switch(termination)
2058 {
2059 case Termination::TERM_CRITERIA_EPSILON:
2060 os << "TERM_CRITERIA_EPSILON";
2061 break;
2062 case Termination::TERM_CRITERIA_ITERATIONS:
2063 os << "TERM_CRITERIA_ITERATIONS";
2064 break;
2065 case Termination::TERM_CRITERIA_BOTH:
2066 os << "TERM_CRITERIA_BOTH";
2067 break;
2068 default:
2069 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2070 }
2071
2072 return os;
2073}
2074
2075/** Formatted output of the Termination type.
2076 *
2077 * @param[in] termination Type to output
2078 *
2079 * @return Formatted string.
2080 */
2081inline std::string to_string(const Termination &termination)
2082{
2083 std::stringstream str;
2084 str << termination;
2085 return str.str();
2086}
2087
Anthony Barbier8914e322018-08-10 15:28:25 +01002088/** Formatted output of the CPUModel type.
2089 *
2090 * @param[out] os Output stream
2091 * @param[in] cpu_model Model to output
2092 *
2093 * @return Modified output stream.
2094 */
2095inline ::std::ostream &operator<<(::std::ostream &os, const CPUModel &cpu_model)
2096{
2097 switch(cpu_model)
2098 {
2099 case CPUModel::GENERIC:
2100 os << "GENERIC";
2101 break;
2102 case CPUModel::GENERIC_FP16:
2103 os << "GENERIC_FP16";
2104 break;
2105 case CPUModel::GENERIC_FP16_DOT:
2106 os << "GENERIC_FP16_DOT";
2107 break;
2108 case CPUModel::A53:
2109 os << "A53";
2110 break;
2111 case CPUModel::A55r0:
2112 os << "A55r0";
2113 break;
2114 case CPUModel::A55r1:
2115 os << "A55r1";
2116 break;
2117 default:
2118 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2119 }
2120
2121 return os;
2122}
2123
2124/** Formatted output of the CPUModel type.
2125 *
2126 * @param[in] cpu_model Model to output
2127 *
2128 * @return Formatted string.
2129 */
2130inline std::string to_string(const CPUModel &cpu_model)
2131{
2132 std::stringstream str;
2133 str << cpu_model;
2134 return str.str();
2135}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002136/** Formatted output of a vector of objects.
2137 *
2138 * @param[out] os Output stream
2139 * @param[in] args Vector of objects to print
2140 *
2141 * @return Modified output stream.
2142 */
2143template <typename T>
2144inline ::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
2145{
2146 os << "[";
2147 bool first = true;
2148 for(auto &arg : args)
2149 {
2150 if(first)
2151 {
2152 first = false;
2153 }
2154 else
2155 {
2156 os << ", ";
2157 }
2158 os << arg;
2159 }
2160 os << "]";
2161 return os;
2162}
2163
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +01002164/** Formatted output of @ref PriorBoxLayerInfo.
2165 *
2166 * @param[out] os Output stream.
2167 * @param[in] info Type to output.
2168 *
2169 * @return Modified output stream.
2170 */
2171inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2172{
2173 os << "Clip:" << info.clip()
2174 << "Flip:" << info.flip()
2175 << "StepX:" << info.steps()[0]
2176 << "StepY:" << info.steps()[1]
2177 << "MinSizes:" << info.min_sizes()
2178 << "MaxSizes:" << info.max_sizes()
2179 << "ImgSizeX:" << info.img_size().x
2180 << "ImgSizeY:" << info.img_size().y
2181 << "Offset:" << info.offset()
2182 << "Variances:" << info.variances();
2183
2184 return os;
2185}
2186
Anthony Barbier671a11e2018-07-06 15:11:36 +01002187/** Formatted output of a vector of objects.
2188 *
2189 * @param[in] args Vector of objects to print
2190 *
2191 * @return String representing args.
2192 */
2193template <typename T>
2194std::string to_string(const std::vector<T> &args)
2195{
2196 std::stringstream str;
2197 str << args;
2198 return str.str();
2199}
2200
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002201/** Formatted output of the WinogradInfo type. */
2202inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2203{
2204 os << "{OutputTileSize=" << info.output_tile_size << ","
2205 << "KernelSize=" << info.kernel_size << ","
2206 << "PadStride=" << info.convolution_info << ","
2207 << "OutputDataLayout=" << info.output_data_layout << "}";
2208
2209 return os;
2210}
2211
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00002212inline std::string to_string(const WinogradInfo &type)
2213{
2214 std::stringstream str;
2215 str << type;
2216 return str.str();
2217}
Anthony Barbier671a11e2018-07-06 15:11:36 +01002218
2219/** Fallback method: try to use std::to_string:
2220 *
2221 * @param[in] val Value to convert to string
2222 *
2223 * @return String representing val.
2224 */
2225template <typename T>
2226inline std::string to_string(const T &val)
2227{
2228 return support::cpp11::to_string(val);
2229}
2230
Vidhya Sudhan Loganathan050471e2019-04-25 09:27:24 +01002231/** Convert a CLTunerMode value to a string
2232 *
2233 * @param val CLTunerMode value to be converted
2234 *
2235 * @return String representing the corresponding CLTunerMode.
2236 */
2237inline std::string to_string(const CLTunerMode val)
2238{
2239 switch(val)
2240 {
2241 case CLTunerMode::EXHAUSTIVE:
2242 {
2243 return std::string("Exhaustive");
2244 }
2245 case CLTunerMode::NORMAL:
2246 {
2247 return std::string("Normal");
2248 }
2249 case CLTunerMode::RAPID:
2250 {
2251 return std::string("Rapid");
2252 }
2253 default:
2254 {
2255 ARM_COMPUTE_ERROR("Invalid tuner mode.");
2256 return std::string("UNDEFINED");
2257 }
2258 }
2259}
2260/** [Print CLTunerMode type] **/
2261/** Formatted output of the CLTunerMode type.
2262 *
2263 * @param[out] os Output stream.
2264 * @param[in] val CLTunerMode to output.
2265 *
2266 * @return Modified output stream.
2267 */
2268inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2269{
2270 os << to_string(val);
2271 return os;
2272}
2273
Anthony Barbier6ff3b192017-09-04 18:44:23 +01002274} // namespace arm_compute
Anthony Barbier4dbc0a92018-08-27 13:39:47 +01002275
2276#endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */