blob: 811fb7b1e8d5a5f3eee098dbfdf7471b0e4527b1 [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;
344 str << info.activation();
345 return str.str();
346}
347
Alex Gildayc357c472018-03-21 13:54:09 +0000348/** Formatted output of the activation function type.
349 *
350 * @param[in] function Type to output.
351 *
352 * @return Formatted string.
353 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100354inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
355{
356 std::stringstream str;
357 str << function;
358 return str.str();
359}
360
Alex Gildayc357c472018-03-21 13:54:09 +0000361/** Formatted output of the NormType type.
362 *
363 * @param[out] os Output stream.
364 * @param[in] norm_type Type to output.
365 *
366 * @return Modified output stream.
367 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100368inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
369{
370 switch(norm_type)
371 {
372 case NormType::CROSS_MAP:
373 os << "CROSS_MAP";
374 break;
375 case NormType::IN_MAP_1D:
376 os << "IN_MAP_1D";
377 break;
378 case NormType::IN_MAP_2D:
379 os << "IN_MAP_2D";
380 break;
381 default:
382 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
383 }
384
385 return os;
386}
387
Alex Gildayc357c472018-03-21 13:54:09 +0000388/** Formatted output of @ref NormalizationLayerInfo.
389 *
390 * @param[in] info Type to output.
391 *
392 * @return Formatted string.
393 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100394inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100395{
396 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000397 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100398 return str.str();
399}
400
Alex Gildayc357c472018-03-21 13:54:09 +0000401/** Formatted output of @ref NormalizationLayerInfo.
402 *
403 * @param[out] os Output stream.
404 * @param[in] info Type to output.
405 *
406 * @return Modified output stream.
407 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100408inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
409{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000410 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100411 return os;
412}
413
Alex Gildayc357c472018-03-21 13:54:09 +0000414/** Formatted output of the PoolingType type.
415 *
416 * @param[out] os Output stream.
417 * @param[in] pool_type Type to output.
418 *
419 * @return Modified output stream.
420 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100421inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
422{
423 switch(pool_type)
424 {
425 case PoolingType::AVG:
426 os << "AVG";
427 break;
428 case PoolingType::MAX:
429 os << "MAX";
430 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100431 case PoolingType::L2:
432 os << "L2";
433 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100434 default:
435 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
436 }
437
438 return os;
439}
440
Alex Gildayc357c472018-03-21 13:54:09 +0000441/** Formatted output of @ref PoolingLayerInfo.
442 *
443 * @param[out] os Output stream.
444 * @param[in] info Type to output.
445 *
446 * @return Modified output stream.
447 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100448inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
449{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100450 os << info.pool_type();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100451
452 return os;
453}
454
Alex Gildayc357c472018-03-21 13:54:09 +0000455/** Formatted output of @ref RoundingPolicy.
456 *
457 * @param[in] rounding_policy Type to output.
458 *
459 * @return Formatted string.
460 */
John Richardsondd715f22017-09-18 16:10:48 +0100461inline std::string to_string(const RoundingPolicy &rounding_policy)
462{
463 std::stringstream str;
464 str << rounding_policy;
465 return str.str();
466}
467
Alex Gildayc357c472018-03-21 13:54:09 +0000468/** Formatted output of the DataLayout type.
469 *
470 * @param[out] os Output stream.
471 * @param[in] data_layout Type to output.
472 *
473 * @return Modified output stream.
474 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000475inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
476{
477 switch(data_layout)
478 {
479 case DataLayout::UNKNOWN:
480 os << "UNKNOWN";
481 break;
482 case DataLayout::NHWC:
483 os << "NHWC";
484 break;
485 case DataLayout::NCHW:
486 os << "NCHW";
487 break;
488 default:
489 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
490 }
491
492 return os;
493}
494
Alex Gildayc357c472018-03-21 13:54:09 +0000495/** Formatted output of the DataLayout type.
496 *
497 * @param[in] data_layout Type to output.
498 *
499 * @return Formatted string.
500 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000501inline std::string to_string(const arm_compute::DataLayout &data_layout)
502{
503 std::stringstream str;
504 str << data_layout;
505 return str.str();
506}
507
Alex Gildayc357c472018-03-21 13:54:09 +0000508/** Formatted output of the DataType type.
509 *
510 * @param[out] os Output stream.
511 * @param[in] data_type Type to output.
512 *
513 * @return Modified output stream.
514 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100515inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
516{
517 switch(data_type)
518 {
519 case DataType::UNKNOWN:
520 os << "UNKNOWN";
521 break;
522 case DataType::U8:
523 os << "U8";
524 break;
525 case DataType::QS8:
526 os << "QS8";
527 break;
Chunosovd621bca2017-11-03 17:33:15 +0700528 case DataType::QASYMM8:
529 os << "QASYMM8";
530 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100531 case DataType::S8:
532 os << "S8";
533 break;
534 case DataType::U16:
535 os << "U16";
536 break;
537 case DataType::S16:
538 os << "S16";
539 break;
Gian Marco Iodicebdb6b0b2017-06-30 12:21:00 +0100540 case DataType::QS16:
541 os << "QS16";
542 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100543 case DataType::U32:
544 os << "U32";
545 break;
546 case DataType::S32:
547 os << "S32";
548 break;
549 case DataType::U64:
550 os << "U64";
551 break;
552 case DataType::S64:
553 os << "S64";
554 break;
555 case DataType::F16:
556 os << "F16";
557 break;
558 case DataType::F32:
559 os << "F32";
560 break;
561 case DataType::F64:
562 os << "F64";
563 break;
564 case DataType::SIZET:
565 os << "SIZET";
566 break;
567 default:
568 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
569 }
570
571 return os;
572}
573
Alex Gildayc357c472018-03-21 13:54:09 +0000574/** Formatted output of the DataType type.
575 *
576 * @param[in] data_type Type to output.
577 *
578 * @return Formatted string.
579 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100580inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100581{
582 std::stringstream str;
583 str << data_type;
584 return str.str();
585}
586
Alex Gildayc357c472018-03-21 13:54:09 +0000587/** Formatted output of the Format type.
588 *
589 * @param[out] os Output stream.
590 * @param[in] format Type to output.
591 *
592 * @return Modified output stream.
593 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100594inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
595{
596 switch(format)
597 {
598 case Format::UNKNOWN:
599 os << "UNKNOWN";
600 break;
601 case Format::U8:
602 os << "U8";
603 break;
604 case Format::S16:
605 os << "S16";
606 break;
607 case Format::U16:
608 os << "U16";
609 break;
610 case Format::S32:
611 os << "S32";
612 break;
613 case Format::U32:
614 os << "U32";
615 break;
616 case Format::F16:
617 os << "F16";
618 break;
619 case Format::F32:
620 os << "F32";
621 break;
622 case Format::UV88:
623 os << "UV88";
624 break;
625 case Format::RGB888:
626 os << "RGB888";
627 break;
628 case Format::RGBA8888:
629 os << "RGBA8888";
630 break;
631 case Format::YUV444:
632 os << "YUV444";
633 break;
634 case Format::YUYV422:
635 os << "YUYV422";
636 break;
637 case Format::NV12:
638 os << "NV12";
639 break;
640 case Format::NV21:
641 os << "NV21";
642 break;
643 case Format::IYUV:
644 os << "IYUV";
645 break;
646 case Format::UYVY422:
647 os << "UYVY422";
648 break;
649 default:
650 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
651 }
652
653 return os;
654}
655
Alex Gildayc357c472018-03-21 13:54:09 +0000656/** Formatted output of the Format type.
657 *
658 * @param[in] format Type to output.
659 *
660 * @return Formatted string.
661 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100662inline std::string to_string(const Format &format)
663{
664 std::stringstream str;
665 str << format;
666 return str.str();
667}
668
Alex Gildayc357c472018-03-21 13:54:09 +0000669/** Formatted output of the Channel type.
670 *
671 * @param[out] os Output stream.
672 * @param[in] channel Type to output.
673 *
674 * @return Modified output stream.
675 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100676inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
677{
678 switch(channel)
679 {
680 case Channel::UNKNOWN:
681 os << "UNKNOWN";
682 break;
683 case Channel::C0:
684 os << "C0";
685 break;
686 case Channel::C1:
687 os << "C1";
688 break;
689 case Channel::C2:
690 os << "C2";
691 break;
692 case Channel::C3:
693 os << "C3";
694 break;
695 case Channel::R:
696 os << "R";
697 break;
698 case Channel::G:
699 os << "G";
700 break;
701 case Channel::B:
702 os << "B";
703 break;
704 case Channel::A:
705 os << "A";
706 break;
707 case Channel::Y:
708 os << "Y";
709 break;
710 case Channel::U:
711 os << "U";
712 break;
713 case Channel::V:
714 os << "V";
715 break;
716 default:
717 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
718 }
719
720 return os;
721}
722
Alex Gildayc357c472018-03-21 13:54:09 +0000723/** Formatted output of the Channel type.
724 *
725 * @param[in] channel Type to output.
726 *
727 * @return Formatted string.
728 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +0100729inline std::string to_string(const Channel &channel)
730{
731 std::stringstream str;
732 str << channel;
733 return str.str();
734}
735
Alex Gildayc357c472018-03-21 13:54:09 +0000736/** Formatted output of the BorderMode type.
737 *
738 * @param[out] os Output stream.
739 * @param[in] mode Type to output.
740 *
741 * @return Modified output stream.
742 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100743inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
744{
745 switch(mode)
746 {
747 case BorderMode::UNDEFINED:
748 os << "UNDEFINED";
749 break;
750 case BorderMode::CONSTANT:
751 os << "CONSTANT";
752 break;
753 case BorderMode::REPLICATE:
754 os << "REPLICATE";
755 break;
756 default:
757 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
758 }
759
760 return os;
761}
762
Alex Gildayc357c472018-03-21 13:54:09 +0000763/** Formatted output of the BorderSize type.
764 *
765 * @param[out] os Output stream.
766 * @param[in] border Type to output.
767 *
768 * @return Modified output stream.
769 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100770inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
771{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +0100772 os << border.top << ","
773 << border.right << ","
774 << border.bottom << ","
775 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100776
777 return os;
778}
Anthony Barbier2a07e182017-08-04 18:20:27 +0100779
Alex Gildayc357c472018-03-21 13:54:09 +0000780/** Formatted output of the InterpolationPolicy type.
781 *
782 * @param[out] os Output stream.
783 * @param[in] policy Type to output.
784 *
785 * @return Modified output stream.
786 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100787inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
788{
789 switch(policy)
790 {
791 case InterpolationPolicy::NEAREST_NEIGHBOR:
792 os << "NEAREST_NEIGHBOR";
793 break;
794 case InterpolationPolicy::BILINEAR:
795 os << "BILINEAR";
796 break;
797 case InterpolationPolicy::AREA:
798 os << "AREA";
799 break;
800 default:
801 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
802 }
803
804 return os;
805}
806
Alex Gildayc357c472018-03-21 13:54:09 +0000807/** Formatted output of the SamplingPolicy type.
808 *
809 * @param[out] os Output stream.
810 * @param[in] policy Type to output.
811 *
812 * @return Modified output stream.
813 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700814inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
815{
816 switch(policy)
817 {
818 case SamplingPolicy::CENTER:
819 os << "CENTER";
820 break;
821 case SamplingPolicy::TOP_LEFT:
822 os << "TOP_LEFT";
823 break;
824 default:
825 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
826 }
827
828 return os;
829}
830
Alex Gildayc357c472018-03-21 13:54:09 +0000831/** Formatted output of the TensorInfo type.
832 *
833 * @param[in] info Type to output.
834 *
835 * @return Formatted string.
836 */
Georgios Pinitas3faea252017-10-30 14:13:50 +0000837inline std::string to_string(const TensorInfo &info)
838{
839 std::stringstream str;
840 str << "{Shape=" << info.tensor_shape() << ","
841 << "Type=" << info.data_type() << ","
842 << "Channels=" << info.num_channels() << ","
843 << "FixedPointPos=" << info.fixed_point_position() << "}";
844 return str.str();
845}
846
Abe Mbise925ca0f2017-10-02 19:16:33 +0100847//FIXME: Check why this doesn't work and the TensorShape and Coordinates overload are needed
Alex Gildayc357c472018-03-21 13:54:09 +0000848/** Formatted output of the Dimensions type.
849 *
850 * @param[in] dimensions Type to output.
851 *
852 * @return Formatted string.
853 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100854template <typename T>
855inline std::string to_string(const Dimensions<T> &dimensions)
856{
857 std::stringstream str;
858 str << dimensions;
859 return str.str();
860}
861
Alex Gildayc357c472018-03-21 13:54:09 +0000862/** Formatted output of the Strides type.
863 *
864 * @param[in] stride Type to output.
865 *
866 * @return Formatted string.
867 */
John Richardsona36eae12017-09-26 16:55:59 +0100868inline std::string to_string(const Strides &stride)
869{
870 std::stringstream str;
871 str << stride;
872 return str.str();
873}
874
Alex Gildayc357c472018-03-21 13:54:09 +0000875/** Formatted output of the TensorShape type.
876 *
877 * @param[in] shape Type to output.
878 *
879 * @return Formatted string.
880 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100881inline std::string to_string(const TensorShape &shape)
882{
883 std::stringstream str;
884 str << shape;
885 return str.str();
886}
887
Alex Gildayc357c472018-03-21 13:54:09 +0000888/** Formatted output of the Coordinates type.
889 *
890 * @param[in] coord Type to output.
891 *
892 * @return Formatted string.
893 */
Abe Mbise925ca0f2017-10-02 19:16:33 +0100894inline std::string to_string(const Coordinates &coord)
895{
896 std::stringstream str;
897 str << coord;
898 return str.str();
899}
900
Alex Gildayc357c472018-03-21 13:54:09 +0000901/** Formatted output of the Rectangle type.
902 *
903 * @param[out] os Output stream.
904 * @param[in] rect Type to output.
905 *
906 * @return Modified output stream.
907 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100908inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
909{
910 os << rect.width << "x" << rect.height;
911 os << "+" << rect.x << "+" << rect.y;
912
913 return os;
914}
915
Alex Gildayc357c472018-03-21 13:54:09 +0000916/** Formatted output of the PadStrideInfo type.
917 *
918 * @param[out] os Output stream.
919 * @param[in] pad_stride_info Type to output.
920 *
921 * @return Modified output stream.
922 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100923inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
924{
925 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
926 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +0100927 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
928 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +0100929
930 return os;
931}
932
Alex Gildayc357c472018-03-21 13:54:09 +0000933/** Formatted output of the PadStrideInfo type.
934 *
935 * @param[in] pad_stride_info Type to output.
936 *
937 * @return Formatted string.
938 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100939inline std::string to_string(const PadStrideInfo &pad_stride_info)
940{
941 std::stringstream str;
942 str << pad_stride_info;
943 return str.str();
944}
945
Alex Gildayc357c472018-03-21 13:54:09 +0000946/** Formatted output of the BorderMode type.
947 *
948 * @param[in] mode Type to output.
949 *
950 * @return Formatted string.
951 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100952inline std::string to_string(const BorderMode &mode)
953{
954 std::stringstream str;
955 str << mode;
956 return str.str();
957}
958
Alex Gildayc357c472018-03-21 13:54:09 +0000959/** Formatted output of the BorderSize type.
960 *
961 * @param[in] border Type to output.
962 *
963 * @return Formatted string.
964 */
John Richardsonb482ce12017-09-18 12:44:01 +0100965inline std::string to_string(const BorderSize &border)
966{
967 std::stringstream str;
968 str << border;
969 return str.str();
970}
971
Alex Gildayc357c472018-03-21 13:54:09 +0000972/** Formatted output of the InterpolationPolicy type.
973 *
974 * @param[in] policy Type to output.
975 *
976 * @return Formatted string.
977 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100978inline std::string to_string(const InterpolationPolicy &policy)
979{
980 std::stringstream str;
981 str << policy;
982 return str.str();
983}
984
Alex Gildayc357c472018-03-21 13:54:09 +0000985/** Formatted output of the SamplingPolicy type.
986 *
987 * @param[in] policy Type to output.
988 *
989 * @return Formatted string.
990 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700991inline std::string to_string(const SamplingPolicy &policy)
992{
993 std::stringstream str;
994 str << policy;
995 return str.str();
996}
997
Alex Gildayc357c472018-03-21 13:54:09 +0000998/** Formatted output of the ConvertPolicy type.
999 *
1000 * @param[out] os Output stream.
1001 * @param[in] policy Type to output.
1002 *
1003 * @return Modified output stream.
1004 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001005inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1006{
1007 switch(policy)
1008 {
1009 case ConvertPolicy::WRAP:
1010 os << "WRAP";
1011 break;
1012 case ConvertPolicy::SATURATE:
1013 os << "SATURATE";
1014 break;
1015 default:
1016 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1017 }
1018
1019 return os;
1020}
1021
1022inline std::string to_string(const ConvertPolicy &policy)
1023{
1024 std::stringstream str;
1025 str << policy;
1026 return str.str();
1027}
1028
Alex Gildayc357c472018-03-21 13:54:09 +00001029/** Formatted output of the Reduction Operations.
1030 *
1031 * @param[out] os Output stream.
1032 * @param[in] op Type to output.
1033 *
1034 * @return Modified output stream.
1035 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001036inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1037{
1038 switch(op)
1039 {
1040 case ReductionOperation::SUM_SQUARE:
1041 os << "SUM_SQUARE";
1042 break;
1043 default:
1044 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1045 }
1046
1047 return os;
1048}
1049
Alex Gildayc357c472018-03-21 13:54:09 +00001050/** Formatted output of the Reduction Operations.
1051 *
1052 * @param[in] op Type to output.
1053 *
1054 * @return Formatted string.
1055 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001056inline std::string to_string(const ReductionOperation &op)
1057{
1058 std::stringstream str;
1059 str << op;
1060 return str.str();
1061}
1062
Alex Gildayc357c472018-03-21 13:54:09 +00001063/** Formatted output of the Norm Type.
1064 *
1065 * @param[in] type Type to output.
1066 *
1067 * @return Formatted string.
1068 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001069inline std::string to_string(const NormType &type)
1070{
1071 std::stringstream str;
1072 str << type;
1073 return str.str();
1074}
1075
Alex Gildayc357c472018-03-21 13:54:09 +00001076/** Formatted output of the Pooling Type.
1077 *
1078 * @param[in] type Type to output.
1079 *
1080 * @return Formatted string.
1081 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001082inline std::string to_string(const PoolingType &type)
1083{
1084 std::stringstream str;
1085 str << type;
1086 return str.str();
1087}
1088
Alex Gildayc357c472018-03-21 13:54:09 +00001089/** Formatted output of the Pooling Layer Info.
1090 *
1091 * @param[in] info Type to output.
1092 *
1093 * @return Formatted string.
1094 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001095inline std::string to_string(const PoolingLayerInfo &info)
1096{
1097 std::stringstream str;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001098 str << "{Type=" << info.pool_type() << ","
1099 << "IsGlobalPooling=" << info.is_global_pooling();
1100 if(!info.is_global_pooling())
1101 {
1102 str << ","
Isabella Gottardi6e464c32018-01-26 12:32:45 +00001103 << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << ","
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001104 << "PadStride=" << info.pad_stride_info();
1105 }
1106 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001107 return str.str();
1108}
1109
Alex Gildayc357c472018-03-21 13:54:09 +00001110/** Formatted output of the KeyPoint type.
1111 *
1112 * @param[out] os Output stream
1113 * @param[in] point Type to output.
1114 *
1115 * @return Modified output stream.
1116 */
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01001117inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point)
1118{
1119 os << "{x=" << point.x << ","
1120 << "y=" << point.y << ","
1121 << "strength=" << point.strength << ","
1122 << "scale=" << point.scale << ","
1123 << "orientation=" << point.orientation << ","
1124 << "tracking_status=" << point.tracking_status << ","
1125 << "error=" << point.error << "}";
1126
1127 return os;
1128}
John Richardson63e50412017-10-13 20:51:42 +01001129
Alex Gildayc357c472018-03-21 13:54:09 +00001130/** Formatted output of the PhaseType type.
1131 *
1132 * @param[out] os Output stream
1133 * @param[in] phase_type Type to output.
1134 *
1135 * @return Modified output stream.
1136 */
John Richardson63e50412017-10-13 20:51:42 +01001137inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type)
1138{
1139 switch(phase_type)
1140 {
1141 case PhaseType::SIGNED:
1142 os << "SIGNED";
1143 break;
1144 case PhaseType::UNSIGNED:
1145 os << "UNSIGNED";
1146 break;
1147 default:
1148 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1149 }
1150
1151 return os;
1152}
1153
Alex Gildayc357c472018-03-21 13:54:09 +00001154/** Formatted output of the PhaseType type.
1155 *
1156 * @param[in] type Type to output.
1157 *
1158 * @return Formatted string.
1159 */
John Richardson63e50412017-10-13 20:51:42 +01001160inline std::string to_string(const arm_compute::PhaseType &type)
1161{
1162 std::stringstream str;
1163 str << type;
1164 return str.str();
1165}
John Richardson3c5f9492017-10-04 15:27:37 +01001166
Alex Gildayc357c472018-03-21 13:54:09 +00001167/** Formatted output of the MagnitudeType type.
1168 *
1169 * @param[out] os Output stream
1170 * @param[in] magnitude_type Type to output.
1171 *
1172 * @return Modified output stream.
1173 */
John Richardson3c5f9492017-10-04 15:27:37 +01001174inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type)
1175{
1176 switch(magnitude_type)
1177 {
1178 case MagnitudeType::L1NORM:
1179 os << "L1NORM";
1180 break;
1181 case MagnitudeType::L2NORM:
1182 os << "L2NORM";
1183 break;
1184 default:
1185 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1186 }
1187
1188 return os;
1189}
1190
Alex Gildayc357c472018-03-21 13:54:09 +00001191/** Formatted output of the MagnitudeType type.
1192 *
1193 * @param[in] type Type to output.
1194 *
1195 * @return Formatted string.
1196 */
John Richardson3c5f9492017-10-04 15:27:37 +01001197inline std::string to_string(const arm_compute::MagnitudeType &type)
1198{
1199 std::stringstream str;
1200 str << type;
1201 return str.str();
1202}
John Richardson1c529922017-11-01 10:57:48 +00001203
Alex Gildayc357c472018-03-21 13:54:09 +00001204/** Formatted output of the GradientDimension type.
1205 *
1206 * @param[out] os Output stream
1207 * @param[in] dim Type to output
1208 *
1209 * @return Modified output stream.
1210 */
John Richardson1c529922017-11-01 10:57:48 +00001211inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim)
1212{
1213 switch(dim)
1214 {
1215 case GradientDimension::GRAD_X:
1216 os << "GRAD_X";
1217 break;
1218 case GradientDimension::GRAD_Y:
1219 os << "GRAD_Y";
1220 break;
1221 case GradientDimension::GRAD_XY:
1222 os << "GRAD_XY";
1223 break;
1224 default:
1225 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1226 }
1227
1228 return os;
1229}
1230
Alex Gildayc357c472018-03-21 13:54:09 +00001231/** Formatted output of the GradientDimension type.
1232 *
1233 * @param[in] type Type to output
1234 *
1235 * @return Formatted string.
1236 */
John Richardson1c529922017-11-01 10:57:48 +00001237inline std::string to_string(const arm_compute::GradientDimension &type)
1238{
1239 std::stringstream str;
1240 str << type;
1241 return str.str();
1242}
John Richardson25f23682017-11-27 14:35:09 +00001243
Alex Gildayc357c472018-03-21 13:54:09 +00001244/** Formatted output of the HOGNormType type.
1245 *
1246 * @param[out] os Output stream
1247 * @param[in] norm_type Type to output
1248 *
1249 * @return Modified output stream.
1250 */
John Richardson25f23682017-11-27 14:35:09 +00001251inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type)
1252{
1253 switch(norm_type)
1254 {
1255 case HOGNormType::L1_NORM:
1256 os << "L1_NORM";
1257 break;
1258 case HOGNormType::L2_NORM:
1259 os << "L2_NORM";
1260 break;
1261 case HOGNormType::L2HYS_NORM:
1262 os << "L2HYS_NORM";
1263 break;
1264 default:
1265 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1266 }
1267
1268 return os;
1269}
1270
Alex Gildayc357c472018-03-21 13:54:09 +00001271/** Formatted output of the HOGNormType type.
1272 *
1273 * @param[in] type Type to output
1274 *
1275 * @return Formatted string.
1276 */
John Richardson25f23682017-11-27 14:35:09 +00001277inline std::string to_string(const HOGNormType &type)
1278{
1279 std::stringstream str;
1280 str << type;
1281 return str.str();
1282}
1283
Alex Gildayc357c472018-03-21 13:54:09 +00001284/** Formatted output of the Size2D type.
1285 *
1286 * @param[out] os Output stream
1287 * @param[in] size Type to output
1288 *
1289 * @return Modified output stream.
1290 */
John Richardson25f23682017-11-27 14:35:09 +00001291inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
1292{
1293 os << size.width << "x" << size.height;
1294
1295 return os;
1296}
1297
Alex Gildayc357c472018-03-21 13:54:09 +00001298/** Formatted output of the Size2D type.
1299 *
1300 * @param[in] type Type to output
1301 *
1302 * @return Formatted string.
1303 */
John Richardson25f23682017-11-27 14:35:09 +00001304inline std::string to_string(const Size2D &type)
1305{
1306 std::stringstream str;
1307 str << type;
1308 return str.str();
1309}
1310
Alex Gildayc357c472018-03-21 13:54:09 +00001311/** Formatted output of the HOGInfo type.
1312 *
1313 * @param[out] os Output stream
1314 * @param[in] hog_info Type to output
1315 *
1316 * @return Modified output stream.
1317 */
John Richardson25f23682017-11-27 14:35:09 +00001318inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info)
1319{
1320 os << "{CellSize=" << hog_info.cell_size() << ","
1321 << "BlockSize=" << hog_info.block_size() << ","
1322 << "DetectionWindowSize=" << hog_info.detection_window_size() << ","
1323 << "BlockStride=" << hog_info.block_stride() << ","
1324 << "NumBins=" << hog_info.num_bins() << ","
1325 << "NormType=" << hog_info.normalization_type() << ","
1326 << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << ","
1327 << "PhaseType=" << hog_info.phase_type() << "}";
1328
1329 return os;
1330}
1331
Alex Gildayc357c472018-03-21 13:54:09 +00001332/** Formatted output of the HOGInfo type.
1333 *
1334 * @param[in] type Type to output
1335 *
1336 * @return Formatted string.
1337 */
John Richardson25f23682017-11-27 14:35:09 +00001338inline std::string to_string(const HOGInfo &type)
1339{
1340 std::stringstream str;
1341 str << type;
1342 return str.str();
1343}
1344
Alex Gildayc357c472018-03-21 13:54:09 +00001345/** Formatted output of the ConvolutionMethod type.
1346 *
1347 * @param[out] os Output stream
1348 * @param[in] conv_method Type to output
1349 *
1350 * @return Modified output stream.
1351 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001352inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
1353{
1354 switch(conv_method)
1355 {
1356 case ConvolutionMethod::GEMM:
1357 os << "GEMM";
1358 break;
1359 case ConvolutionMethod::DIRECT:
1360 os << "DIRECT";
1361 break;
1362 case ConvolutionMethod::WINOGRAD:
1363 os << "WINOGRAD";
1364 break;
1365 default:
1366 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1367 }
1368
1369 return os;
1370}
1371
Alex Gildayc357c472018-03-21 13:54:09 +00001372/** Formatted output of the ConvolutionMethod type.
1373 *
1374 * @param[in] conv_method Type to output
1375 *
1376 * @return Formatted string.
1377 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001378inline std::string to_string(const ConvolutionMethod &conv_method)
1379{
1380 std::stringstream str;
1381 str << conv_method;
1382 return str.str();
1383}
1384
Alex Gildayc357c472018-03-21 13:54:09 +00001385/** Formatted output of the GPUTarget type.
1386 *
1387 * @param[out] os Output stream
1388 * @param[in] gpu_target Type to output
1389 *
1390 * @return Modified output stream.
1391 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001392inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
1393{
1394 switch(gpu_target)
1395 {
1396 case GPUTarget::GPU_ARCH_MASK:
1397 os << "GPU_ARCH_MASK";
1398 break;
1399 case GPUTarget::MIDGARD:
1400 os << "MIDGARD";
1401 break;
1402 case GPUTarget::BIFROST:
1403 os << "BIFROST";
1404 break;
1405 case GPUTarget::T600:
1406 os << "T600";
1407 break;
1408 case GPUTarget::T700:
1409 os << "T700";
1410 break;
1411 case GPUTarget::T800:
1412 os << "T800";
1413 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00001414 case GPUTarget::G71:
1415 os << "G71";
1416 break;
1417 case GPUTarget::G72:
1418 os << "G72";
1419 break;
1420 case GPUTarget::G51:
1421 os << "G51";
1422 break;
1423 case GPUTarget::G51BIG:
1424 os << "G51BIG";
1425 break;
1426 case GPUTarget::G51LIT:
1427 os << "G51LIT";
1428 break;
1429 case GPUTarget::TNOX:
1430 os << "TNOX";
1431 break;
1432 case GPUTarget::TTRX:
1433 os << "TTRX";
1434 break;
1435 case GPUTarget::TBOX:
1436 os << "TBOX";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001437 break;
1438 default:
1439 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1440 }
1441
1442 return os;
1443}
1444
Alex Gildayc357c472018-03-21 13:54:09 +00001445/** Formatted output of the GPUTarget type.
1446 *
1447 * @param[in] gpu_target Type to output
1448 *
1449 * @return Formatted string.
1450 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001451inline std::string to_string(const GPUTarget &gpu_target)
1452{
1453 std::stringstream str;
1454 str << gpu_target;
1455 return str.str();
1456}
John Richardson684cb0f2018-01-09 11:17:00 +00001457/** Formatted output of the DetectionWindow type. */
1458inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
1459{
1460 os << "{x=" << detection_window.x << ","
1461 << "y=" << detection_window.y << ","
1462 << "width=" << detection_window.width << ","
1463 << "height=" << detection_window.height << ","
1464 << "idx_class=" << detection_window.idx_class << ","
1465 << "score=" << detection_window.score << "}";
1466
1467 return os;
1468}
1469
1470inline std::string to_string(const DetectionWindow &type)
1471{
1472 std::stringstream str;
1473 str << type;
1474 return str.str();
1475}
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001476} // namespace arm_compute
Alex Gildayc357c472018-03-21 13:54:09 +00001477#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */