blob: 9ac4b343b39a8fa5c39b927a1a5bc80cc8febb5d [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Michalis Spyroud466c2d2018-01-30 10:54:39 +00002 * Copyright (c) 2017-2018 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 */
24#ifndef __ARM_COMPUTE_TEST_TYPE_PRINTER_H__
25#define __ARM_COMPUTE_TEST_TYPE_PRINTER_H__
26
Isabella Gottardif07d28d2018-02-06 14:52:43 +000027#include "arm_compute/core/CL/CLTypes.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010028#include "arm_compute/core/Dimensions.h"
29#include "arm_compute/core/Error.h"
John Richardson25f23682017-11-27 14:35:09 +000030#include "arm_compute/core/HOGInfo.h"
31#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010032#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000033#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010034#include "arm_compute/core/Types.h"
35
Abe Mbise4bd2cb82017-09-27 18:39:19 +010036#include "tests/Types.h"
37
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038#include <ostream>
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010039#include <sstream>
40#include <string>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010041
42namespace arm_compute
43{
Alex Gildayc357c472018-03-21 13:54:09 +000044/** Formatted output of the Dimensions type.
45 *
46 * @param[out] os Output stream.
47 * @param[in] dimensions Type to output.
48 *
49 * @return Modified output stream.
50 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051template <typename T>
52inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
53{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010054 if(dimensions.num_dimensions() > 0)
55 {
56 os << dimensions[0];
57
58 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
59 {
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +010060 os << "x" << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +010061 }
62 }
63
Anthony Barbier6ff3b192017-09-04 18:44:23 +010064 return os;
65}
66
Alex Gildayc357c472018-03-21 13:54:09 +000067/** Formatted output of the NonLinearFilterFunction type.
68 *
69 * @param[out] os Output stream.
70 * @param[in] function Type to output.
71 *
72 * @return Modified output stream.
73 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +010074inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function)
75{
76 switch(function)
77 {
78 case NonLinearFilterFunction::MAX:
79 os << "MAX";
80 break;
81 case NonLinearFilterFunction::MEDIAN:
82 os << "MEDIAN";
83 break;
84 case NonLinearFilterFunction::MIN:
85 os << "MIN";
86 break;
87 default:
88 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
89 }
90
91 return os;
92}
93
Alex Gildayc357c472018-03-21 13:54:09 +000094/** Formatted output of the NonLinearFilterFunction type.
95 *
96 * @param[in] function Type to output.
97 *
98 * @return Formatted string.
99 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100100inline std::string to_string(const NonLinearFilterFunction &function)
101{
102 std::stringstream str;
103 str << function;
104 return str.str();
105}
106
Alex Gildayc357c472018-03-21 13:54:09 +0000107/** Formatted output of the MatrixPattern type.
108 *
109 * @param[out] os Output stream.
110 * @param[in] pattern Type to output.
111 *
112 * @return Modified output stream.
113 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +0100114inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern)
115{
116 switch(pattern)
117 {
118 case MatrixPattern::BOX:
119 os << "BOX";
120 break;
121 case MatrixPattern::CROSS:
122 os << "CROSS";
123 break;
124 case MatrixPattern::DISK:
125 os << "DISK";
126 break;
127 case MatrixPattern::OTHER:
128 os << "OTHER";
129 break;
130 default:
131 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
132 }
133
134 return os;
135}
136
Alex Gildayc357c472018-03-21 13:54:09 +0000137/** Formatted output of the MatrixPattern type.
138 *
139 * @param[in] pattern Type to output.
140 *
141 * @return Formatted string.
142 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100143inline std::string to_string(const MatrixPattern &pattern)
144{
145 std::stringstream str;
146 str << pattern;
147 return str.str();
148}
149
Alex Gildayc357c472018-03-21 13:54:09 +0000150/** Formatted output of the RoundingPolicy type.
151 *
152 * @param[out] os Output stream.
153 * @param[in] rounding_policy Type to output.
154 *
155 * @return Modified output stream.
156 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100157inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100158{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100159 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100160 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100161 case RoundingPolicy::TO_ZERO:
162 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100163 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100164 case RoundingPolicy::TO_NEAREST_UP:
165 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100166 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100167 case RoundingPolicy::TO_NEAREST_EVEN:
168 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100169 break;
170 default:
171 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
172 }
173
174 return os;
175}
176
Alex Gildayc357c472018-03-21 13:54:09 +0000177/** Formatted output of the WeightsInfo type.
178 *
179 * @param[out] os Output stream.
180 * @param[in] weights_info Type to output.
181 *
182 * @return Modified output stream.
183 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100184inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100185{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100186 os << weights_info.are_reshaped() << ";";
187 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100188
189 return os;
190}
191
Alex Gildayc357c472018-03-21 13:54:09 +0000192/** Formatted output of the ROIPoolingInfo type.
193 *
194 * @param[out] os Output stream.
195 * @param[in] pool_info Type to output.
196 *
197 * @return Modified output stream.
198 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100199inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100200{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100201 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100202 return os;
203}
204
Alex Gildayc357c472018-03-21 13:54:09 +0000205/** Formatted output of the QuantizationInfo type.
206 *
207 * @param[out] os Output stream.
208 * @param[in] quantization_info Type to output.
209 *
210 * @return Modified output stream.
211 */
Chunosovd621bca2017-11-03 17:33:15 +0700212inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info)
213{
214 os << "Scale:" << quantization_info.scale << "~"
215 << "Offset:" << quantization_info.offset;
216 return os;
217}
218
Alex Gildayc357c472018-03-21 13:54:09 +0000219/** Formatted output of the QuantizationInfo type.
220 *
221 * @param[in] quantization_info Type to output.
222 *
223 * @return Formatted string.
224 */
Chunosovd621bca2017-11-03 17:33:15 +0700225inline std::string to_string(const QuantizationInfo &quantization_info)
226{
227 std::stringstream str;
228 str << quantization_info;
229 return str.str();
230}
231
Alex Gildayc357c472018-03-21 13:54:09 +0000232/** Formatted output of the FixedPointOp type.
233 *
234 * @param[out] os Output stream.
235 * @param[in] op Type to output.
236 *
237 * @return Modified output stream.
238 */
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100239inline ::std::ostream &operator<<(::std::ostream &os, const FixedPointOp &op)
240{
241 switch(op)
242 {
John Richardson70f946b2017-10-02 16:52:16 +0100243 case FixedPointOp::ADD:
244 os << "ADD";
245 break;
246 case FixedPointOp::SUB:
247 os << "SUB";
248 break;
249 case FixedPointOp::MUL:
250 os << "MUL";
251 break;
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100252 case FixedPointOp::EXP:
253 os << "EXP";
254 break;
255 case FixedPointOp::LOG:
256 os << "LOG";
257 break;
258 case FixedPointOp::INV_SQRT:
259 os << "INV_SQRT";
260 break;
261 case FixedPointOp::RECIPROCAL:
262 os << "RECIPROCAL";
263 break;
264 default:
265 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
266 }
267
268 return os;
269}
John Richardson70f946b2017-10-02 16:52:16 +0100270
Alex Gildayc357c472018-03-21 13:54:09 +0000271/** Formatted output of the FixedPointOp type.
272 *
273 * @param[in] op Type to output.
274 *
275 * @return Formatted string.
276 */
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100277inline std::string to_string(const FixedPointOp &op)
278{
279 std::stringstream str;
280 str << op;
281 return str.str();
282}
283
Alex Gildayc357c472018-03-21 13:54:09 +0000284/** Formatted output of the activation function type.
285 *
286 * @param[out] os Output stream.
287 * @param[in] act_function Type to output.
288 *
289 * @return Modified output stream.
290 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100291inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
292{
293 switch(act_function)
294 {
295 case ActivationLayerInfo::ActivationFunction::ABS:
296 os << "ABS";
297 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298 case ActivationLayerInfo::ActivationFunction::LINEAR:
299 os << "LINEAR";
300 break;
301 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
302 os << "LOGISTIC";
303 break;
304 case ActivationLayerInfo::ActivationFunction::RELU:
305 os << "RELU";
306 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100307 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
308 os << "BOUNDED_RELU";
309 break;
310 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
311 os << "LEAKY_RELU";
312 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100313 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
314 os << "SOFT_RELU";
315 break;
316 case ActivationLayerInfo::ActivationFunction::SQRT:
317 os << "SQRT";
318 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100319 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
320 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000321 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100322 case ActivationLayerInfo::ActivationFunction::SQUARE:
323 os << "SQUARE";
324 break;
325 case ActivationLayerInfo::ActivationFunction::TANH:
326 os << "TANH";
327 break;
328 default:
329 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
330 }
331
332 return os;
333}
334
Alex Gildayc357c472018-03-21 13:54:09 +0000335/** Formatted output of the activation function info type.
336 *
337 * @param[in] info Type to output.
338 *
339 * @return Formatted string.
340 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100341inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100342{
343 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000344 if(info.enabled())
345 {
346 str << info.activation();
347 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100348 return str.str();
349}
350
Alex Gildayc357c472018-03-21 13:54:09 +0000351/** Formatted output of the activation function type.
352 *
353 * @param[in] function Type to output.
354 *
355 * @return Formatted string.
356 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100357inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
358{
359 std::stringstream str;
360 str << function;
361 return str.str();
362}
363
Alex Gildayc357c472018-03-21 13:54:09 +0000364/** Formatted output of the NormType type.
365 *
366 * @param[out] os Output stream.
367 * @param[in] norm_type Type to output.
368 *
369 * @return Modified output stream.
370 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100371inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
372{
373 switch(norm_type)
374 {
375 case NormType::CROSS_MAP:
376 os << "CROSS_MAP";
377 break;
378 case NormType::IN_MAP_1D:
379 os << "IN_MAP_1D";
380 break;
381 case NormType::IN_MAP_2D:
382 os << "IN_MAP_2D";
383 break;
384 default:
385 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
386 }
387
388 return os;
389}
390
Alex Gildayc357c472018-03-21 13:54:09 +0000391/** Formatted output of @ref NormalizationLayerInfo.
392 *
393 * @param[in] info Type to output.
394 *
395 * @return Formatted string.
396 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100397inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100398{
399 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000400 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100401 return str.str();
402}
403
Alex Gildayc357c472018-03-21 13:54:09 +0000404/** Formatted output of @ref NormalizationLayerInfo.
405 *
406 * @param[out] os Output stream.
407 * @param[in] info Type to output.
408 *
409 * @return Modified output stream.
410 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100411inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
412{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000413 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100414 return os;
415}
416
Alex Gildayc357c472018-03-21 13:54:09 +0000417/** Formatted output of the PoolingType type.
418 *
419 * @param[out] os Output stream.
420 * @param[in] pool_type Type to output.
421 *
422 * @return Modified output stream.
423 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100424inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
425{
426 switch(pool_type)
427 {
428 case PoolingType::AVG:
429 os << "AVG";
430 break;
431 case PoolingType::MAX:
432 os << "MAX";
433 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100434 case PoolingType::L2:
435 os << "L2";
436 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100437 default:
438 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
439 }
440
441 return os;
442}
443
Alex Gildayc357c472018-03-21 13:54:09 +0000444/** Formatted output of @ref PoolingLayerInfo.
445 *
446 * @param[out] os Output stream.
447 * @param[in] info Type to output.
448 *
449 * @return Modified output stream.
450 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100451inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
452{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100453 os << info.pool_type();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100454
455 return os;
456}
457
Alex Gildayc357c472018-03-21 13:54:09 +0000458/** Formatted output of @ref RoundingPolicy.
459 *
460 * @param[in] rounding_policy Type to output.
461 *
462 * @return Formatted string.
463 */
John Richardsondd715f22017-09-18 16:10:48 +0100464inline std::string to_string(const RoundingPolicy &rounding_policy)
465{
466 std::stringstream str;
467 str << rounding_policy;
468 return str.str();
469}
470
Alex Gildayc357c472018-03-21 13:54:09 +0000471/** Formatted output of the DataLayout type.
472 *
473 * @param[out] os Output stream.
474 * @param[in] data_layout Type to output.
475 *
476 * @return Modified output stream.
477 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000478inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
479{
480 switch(data_layout)
481 {
482 case DataLayout::UNKNOWN:
483 os << "UNKNOWN";
484 break;
485 case DataLayout::NHWC:
486 os << "NHWC";
487 break;
488 case DataLayout::NCHW:
489 os << "NCHW";
490 break;
491 default:
492 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
493 }
494
495 return os;
496}
497
Alex Gildayc357c472018-03-21 13:54:09 +0000498/** Formatted output of the DataLayout type.
499 *
500 * @param[in] data_layout Type to output.
501 *
502 * @return Formatted string.
503 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000504inline std::string to_string(const arm_compute::DataLayout &data_layout)
505{
506 std::stringstream str;
507 str << data_layout;
508 return str.str();
509}
510
Alex Gildayc357c472018-03-21 13:54:09 +0000511/** Formatted output of the DataType type.
512 *
513 * @param[out] os Output stream.
514 * @param[in] data_type Type to output.
515 *
516 * @return Modified output stream.
517 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100518inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
519{
520 switch(data_type)
521 {
522 case DataType::UNKNOWN:
523 os << "UNKNOWN";
524 break;
525 case DataType::U8:
526 os << "U8";
527 break;
528 case DataType::QS8:
529 os << "QS8";
530 break;
Chunosovd621bca2017-11-03 17:33:15 +0700531 case DataType::QASYMM8:
532 os << "QASYMM8";
533 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100534 case DataType::S8:
535 os << "S8";
536 break;
537 case DataType::U16:
538 os << "U16";
539 break;
540 case DataType::S16:
541 os << "S16";
542 break;
Gian Marco Iodicebdb6b0b2017-06-30 12:21:00 +0100543 case DataType::QS16:
544 os << "QS16";
545 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100546 case DataType::U32:
547 os << "U32";
548 break;
549 case DataType::S32:
550 os << "S32";
551 break;
552 case DataType::U64:
553 os << "U64";
554 break;
555 case DataType::S64:
556 os << "S64";
557 break;
558 case DataType::F16:
559 os << "F16";
560 break;
561 case DataType::F32:
562 os << "F32";
563 break;
564 case DataType::F64:
565 os << "F64";
566 break;
567 case DataType::SIZET:
568 os << "SIZET";
569 break;
570 default:
571 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
572 }
573
574 return os;
575}
576
Alex Gildayc357c472018-03-21 13:54:09 +0000577/** Formatted output of the DataType type.
578 *
579 * @param[in] data_type Type to output.
580 *
581 * @return Formatted string.
582 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100583inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100584{
585 std::stringstream str;
586 str << data_type;
587 return str.str();
588}
589
Alex Gildayc357c472018-03-21 13:54:09 +0000590/** Formatted output of the Format type.
591 *
592 * @param[out] os Output stream.
593 * @param[in] format Type to output.
594 *
595 * @return Modified output stream.
596 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100597inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
598{
599 switch(format)
600 {
601 case Format::UNKNOWN:
602 os << "UNKNOWN";
603 break;
604 case Format::U8:
605 os << "U8";
606 break;
607 case Format::S16:
608 os << "S16";
609 break;
610 case Format::U16:
611 os << "U16";
612 break;
613 case Format::S32:
614 os << "S32";
615 break;
616 case Format::U32:
617 os << "U32";
618 break;
619 case Format::F16:
620 os << "F16";
621 break;
622 case Format::F32:
623 os << "F32";
624 break;
625 case Format::UV88:
626 os << "UV88";
627 break;
628 case Format::RGB888:
629 os << "RGB888";
630 break;
631 case Format::RGBA8888:
632 os << "RGBA8888";
633 break;
634 case Format::YUV444:
635 os << "YUV444";
636 break;
637 case Format::YUYV422:
638 os << "YUYV422";
639 break;
640 case Format::NV12:
641 os << "NV12";
642 break;
643 case Format::NV21:
644 os << "NV21";
645 break;
646 case Format::IYUV:
647 os << "IYUV";
648 break;
649 case Format::UYVY422:
650 os << "UYVY422";
651 break;
652 default:
653 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
654 }
655
656 return os;
657}
658
Alex Gildayc357c472018-03-21 13:54:09 +0000659/** Formatted output of the Format type.
660 *
661 * @param[in] format Type to output.
662 *
663 * @return Formatted string.
664 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100665inline std::string to_string(const Format &format)
666{
667 std::stringstream str;
668 str << format;
669 return str.str();
670}
671
Alex Gildayc357c472018-03-21 13:54:09 +0000672/** Formatted output of the Channel type.
673 *
674 * @param[out] os Output stream.
675 * @param[in] channel Type to output.
676 *
677 * @return Modified output stream.
678 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100679inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
680{
681 switch(channel)
682 {
683 case Channel::UNKNOWN:
684 os << "UNKNOWN";
685 break;
686 case Channel::C0:
687 os << "C0";
688 break;
689 case Channel::C1:
690 os << "C1";
691 break;
692 case Channel::C2:
693 os << "C2";
694 break;
695 case Channel::C3:
696 os << "C3";
697 break;
698 case Channel::R:
699 os << "R";
700 break;
701 case Channel::G:
702 os << "G";
703 break;
704 case Channel::B:
705 os << "B";
706 break;
707 case Channel::A:
708 os << "A";
709 break;
710 case Channel::Y:
711 os << "Y";
712 break;
713 case Channel::U:
714 os << "U";
715 break;
716 case Channel::V:
717 os << "V";
718 break;
719 default:
720 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
721 }
722
723 return os;
724}
725
Alex Gildayc357c472018-03-21 13:54:09 +0000726/** Formatted output of the Channel type.
727 *
728 * @param[in] channel Type to output.
729 *
730 * @return Formatted string.
731 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +0100732inline std::string to_string(const Channel &channel)
733{
734 std::stringstream str;
735 str << channel;
736 return str.str();
737}
738
Alex Gildayc357c472018-03-21 13:54:09 +0000739/** Formatted output of the BorderMode type.
740 *
741 * @param[out] os Output stream.
742 * @param[in] mode Type to output.
743 *
744 * @return Modified output stream.
745 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100746inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
747{
748 switch(mode)
749 {
750 case BorderMode::UNDEFINED:
751 os << "UNDEFINED";
752 break;
753 case BorderMode::CONSTANT:
754 os << "CONSTANT";
755 break;
756 case BorderMode::REPLICATE:
757 os << "REPLICATE";
758 break;
759 default:
760 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
761 }
762
763 return os;
764}
765
Alex Gildayc357c472018-03-21 13:54:09 +0000766/** Formatted output of the BorderSize type.
767 *
768 * @param[out] os Output stream.
769 * @param[in] border Type to output.
770 *
771 * @return Modified output stream.
772 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100773inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
774{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +0100775 os << border.top << ","
776 << border.right << ","
777 << border.bottom << ","
778 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100779
780 return os;
781}
Anthony Barbier2a07e182017-08-04 18:20:27 +0100782
Alex Gildayc357c472018-03-21 13:54:09 +0000783/** Formatted output of the InterpolationPolicy type.
784 *
785 * @param[out] os Output stream.
786 * @param[in] policy Type to output.
787 *
788 * @return Modified output stream.
789 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100790inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
791{
792 switch(policy)
793 {
794 case InterpolationPolicy::NEAREST_NEIGHBOR:
795 os << "NEAREST_NEIGHBOR";
796 break;
797 case InterpolationPolicy::BILINEAR:
798 os << "BILINEAR";
799 break;
800 case InterpolationPolicy::AREA:
801 os << "AREA";
802 break;
803 default:
804 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
805 }
806
807 return os;
808}
809
Alex Gildayc357c472018-03-21 13:54:09 +0000810/** Formatted output of the SamplingPolicy type.
811 *
812 * @param[out] os Output stream.
813 * @param[in] policy Type to output.
814 *
815 * @return Modified output stream.
816 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700817inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
818{
819 switch(policy)
820 {
821 case SamplingPolicy::CENTER:
822 os << "CENTER";
823 break;
824 case SamplingPolicy::TOP_LEFT:
825 os << "TOP_LEFT";
826 break;
827 default:
828 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
829 }
830
831 return os;
832}
833
Alex Gildayc357c472018-03-21 13:54:09 +0000834/** Formatted output of the TensorInfo type.
835 *
836 * @param[in] info Type to output.
837 *
838 * @return Formatted string.
839 */
Georgios Pinitas3faea252017-10-30 14:13:50 +0000840inline std::string to_string(const TensorInfo &info)
841{
842 std::stringstream str;
843 str << "{Shape=" << info.tensor_shape() << ","
844 << "Type=" << info.data_type() << ","
845 << "Channels=" << info.num_channels() << ","
846 << "FixedPointPos=" << info.fixed_point_position() << "}";
847 return str.str();
848}
849
Abe Mbise925ca0f2017-10-02 19:16:33 +0100850//FIXME: Check why this doesn't work and the TensorShape and Coordinates overload are needed
Alex Gildayc357c472018-03-21 13:54:09 +0000851/** Formatted output of the Dimensions type.
852 *
853 * @param[in] dimensions Type to output.
854 *
855 * @return Formatted string.
856 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100857template <typename T>
858inline std::string to_string(const Dimensions<T> &dimensions)
859{
860 std::stringstream str;
861 str << dimensions;
862 return str.str();
863}
864
Alex Gildayc357c472018-03-21 13:54:09 +0000865/** Formatted output of the Strides type.
866 *
867 * @param[in] stride Type to output.
868 *
869 * @return Formatted string.
870 */
John Richardsona36eae12017-09-26 16:55:59 +0100871inline std::string to_string(const Strides &stride)
872{
873 std::stringstream str;
874 str << stride;
875 return str.str();
876}
877
Alex Gildayc357c472018-03-21 13:54:09 +0000878/** Formatted output of the TensorShape type.
879 *
880 * @param[in] shape Type to output.
881 *
882 * @return Formatted string.
883 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100884inline std::string to_string(const TensorShape &shape)
885{
886 std::stringstream str;
887 str << shape;
888 return str.str();
889}
890
Alex Gildayc357c472018-03-21 13:54:09 +0000891/** Formatted output of the Coordinates type.
892 *
893 * @param[in] coord Type to output.
894 *
895 * @return Formatted string.
896 */
Abe Mbise925ca0f2017-10-02 19:16:33 +0100897inline std::string to_string(const Coordinates &coord)
898{
899 std::stringstream str;
900 str << coord;
901 return str.str();
902}
903
Alex Gildayc357c472018-03-21 13:54:09 +0000904/** Formatted output of the Rectangle type.
905 *
906 * @param[out] os Output stream.
907 * @param[in] rect Type to output.
908 *
909 * @return Modified output stream.
910 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100911inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
912{
913 os << rect.width << "x" << rect.height;
914 os << "+" << rect.x << "+" << rect.y;
915
916 return os;
917}
918
Alex Gildayc357c472018-03-21 13:54:09 +0000919/** Formatted output of the PadStrideInfo type.
920 *
921 * @param[out] os Output stream.
922 * @param[in] pad_stride_info Type to output.
923 *
924 * @return Modified output stream.
925 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100926inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
927{
928 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
929 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +0100930 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
931 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +0100932
933 return os;
934}
935
Alex Gildayc357c472018-03-21 13:54:09 +0000936/** Formatted output of the PadStrideInfo type.
937 *
938 * @param[in] pad_stride_info Type to output.
939 *
940 * @return Formatted string.
941 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100942inline std::string to_string(const PadStrideInfo &pad_stride_info)
943{
944 std::stringstream str;
945 str << pad_stride_info;
946 return str.str();
947}
948
Alex Gildayc357c472018-03-21 13:54:09 +0000949/** Formatted output of the BorderMode type.
950 *
951 * @param[in] mode Type to output.
952 *
953 * @return Formatted string.
954 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100955inline std::string to_string(const BorderMode &mode)
956{
957 std::stringstream str;
958 str << mode;
959 return str.str();
960}
961
Alex Gildayc357c472018-03-21 13:54:09 +0000962/** Formatted output of the BorderSize type.
963 *
964 * @param[in] border Type to output.
965 *
966 * @return Formatted string.
967 */
John Richardsonb482ce12017-09-18 12:44:01 +0100968inline std::string to_string(const BorderSize &border)
969{
970 std::stringstream str;
971 str << border;
972 return str.str();
973}
974
Alex Gildayc357c472018-03-21 13:54:09 +0000975/** Formatted output of the InterpolationPolicy type.
976 *
977 * @param[in] policy Type to output.
978 *
979 * @return Formatted string.
980 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100981inline std::string to_string(const InterpolationPolicy &policy)
982{
983 std::stringstream str;
984 str << policy;
985 return str.str();
986}
987
Alex Gildayc357c472018-03-21 13:54:09 +0000988/** Formatted output of the SamplingPolicy type.
989 *
990 * @param[in] policy Type to output.
991 *
992 * @return Formatted string.
993 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700994inline std::string to_string(const SamplingPolicy &policy)
995{
996 std::stringstream str;
997 str << policy;
998 return str.str();
999}
1000
Alex Gildayc357c472018-03-21 13:54:09 +00001001/** Formatted output of the ConvertPolicy type.
1002 *
1003 * @param[out] os Output stream.
1004 * @param[in] policy Type to output.
1005 *
1006 * @return Modified output stream.
1007 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001008inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1009{
1010 switch(policy)
1011 {
1012 case ConvertPolicy::WRAP:
1013 os << "WRAP";
1014 break;
1015 case ConvertPolicy::SATURATE:
1016 os << "SATURATE";
1017 break;
1018 default:
1019 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1020 }
1021
1022 return os;
1023}
1024
1025inline std::string to_string(const ConvertPolicy &policy)
1026{
1027 std::stringstream str;
1028 str << policy;
1029 return str.str();
1030}
1031
Alex Gildayc357c472018-03-21 13:54:09 +00001032/** Formatted output of the Reduction Operations.
1033 *
1034 * @param[out] os Output stream.
1035 * @param[in] op Type to output.
1036 *
1037 * @return Modified output stream.
1038 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001039inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1040{
1041 switch(op)
1042 {
1043 case ReductionOperation::SUM_SQUARE:
1044 os << "SUM_SQUARE";
1045 break;
1046 default:
1047 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1048 }
1049
1050 return os;
1051}
1052
Alex Gildayc357c472018-03-21 13:54:09 +00001053/** Formatted output of the Reduction Operations.
1054 *
1055 * @param[in] op Type to output.
1056 *
1057 * @return Formatted string.
1058 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001059inline std::string to_string(const ReductionOperation &op)
1060{
1061 std::stringstream str;
1062 str << op;
1063 return str.str();
1064}
1065
Alex Gildayc357c472018-03-21 13:54:09 +00001066/** Formatted output of the Norm Type.
1067 *
1068 * @param[in] type Type to output.
1069 *
1070 * @return Formatted string.
1071 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001072inline std::string to_string(const NormType &type)
1073{
1074 std::stringstream str;
1075 str << type;
1076 return str.str();
1077}
1078
Alex Gildayc357c472018-03-21 13:54:09 +00001079/** Formatted output of the Pooling Type.
1080 *
1081 * @param[in] type Type to output.
1082 *
1083 * @return Formatted string.
1084 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001085inline std::string to_string(const PoolingType &type)
1086{
1087 std::stringstream str;
1088 str << type;
1089 return str.str();
1090}
1091
Alex Gildayc357c472018-03-21 13:54:09 +00001092/** Formatted output of the Pooling Layer Info.
1093 *
1094 * @param[in] info Type to output.
1095 *
1096 * @return Formatted string.
1097 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001098inline std::string to_string(const PoolingLayerInfo &info)
1099{
1100 std::stringstream str;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001101 str << "{Type=" << info.pool_type() << ","
1102 << "IsGlobalPooling=" << info.is_global_pooling();
1103 if(!info.is_global_pooling())
1104 {
1105 str << ","
Isabella Gottardi6e464c32018-01-26 12:32:45 +00001106 << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << ","
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001107 << "PadStride=" << info.pad_stride_info();
1108 }
1109 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001110 return str.str();
1111}
1112
Alex Gildayc357c472018-03-21 13:54:09 +00001113/** Formatted output of the KeyPoint type.
1114 *
1115 * @param[out] os Output stream
1116 * @param[in] point Type to output.
1117 *
1118 * @return Modified output stream.
1119 */
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01001120inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point)
1121{
1122 os << "{x=" << point.x << ","
1123 << "y=" << point.y << ","
1124 << "strength=" << point.strength << ","
1125 << "scale=" << point.scale << ","
1126 << "orientation=" << point.orientation << ","
1127 << "tracking_status=" << point.tracking_status << ","
1128 << "error=" << point.error << "}";
1129
1130 return os;
1131}
John Richardson63e50412017-10-13 20:51:42 +01001132
Alex Gildayc357c472018-03-21 13:54:09 +00001133/** Formatted output of the PhaseType type.
1134 *
1135 * @param[out] os Output stream
1136 * @param[in] phase_type Type to output.
1137 *
1138 * @return Modified output stream.
1139 */
John Richardson63e50412017-10-13 20:51:42 +01001140inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type)
1141{
1142 switch(phase_type)
1143 {
1144 case PhaseType::SIGNED:
1145 os << "SIGNED";
1146 break;
1147 case PhaseType::UNSIGNED:
1148 os << "UNSIGNED";
1149 break;
1150 default:
1151 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1152 }
1153
1154 return os;
1155}
1156
Alex Gildayc357c472018-03-21 13:54:09 +00001157/** Formatted output of the PhaseType type.
1158 *
1159 * @param[in] type Type to output.
1160 *
1161 * @return Formatted string.
1162 */
John Richardson63e50412017-10-13 20:51:42 +01001163inline std::string to_string(const arm_compute::PhaseType &type)
1164{
1165 std::stringstream str;
1166 str << type;
1167 return str.str();
1168}
John Richardson3c5f9492017-10-04 15:27:37 +01001169
Alex Gildayc357c472018-03-21 13:54:09 +00001170/** Formatted output of the MagnitudeType type.
1171 *
1172 * @param[out] os Output stream
1173 * @param[in] magnitude_type Type to output.
1174 *
1175 * @return Modified output stream.
1176 */
John Richardson3c5f9492017-10-04 15:27:37 +01001177inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type)
1178{
1179 switch(magnitude_type)
1180 {
1181 case MagnitudeType::L1NORM:
1182 os << "L1NORM";
1183 break;
1184 case MagnitudeType::L2NORM:
1185 os << "L2NORM";
1186 break;
1187 default:
1188 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1189 }
1190
1191 return os;
1192}
1193
Alex Gildayc357c472018-03-21 13:54:09 +00001194/** Formatted output of the MagnitudeType type.
1195 *
1196 * @param[in] type Type to output.
1197 *
1198 * @return Formatted string.
1199 */
John Richardson3c5f9492017-10-04 15:27:37 +01001200inline std::string to_string(const arm_compute::MagnitudeType &type)
1201{
1202 std::stringstream str;
1203 str << type;
1204 return str.str();
1205}
John Richardson1c529922017-11-01 10:57:48 +00001206
Alex Gildayc357c472018-03-21 13:54:09 +00001207/** Formatted output of the GradientDimension type.
1208 *
1209 * @param[out] os Output stream
1210 * @param[in] dim Type to output
1211 *
1212 * @return Modified output stream.
1213 */
John Richardson1c529922017-11-01 10:57:48 +00001214inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim)
1215{
1216 switch(dim)
1217 {
1218 case GradientDimension::GRAD_X:
1219 os << "GRAD_X";
1220 break;
1221 case GradientDimension::GRAD_Y:
1222 os << "GRAD_Y";
1223 break;
1224 case GradientDimension::GRAD_XY:
1225 os << "GRAD_XY";
1226 break;
1227 default:
1228 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1229 }
1230
1231 return os;
1232}
1233
Alex Gildayc357c472018-03-21 13:54:09 +00001234/** Formatted output of the GradientDimension type.
1235 *
1236 * @param[in] type Type to output
1237 *
1238 * @return Formatted string.
1239 */
John Richardson1c529922017-11-01 10:57:48 +00001240inline std::string to_string(const arm_compute::GradientDimension &type)
1241{
1242 std::stringstream str;
1243 str << type;
1244 return str.str();
1245}
John Richardson25f23682017-11-27 14:35:09 +00001246
Alex Gildayc357c472018-03-21 13:54:09 +00001247/** Formatted output of the HOGNormType type.
1248 *
1249 * @param[out] os Output stream
1250 * @param[in] norm_type Type to output
1251 *
1252 * @return Modified output stream.
1253 */
John Richardson25f23682017-11-27 14:35:09 +00001254inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type)
1255{
1256 switch(norm_type)
1257 {
1258 case HOGNormType::L1_NORM:
1259 os << "L1_NORM";
1260 break;
1261 case HOGNormType::L2_NORM:
1262 os << "L2_NORM";
1263 break;
1264 case HOGNormType::L2HYS_NORM:
1265 os << "L2HYS_NORM";
1266 break;
1267 default:
1268 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1269 }
1270
1271 return os;
1272}
1273
Alex Gildayc357c472018-03-21 13:54:09 +00001274/** Formatted output of the HOGNormType type.
1275 *
1276 * @param[in] type Type to output
1277 *
1278 * @return Formatted string.
1279 */
John Richardson25f23682017-11-27 14:35:09 +00001280inline std::string to_string(const HOGNormType &type)
1281{
1282 std::stringstream str;
1283 str << type;
1284 return str.str();
1285}
1286
Alex Gildayc357c472018-03-21 13:54:09 +00001287/** Formatted output of the Size2D type.
1288 *
1289 * @param[out] os Output stream
1290 * @param[in] size Type to output
1291 *
1292 * @return Modified output stream.
1293 */
John Richardson25f23682017-11-27 14:35:09 +00001294inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
1295{
1296 os << size.width << "x" << size.height;
1297
1298 return os;
1299}
1300
Alex Gildayc357c472018-03-21 13:54:09 +00001301/** Formatted output of the Size2D type.
1302 *
1303 * @param[in] type Type to output
1304 *
1305 * @return Formatted string.
1306 */
John Richardson25f23682017-11-27 14:35:09 +00001307inline std::string to_string(const Size2D &type)
1308{
1309 std::stringstream str;
1310 str << type;
1311 return str.str();
1312}
1313
Alex Gildayc357c472018-03-21 13:54:09 +00001314/** Formatted output of the HOGInfo type.
1315 *
1316 * @param[out] os Output stream
1317 * @param[in] hog_info Type to output
1318 *
1319 * @return Modified output stream.
1320 */
John Richardson25f23682017-11-27 14:35:09 +00001321inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info)
1322{
1323 os << "{CellSize=" << hog_info.cell_size() << ","
1324 << "BlockSize=" << hog_info.block_size() << ","
1325 << "DetectionWindowSize=" << hog_info.detection_window_size() << ","
1326 << "BlockStride=" << hog_info.block_stride() << ","
1327 << "NumBins=" << hog_info.num_bins() << ","
1328 << "NormType=" << hog_info.normalization_type() << ","
1329 << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << ","
1330 << "PhaseType=" << hog_info.phase_type() << "}";
1331
1332 return os;
1333}
1334
Alex Gildayc357c472018-03-21 13:54:09 +00001335/** Formatted output of the HOGInfo type.
1336 *
1337 * @param[in] type Type to output
1338 *
1339 * @return Formatted string.
1340 */
John Richardson25f23682017-11-27 14:35:09 +00001341inline std::string to_string(const HOGInfo &type)
1342{
1343 std::stringstream str;
1344 str << type;
1345 return str.str();
1346}
1347
Alex Gildayc357c472018-03-21 13:54:09 +00001348/** Formatted output of the ConvolutionMethod type.
1349 *
1350 * @param[out] os Output stream
1351 * @param[in] conv_method Type to output
1352 *
1353 * @return Modified output stream.
1354 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001355inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
1356{
1357 switch(conv_method)
1358 {
1359 case ConvolutionMethod::GEMM:
1360 os << "GEMM";
1361 break;
1362 case ConvolutionMethod::DIRECT:
1363 os << "DIRECT";
1364 break;
1365 case ConvolutionMethod::WINOGRAD:
1366 os << "WINOGRAD";
1367 break;
1368 default:
1369 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1370 }
1371
1372 return os;
1373}
1374
Alex Gildayc357c472018-03-21 13:54:09 +00001375/** Formatted output of the ConvolutionMethod type.
1376 *
1377 * @param[in] conv_method Type to output
1378 *
1379 * @return Formatted string.
1380 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001381inline std::string to_string(const ConvolutionMethod &conv_method)
1382{
1383 std::stringstream str;
1384 str << conv_method;
1385 return str.str();
1386}
1387
Alex Gildayc357c472018-03-21 13:54:09 +00001388/** Formatted output of the GPUTarget type.
1389 *
1390 * @param[out] os Output stream
1391 * @param[in] gpu_target Type to output
1392 *
1393 * @return Modified output stream.
1394 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001395inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
1396{
1397 switch(gpu_target)
1398 {
1399 case GPUTarget::GPU_ARCH_MASK:
1400 os << "GPU_ARCH_MASK";
1401 break;
1402 case GPUTarget::MIDGARD:
1403 os << "MIDGARD";
1404 break;
1405 case GPUTarget::BIFROST:
1406 os << "BIFROST";
1407 break;
1408 case GPUTarget::T600:
1409 os << "T600";
1410 break;
1411 case GPUTarget::T700:
1412 os << "T700";
1413 break;
1414 case GPUTarget::T800:
1415 os << "T800";
1416 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00001417 case GPUTarget::G71:
1418 os << "G71";
1419 break;
1420 case GPUTarget::G72:
1421 os << "G72";
1422 break;
1423 case GPUTarget::G51:
1424 os << "G51";
1425 break;
1426 case GPUTarget::G51BIG:
1427 os << "G51BIG";
1428 break;
1429 case GPUTarget::G51LIT:
1430 os << "G51LIT";
1431 break;
1432 case GPUTarget::TNOX:
1433 os << "TNOX";
1434 break;
1435 case GPUTarget::TTRX:
1436 os << "TTRX";
1437 break;
1438 case GPUTarget::TBOX:
1439 os << "TBOX";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001440 break;
1441 default:
1442 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1443 }
1444
1445 return os;
1446}
1447
Alex Gildayc357c472018-03-21 13:54:09 +00001448/** Formatted output of the GPUTarget type.
1449 *
1450 * @param[in] gpu_target Type to output
1451 *
1452 * @return Formatted string.
1453 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001454inline std::string to_string(const GPUTarget &gpu_target)
1455{
1456 std::stringstream str;
1457 str << gpu_target;
1458 return str.str();
1459}
John Richardson684cb0f2018-01-09 11:17:00 +00001460/** Formatted output of the DetectionWindow type. */
1461inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
1462{
1463 os << "{x=" << detection_window.x << ","
1464 << "y=" << detection_window.y << ","
1465 << "width=" << detection_window.width << ","
1466 << "height=" << detection_window.height << ","
1467 << "idx_class=" << detection_window.idx_class << ","
1468 << "score=" << detection_window.score << "}";
1469
1470 return os;
1471}
1472
1473inline std::string to_string(const DetectionWindow &type)
1474{
1475 std::stringstream str;
1476 str << type;
1477 return str.str();
1478}
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001479} // namespace arm_compute
Alex Gildayc357c472018-03-21 13:54:09 +00001480#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */