blob: 4c697ecca660c76de7ffe5922d7561befe29cb6c [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"
Michele Di Giorgiob8fc60f2018-04-25 11:58:07 +010030#include "arm_compute/core/GPUTarget.h"
John Richardson25f23682017-11-27 14:35:09 +000031#include "arm_compute/core/HOGInfo.h"
32#include "arm_compute/core/Size2D.h"
John Richardsona36eae12017-09-26 16:55:59 +010033#include "arm_compute/core/Strides.h"
Georgios Pinitas3faea252017-10-30 14:13:50 +000034#include "arm_compute/core/TensorInfo.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010035#include "arm_compute/core/Types.h"
36
Abe Mbise4bd2cb82017-09-27 18:39:19 +010037#include "tests/Types.h"
38
Anthony Barbier6ff3b192017-09-04 18:44:23 +010039#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{
Alex Gildayc357c472018-03-21 13:54:09 +000045/** Formatted output of the Dimensions type.
46 *
47 * @param[out] os Output stream.
48 * @param[in] dimensions Type to output.
49 *
50 * @return Modified output stream.
51 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010052template <typename T>
53inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
54{
Anthony Barbier6ff3b192017-09-04 18:44:23 +010055 if(dimensions.num_dimensions() > 0)
56 {
57 os << dimensions[0];
58
59 for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
60 {
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +010061 os << "x" << dimensions[d];
Anthony Barbier6ff3b192017-09-04 18:44:23 +010062 }
63 }
64
Anthony Barbier6ff3b192017-09-04 18:44:23 +010065 return os;
66}
67
Alex Gildayc357c472018-03-21 13:54:09 +000068/** Formatted output of the NonLinearFilterFunction type.
69 *
70 * @param[out] os Output stream.
71 * @param[in] function Type to output.
72 *
73 * @return Modified output stream.
74 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +010075inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function)
76{
77 switch(function)
78 {
79 case NonLinearFilterFunction::MAX:
80 os << "MAX";
81 break;
82 case NonLinearFilterFunction::MEDIAN:
83 os << "MEDIAN";
84 break;
85 case NonLinearFilterFunction::MIN:
86 os << "MIN";
87 break;
88 default:
89 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
90 }
91
92 return os;
93}
94
Alex Gildayc357c472018-03-21 13:54:09 +000095/** Formatted output of the NonLinearFilterFunction type.
96 *
97 * @param[in] function Type to output.
98 *
99 * @return Formatted string.
100 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100101inline std::string to_string(const NonLinearFilterFunction &function)
102{
103 std::stringstream str;
104 str << function;
105 return str.str();
106}
107
Alex Gildayc357c472018-03-21 13:54:09 +0000108/** Formatted output of the MatrixPattern type.
109 *
110 * @param[out] os Output stream.
111 * @param[in] pattern Type to output.
112 *
113 * @return Modified output stream.
114 */
Isabella Gottardi3b77e9d2017-06-22 11:05:41 +0100115inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern)
116{
117 switch(pattern)
118 {
119 case MatrixPattern::BOX:
120 os << "BOX";
121 break;
122 case MatrixPattern::CROSS:
123 os << "CROSS";
124 break;
125 case MatrixPattern::DISK:
126 os << "DISK";
127 break;
128 case MatrixPattern::OTHER:
129 os << "OTHER";
130 break;
131 default:
132 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
133 }
134
135 return os;
136}
137
Alex Gildayc357c472018-03-21 13:54:09 +0000138/** Formatted output of the MatrixPattern type.
139 *
140 * @param[in] pattern Type to output.
141 *
142 * @return Formatted string.
143 */
John Richardson6f4d49f2017-09-07 11:21:10 +0100144inline std::string to_string(const MatrixPattern &pattern)
145{
146 std::stringstream str;
147 str << pattern;
148 return str.str();
149}
150
Alex Gildayc357c472018-03-21 13:54:09 +0000151/** Formatted output of the RoundingPolicy type.
152 *
153 * @param[out] os Output stream.
154 * @param[in] rounding_policy Type to output.
155 *
156 * @return Modified output stream.
157 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100158inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100159{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100160 switch(rounding_policy)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100161 {
Anthony Barbier2a07e182017-08-04 18:20:27 +0100162 case RoundingPolicy::TO_ZERO:
163 os << "TO_ZERO";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100164 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100165 case RoundingPolicy::TO_NEAREST_UP:
166 os << "TO_NEAREST_UP";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100167 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100168 case RoundingPolicy::TO_NEAREST_EVEN:
169 os << "TO_NEAREST_EVEN";
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100170 break;
171 default:
172 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
173 }
174
175 return os;
176}
177
Alex Gildayc357c472018-03-21 13:54:09 +0000178/** Formatted output of the WeightsInfo type.
179 *
180 * @param[out] os Output stream.
181 * @param[in] weights_info Type to output.
182 *
183 * @return Modified output stream.
184 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100185inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100186{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100187 os << weights_info.are_reshaped() << ";";
188 os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100189
190 return os;
191}
192
Alex Gildayc357c472018-03-21 13:54:09 +0000193/** Formatted output of the ROIPoolingInfo type.
194 *
195 * @param[out] os Output stream.
196 * @param[in] pool_info Type to output.
197 *
198 * @return Modified output stream.
199 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100200inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100201{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100202 os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
Georgios Pinitasd9769582017-08-03 10:19:40 +0100203 return os;
204}
205
Alex Gildayc357c472018-03-21 13:54:09 +0000206/** Formatted output of the QuantizationInfo type.
207 *
208 * @param[out] os Output stream.
209 * @param[in] quantization_info Type to output.
210 *
211 * @return Modified output stream.
212 */
Chunosovd621bca2017-11-03 17:33:15 +0700213inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info)
214{
215 os << "Scale:" << quantization_info.scale << "~"
216 << "Offset:" << quantization_info.offset;
217 return os;
218}
219
Alex Gildayc357c472018-03-21 13:54:09 +0000220/** Formatted output of the QuantizationInfo type.
221 *
222 * @param[in] quantization_info Type to output.
223 *
224 * @return Formatted string.
225 */
Chunosovd621bca2017-11-03 17:33:15 +0700226inline std::string to_string(const QuantizationInfo &quantization_info)
227{
228 std::stringstream str;
229 str << quantization_info;
230 return str.str();
231}
232
Alex Gildayc357c472018-03-21 13:54:09 +0000233/** Formatted output of the FixedPointOp type.
234 *
235 * @param[out] os Output stream.
236 * @param[in] op Type to output.
237 *
238 * @return Modified output stream.
239 */
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100240inline ::std::ostream &operator<<(::std::ostream &os, const FixedPointOp &op)
241{
242 switch(op)
243 {
John Richardson70f946b2017-10-02 16:52:16 +0100244 case FixedPointOp::ADD:
245 os << "ADD";
246 break;
247 case FixedPointOp::SUB:
248 os << "SUB";
249 break;
250 case FixedPointOp::MUL:
251 os << "MUL";
252 break;
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100253 case FixedPointOp::EXP:
254 os << "EXP";
255 break;
256 case FixedPointOp::LOG:
257 os << "LOG";
258 break;
259 case FixedPointOp::INV_SQRT:
260 os << "INV_SQRT";
261 break;
262 case FixedPointOp::RECIPROCAL:
263 os << "RECIPROCAL";
264 break;
265 default:
266 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
267 }
268
269 return os;
270}
John Richardson70f946b2017-10-02 16:52:16 +0100271
Alex Gildayc357c472018-03-21 13:54:09 +0000272/** Formatted output of the FixedPointOp type.
273 *
274 * @param[in] op Type to output.
275 *
276 * @return Formatted string.
277 */
Abe Mbise4bd2cb82017-09-27 18:39:19 +0100278inline std::string to_string(const FixedPointOp &op)
279{
280 std::stringstream str;
281 str << op;
282 return str.str();
283}
284
Alex Gildayc357c472018-03-21 13:54:09 +0000285/** Formatted output of the activation function type.
286 *
287 * @param[out] os Output stream.
288 * @param[in] act_function Type to output.
289 *
290 * @return Modified output stream.
291 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100292inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
293{
294 switch(act_function)
295 {
296 case ActivationLayerInfo::ActivationFunction::ABS:
297 os << "ABS";
298 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100299 case ActivationLayerInfo::ActivationFunction::LINEAR:
300 os << "LINEAR";
301 break;
302 case ActivationLayerInfo::ActivationFunction::LOGISTIC:
303 os << "LOGISTIC";
304 break;
305 case ActivationLayerInfo::ActivationFunction::RELU:
306 os << "RELU";
307 break;
Georgios Pinitas579c0492017-07-12 16:12:12 +0100308 case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
309 os << "BOUNDED_RELU";
310 break;
311 case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
312 os << "LEAKY_RELU";
313 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100314 case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
315 os << "SOFT_RELU";
316 break;
317 case ActivationLayerInfo::ActivationFunction::SQRT:
318 os << "SQRT";
319 break;
Anthony Barbier2a07e182017-08-04 18:20:27 +0100320 case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
321 os << "LU_BOUNDED_RELU";
Kevin Petitd9f80712017-12-06 12:18:48 +0000322 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100323 case ActivationLayerInfo::ActivationFunction::SQUARE:
324 os << "SQUARE";
325 break;
326 case ActivationLayerInfo::ActivationFunction::TANH:
327 os << "TANH";
328 break;
329 default:
330 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
331 }
332
333 return os;
334}
335
Alex Gildayc357c472018-03-21 13:54:09 +0000336/** Formatted output of the activation function info type.
337 *
338 * @param[in] info Type to output.
339 *
340 * @return Formatted string.
341 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100342inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100343{
344 std::stringstream str;
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000345 if(info.enabled())
346 {
347 str << info.activation();
348 }
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100349 return str.str();
350}
351
Alex Gildayc357c472018-03-21 13:54:09 +0000352/** Formatted output of the activation function type.
353 *
354 * @param[in] function Type to output.
355 *
356 * @return Formatted string.
357 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100358inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
359{
360 std::stringstream str;
361 str << function;
362 return str.str();
363}
364
Alex Gildayc357c472018-03-21 13:54:09 +0000365/** Formatted output of the NormType type.
366 *
367 * @param[out] os Output stream.
368 * @param[in] norm_type Type to output.
369 *
370 * @return Modified output stream.
371 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100372inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
373{
374 switch(norm_type)
375 {
376 case NormType::CROSS_MAP:
377 os << "CROSS_MAP";
378 break;
379 case NormType::IN_MAP_1D:
380 os << "IN_MAP_1D";
381 break;
382 case NormType::IN_MAP_2D:
383 os << "IN_MAP_2D";
384 break;
385 default:
386 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
387 }
388
389 return os;
390}
391
Alex Gildayc357c472018-03-21 13:54:09 +0000392/** Formatted output of @ref NormalizationLayerInfo.
393 *
394 * @param[in] info Type to output.
395 *
396 * @return Formatted string.
397 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100398inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100399{
400 std::stringstream str;
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000401 str << info.type() << ":NormSize=" << info.norm_size();
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100402 return str.str();
403}
404
Alex Gildayc357c472018-03-21 13:54:09 +0000405/** Formatted output of @ref NormalizationLayerInfo.
406 *
407 * @param[out] os Output stream.
408 * @param[in] info Type to output.
409 *
410 * @return Modified output stream.
411 */
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100412inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
413{
Michalis Spyroud466c2d2018-01-30 10:54:39 +0000414 os << info.type() << ":NormSize=" << info.norm_size();
Georgios Pinitas6f669f02017-09-26 12:32:57 +0100415 return os;
416}
417
Alex Gildayc357c472018-03-21 13:54:09 +0000418/** Formatted output of the PoolingType type.
419 *
420 * @param[out] os Output stream.
421 * @param[in] pool_type Type to output.
422 *
423 * @return Modified output stream.
424 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100425inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
426{
427 switch(pool_type)
428 {
429 case PoolingType::AVG:
430 os << "AVG";
431 break;
432 case PoolingType::MAX:
433 os << "MAX";
434 break;
Georgios Pinitascdf51452017-08-31 14:21:36 +0100435 case PoolingType::L2:
436 os << "L2";
437 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100438 default:
439 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
440 }
441
442 return os;
443}
444
Alex Gildayc357c472018-03-21 13:54:09 +0000445/** Formatted output of @ref PoolingLayerInfo.
446 *
447 * @param[out] os Output stream.
448 * @param[in] info Type to output.
449 *
450 * @return Modified output stream.
451 */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100452inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
453{
Anthony Barbier2a07e182017-08-04 18:20:27 +0100454 os << info.pool_type();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100455
456 return os;
457}
458
Alex Gildayc357c472018-03-21 13:54:09 +0000459/** Formatted output of @ref RoundingPolicy.
460 *
461 * @param[in] rounding_policy Type to output.
462 *
463 * @return Formatted string.
464 */
John Richardsondd715f22017-09-18 16:10:48 +0100465inline std::string to_string(const RoundingPolicy &rounding_policy)
466{
467 std::stringstream str;
468 str << rounding_policy;
469 return str.str();
470}
471
Alex Gildayc357c472018-03-21 13:54:09 +0000472/** Formatted output of the DataLayout type.
473 *
474 * @param[out] os Output stream.
475 * @param[in] data_layout Type to output.
476 *
477 * @return Modified output stream.
478 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000479inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
480{
481 switch(data_layout)
482 {
483 case DataLayout::UNKNOWN:
484 os << "UNKNOWN";
485 break;
486 case DataLayout::NHWC:
487 os << "NHWC";
488 break;
489 case DataLayout::NCHW:
490 os << "NCHW";
491 break;
492 default:
493 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
494 }
495
496 return os;
497}
498
Alex Gildayc357c472018-03-21 13:54:09 +0000499/** Formatted output of the DataLayout type.
500 *
501 * @param[in] data_layout Type to output.
502 *
503 * @return Formatted string.
504 */
Michele Di Giorgio4a65b982018-03-02 11:21:38 +0000505inline std::string to_string(const arm_compute::DataLayout &data_layout)
506{
507 std::stringstream str;
508 str << data_layout;
509 return str.str();
510}
511
Alex Gildayc357c472018-03-21 13:54:09 +0000512/** Formatted output of the DataType type.
513 *
514 * @param[out] os Output stream.
515 * @param[in] data_type Type to output.
516 *
517 * @return Modified output stream.
518 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100519inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
520{
521 switch(data_type)
522 {
523 case DataType::UNKNOWN:
524 os << "UNKNOWN";
525 break;
526 case DataType::U8:
527 os << "U8";
528 break;
529 case DataType::QS8:
530 os << "QS8";
531 break;
Chunosovd621bca2017-11-03 17:33:15 +0700532 case DataType::QASYMM8:
533 os << "QASYMM8";
534 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100535 case DataType::S8:
536 os << "S8";
537 break;
538 case DataType::U16:
539 os << "U16";
540 break;
541 case DataType::S16:
542 os << "S16";
543 break;
Gian Marco Iodicebdb6b0b2017-06-30 12:21:00 +0100544 case DataType::QS16:
545 os << "QS16";
546 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100547 case DataType::U32:
548 os << "U32";
549 break;
550 case DataType::S32:
551 os << "S32";
552 break;
553 case DataType::U64:
554 os << "U64";
555 break;
556 case DataType::S64:
557 os << "S64";
558 break;
559 case DataType::F16:
560 os << "F16";
561 break;
562 case DataType::F32:
563 os << "F32";
564 break;
565 case DataType::F64:
566 os << "F64";
567 break;
568 case DataType::SIZET:
569 os << "SIZET";
570 break;
571 default:
572 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
573 }
574
575 return os;
576}
577
Alex Gildayc357c472018-03-21 13:54:09 +0000578/** Formatted output of the DataType type.
579 *
580 * @param[in] data_type Type to output.
581 *
582 * @return Formatted string.
583 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100584inline std::string to_string(const arm_compute::DataType &data_type)
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100585{
586 std::stringstream str;
587 str << data_type;
588 return str.str();
589}
590
Alex Gildayc357c472018-03-21 13:54:09 +0000591/** Formatted output of the Format type.
592 *
593 * @param[out] os Output stream.
594 * @param[in] format Type to output.
595 *
596 * @return Modified output stream.
597 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100598inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
599{
600 switch(format)
601 {
602 case Format::UNKNOWN:
603 os << "UNKNOWN";
604 break;
605 case Format::U8:
606 os << "U8";
607 break;
608 case Format::S16:
609 os << "S16";
610 break;
611 case Format::U16:
612 os << "U16";
613 break;
614 case Format::S32:
615 os << "S32";
616 break;
617 case Format::U32:
618 os << "U32";
619 break;
620 case Format::F16:
621 os << "F16";
622 break;
623 case Format::F32:
624 os << "F32";
625 break;
626 case Format::UV88:
627 os << "UV88";
628 break;
629 case Format::RGB888:
630 os << "RGB888";
631 break;
632 case Format::RGBA8888:
633 os << "RGBA8888";
634 break;
635 case Format::YUV444:
636 os << "YUV444";
637 break;
638 case Format::YUYV422:
639 os << "YUYV422";
640 break;
641 case Format::NV12:
642 os << "NV12";
643 break;
644 case Format::NV21:
645 os << "NV21";
646 break;
647 case Format::IYUV:
648 os << "IYUV";
649 break;
650 case Format::UYVY422:
651 os << "UYVY422";
652 break;
653 default:
654 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
655 }
656
657 return os;
658}
659
Alex Gildayc357c472018-03-21 13:54:09 +0000660/** Formatted output of the Format type.
661 *
662 * @param[in] format Type to output.
663 *
664 * @return Formatted string.
665 */
Moritz Pflanzer7655a672017-09-23 11:57:33 +0100666inline std::string to_string(const Format &format)
667{
668 std::stringstream str;
669 str << format;
670 return str.str();
671}
672
Alex Gildayc357c472018-03-21 13:54:09 +0000673/** Formatted output of the Channel type.
674 *
675 * @param[out] os Output stream.
676 * @param[in] channel Type to output.
677 *
678 * @return Modified output stream.
679 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100680inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
681{
682 switch(channel)
683 {
684 case Channel::UNKNOWN:
685 os << "UNKNOWN";
686 break;
687 case Channel::C0:
688 os << "C0";
689 break;
690 case Channel::C1:
691 os << "C1";
692 break;
693 case Channel::C2:
694 os << "C2";
695 break;
696 case Channel::C3:
697 os << "C3";
698 break;
699 case Channel::R:
700 os << "R";
701 break;
702 case Channel::G:
703 os << "G";
704 break;
705 case Channel::B:
706 os << "B";
707 break;
708 case Channel::A:
709 os << "A";
710 break;
711 case Channel::Y:
712 os << "Y";
713 break;
714 case Channel::U:
715 os << "U";
716 break;
717 case Channel::V:
718 os << "V";
719 break;
720 default:
721 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
722 }
723
724 return os;
725}
726
Alex Gildayc357c472018-03-21 13:54:09 +0000727/** Formatted output of the Channel type.
728 *
729 * @param[in] channel Type to output.
730 *
731 * @return Formatted string.
732 */
Ioan-Cristian Szabo9414f642017-10-27 17:35:40 +0100733inline std::string to_string(const Channel &channel)
734{
735 std::stringstream str;
736 str << channel;
737 return str.str();
738}
739
Alex Gildayc357c472018-03-21 13:54:09 +0000740/** Formatted output of the BorderMode type.
741 *
742 * @param[out] os Output stream.
743 * @param[in] mode Type to output.
744 *
745 * @return Modified output stream.
746 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100747inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
748{
749 switch(mode)
750 {
751 case BorderMode::UNDEFINED:
752 os << "UNDEFINED";
753 break;
754 case BorderMode::CONSTANT:
755 os << "CONSTANT";
756 break;
757 case BorderMode::REPLICATE:
758 os << "REPLICATE";
759 break;
760 default:
761 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
762 }
763
764 return os;
765}
766
Alex Gildayc357c472018-03-21 13:54:09 +0000767/** Formatted output of the BorderSize type.
768 *
769 * @param[out] os Output stream.
770 * @param[in] border Type to output.
771 *
772 * @return Modified output stream.
773 */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100774inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
775{
Moritz Pflanzerc87fbf82017-07-18 14:02:10 +0100776 os << border.top << ","
777 << border.right << ","
778 << border.bottom << ","
779 << border.left;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100780
781 return os;
782}
Anthony Barbier2a07e182017-08-04 18:20:27 +0100783
Alex Gildayc357c472018-03-21 13:54:09 +0000784/** Formatted output of the InterpolationPolicy type.
785 *
786 * @param[out] os Output stream.
787 * @param[in] policy Type to output.
788 *
789 * @return Modified output stream.
790 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100791inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
792{
793 switch(policy)
794 {
795 case InterpolationPolicy::NEAREST_NEIGHBOR:
796 os << "NEAREST_NEIGHBOR";
797 break;
798 case InterpolationPolicy::BILINEAR:
799 os << "BILINEAR";
800 break;
801 case InterpolationPolicy::AREA:
802 os << "AREA";
803 break;
804 default:
805 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
806 }
807
808 return os;
809}
810
Alex Gildayc357c472018-03-21 13:54:09 +0000811/** Formatted output of the SamplingPolicy type.
812 *
813 * @param[out] os Output stream.
814 * @param[in] policy Type to output.
815 *
816 * @return Modified output stream.
817 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700818inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
819{
820 switch(policy)
821 {
822 case SamplingPolicy::CENTER:
823 os << "CENTER";
824 break;
825 case SamplingPolicy::TOP_LEFT:
826 os << "TOP_LEFT";
827 break;
828 default:
829 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
830 }
831
832 return os;
833}
834
Alex Gildayc357c472018-03-21 13:54:09 +0000835/** Formatted output of the TensorInfo type.
836 *
837 * @param[in] info Type to output.
838 *
839 * @return Formatted string.
840 */
Georgios Pinitas3faea252017-10-30 14:13:50 +0000841inline std::string to_string(const TensorInfo &info)
842{
843 std::stringstream str;
844 str << "{Shape=" << info.tensor_shape() << ","
845 << "Type=" << info.data_type() << ","
846 << "Channels=" << info.num_channels() << ","
847 << "FixedPointPos=" << info.fixed_point_position() << "}";
848 return str.str();
849}
850
Abe Mbise925ca0f2017-10-02 19:16:33 +0100851//FIXME: Check why this doesn't work and the TensorShape and Coordinates overload are needed
Alex Gildayc357c472018-03-21 13:54:09 +0000852/** Formatted output of the Dimensions type.
853 *
854 * @param[in] dimensions Type to output.
855 *
856 * @return Formatted string.
857 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100858template <typename T>
859inline std::string to_string(const Dimensions<T> &dimensions)
860{
861 std::stringstream str;
862 str << dimensions;
863 return str.str();
864}
865
Alex Gildayc357c472018-03-21 13:54:09 +0000866/** Formatted output of the Strides type.
867 *
868 * @param[in] stride Type to output.
869 *
870 * @return Formatted string.
871 */
John Richardsona36eae12017-09-26 16:55:59 +0100872inline std::string to_string(const Strides &stride)
873{
874 std::stringstream str;
875 str << stride;
876 return str.str();
877}
878
Alex Gildayc357c472018-03-21 13:54:09 +0000879/** Formatted output of the TensorShape type.
880 *
881 * @param[in] shape Type to output.
882 *
883 * @return Formatted string.
884 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100885inline std::string to_string(const TensorShape &shape)
886{
887 std::stringstream str;
888 str << shape;
889 return str.str();
890}
891
Alex Gildayc357c472018-03-21 13:54:09 +0000892/** Formatted output of the Coordinates type.
893 *
894 * @param[in] coord Type to output.
895 *
896 * @return Formatted string.
897 */
Abe Mbise925ca0f2017-10-02 19:16:33 +0100898inline std::string to_string(const Coordinates &coord)
899{
900 std::stringstream str;
901 str << coord;
902 return str.str();
903}
904
Alex Gildayc357c472018-03-21 13:54:09 +0000905/** Formatted output of the Rectangle type.
906 *
907 * @param[out] os Output stream.
908 * @param[in] rect Type to output.
909 *
910 * @return Modified output stream.
911 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100912inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
913{
914 os << rect.width << "x" << rect.height;
915 os << "+" << rect.x << "+" << rect.y;
916
917 return os;
918}
919
Alex Gildayc357c472018-03-21 13:54:09 +0000920/** Formatted output of the PadStrideInfo type.
921 *
922 * @param[out] os Output stream.
923 * @param[in] pad_stride_info Type to output.
924 *
925 * @return Modified output stream.
926 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100927inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
928{
929 os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
930 os << ";";
Jaroslaw Rzepeckia1ed41f2017-10-13 11:13:58 +0100931 os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
932 << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
Anthony Barbier2a07e182017-08-04 18:20:27 +0100933
934 return os;
935}
936
Alex Gildayc357c472018-03-21 13:54:09 +0000937/** Formatted output of the PadStrideInfo type.
938 *
939 * @param[in] pad_stride_info Type to output.
940 *
941 * @return Formatted string.
942 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100943inline std::string to_string(const PadStrideInfo &pad_stride_info)
944{
945 std::stringstream str;
946 str << pad_stride_info;
947 return str.str();
948}
949
Alex Gildayc357c472018-03-21 13:54:09 +0000950/** Formatted output of the BorderMode type.
951 *
952 * @param[in] mode Type to output.
953 *
954 * @return Formatted string.
955 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100956inline std::string to_string(const BorderMode &mode)
957{
958 std::stringstream str;
959 str << mode;
960 return str.str();
961}
962
Alex Gildayc357c472018-03-21 13:54:09 +0000963/** Formatted output of the BorderSize type.
964 *
965 * @param[in] border Type to output.
966 *
967 * @return Formatted string.
968 */
John Richardsonb482ce12017-09-18 12:44:01 +0100969inline std::string to_string(const BorderSize &border)
970{
971 std::stringstream str;
972 str << border;
973 return str.str();
974}
975
Alex Gildayc357c472018-03-21 13:54:09 +0000976/** Formatted output of the InterpolationPolicy type.
977 *
978 * @param[in] policy Type to output.
979 *
980 * @return Formatted string.
981 */
Anthony Barbier2a07e182017-08-04 18:20:27 +0100982inline std::string to_string(const InterpolationPolicy &policy)
983{
984 std::stringstream str;
985 str << policy;
986 return str.str();
987}
988
Alex Gildayc357c472018-03-21 13:54:09 +0000989/** Formatted output of the SamplingPolicy type.
990 *
991 * @param[in] policy Type to output.
992 *
993 * @return Formatted string.
994 */
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700995inline std::string to_string(const SamplingPolicy &policy)
996{
997 std::stringstream str;
998 str << policy;
999 return str.str();
1000}
1001
Alex Gildayc357c472018-03-21 13:54:09 +00001002/** Formatted output of the ConvertPolicy type.
1003 *
1004 * @param[out] os Output stream.
1005 * @param[in] policy Type to output.
1006 *
1007 * @return Modified output stream.
1008 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001009inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1010{
1011 switch(policy)
1012 {
1013 case ConvertPolicy::WRAP:
1014 os << "WRAP";
1015 break;
1016 case ConvertPolicy::SATURATE:
1017 os << "SATURATE";
1018 break;
1019 default:
1020 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1021 }
1022
1023 return os;
1024}
1025
1026inline std::string to_string(const ConvertPolicy &policy)
1027{
1028 std::stringstream str;
1029 str << policy;
1030 return str.str();
1031}
1032
Alex Gildayc357c472018-03-21 13:54:09 +00001033/** Formatted output of the Reduction Operations.
1034 *
1035 * @param[out] os Output stream.
1036 * @param[in] op Type to output.
1037 *
1038 * @return Modified output stream.
1039 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001040inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1041{
1042 switch(op)
1043 {
1044 case ReductionOperation::SUM_SQUARE:
1045 os << "SUM_SQUARE";
1046 break;
1047 default:
1048 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1049 }
1050
1051 return os;
1052}
1053
Alex Gildayc357c472018-03-21 13:54:09 +00001054/** Formatted output of the Reduction Operations.
1055 *
1056 * @param[in] op Type to output.
1057 *
1058 * @return Formatted string.
1059 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001060inline std::string to_string(const ReductionOperation &op)
1061{
1062 std::stringstream str;
1063 str << op;
1064 return str.str();
1065}
1066
Alex Gildayc357c472018-03-21 13:54:09 +00001067/** Formatted output of the Norm Type.
1068 *
1069 * @param[in] type Type to output.
1070 *
1071 * @return Formatted string.
1072 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001073inline std::string to_string(const NormType &type)
1074{
1075 std::stringstream str;
1076 str << type;
1077 return str.str();
1078}
1079
Alex Gildayc357c472018-03-21 13:54:09 +00001080/** Formatted output of the Pooling Type.
1081 *
1082 * @param[in] type Type to output.
1083 *
1084 * @return Formatted string.
1085 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001086inline std::string to_string(const PoolingType &type)
1087{
1088 std::stringstream str;
1089 str << type;
1090 return str.str();
1091}
1092
Alex Gildayc357c472018-03-21 13:54:09 +00001093/** Formatted output of the Pooling Layer Info.
1094 *
1095 * @param[in] info Type to output.
1096 *
1097 * @return Formatted string.
1098 */
Anthony Barbier2a07e182017-08-04 18:20:27 +01001099inline std::string to_string(const PoolingLayerInfo &info)
1100{
1101 std::stringstream str;
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001102 str << "{Type=" << info.pool_type() << ","
1103 << "IsGlobalPooling=" << info.is_global_pooling();
1104 if(!info.is_global_pooling())
1105 {
1106 str << ","
Isabella Gottardi6e464c32018-01-26 12:32:45 +00001107 << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << ","
Georgios Pinitas4c2dd542017-11-13 12:58:41 +00001108 << "PadStride=" << info.pad_stride_info();
1109 }
1110 str << "}";
Anthony Barbier2a07e182017-08-04 18:20:27 +01001111 return str.str();
1112}
1113
Alex Gildayc357c472018-03-21 13:54:09 +00001114/** Formatted output of the KeyPoint type.
1115 *
1116 * @param[out] os Output stream
1117 * @param[in] point Type to output.
1118 *
1119 * @return Modified output stream.
1120 */
Moritz Pflanzer6c6597c2017-09-24 12:09:41 +01001121inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point)
1122{
1123 os << "{x=" << point.x << ","
1124 << "y=" << point.y << ","
1125 << "strength=" << point.strength << ","
1126 << "scale=" << point.scale << ","
1127 << "orientation=" << point.orientation << ","
1128 << "tracking_status=" << point.tracking_status << ","
1129 << "error=" << point.error << "}";
1130
1131 return os;
1132}
John Richardson63e50412017-10-13 20:51:42 +01001133
Alex Gildayc357c472018-03-21 13:54:09 +00001134/** Formatted output of the PhaseType type.
1135 *
1136 * @param[out] os Output stream
1137 * @param[in] phase_type Type to output.
1138 *
1139 * @return Modified output stream.
1140 */
John Richardson63e50412017-10-13 20:51:42 +01001141inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type)
1142{
1143 switch(phase_type)
1144 {
1145 case PhaseType::SIGNED:
1146 os << "SIGNED";
1147 break;
1148 case PhaseType::UNSIGNED:
1149 os << "UNSIGNED";
1150 break;
1151 default:
1152 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1153 }
1154
1155 return os;
1156}
1157
Alex Gildayc357c472018-03-21 13:54:09 +00001158/** Formatted output of the PhaseType type.
1159 *
1160 * @param[in] type Type to output.
1161 *
1162 * @return Formatted string.
1163 */
John Richardson63e50412017-10-13 20:51:42 +01001164inline std::string to_string(const arm_compute::PhaseType &type)
1165{
1166 std::stringstream str;
1167 str << type;
1168 return str.str();
1169}
John Richardson3c5f9492017-10-04 15:27:37 +01001170
Alex Gildayc357c472018-03-21 13:54:09 +00001171/** Formatted output of the MagnitudeType type.
1172 *
1173 * @param[out] os Output stream
1174 * @param[in] magnitude_type Type to output.
1175 *
1176 * @return Modified output stream.
1177 */
John Richardson3c5f9492017-10-04 15:27:37 +01001178inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type)
1179{
1180 switch(magnitude_type)
1181 {
1182 case MagnitudeType::L1NORM:
1183 os << "L1NORM";
1184 break;
1185 case MagnitudeType::L2NORM:
1186 os << "L2NORM";
1187 break;
1188 default:
1189 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1190 }
1191
1192 return os;
1193}
1194
Alex Gildayc357c472018-03-21 13:54:09 +00001195/** Formatted output of the MagnitudeType type.
1196 *
1197 * @param[in] type Type to output.
1198 *
1199 * @return Formatted string.
1200 */
John Richardson3c5f9492017-10-04 15:27:37 +01001201inline std::string to_string(const arm_compute::MagnitudeType &type)
1202{
1203 std::stringstream str;
1204 str << type;
1205 return str.str();
1206}
John Richardson1c529922017-11-01 10:57:48 +00001207
Alex Gildayc357c472018-03-21 13:54:09 +00001208/** Formatted output of the GradientDimension type.
1209 *
1210 * @param[out] os Output stream
1211 * @param[in] dim Type to output
1212 *
1213 * @return Modified output stream.
1214 */
John Richardson1c529922017-11-01 10:57:48 +00001215inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim)
1216{
1217 switch(dim)
1218 {
1219 case GradientDimension::GRAD_X:
1220 os << "GRAD_X";
1221 break;
1222 case GradientDimension::GRAD_Y:
1223 os << "GRAD_Y";
1224 break;
1225 case GradientDimension::GRAD_XY:
1226 os << "GRAD_XY";
1227 break;
1228 default:
1229 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1230 }
1231
1232 return os;
1233}
1234
Alex Gildayc357c472018-03-21 13:54:09 +00001235/** Formatted output of the GradientDimension type.
1236 *
1237 * @param[in] type Type to output
1238 *
1239 * @return Formatted string.
1240 */
John Richardson1c529922017-11-01 10:57:48 +00001241inline std::string to_string(const arm_compute::GradientDimension &type)
1242{
1243 std::stringstream str;
1244 str << type;
1245 return str.str();
1246}
John Richardson25f23682017-11-27 14:35:09 +00001247
Alex Gildayc357c472018-03-21 13:54:09 +00001248/** Formatted output of the HOGNormType type.
1249 *
1250 * @param[out] os Output stream
1251 * @param[in] norm_type Type to output
1252 *
1253 * @return Modified output stream.
1254 */
John Richardson25f23682017-11-27 14:35:09 +00001255inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type)
1256{
1257 switch(norm_type)
1258 {
1259 case HOGNormType::L1_NORM:
1260 os << "L1_NORM";
1261 break;
1262 case HOGNormType::L2_NORM:
1263 os << "L2_NORM";
1264 break;
1265 case HOGNormType::L2HYS_NORM:
1266 os << "L2HYS_NORM";
1267 break;
1268 default:
1269 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1270 }
1271
1272 return os;
1273}
1274
Alex Gildayc357c472018-03-21 13:54:09 +00001275/** Formatted output of the HOGNormType type.
1276 *
1277 * @param[in] type Type to output
1278 *
1279 * @return Formatted string.
1280 */
John Richardson25f23682017-11-27 14:35:09 +00001281inline std::string to_string(const HOGNormType &type)
1282{
1283 std::stringstream str;
1284 str << type;
1285 return str.str();
1286}
1287
Alex Gildayc357c472018-03-21 13:54:09 +00001288/** Formatted output of the Size2D type.
1289 *
1290 * @param[out] os Output stream
1291 * @param[in] size Type to output
1292 *
1293 * @return Modified output stream.
1294 */
John Richardson25f23682017-11-27 14:35:09 +00001295inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
1296{
1297 os << size.width << "x" << size.height;
1298
1299 return os;
1300}
1301
Alex Gildayc357c472018-03-21 13:54:09 +00001302/** Formatted output of the Size2D type.
1303 *
1304 * @param[in] type Type to output
1305 *
1306 * @return Formatted string.
1307 */
John Richardson25f23682017-11-27 14:35:09 +00001308inline std::string to_string(const Size2D &type)
1309{
1310 std::stringstream str;
1311 str << type;
1312 return str.str();
1313}
1314
Alex Gildayc357c472018-03-21 13:54:09 +00001315/** Formatted output of the HOGInfo type.
1316 *
1317 * @param[out] os Output stream
1318 * @param[in] hog_info Type to output
1319 *
1320 * @return Modified output stream.
1321 */
John Richardson25f23682017-11-27 14:35:09 +00001322inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info)
1323{
1324 os << "{CellSize=" << hog_info.cell_size() << ","
1325 << "BlockSize=" << hog_info.block_size() << ","
1326 << "DetectionWindowSize=" << hog_info.detection_window_size() << ","
1327 << "BlockStride=" << hog_info.block_stride() << ","
1328 << "NumBins=" << hog_info.num_bins() << ","
1329 << "NormType=" << hog_info.normalization_type() << ","
1330 << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << ","
1331 << "PhaseType=" << hog_info.phase_type() << "}";
1332
1333 return os;
1334}
1335
Alex Gildayc357c472018-03-21 13:54:09 +00001336/** Formatted output of the HOGInfo type.
1337 *
1338 * @param[in] type Type to output
1339 *
1340 * @return Formatted string.
1341 */
John Richardson25f23682017-11-27 14:35:09 +00001342inline std::string to_string(const HOGInfo &type)
1343{
1344 std::stringstream str;
1345 str << type;
1346 return str.str();
1347}
1348
Alex Gildayc357c472018-03-21 13:54:09 +00001349/** Formatted output of the ConvolutionMethod type.
1350 *
1351 * @param[out] os Output stream
1352 * @param[in] conv_method Type to output
1353 *
1354 * @return Modified output stream.
1355 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001356inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
1357{
1358 switch(conv_method)
1359 {
1360 case ConvolutionMethod::GEMM:
1361 os << "GEMM";
1362 break;
1363 case ConvolutionMethod::DIRECT:
1364 os << "DIRECT";
1365 break;
1366 case ConvolutionMethod::WINOGRAD:
1367 os << "WINOGRAD";
1368 break;
1369 default:
1370 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1371 }
1372
1373 return os;
1374}
1375
Alex Gildayc357c472018-03-21 13:54:09 +00001376/** Formatted output of the ConvolutionMethod type.
1377 *
1378 * @param[in] conv_method Type to output
1379 *
1380 * @return Formatted string.
1381 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001382inline std::string to_string(const ConvolutionMethod &conv_method)
1383{
1384 std::stringstream str;
1385 str << conv_method;
1386 return str.str();
1387}
1388
Alex Gildayc357c472018-03-21 13:54:09 +00001389/** Formatted output of the GPUTarget type.
1390 *
1391 * @param[out] os Output stream
1392 * @param[in] gpu_target Type to output
1393 *
1394 * @return Modified output stream.
1395 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001396inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
1397{
1398 switch(gpu_target)
1399 {
1400 case GPUTarget::GPU_ARCH_MASK:
1401 os << "GPU_ARCH_MASK";
1402 break;
1403 case GPUTarget::MIDGARD:
1404 os << "MIDGARD";
1405 break;
1406 case GPUTarget::BIFROST:
1407 os << "BIFROST";
1408 break;
1409 case GPUTarget::T600:
1410 os << "T600";
1411 break;
1412 case GPUTarget::T700:
1413 os << "T700";
1414 break;
1415 case GPUTarget::T800:
1416 os << "T800";
1417 break;
Michalis Spyroua9676112018-02-22 18:07:43 +00001418 case GPUTarget::G71:
1419 os << "G71";
1420 break;
1421 case GPUTarget::G72:
1422 os << "G72";
1423 break;
1424 case GPUTarget::G51:
1425 os << "G51";
1426 break;
1427 case GPUTarget::G51BIG:
1428 os << "G51BIG";
1429 break;
1430 case GPUTarget::G51LIT:
1431 os << "G51LIT";
1432 break;
1433 case GPUTarget::TNOX:
1434 os << "TNOX";
1435 break;
1436 case GPUTarget::TTRX:
1437 os << "TTRX";
1438 break;
1439 case GPUTarget::TBOX:
1440 os << "TBOX";
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001441 break;
1442 default:
1443 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1444 }
1445
1446 return os;
1447}
1448
Alex Gildayc357c472018-03-21 13:54:09 +00001449/** Formatted output of the GPUTarget type.
1450 *
1451 * @param[in] gpu_target Type to output
1452 *
1453 * @return Formatted string.
1454 */
Isabella Gottardif07d28d2018-02-06 14:52:43 +00001455inline std::string to_string(const GPUTarget &gpu_target)
1456{
1457 std::stringstream str;
1458 str << gpu_target;
1459 return str.str();
1460}
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00001461
John Richardson8de92612018-02-22 14:09:31 +00001462/** Formatted output of the DetectionWindow type.
1463 *
1464 * @param[out] os Output stream
1465 * @param[in] detection_window Type to output
1466 *
1467 * @return Modified output stream.
1468 */
John Richardson684cb0f2018-01-09 11:17:00 +00001469inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
1470{
1471 os << "{x=" << detection_window.x << ","
1472 << "y=" << detection_window.y << ","
1473 << "width=" << detection_window.width << ","
1474 << "height=" << detection_window.height << ","
1475 << "idx_class=" << detection_window.idx_class << ","
1476 << "score=" << detection_window.score << "}";
1477
1478 return os;
1479}
1480
John Richardson8de92612018-02-22 14:09:31 +00001481/** Formatted output of the DetectionWindow type.
1482 *
1483 * @param[in] detection_window Type to output
1484 *
1485 * @return Formatted string.
1486 */
1487inline std::string to_string(const DetectionWindow &detection_window)
1488{
1489 std::stringstream str;
1490 str << detection_window;
1491 return str.str();
1492}
1493
1494/** Formatted output of the Termination type.
1495 *
1496 * @param[out] os Output stream
1497 * @param[in] termination Type to output
1498 *
1499 * @return Modified output stream.
1500 */
1501inline ::std::ostream &operator<<(::std::ostream &os, const Termination &termination)
1502{
1503 switch(termination)
1504 {
1505 case Termination::TERM_CRITERIA_EPSILON:
1506 os << "TERM_CRITERIA_EPSILON";
1507 break;
1508 case Termination::TERM_CRITERIA_ITERATIONS:
1509 os << "TERM_CRITERIA_ITERATIONS";
1510 break;
1511 case Termination::TERM_CRITERIA_BOTH:
1512 os << "TERM_CRITERIA_BOTH";
1513 break;
1514 default:
1515 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1516 }
1517
1518 return os;
1519}
1520
1521/** Formatted output of the Termination type.
1522 *
1523 * @param[in] termination Type to output
1524 *
1525 * @return Formatted string.
1526 */
1527inline std::string to_string(const Termination &termination)
1528{
1529 std::stringstream str;
1530 str << termination;
1531 return str.str();
1532}
1533
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00001534/** Formatted output of the WinogradInfo type. */
1535inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
1536{
1537 os << "{OutputTileSize=" << info.output_tile_size << ","
1538 << "KernelSize=" << info.kernel_size << ","
1539 << "PadStride=" << info.convolution_info << ","
1540 << "OutputDataLayout=" << info.output_data_layout << "}";
1541
1542 return os;
1543}
1544
Gian Marco Iodice247f52c2018-03-22 11:24:56 +00001545inline std::string to_string(const WinogradInfo &type)
1546{
1547 std::stringstream str;
1548 str << type;
1549 return str.str();
1550}
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001551} // namespace arm_compute
John Richardson8de92612018-02-22 14:09:31 +00001552#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */