arm_compute v18.02
[platform/upstream/armcl.git] / utils / TypePrinter.h
1 /*
2  * Copyright (c) 2017-2018 ARM Limited.
3  *
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
27 #include "arm_compute/core/CL/CLTypes.h"
28 #include "arm_compute/core/Dimensions.h"
29 #include "arm_compute/core/Error.h"
30 #include "arm_compute/core/HOGInfo.h"
31 #include "arm_compute/core/Size2D.h"
32 #include "arm_compute/core/Strides.h"
33 #include "arm_compute/core/TensorInfo.h"
34 #include "arm_compute/core/Types.h"
35
36 #include "tests/Types.h"
37
38 #include <ostream>
39 #include <sstream>
40 #include <string>
41
42 namespace arm_compute
43 {
44 /** Formatted output of the Dimensions type. */
45 template <typename T>
46 inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
47 {
48     if(dimensions.num_dimensions() > 0)
49     {
50         os << dimensions[0];
51
52         for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
53         {
54             os << "x" << dimensions[d];
55         }
56     }
57
58     return os;
59 }
60
61 /** Formatted output of the NonLinearFilterFunction type. */
62 inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function)
63 {
64     switch(function)
65     {
66         case NonLinearFilterFunction::MAX:
67             os << "MAX";
68             break;
69         case NonLinearFilterFunction::MEDIAN:
70             os << "MEDIAN";
71             break;
72         case NonLinearFilterFunction::MIN:
73             os << "MIN";
74             break;
75         default:
76             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
77     }
78
79     return os;
80 }
81
82 inline std::string to_string(const NonLinearFilterFunction &function)
83 {
84     std::stringstream str;
85     str << function;
86     return str.str();
87 }
88
89 /** Formatted output of the MatrixPattern type. */
90 inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern)
91 {
92     switch(pattern)
93     {
94         case MatrixPattern::BOX:
95             os << "BOX";
96             break;
97         case MatrixPattern::CROSS:
98             os << "CROSS";
99             break;
100         case MatrixPattern::DISK:
101             os << "DISK";
102             break;
103         case MatrixPattern::OTHER:
104             os << "OTHER";
105             break;
106         default:
107             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
108     }
109
110     return os;
111 }
112
113 inline std::string to_string(const MatrixPattern &pattern)
114 {
115     std::stringstream str;
116     str << pattern;
117     return str.str();
118 }
119
120 /** Formatted output of the RoundingPolicy type. */
121 inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
122 {
123     switch(rounding_policy)
124     {
125         case RoundingPolicy::TO_ZERO:
126             os << "TO_ZERO";
127             break;
128         case RoundingPolicy::TO_NEAREST_UP:
129             os << "TO_NEAREST_UP";
130             break;
131         case RoundingPolicy::TO_NEAREST_EVEN:
132             os << "TO_NEAREST_EVEN";
133             break;
134         default:
135             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
136     }
137
138     return os;
139 }
140
141 /** Formatted output of the WeightsInfo type. */
142 inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
143 {
144     os << weights_info.are_reshaped() << ";";
145     os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
146
147     return os;
148 }
149
150 /** Formatted output of the ROIPoolingInfo type. */
151 inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
152 {
153     os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
154     return os;
155 }
156
157 /** Formatted output of the QuantizationInfo type. */
158 inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &quantization_info)
159 {
160     os << "Scale:" << quantization_info.scale << "~"
161        << "Offset:" << quantization_info.offset;
162     return os;
163 }
164
165 inline std::string to_string(const QuantizationInfo &quantization_info)
166 {
167     std::stringstream str;
168     str << quantization_info;
169     return str.str();
170 }
171
172 inline ::std::ostream &operator<<(::std::ostream &os, const FixedPointOp &op)
173 {
174     switch(op)
175     {
176         case FixedPointOp::ADD:
177             os << "ADD";
178             break;
179         case FixedPointOp::SUB:
180             os << "SUB";
181             break;
182         case FixedPointOp::MUL:
183             os << "MUL";
184             break;
185         case FixedPointOp::EXP:
186             os << "EXP";
187             break;
188         case FixedPointOp::LOG:
189             os << "LOG";
190             break;
191         case FixedPointOp::INV_SQRT:
192             os << "INV_SQRT";
193             break;
194         case FixedPointOp::RECIPROCAL:
195             os << "RECIPROCAL";
196             break;
197         default:
198             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
199     }
200
201     return os;
202 }
203
204 inline std::string to_string(const FixedPointOp &op)
205 {
206     std::stringstream str;
207     str << op;
208     return str.str();
209 }
210
211 /** Formatted output of the activation function type. */
212 inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
213 {
214     switch(act_function)
215     {
216         case ActivationLayerInfo::ActivationFunction::ABS:
217             os << "ABS";
218             break;
219         case ActivationLayerInfo::ActivationFunction::LINEAR:
220             os << "LINEAR";
221             break;
222         case ActivationLayerInfo::ActivationFunction::LOGISTIC:
223             os << "LOGISTIC";
224             break;
225         case ActivationLayerInfo::ActivationFunction::RELU:
226             os << "RELU";
227             break;
228         case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
229             os << "BOUNDED_RELU";
230             break;
231         case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
232             os << "LEAKY_RELU";
233             break;
234         case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
235             os << "SOFT_RELU";
236             break;
237         case ActivationLayerInfo::ActivationFunction::SQRT:
238             os << "SQRT";
239             break;
240         case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
241             os << "LU_BOUNDED_RELU";
242             break;
243         case ActivationLayerInfo::ActivationFunction::SQUARE:
244             os << "SQUARE";
245             break;
246         case ActivationLayerInfo::ActivationFunction::TANH:
247             os << "TANH";
248             break;
249         default:
250             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
251     }
252
253     return os;
254 }
255
256 inline std::string to_string(const arm_compute::ActivationLayerInfo &info)
257 {
258     std::stringstream str;
259     str << info.activation();
260     return str.str();
261 }
262
263 inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function)
264 {
265     std::stringstream str;
266     str << function;
267     return str.str();
268 }
269
270 /** Formatted output of the NormType type. */
271 inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
272 {
273     switch(norm_type)
274     {
275         case NormType::CROSS_MAP:
276             os << "CROSS_MAP";
277             break;
278         case NormType::IN_MAP_1D:
279             os << "IN_MAP_1D";
280             break;
281         case NormType::IN_MAP_2D:
282             os << "IN_MAP_2D";
283             break;
284         default:
285             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
286     }
287
288     return os;
289 }
290
291 inline std::string to_string(const arm_compute::NormalizationLayerInfo &info)
292 {
293     std::stringstream str;
294     str << info.type() << ":NormSize=" << info.norm_size();
295     return str.str();
296 }
297
298 /** Formatted output of @ref NormalizationLayerInfo. */
299 inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
300 {
301     os << info.type() << ":NormSize=" << info.norm_size();
302     return os;
303 }
304
305 /** Formatted output of the PoolingType type. */
306 inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
307 {
308     switch(pool_type)
309     {
310         case PoolingType::AVG:
311             os << "AVG";
312             break;
313         case PoolingType::MAX:
314             os << "MAX";
315             break;
316         case PoolingType::L2:
317             os << "L2";
318             break;
319         default:
320             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
321     }
322
323     return os;
324 }
325
326 /** Formatted output of @ref PoolingLayerInfo. */
327 inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
328 {
329     os << info.pool_type();
330
331     return os;
332 }
333
334 inline std::string to_string(const RoundingPolicy &rounding_policy)
335 {
336     std::stringstream str;
337     str << rounding_policy;
338     return str.str();
339 }
340
341 /** Formatted output of the DataType type. */
342 inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
343 {
344     switch(data_type)
345     {
346         case DataType::UNKNOWN:
347             os << "UNKNOWN";
348             break;
349         case DataType::U8:
350             os << "U8";
351             break;
352         case DataType::QS8:
353             os << "QS8";
354             break;
355         case DataType::QASYMM8:
356             os << "QASYMM8";
357             break;
358         case DataType::S8:
359             os << "S8";
360             break;
361         case DataType::U16:
362             os << "U16";
363             break;
364         case DataType::S16:
365             os << "S16";
366             break;
367         case DataType::QS16:
368             os << "QS16";
369             break;
370         case DataType::U32:
371             os << "U32";
372             break;
373         case DataType::S32:
374             os << "S32";
375             break;
376         case DataType::U64:
377             os << "U64";
378             break;
379         case DataType::S64:
380             os << "S64";
381             break;
382         case DataType::F16:
383             os << "F16";
384             break;
385         case DataType::F32:
386             os << "F32";
387             break;
388         case DataType::F64:
389             os << "F64";
390             break;
391         case DataType::SIZET:
392             os << "SIZET";
393             break;
394         default:
395             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
396     }
397
398     return os;
399 }
400
401 inline std::string to_string(const arm_compute::DataType &data_type)
402 {
403     std::stringstream str;
404     str << data_type;
405     return str.str();
406 }
407
408 /** Formatted output of the Format type. */
409 inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
410 {
411     switch(format)
412     {
413         case Format::UNKNOWN:
414             os << "UNKNOWN";
415             break;
416         case Format::U8:
417             os << "U8";
418             break;
419         case Format::S16:
420             os << "S16";
421             break;
422         case Format::U16:
423             os << "U16";
424             break;
425         case Format::S32:
426             os << "S32";
427             break;
428         case Format::U32:
429             os << "U32";
430             break;
431         case Format::F16:
432             os << "F16";
433             break;
434         case Format::F32:
435             os << "F32";
436             break;
437         case Format::UV88:
438             os << "UV88";
439             break;
440         case Format::RGB888:
441             os << "RGB888";
442             break;
443         case Format::RGBA8888:
444             os << "RGBA8888";
445             break;
446         case Format::YUV444:
447             os << "YUV444";
448             break;
449         case Format::YUYV422:
450             os << "YUYV422";
451             break;
452         case Format::NV12:
453             os << "NV12";
454             break;
455         case Format::NV21:
456             os << "NV21";
457             break;
458         case Format::IYUV:
459             os << "IYUV";
460             break;
461         case Format::UYVY422:
462             os << "UYVY422";
463             break;
464         default:
465             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
466     }
467
468     return os;
469 }
470
471 inline std::string to_string(const Format &format)
472 {
473     std::stringstream str;
474     str << format;
475     return str.str();
476 }
477
478 /** Formatted output of the Channel type. */
479 inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
480 {
481     switch(channel)
482     {
483         case Channel::UNKNOWN:
484             os << "UNKNOWN";
485             break;
486         case Channel::C0:
487             os << "C0";
488             break;
489         case Channel::C1:
490             os << "C1";
491             break;
492         case Channel::C2:
493             os << "C2";
494             break;
495         case Channel::C3:
496             os << "C3";
497             break;
498         case Channel::R:
499             os << "R";
500             break;
501         case Channel::G:
502             os << "G";
503             break;
504         case Channel::B:
505             os << "B";
506             break;
507         case Channel::A:
508             os << "A";
509             break;
510         case Channel::Y:
511             os << "Y";
512             break;
513         case Channel::U:
514             os << "U";
515             break;
516         case Channel::V:
517             os << "V";
518             break;
519         default:
520             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
521     }
522
523     return os;
524 }
525
526 inline std::string to_string(const Channel &channel)
527 {
528     std::stringstream str;
529     str << channel;
530     return str.str();
531 }
532
533 /** Formatted output of the BorderMode type. */
534 inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
535 {
536     switch(mode)
537     {
538         case BorderMode::UNDEFINED:
539             os << "UNDEFINED";
540             break;
541         case BorderMode::CONSTANT:
542             os << "CONSTANT";
543             break;
544         case BorderMode::REPLICATE:
545             os << "REPLICATE";
546             break;
547         default:
548             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
549     }
550
551     return os;
552 }
553
554 /** Formatted output of the BorderSize type. */
555 inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
556 {
557     os << border.top << ","
558        << border.right << ","
559        << border.bottom << ","
560        << border.left;
561
562     return os;
563 }
564
565 /** Formatted output of the InterpolationPolicy type. */
566 inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
567 {
568     switch(policy)
569     {
570         case InterpolationPolicy::NEAREST_NEIGHBOR:
571             os << "NEAREST_NEIGHBOR";
572             break;
573         case InterpolationPolicy::BILINEAR:
574             os << "BILINEAR";
575             break;
576         case InterpolationPolicy::AREA:
577             os << "AREA";
578             break;
579         default:
580             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
581     }
582
583     return os;
584 }
585
586 /** Formatted output of the SamplingPolicy type. */
587 inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
588 {
589     switch(policy)
590     {
591         case SamplingPolicy::CENTER:
592             os << "CENTER";
593             break;
594         case SamplingPolicy::TOP_LEFT:
595             os << "TOP_LEFT";
596             break;
597         default:
598             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
599     }
600
601     return os;
602 }
603
604 /** Formatted output of the TensorInfo type. */
605 inline std::string to_string(const TensorInfo &info)
606 {
607     std::stringstream str;
608     str << "{Shape=" << info.tensor_shape() << ","
609         << "Type=" << info.data_type() << ","
610         << "Channels=" << info.num_channels() << ","
611         << "FixedPointPos=" << info.fixed_point_position() << "}";
612     return str.str();
613 }
614
615 template <typename T>
616 inline std::string to_string(const Dimensions<T> &dimensions)
617 {
618     std::stringstream str;
619     str << dimensions;
620     return str.str();
621 }
622
623 inline std::string to_string(const Strides &stride)
624 {
625     std::stringstream str;
626     str << stride;
627     return str.str();
628 }
629
630 /** Formatted output of the TensorShape type. */
631 inline std::string to_string(const TensorShape &shape)
632 {
633     std::stringstream str;
634     str << shape;
635     return str.str();
636 }
637
638 /** Formatted output of the Coordinates type. */
639 inline std::string to_string(const Coordinates &coord)
640 {
641     std::stringstream str;
642     str << coord;
643     return str.str();
644 }
645
646 /** Formatted output of the Rectangle type. */
647 inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
648 {
649     os << rect.width << "x" << rect.height;
650     os << "+" << rect.x << "+" << rect.y;
651
652     return os;
653 }
654
655 /** Formatted output of the PadStridInfo type. */
656 inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
657 {
658     os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
659     os << ";";
660     os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
661        << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
662
663     return os;
664 }
665
666 inline std::string to_string(const PadStrideInfo &pad_stride_info)
667 {
668     std::stringstream str;
669     str << pad_stride_info;
670     return str.str();
671 }
672
673 inline std::string to_string(const BorderMode &mode)
674 {
675     std::stringstream str;
676     str << mode;
677     return str.str();
678 }
679
680 inline std::string to_string(const BorderSize &border)
681 {
682     std::stringstream str;
683     str << border;
684     return str.str();
685 }
686
687 inline std::string to_string(const InterpolationPolicy &policy)
688 {
689     std::stringstream str;
690     str << policy;
691     return str.str();
692 }
693
694 inline std::string to_string(const SamplingPolicy &policy)
695 {
696     std::stringstream str;
697     str << policy;
698     return str.str();
699 }
700
701 /** Formatted output of the ConversionPolicy type. */
702 inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
703 {
704     switch(policy)
705     {
706         case ConvertPolicy::WRAP:
707             os << "WRAP";
708             break;
709         case ConvertPolicy::SATURATE:
710             os << "SATURATE";
711             break;
712         default:
713             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
714     }
715
716     return os;
717 }
718
719 inline std::string to_string(const ConvertPolicy &policy)
720 {
721     std::stringstream str;
722     str << policy;
723     return str.str();
724 }
725
726 /** Formatted output of the Reduction Operations. */
727 inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
728 {
729     switch(op)
730     {
731         case ReductionOperation::SUM_SQUARE:
732             os << "SUM_SQUARE";
733             break;
734         default:
735             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
736     }
737
738     return os;
739 }
740
741 inline std::string to_string(const ReductionOperation &op)
742 {
743     std::stringstream str;
744     str << op;
745     return str.str();
746 }
747
748 inline std::string to_string(const NormType &type)
749 {
750     std::stringstream str;
751     str << type;
752     return str.str();
753 }
754
755 inline std::string to_string(const PoolingType &type)
756 {
757     std::stringstream str;
758     str << type;
759     return str.str();
760 }
761
762 inline std::string to_string(const PoolingLayerInfo &info)
763 {
764     std::stringstream str;
765     str << "{Type=" << info.pool_type() << ","
766         << "IsGlobalPooling=" << info.is_global_pooling();
767     if(!info.is_global_pooling())
768     {
769         str << ","
770             << "PoolSize=" << info.pool_size().width << "," << info.pool_size().height << ","
771             << "PadStride=" << info.pad_stride_info();
772     }
773     str << "}";
774     return str.str();
775 }
776
777 /** Formatted output of the KeyPoint type. */
778 inline ::std::ostream &operator<<(::std::ostream &os, const KeyPoint &point)
779 {
780     os << "{x=" << point.x << ","
781        << "y=" << point.y << ","
782        << "strength=" << point.strength << ","
783        << "scale=" << point.scale << ","
784        << "orientation=" << point.orientation << ","
785        << "tracking_status=" << point.tracking_status << ","
786        << "error=" << point.error << "}";
787
788     return os;
789 }
790
791 /** Formatted output of the PhaseType type. */
792 inline ::std::ostream &operator<<(::std::ostream &os, const PhaseType &phase_type)
793 {
794     switch(phase_type)
795     {
796         case PhaseType::SIGNED:
797             os << "SIGNED";
798             break;
799         case PhaseType::UNSIGNED:
800             os << "UNSIGNED";
801             break;
802         default:
803             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
804     }
805
806     return os;
807 }
808
809 inline std::string to_string(const arm_compute::PhaseType &type)
810 {
811     std::stringstream str;
812     str << type;
813     return str.str();
814 }
815
816 /** Formatted output of the MagnitudeType type. */
817 inline ::std::ostream &operator<<(::std::ostream &os, const MagnitudeType &magnitude_type)
818 {
819     switch(magnitude_type)
820     {
821         case MagnitudeType::L1NORM:
822             os << "L1NORM";
823             break;
824         case MagnitudeType::L2NORM:
825             os << "L2NORM";
826             break;
827         default:
828             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
829     }
830
831     return os;
832 }
833
834 inline std::string to_string(const arm_compute::MagnitudeType &type)
835 {
836     std::stringstream str;
837     str << type;
838     return str.str();
839 }
840
841 /** Formatted output of the GradientDimension type. */
842 inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim)
843 {
844     switch(dim)
845     {
846         case GradientDimension::GRAD_X:
847             os << "GRAD_X";
848             break;
849         case GradientDimension::GRAD_Y:
850             os << "GRAD_Y";
851             break;
852         case GradientDimension::GRAD_XY:
853             os << "GRAD_XY";
854             break;
855         default:
856             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
857     }
858
859     return os;
860 }
861
862 inline std::string to_string(const arm_compute::GradientDimension &type)
863 {
864     std::stringstream str;
865     str << type;
866     return str.str();
867 }
868
869 /** Formatted output of the HOGNormType type. */
870 inline ::std::ostream &operator<<(::std::ostream &os, const HOGNormType &norm_type)
871 {
872     switch(norm_type)
873     {
874         case HOGNormType::L1_NORM:
875             os << "L1_NORM";
876             break;
877         case HOGNormType::L2_NORM:
878             os << "L2_NORM";
879             break;
880         case HOGNormType::L2HYS_NORM:
881             os << "L2HYS_NORM";
882             break;
883         default:
884             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
885     }
886
887     return os;
888 }
889
890 inline std::string to_string(const HOGNormType &type)
891 {
892     std::stringstream str;
893     str << type;
894     return str.str();
895 }
896
897 /** Formatted output of the Size2D type. */
898 inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
899 {
900     os << size.width << "x" << size.height;
901
902     return os;
903 }
904
905 inline std::string to_string(const Size2D &type)
906 {
907     std::stringstream str;
908     str << type;
909     return str.str();
910 }
911
912 /** Formatted output of the Size2D type. */
913 inline ::std::ostream &operator<<(::std::ostream &os, const HOGInfo &hog_info)
914 {
915     os << "{CellSize=" << hog_info.cell_size() << ","
916        << "BlockSize=" << hog_info.block_size() << ","
917        << "DetectionWindowSize=" << hog_info.detection_window_size() << ","
918        << "BlockStride=" << hog_info.block_stride() << ","
919        << "NumBins=" << hog_info.num_bins() << ","
920        << "NormType=" << hog_info.normalization_type() << ","
921        << "L2HystThreshold=" << hog_info.l2_hyst_threshold() << ","
922        << "PhaseType=" << hog_info.phase_type() << "}";
923
924     return os;
925 }
926
927 /** Formatted output of the HOGInfo type. */
928 inline std::string to_string(const HOGInfo &type)
929 {
930     std::stringstream str;
931     str << type;
932     return str.str();
933 }
934
935 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
936 {
937     switch(conv_method)
938     {
939         case ConvolutionMethod::GEMM:
940             os << "GEMM";
941             break;
942         case ConvolutionMethod::DIRECT:
943             os << "DIRECT";
944             break;
945         case ConvolutionMethod::WINOGRAD:
946             os << "WINOGRAD";
947             break;
948         default:
949             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
950     }
951
952     return os;
953 }
954
955 inline std::string to_string(const ConvolutionMethod &conv_method)
956 {
957     std::stringstream str;
958     str << conv_method;
959     return str.str();
960 }
961
962 inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
963 {
964     switch(gpu_target)
965     {
966         case GPUTarget::GPU_ARCH_MASK:
967             os << "GPU_ARCH_MASK";
968             break;
969         case GPUTarget::MIDGARD:
970             os << "MIDGARD";
971             break;
972         case GPUTarget::BIFROST:
973             os << "BIFROST";
974             break;
975         case GPUTarget::T600:
976             os << "T600";
977             break;
978         case GPUTarget::T700:
979             os << "T700";
980             break;
981         case GPUTarget::T800:
982             os << "T800";
983             break;
984         case GPUTarget::G70:
985             os << "G70";
986             break;
987         default:
988             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
989     }
990
991     return os;
992 }
993
994 inline std::string to_string(const GPUTarget &gpu_target)
995 {
996     std::stringstream str;
997     str << gpu_target;
998     return str.str();
999 }
1000 } // namespace arm_compute
1001 #endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */