Compute Library
 21.11
TypePrinter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2021 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_TYPE_PRINTER_H__
25 #define __ARM_COMPUTE_TYPE_PRINTER_H__
26 
27 #ifdef ARM_COMPUTE_OPENCL_ENABLED
29 #endif /* ARM_COMPUTE_OPENCL_ENABLED */
30 
32 #include "arm_compute/core/Error.h"
38 #include "arm_compute/core/Types.h"
45 #include "support/Cast.h"
46 #include "support/StringSupport.h"
47 #include <ostream>
48 #include <sstream>
49 #include <string>
50 
51 namespace arm_compute
52 {
53 /** Formatted output if arg is not null
54  *
55  * @param[in] arg Object to print
56  *
57  * @return String representing arg.
58  */
59 template <typename T>
60 std::string to_string_if_not_null(T *arg)
61 {
62  if(arg == nullptr)
63  {
64  return "nullptr";
65  }
66  else
67  {
68  return to_string(*arg);
69  }
70 }
71 
72 /** Fallback method: try to use std::to_string:
73  *
74  * @param[in] val Value to convert to string
75  *
76  * @return String representing val.
77  */
78 template <typename T>
79 inline std::string to_string(const T &val)
80 {
81  return support::cpp11::to_string(val);
82 }
83 
84 /** Formatted output of a vector of objects.
85  *
86  * @note: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are
87  * overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
88  *
89  * @param[out] os Output stream
90  * @param[in] args Vector of objects to print
91  *
92  * @return Modified output stream.
93  */
94 template <typename T>
95 ::std::ostream &operator<<(::std::ostream &os, const std::vector<T> &args)
96 {
97  const size_t max_print_size = 5U;
98 
99  os << "[";
100  bool first = true;
101  size_t i;
102  for(i = 0; i < args.size(); ++i)
103  {
104  if(i == max_print_size)
105  {
106  break;
107  }
108  if(first)
109  {
110  first = false;
111  }
112  else
113  {
114  os << ", ";
115  }
116  os << to_string(args[i]);
117  }
118  if(i < args.size())
119  {
120  os << ", ...";
121  }
122  os << "]";
123  return os;
124 }
125 
126 /** Formatted output of a vector of objects.
127  *
128  * @param[in] args Vector of objects to print
129  *
130  * @return String representing args.
131  */
132 template <typename T>
133 std::string to_string(const std::vector<T> &args)
134 {
135  std::stringstream str;
136  str << args;
137  return str.str();
138 }
139 
140 /** @name (EXPERIMENTAL_POST_OPS)
141  * @{
142  */
143 /** Formmated output of the @ref experimental::PostOpType type
144  *
145  * @param[out] os Output stream.
146  * @param[in] post_op_type Type to output.
147  *
148  * @return Modified output stream.
149  */
150 inline ::std::ostream &operator<<(::std::ostream &os, experimental::PostOpType post_op_type)
151 {
152  os << "type=";
153  switch(post_op_type)
154  {
156  {
157  os << "Activation";
158  break;
159  }
161  {
162  os << "Eltwise_Add";
163  break;
164  }
166  {
167  os << "Eltwise_PRelu";
168  break;
169  }
170  default:
171  {
172  ARM_COMPUTE_ERROR("Unsupported PostOpType");
173  break;
174  }
175  }
176  return os;
177 }
178 /** Converts a @ref experimental::PostOpType to string
179  *
180  * @param[in] post_op_type PostOpType value to be converted
181  *
182  * @return String representing the corresponding PostOpType
183  */
184 inline std::string to_string(experimental::PostOpType post_op_type)
185 {
186  std::stringstream str;
187  str << post_op_type;
188  return str.str();
189 }
190 /** Formatted output of the @ref experimental::IPostOp type.
191  *
192  * @param[out] os Output stream.
193  * @param[in] post_op Type to output.
194  *
195  * @return Modified output stream.
196  */
197 template <typename T>
198 inline ::std::ostream &operator<<(::std::ostream &os, const experimental::IPostOp<T> &post_op)
199 {
200  os << "<";
201  os << post_op.type() << ",";
202  os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
203  switch(post_op.type())
204  {
206  {
207  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
208  os << "act_info=" << &(_post_op->_act_info);
209  break;
210  }
212  {
213  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
214  os << "convert_policy=" << _post_op->_policy;
215  break;
216  }
218  {
219  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
220  os << "convert_policy=" << _post_op->_policy;
221  break;
222  }
223  default:
224  {
225  ARM_COMPUTE_ERROR("Unsupported PostOpType");
226  break;
227  }
228  }
229  os << ">";
230  return os;
231 }
232 /** Converts an @ref experimental::IPostOp to string
233  *
234  * @param[in] post_op IPostOp value to be converted
235  *
236  * @return String representing the corresponding IPostOp
237  */
238 template <typename T>
239 inline std::string to_string(const experimental::IPostOp<T> &post_op)
240 {
241  std::stringstream str;
242  str << post_op;
243  return str.str();
244 }
245 /** Formatted output of the @ref experimental::PostOpList type.
246  *
247  * @param[out] os Output stream.
248  * @param[in] post_ops Type to output.
249  *
250  * @return Modified output stream.
251  */
252 template <typename T>
253 inline ::std::ostream &operator<<(::std::ostream &os, const experimental::PostOpList<T> &post_ops)
254 {
255  os << "[";
256  for(const auto &post_op : post_ops.get_list())
257  {
258  os << *post_op << ",";
259  }
260  os << "]";
261  return os;
262 }
263 /** Converts a @ref experimental::PostOpList to string
264  *
265  * @param[in] post_ops PostOpList value to be converted
266  *
267  * @return String representing the corresponding PostOpList
268  */
269 template <typename T>
271 {
272  std::stringstream str;
273  str << post_ops;
274  return str.str();
275 }
276 /** @} */ // end of group (EXPERIMENTAL_POST_OPS)
277 
278 /** Formatted output of the Dimensions type.
279  *
280  * @param[out] os Output stream.
281  * @param[in] dimensions Type to output.
282  *
283  * @return Modified output stream.
284  */
285 template <typename T>
286 inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions<T> &dimensions)
287 {
288  if(dimensions.num_dimensions() > 0)
289  {
290  os << dimensions[0];
291 
292  for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
293  {
294  os << "," << dimensions[d];
295  }
296  }
297 
298  return os;
299 }
300 
301 /** Formatted output of the RoundingPolicy type.
302  *
303  * @param[out] os Output stream.
304  * @param[in] rounding_policy Type to output.
305  *
306  * @return Modified output stream.
307  */
308 inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy)
309 {
310  switch(rounding_policy)
311  {
313  os << "TO_ZERO";
314  break;
316  os << "TO_NEAREST_UP";
317  break;
319  os << "TO_NEAREST_EVEN";
320  break;
321  default:
322  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
323  }
324 
325  return os;
326 }
327 
328 /** Formatted output of the WeightsInfo type.
329  *
330  * @param[out] os Output stream.
331  * @param[in] weights_info Type to output.
332  *
333  * @return Modified output stream.
334  */
335 inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info)
336 {
337  os << weights_info.are_reshaped() << ";";
338  os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
339 
340  return os;
341 }
342 
343 /** Formatted output of the ROIPoolingInfo type.
344  *
345  * @param[out] os Output stream.
346  * @param[in] pool_info Type to output.
347  *
348  * @return Modified output stream.
349  */
350 inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
351 {
352  os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
353  return os;
354 }
355 
356 /** Formatted output of the ROIPoolingInfo type.
357  *
358  * @param[in] pool_info Type to output.
359  *
360  * @return Formatted string.
361  */
362 inline std::string to_string(const ROIPoolingLayerInfo &pool_info)
363 {
364  std::stringstream str;
365  str << pool_info;
366  return str.str();
367 }
368 
369 /** Formatted output of the GEMMKernelInfo type.
370  *
371  * @param[out] os Output stream.
372  * @param[in] gemm_info Type to output.
373  *
374  * @return Modified output stream.
375  */
376 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMKernelInfo &gemm_info)
377 {
378  os << "( m=" << gemm_info.m;
379  os << " n=" << gemm_info.n;
380  os << " k=" << gemm_info.k;
381  os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
382  os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
383  os << " broadcast_bias=" << gemm_info.broadcast_bias;
384  os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
385  os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
386  os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
387  os << " a_offset=" << gemm_info.a_offset;
388  os << " b_offset=" << gemm_info.b_offset;
389  os << "post_ops=" << gemm_info.post_ops;
390  os << ")";
391  return os;
392 }
393 
394 /** Formatted output of the GEMMLHSMatrixInfo type.
395  *
396  * @param[out] os Output stream.
397  * @param[in] gemm_info Type to output.
398  *
399  * @return Modified output stream.
400  */
401 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
402 {
403  os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
404  return os;
405 }
406 
407 /** Formatted output of the GEMMRHSMatrixInfo type.
408  *
409  * @param[out] os Output stream.
410  * @param[in] gemm_info Type to output.
411  *
412  * @return Modified output stream.
413  */
414 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
415 {
416  os << "( n0=" << (unsigned int)gemm_info.n0 << " k0=" << gemm_info.k0 << " h0=" << gemm_info.h0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << " exp_img=" <<
417  gemm_info.export_to_cl_image << "})";
418  return os;
419 }
420 
421 /** Formatted output of the GEMMRHSMatrixInfo type.
422  *
423  * @param[in] gemm_info GEMMRHSMatrixInfo to output.
424  *
425  * @return Formatted string.
426  */
427 inline std::string to_string(const GEMMRHSMatrixInfo &gemm_info)
428 {
429  std::stringstream str;
430  str << gemm_info;
431  return str.str();
432 }
433 
434 /** Formatted output of the GEMMLHSMatrixInfo type.
435  *
436  * @param[in] gemm_info GEMMLHSMatrixInfo to output.
437  *
438  * @return Formatted string.
439  */
440 inline std::string to_string(const GEMMLHSMatrixInfo &gemm_info)
441 {
442  std::stringstream str;
443  str << gemm_info;
444  return str.str();
445 }
446 
447 /** Formatted output of the GEMMKernelInfo type.
448  *
449  * @param[in] gemm_info GEMMKernelInfo Type to output.
450  *
451  * @return Formatted string.
452  */
453 inline std::string to_string(const GEMMKernelInfo &gemm_info)
454 {
455  std::stringstream str;
456  str << gemm_info;
457  return str.str();
458 }
459 
460 /** Formatted output of the BoundingBoxTransformInfo type.
461  *
462  * @param[out] os Output stream.
463  * @param[in] bbox_info Type to output.
464  *
465  * @return Modified output stream.
466  */
467 inline ::std::ostream &operator<<(::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
468 {
469  auto weights = bbox_info.weights();
470  os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
471  "})";
472  return os;
473 }
474 
475 /** Formatted output of the BoundingBoxTransformInfo type.
476  *
477  * @param[in] bbox_info Type to output.
478  *
479  * @return Formatted string.
480  */
481 inline std::string to_string(const BoundingBoxTransformInfo &bbox_info)
482 {
483  std::stringstream str;
484  str << bbox_info;
485  return str.str();
486 }
487 
488 /** Formatted output of the ComputeAnchorsInfo type.
489  *
490  * @param[out] os Output stream.
491  * @param[in] anchors_info Type to output.
492  *
493  * @return Modified output stream.
494  */
495 inline ::std::ostream &operator<<(::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
496 {
497  os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
498  return os;
499 }
500 
501 /** Formatted output of the ComputeAnchorsInfo type.
502  *
503  * @param[in] anchors_info Type to output.
504  *
505  * @return Formatted string.
506  */
507 inline std::string to_string(const ComputeAnchorsInfo &anchors_info)
508 {
509  std::stringstream str;
510  str << anchors_info;
511  return str.str();
512 }
513 
514 /** Formatted output of the GenerateProposalsInfo type.
515  *
516  * @param[out] os Output stream.
517  * @param[in] proposals_info Type to output.
518  *
519  * @return Modified output stream.
520  */
521 inline ::std::ostream &operator<<(::std::ostream &os, const GenerateProposalsInfo &proposals_info)
522 {
523  os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
524  return os;
525 }
526 
527 /** Formatted output of the GenerateProposalsInfo type.
528  *
529  * @param[in] proposals_info Type to output.
530  *
531  * @return Formatted string.
532  */
533 inline std::string to_string(const GenerateProposalsInfo &proposals_info)
534 {
535  std::stringstream str;
536  str << proposals_info;
537  return str.str();
538 }
539 
540 /** Formatted output of the QuantizationInfo type.
541  *
542  * @param[out] os Output stream.
543  * @param[in] qinfo Type to output.
544  *
545  * @return Modified output stream.
546  */
547 inline ::std::ostream &operator<<(::std::ostream &os, const QuantizationInfo &qinfo)
548 {
549  const UniformQuantizationInfo uqinfo = qinfo.uniform();
550  os << "Scale:" << uqinfo.scale << "~";
551  os << "Offset:" << uqinfo.offset;
552  return os;
553 }
554 
555 /** Formatted output of the QuantizationInfo type.
556  *
557  * @param[in] quantization_info Type to output.
558  *
559  * @return Formatted string.
560  */
561 inline std::string to_string(const QuantizationInfo &quantization_info)
562 {
563  std::stringstream str;
564  str << quantization_info;
565  return str.str();
566 }
567 
568 /** Formatted output of the activation function type.
569  *
570  * @param[out] os Output stream.
571  * @param[in] act_function Type to output.
572  *
573  * @return Modified output stream.
574  */
575 inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
576 {
577  switch(act_function)
578  {
580  os << "ABS";
581  break;
583  os << "LINEAR";
584  break;
586  os << "LOGISTIC";
587  break;
589  os << "RELU";
590  break;
592  os << "BOUNDED_RELU";
593  break;
595  os << "LEAKY_RELU";
596  break;
598  os << "SOFT_RELU";
599  break;
601  os << "SQRT";
602  break;
604  os << "LU_BOUNDED_RELU";
605  break;
607  os << "ELU";
608  break;
610  os << "SQUARE";
611  break;
613  os << "TANH";
614  break;
616  os << "IDENTITY";
617  break;
619  os << "HARD_SWISH";
620  break;
621 
622  default:
623  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
624  }
625 
626  return os;
627 }
628 
629 /** Formatted output of the activation function info type.
630  *
631  * @param[in] info ActivationLayerInfo to output.
632  *
633  * @return Formatted string.
634  */
636 {
637  std::stringstream str;
638  if(info.enabled())
639  {
640  str << info.activation();
641  }
642  return str.str();
643 }
644 
645 /** Formatted output of the activation function info.
646  *
647  * @param[out] os Output stream.
648  * @param[in] info ActivationLayerInfo to output.
649  *
650  * @return Formatted string.
651  */
652 inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo *info)
653 {
654  if(info != nullptr)
655  {
656  if(info->enabled())
657  {
658  os << info->activation();
659  os << "(";
660  os << "VAL_A=" << info->a() << ",";
661  os << "VAL_B=" << info->b();
662  os << ")";
663  }
664  else
665  {
666  os << "disabled";
667  }
668  }
669  else
670  {
671  os << "nullptr";
672  }
673  return os;
674 }
675 
676 /** Formatted output of the activation function type.
677  *
678  * @param[in] function Type to output.
679  *
680  * @return Formatted string.
681  */
683 {
684  std::stringstream str;
685  str << function;
686  return str.str();
687 }
688 
689 /** Formatted output of the NormType type.
690  *
691  * @param[out] os Output stream.
692  * @param[in] norm_type Type to output.
693  *
694  * @return Modified output stream.
695  */
696 inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type)
697 {
698  switch(norm_type)
699  {
700  case NormType::CROSS_MAP:
701  os << "CROSS_MAP";
702  break;
703  case NormType::IN_MAP_1D:
704  os << "IN_MAP_1D";
705  break;
706  case NormType::IN_MAP_2D:
707  os << "IN_MAP_2D";
708  break;
709  default:
710  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
711  }
712 
713  return os;
714 }
715 
716 /** Formatted output of @ref NormalizationLayerInfo.
717  *
718  * @param[in] info Type to output.
719  *
720  * @return Formatted string.
721  */
723 {
724  std::stringstream str;
725  str << info.type() << ":NormSize=" << info.norm_size();
726  return str.str();
727 }
728 
729 /** Formatted output of @ref NormalizationLayerInfo.
730  *
731  * @param[out] os Output stream.
732  * @param[in] info Type to output.
733  *
734  * @return Modified output stream.
735  */
736 inline ::std::ostream &operator<<(::std::ostream &os, const NormalizationLayerInfo &info)
737 {
738  os << info.type() << ":NormSize=" << info.norm_size();
739  return os;
740 }
741 
742 /** Formatted output of the PoolingType type.
743  *
744  * @param[out] os Output stream.
745  * @param[in] pool_type Type to output.
746  *
747  * @return Modified output stream.
748  */
749 inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type)
750 {
751  switch(pool_type)
752  {
753  case PoolingType::AVG:
754  os << "AVG";
755  break;
756  case PoolingType::MAX:
757  os << "MAX";
758  break;
759  case PoolingType::L2:
760  os << "L2";
761  break;
762  default:
763  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
764  }
765 
766  return os;
767 }
768 
769 /** Formatted output of @ref PoolingLayerInfo.
770  *
771  * @param[out] os Output stream.
772  * @param[in] info Type to output.
773  *
774  * @return Modified output stream.
775  */
776 inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info)
777 {
778  os << info.pool_type;
779 
780  return os;
781 }
782 
783 /** Formatted output of @ref RoundingPolicy.
784  *
785  * @param[in] rounding_policy Type to output.
786  *
787  * @return Formatted string.
788  */
789 inline std::string to_string(const RoundingPolicy &rounding_policy)
790 {
791  std::stringstream str;
792  str << rounding_policy;
793  return str.str();
794 }
795 
796 /** [Print DataLayout type] **/
797 /** Formatted output of the DataLayout type.
798  *
799  * @param[out] os Output stream.
800  * @param[in] data_layout Type to output.
801  *
802  * @return Modified output stream.
803  */
804 inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_layout)
805 {
806  switch(data_layout)
807  {
808  case DataLayout::UNKNOWN:
809  os << "UNKNOWN";
810  break;
811  case DataLayout::NHWC:
812  os << "NHWC";
813  break;
814  case DataLayout::NCHW:
815  os << "NCHW";
816  break;
817  case DataLayout::NDHWC:
818  os << "NDHWC";
819  break;
820  case DataLayout::NCDHW:
821  os << "NCDHW";
822  break;
823  default:
824  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
825  }
826 
827  return os;
828 }
829 
830 /** Formatted output of the DataLayout type.
831  *
832  * @param[in] data_layout Type to output.
833  *
834  * @return Formatted string.
835  */
837 {
838  std::stringstream str;
839  str << data_layout;
840  return str.str();
841 }
842 /** [Print DataLayout type] **/
843 
844 /** Formatted output of the DataLayoutDimension type.
845  *
846  * @param[out] os Output stream.
847  * @param[in] data_layout_dim Data layout dimension to print.
848  *
849  * @return Modified output stream.
850  */
851 inline ::std::ostream &operator<<(::std::ostream &os, const DataLayoutDimension &data_layout_dim)
852 {
853  switch(data_layout_dim)
854  {
856  os << "WIDTH";
857  break;
859  os << "HEIGHT";
860  break;
862  os << "CHANNEL";
863  break;
865  os << "DEPTH";
866  break;
868  os << "BATCHES";
869  break;
870  default:
871  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
872  }
873  return os;
874 }
875 
876 /** Formatted output of the DataType type.
877  *
878  * @param[out] os Output stream.
879  * @param[in] data_type Type to output.
880  *
881  * @return Modified output stream.
882  */
883 inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type)
884 {
885  switch(data_type)
886  {
887  case DataType::UNKNOWN:
888  os << "UNKNOWN";
889  break;
890  case DataType::U8:
891  os << "U8";
892  break;
893  case DataType::QSYMM8:
894  os << "QSYMM8";
895  break;
896  case DataType::QASYMM8:
897  os << "QASYMM8";
898  break;
900  os << "QASYMM8_SIGNED";
901  break;
903  os << "QSYMM8_PER_CHANNEL";
904  break;
905  case DataType::S8:
906  os << "S8";
907  break;
908  case DataType::U16:
909  os << "U16";
910  break;
911  case DataType::S16:
912  os << "S16";
913  break;
914  case DataType::QSYMM16:
915  os << "QSYMM16";
916  break;
917  case DataType::QASYMM16:
918  os << "QASYMM16";
919  break;
920  case DataType::U32:
921  os << "U32";
922  break;
923  case DataType::S32:
924  os << "S32";
925  break;
926  case DataType::U64:
927  os << "U64";
928  break;
929  case DataType::S64:
930  os << "S64";
931  break;
932  case DataType::BFLOAT16:
933  os << "BFLOAT16";
934  break;
935  case DataType::F16:
936  os << "F16";
937  break;
938  case DataType::F32:
939  os << "F32";
940  break;
941  case DataType::F64:
942  os << "F64";
943  break;
944  case DataType::SIZET:
945  os << "SIZET";
946  break;
947  default:
948  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
949  }
950 
951  return os;
952 }
953 
954 /** Formatted output of the DataType type.
955  *
956  * @param[in] data_type Type to output.
957  *
958  * @return Formatted string.
959  */
960 inline std::string to_string(const arm_compute::DataType &data_type)
961 {
962  std::stringstream str;
963  str << data_type;
964  return str.str();
965 }
966 
967 /** Formatted output of the Format type.
968  *
969  * @param[out] os Output stream.
970  * @param[in] format Type to output.
971  *
972  * @return Modified output stream.
973  */
974 inline ::std::ostream &operator<<(::std::ostream &os, const Format &format)
975 {
976  switch(format)
977  {
978  case Format::UNKNOWN:
979  os << "UNKNOWN";
980  break;
981  case Format::U8:
982  os << "U8";
983  break;
984  case Format::S16:
985  os << "S16";
986  break;
987  case Format::U16:
988  os << "U16";
989  break;
990  case Format::S32:
991  os << "S32";
992  break;
993  case Format::U32:
994  os << "U32";
995  break;
996  case Format::F16:
997  os << "F16";
998  break;
999  case Format::F32:
1000  os << "F32";
1001  break;
1002  case Format::UV88:
1003  os << "UV88";
1004  break;
1005  case Format::RGB888:
1006  os << "RGB888";
1007  break;
1008  case Format::RGBA8888:
1009  os << "RGBA8888";
1010  break;
1011  case Format::YUV444:
1012  os << "YUV444";
1013  break;
1014  case Format::YUYV422:
1015  os << "YUYV422";
1016  break;
1017  case Format::NV12:
1018  os << "NV12";
1019  break;
1020  case Format::NV21:
1021  os << "NV21";
1022  break;
1023  case Format::IYUV:
1024  os << "IYUV";
1025  break;
1026  case Format::UYVY422:
1027  os << "UYVY422";
1028  break;
1029  default:
1030  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1031  }
1032 
1033  return os;
1034 }
1035 
1036 /** Formatted output of the Format type.
1037  *
1038  * @param[in] format Type to output.
1039  *
1040  * @return Formatted string.
1041  */
1042 inline std::string to_string(const Format &format)
1043 {
1044  std::stringstream str;
1045  str << format;
1046  return str.str();
1047 }
1048 
1049 /** Formatted output of the Channel type.
1050  *
1051  * @param[out] os Output stream.
1052  * @param[in] channel Type to output.
1053  *
1054  * @return Modified output stream.
1055  */
1056 inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel)
1057 {
1058  switch(channel)
1059  {
1060  case Channel::UNKNOWN:
1061  os << "UNKNOWN";
1062  break;
1063  case Channel::C0:
1064  os << "C0";
1065  break;
1066  case Channel::C1:
1067  os << "C1";
1068  break;
1069  case Channel::C2:
1070  os << "C2";
1071  break;
1072  case Channel::C3:
1073  os << "C3";
1074  break;
1075  case Channel::R:
1076  os << "R";
1077  break;
1078  case Channel::G:
1079  os << "G";
1080  break;
1081  case Channel::B:
1082  os << "B";
1083  break;
1084  case Channel::A:
1085  os << "A";
1086  break;
1087  case Channel::Y:
1088  os << "Y";
1089  break;
1090  case Channel::U:
1091  os << "U";
1092  break;
1093  case Channel::V:
1094  os << "V";
1095  break;
1096  default:
1097  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1098  }
1099 
1100  return os;
1101 }
1102 
1103 /** Formatted output of the Channel type.
1104  *
1105  * @param[in] channel Type to output.
1106  *
1107  * @return Formatted string.
1108  */
1109 inline std::string to_string(const Channel &channel)
1110 {
1111  std::stringstream str;
1112  str << channel;
1113  return str.str();
1114 }
1115 
1116 /** Formatted output of the BorderMode type.
1117  *
1118  * @param[out] os Output stream.
1119  * @param[in] mode Type to output.
1120  *
1121  * @return Modified output stream.
1122  */
1123 inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode)
1124 {
1125  switch(mode)
1126  {
1127  case BorderMode::UNDEFINED:
1128  os << "UNDEFINED";
1129  break;
1130  case BorderMode::CONSTANT:
1131  os << "CONSTANT";
1132  break;
1133  case BorderMode::REPLICATE:
1134  os << "REPLICATE";
1135  break;
1136  default:
1137  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1138  }
1139 
1140  return os;
1141 }
1142 
1143 /** Formatted output of the BorderSize type.
1144  *
1145  * @param[out] os Output stream.
1146  * @param[in] border Type to output.
1147  *
1148  * @return Modified output stream.
1149  */
1150 inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border)
1151 {
1152  os << border.top << ","
1153  << border.right << ","
1154  << border.bottom << ","
1155  << border.left;
1156 
1157  return os;
1158 }
1159 
1160 /** Formatted output of the PaddingList type.
1161  *
1162  * @param[out] os Output stream.
1163  * @param[in] padding Type to output.
1164  *
1165  * @return Modified output stream.
1166  */
1167 inline ::std::ostream &operator<<(::std::ostream &os, const PaddingList &padding)
1168 {
1169  os << "{";
1170  for(auto const &p : padding)
1171  {
1172  os << "{" << p.first << "," << p.second << "}";
1173  }
1174  os << "}";
1175  return os;
1176 }
1177 
1178 /** Formatted output of the Multiples type.
1179  *
1180  * @param[out] os Output stream.
1181  * @param[in] multiples Type to output.
1182  *
1183  * @return Modified output stream.
1184  */
1185 inline ::std::ostream &operator<<(::std::ostream &os, const Multiples &multiples)
1186 {
1187  os << "(";
1188  for(size_t i = 0; i < multiples.size() - 1; i++)
1189  {
1190  os << multiples[i] << ", ";
1191  }
1192  os << multiples.back() << ")";
1193  return os;
1194 }
1195 
1196 /** Formatted output of the InterpolationPolicy type.
1197  *
1198  * @param[out] os Output stream.
1199  * @param[in] policy Type to output.
1200  *
1201  * @return Modified output stream.
1202  */
1203 inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy)
1204 {
1205  switch(policy)
1206  {
1208  os << "NEAREST_NEIGHBOR";
1209  break;
1211  os << "BILINEAR";
1212  break;
1214  os << "AREA";
1215  break;
1216  default:
1217  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1218  }
1219 
1220  return os;
1221 }
1222 
1223 /** Formatted output of the SamplingPolicy type.
1224  *
1225  * @param[out] os Output stream.
1226  * @param[in] policy Type to output.
1227  *
1228  * @return Modified output stream.
1229  */
1230 inline ::std::ostream &operator<<(::std::ostream &os, const SamplingPolicy &policy)
1231 {
1232  switch(policy)
1233  {
1235  os << "CENTER";
1236  break;
1238  os << "TOP_LEFT";
1239  break;
1240  default:
1241  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1242  }
1243 
1244  return os;
1245 }
1246 
1247 /** Formatted output of the ITensorInfo type.
1248  *
1249  * @param[out] os Output stream.
1250  * @param[in] info Tensor information.
1251  *
1252  * @return Modified output stream.
1253  */
1254 inline ::std::ostream &operator<<(std::ostream &os, const ITensorInfo *info)
1255 {
1256  const DataType data_type = info->data_type();
1257  const DataLayout data_layout = info->data_layout();
1258 
1259  os << "Shape=" << info->tensor_shape() << ","
1260  << "DataLayout=" << string_from_data_layout(data_layout) << ","
1261  << "DataType=" << string_from_data_type(data_type);
1262 
1263  if(is_data_type_quantized(data_type))
1264  {
1265  const QuantizationInfo qinfo = info->quantization_info();
1266  const auto scales = qinfo.scale();
1267  const auto offsets = qinfo.offset();
1268 
1269  os << ", QuantizationInfo={"
1270  << "scales.size=" << scales.size()
1271  << ", scale(s)=" << scales << ", ";
1272 
1273  os << "offsets.size=" << offsets.size()
1274  << ", offset(s)=" << offsets << "}";
1275  }
1276  return os;
1277 }
1278 
1279 /** Formatted output of the const TensorInfo& type.
1280  *
1281  * @param[out] os Output stream.
1282  * @param[in] info Type to output.
1283  *
1284  * @return Modified output stream.
1285  */
1286 inline ::std::ostream &operator<<(::std::ostream &os, const TensorInfo &info)
1287 {
1288  os << &info;
1289  return os;
1290 }
1291 
1292 /** Formatted output of the const TensorInfo& type.
1293  *
1294  * @param[in] info Type to output.
1295  *
1296  * @return Formatted string.
1297  */
1298 inline std::string to_string(const TensorInfo &info)
1299 {
1300  std::stringstream str;
1301  str << &info;
1302  return str.str();
1303 }
1304 
1305 /** Formatted output of the const ITensorInfo& type.
1306  *
1307  * @param[in] info Type to output.
1308  *
1309  * @return Formatted string.
1310  */
1311 inline std::string to_string(const ITensorInfo &info)
1312 {
1313  std::stringstream str;
1314  str << &info;
1315  return str.str();
1316 }
1317 
1318 /** Formatted output of the const ITensorInfo* type.
1319  *
1320  * @param[in] info Type to output.
1321  *
1322  * @return Formatted string.
1323  */
1324 inline std::string to_string(const ITensorInfo *info)
1325 {
1326  std::string ret_str = "nullptr";
1327  if(info != nullptr)
1328  {
1329  std::stringstream str;
1330  str << info;
1331  ret_str = str.str();
1332  }
1333  return ret_str;
1334 }
1335 
1336 /** Formatted output of the ITensorInfo* type.
1337  *
1338  * @param[in] info Type to output.
1339  *
1340  * @return Formatted string.
1341  */
1342 inline std::string to_string(ITensorInfo *info)
1343 {
1344  return to_string(static_cast<const ITensorInfo *>(info));
1345 }
1346 
1347 /** Formatted output of the ITensorInfo type obtained from const ITensor* type.
1348  *
1349  * @param[in] tensor Type to output.
1350  *
1351  * @return Formatted string.
1352  */
1353 inline std::string to_string(const ITensor *tensor)
1354 {
1355  std::string ret_str = "nullptr";
1356  if(tensor != nullptr)
1357  {
1358  std::stringstream str;
1359  str << "ITensor->info(): " << tensor->info();
1360  ret_str = str.str();
1361  }
1362  return ret_str;
1363 }
1364 
1365 /** Formatted output of the ITensorInfo type obtained from the ITensor* type.
1366  *
1367  * @param[in] tensor Type to output.
1368  *
1369  * @return Formatted string.
1370  */
1371 inline std::string to_string(ITensor *tensor)
1372 {
1373  return to_string(static_cast<const ITensor *>(tensor));
1374 }
1375 
1376 /** Formatted output of the ITensorInfo type obtained from the ITensor& type.
1377  *
1378  * @param[in] tensor Type to output.
1379  *
1380  * @return Formatted string.
1381  */
1382 inline std::string to_string(ITensor &tensor)
1383 {
1384  std::stringstream str;
1385  str << "ITensor.info(): " << tensor.info();
1386  return str.str();
1387 }
1388 
1389 #ifdef ARM_COMPUTE_OPENCL_ENABLED
1390 /** Formatted output of the ITensorInfo type obtained from the const ICLTensor& type.
1391  *
1392  * @param[in] cl_tensor Type to output.
1393  *
1394  * @return Formatted string.
1395  */
1396 inline std::string to_string(const ICLTensor *cl_tensor)
1397 {
1398  std::string ret_str = "nullptr";
1399  if(cl_tensor != nullptr)
1400  {
1401  std::stringstream str;
1402  str << "ICLTensor->info(): " << cl_tensor->info();
1403  ret_str = str.str();
1404  }
1405  return ret_str;
1406 }
1407 
1408 /** Formatted output of the ITensorInfo type obtained from the ICLTensor& type.
1409  *
1410  * @param[in] cl_tensor Type to output.
1411  *
1412  * @return Formatted string.
1413  */
1414 inline std::string to_string(ICLTensor *cl_tensor)
1415 {
1416  return to_string(static_cast<const ICLTensor *>(cl_tensor));
1417 }
1418 #endif /* ARM_COMPUTE_OPENCL_ENABLED */
1419 
1420 /** Formatted output of the Dimensions type.
1421  *
1422  * @param[in] dimensions Type to output.
1423  *
1424  * @return Formatted string.
1425  */
1426 template <typename T>
1427 inline std::string to_string(const Dimensions<T> &dimensions)
1428 {
1429  std::stringstream str;
1430  str << dimensions;
1431  return str.str();
1432 }
1433 
1434 /** Formatted output of the Strides type.
1435  *
1436  * @param[in] stride Type to output.
1437  *
1438  * @return Formatted string.
1439  */
1440 inline std::string to_string(const Strides &stride)
1441 {
1442  std::stringstream str;
1443  str << stride;
1444  return str.str();
1445 }
1446 
1447 /** Formatted output of the TensorShape type.
1448  *
1449  * @param[in] shape Type to output.
1450  *
1451  * @return Formatted string.
1452  */
1453 inline std::string to_string(const TensorShape &shape)
1454 {
1455  std::stringstream str;
1456  str << shape;
1457  return str.str();
1458 }
1459 
1460 /** Formatted output of the Coordinates type.
1461  *
1462  * @param[in] coord Type to output.
1463  *
1464  * @return Formatted string.
1465  */
1466 inline std::string to_string(const Coordinates &coord)
1467 {
1468  std::stringstream str;
1469  str << coord;
1470  return str.str();
1471 }
1472 
1473 /** Formatted output of the GEMMReshapeInfo type.
1474  *
1475  * @param[out] os Output stream.
1476  * @param[in] info Type to output.
1477  *
1478  * @return Modified output stream.
1479  */
1480 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info)
1481 {
1482  os << "{m=" << info.m() << ",";
1483  os << "n=" << info.n() << ",";
1484  os << "k=" << info.k() << ",";
1485  os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1486  os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1487  os << "}";
1488 
1489  return os;
1490 }
1491 
1492 /** Formatted output of the GEMMInfo type.
1493  *
1494  * @param[out] os Output stream.
1495  * @param[in] info Type to output.
1496  *
1497  * @return Modified output stream.
1498  */
1499 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info)
1500 {
1501  os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1502  os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1503  os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
1504  os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1505  os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1506  os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1507  os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1508  os << "broadcast_bias=" << info.broadcast_bias() << ",";
1509  os << "pretranspose_B=" << info.pretranspose_B() << ",";
1510  os << "post_ops=" << info.post_ops() << "}";
1511 
1512  return os;
1513 }
1514 
1515 /** Formatted output of the Window::Dimension type.
1516  *
1517  * @param[out] os Output stream.
1518  * @param[in] dim Type to output.
1519  *
1520  * @return Modified output stream.
1521  */
1522 inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim)
1523 {
1524  os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1525 
1526  return os;
1527 }
1528 /** Formatted output of the Window type.
1529  *
1530  * @param[out] os Output stream.
1531  * @param[in] win Type to output.
1532  *
1533  * @return Modified output stream.
1534  */
1535 inline ::std::ostream &operator<<(::std::ostream &os, const Window &win)
1536 {
1537  os << "{";
1538  for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1539  {
1540  if(i > 0)
1541  {
1542  os << ", ";
1543  }
1544  os << win[i];
1545  }
1546  os << "}";
1547 
1548  return os;
1549 }
1550 
1551 /** Formatted output of the WeightsInfo type.
1552  *
1553  * @param[in] info Type to output.
1554  *
1555  * @return Formatted string.
1556  */
1557 inline std::string to_string(const WeightsInfo &info)
1558 {
1559  std::stringstream str;
1560  str << info;
1561  return str.str();
1562 }
1563 
1564 /** Formatted output of the GEMMReshapeInfo type.
1565  *
1566  * @param[in] info Type to output.
1567  *
1568  * @return Formatted string.
1569  */
1570 inline std::string to_string(const GEMMReshapeInfo &info)
1571 {
1572  std::stringstream str;
1573  str << info;
1574  return str.str();
1575 }
1576 
1577 /** Formatted output of the GEMMInfo type.
1578  *
1579  * @param[in] info Type to output.
1580  *
1581  * @return Formatted string.
1582  */
1583 inline std::string to_string(const GEMMInfo &info)
1584 {
1585  std::stringstream str;
1586  str << info;
1587  return str.str();
1588 }
1589 
1590 /** Formatted output of the Window::Dimension type.
1591  *
1592  * @param[in] dim Type to output.
1593  *
1594  * @return Formatted string.
1595  */
1596 inline std::string to_string(const Window::Dimension &dim)
1597 {
1598  std::stringstream str;
1599  str << dim;
1600  return str.str();
1601 }
1602 /** Formatted output of the Window& type.
1603  *
1604  * @param[in] win Type to output.
1605  *
1606  * @return Formatted string.
1607  */
1608 inline std::string to_string(const Window &win)
1609 {
1610  std::stringstream str;
1611  str << win;
1612  return str.str();
1613 }
1614 
1615 /** Formatted output of the Window* type.
1616  *
1617  * @param[in] win Type to output.
1618  *
1619  * @return Formatted string.
1620  */
1621 inline std::string to_string(Window *win)
1622 {
1623  std::string ret_str = "nullptr";
1624  if(win != nullptr)
1625  {
1626  std::stringstream str;
1627  str << *win;
1628  ret_str = str.str();
1629  }
1630  return ret_str;
1631 }
1632 
1633 /** Formatted output of the Rectangle type.
1634  *
1635  * @param[out] os Output stream.
1636  * @param[in] rect Type to output.
1637  *
1638  * @return Modified output stream.
1639  */
1640 inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect)
1641 {
1642  os << rect.width << "x" << rect.height;
1643  os << "+" << rect.x << "+" << rect.y;
1644 
1645  return os;
1646 }
1647 
1648 /** Formatted output of the PaddingMode type.
1649  *
1650  * @param[out] os Output stream.
1651  * @param[in] mode Type to output.
1652  *
1653  * @return Modified output stream.
1654  */
1655 inline ::std::ostream &operator<<(::std::ostream &os, const PaddingMode &mode)
1656 {
1657  switch(mode)
1658  {
1659  case PaddingMode::CONSTANT:
1660  os << "CONSTANT";
1661  break;
1662  case PaddingMode::REFLECT:
1663  os << "REFLECT";
1664  break;
1666  os << "SYMMETRIC";
1667  break;
1668  default:
1669  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1670  }
1671 
1672  return os;
1673 }
1674 
1675 /** Formatted output of the PaddingMode type.
1676  *
1677  * @param[in] mode Type to output.
1678  *
1679  * @return Formatted string.
1680  */
1681 inline std::string to_string(const PaddingMode &mode)
1682 {
1683  std::stringstream str;
1684  str << mode;
1685  return str.str();
1686 }
1687 
1688 /** Formatted output of the PadStrideInfo type.
1689  *
1690  * @param[out] os Output stream.
1691  * @param[in] pad_stride_info Type to output.
1692  *
1693  * @return Modified output stream.
1694  */
1695 inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info)
1696 {
1697  os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1698  os << ";";
1699  os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1700  << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
1701 
1702  return os;
1703 }
1704 
1705 /** Formatted output of the PadStrideInfo type.
1706  *
1707  * @param[in] pad_stride_info Type to output.
1708  *
1709  * @return Formatted string.
1710  */
1711 inline std::string to_string(const PadStrideInfo &pad_stride_info)
1712 {
1713  std::stringstream str;
1714  str << pad_stride_info;
1715  return str.str();
1716 }
1717 
1718 /** Formatted output of the BorderMode type.
1719  *
1720  * @param[in] mode Type to output.
1721  *
1722  * @return Formatted string.
1723  */
1724 inline std::string to_string(const BorderMode &mode)
1725 {
1726  std::stringstream str;
1727  str << mode;
1728  return str.str();
1729 }
1730 
1731 /** Formatted output of the BorderSize type.
1732  *
1733  * @param[in] border Type to output.
1734  *
1735  * @return Formatted string.
1736  */
1737 inline std::string to_string(const BorderSize &border)
1738 {
1739  std::stringstream str;
1740  str << border;
1741  return str.str();
1742 }
1743 
1744 /** Formatted output of the PaddingList type.
1745  *
1746  * @param[in] padding Type to output.
1747  *
1748  * @return Formatted string.
1749  */
1750 inline std::string to_string(const PaddingList &padding)
1751 {
1752  std::stringstream str;
1753  str << padding;
1754  return str.str();
1755 }
1756 
1757 /** Formatted output of the Multiples type.
1758  *
1759  * @param[in] multiples Type to output.
1760  *
1761  * @return Formatted string.
1762  */
1763 inline std::string to_string(const Multiples &multiples)
1764 {
1765  std::stringstream str;
1766  str << multiples;
1767  return str.str();
1768 }
1769 
1770 /** Formatted output of the InterpolationPolicy type.
1771  *
1772  * @param[in] policy Type to output.
1773  *
1774  * @return Formatted string.
1775  */
1776 inline std::string to_string(const InterpolationPolicy &policy)
1777 {
1778  std::stringstream str;
1779  str << policy;
1780  return str.str();
1781 }
1782 
1783 /** Formatted output of the SamplingPolicy type.
1784  *
1785  * @param[in] policy Type to output.
1786  *
1787  * @return Formatted string.
1788  */
1789 inline std::string to_string(const SamplingPolicy &policy)
1790 {
1791  std::stringstream str;
1792  str << policy;
1793  return str.str();
1794 }
1795 
1796 /** Formatted output of the ConvertPolicy type.
1797  *
1798  * @param[out] os Output stream.
1799  * @param[in] policy Type to output.
1800  *
1801  * @return Modified output stream.
1802  */
1803 inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy)
1804 {
1805  switch(policy)
1806  {
1807  case ConvertPolicy::WRAP:
1808  os << "WRAP";
1809  break;
1811  os << "SATURATE";
1812  break;
1813  default:
1814  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1815  }
1816 
1817  return os;
1818 }
1819 
1820 inline std::string to_string(const ConvertPolicy &policy)
1821 {
1822  std::stringstream str;
1823  str << policy;
1824  return str.str();
1825 }
1826 
1827 /** Formatted output of the ArithmeticOperation type.
1828  *
1829  * @param[out] os Output stream.
1830  * @param[in] op Operation to output.
1831  *
1832  * @return Modified output stream.
1833  */
1834 inline ::std::ostream &operator<<(::std::ostream &os, const ArithmeticOperation &op)
1835 {
1836  switch(op)
1837  {
1839  os << "ADD";
1840  break;
1842  os << "SUB";
1843  break;
1845  os << "DIV";
1846  break;
1848  os << "MAX";
1849  break;
1851  os << "MIN";
1852  break;
1854  os << "SQUARED_DIFF";
1855  break;
1857  os << "POWER";
1858  break;
1859  default:
1860  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1861  }
1862 
1863  return os;
1864 }
1865 
1866 /** Formatted output of the Arithmetic Operation
1867  *
1868  * @param[in] op Type to output.
1869  *
1870  * @return Formatted string.
1871  */
1872 inline std::string to_string(const ArithmeticOperation &op)
1873 {
1874  std::stringstream str;
1875  str << op;
1876  return str.str();
1877 }
1878 
1879 /** Formatted output of the Reduction Operations.
1880  *
1881  * @param[out] os Output stream.
1882  * @param[in] op Type to output.
1883  *
1884  * @return Modified output stream.
1885  */
1886 inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op)
1887 {
1888  switch(op)
1889  {
1891  os << "SUM";
1892  break;
1894  os << "SUM_SQUARE";
1895  break;
1897  os << "MEAN_SUM";
1898  break;
1900  os << "ARG_IDX_MAX";
1901  break;
1903  os << "ARG_IDX_MIN";
1904  break;
1906  os << "PROD";
1907  break;
1909  os << "MIN";
1910  break;
1912  os << "MAX";
1913  break;
1914  default:
1915  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1916  }
1917 
1918  return os;
1919 }
1920 
1921 /** Formatted output of the Reduction Operations.
1922  *
1923  * @param[in] op Type to output.
1924  *
1925  * @return Formatted string.
1926  */
1927 inline std::string to_string(const ReductionOperation &op)
1928 {
1929  std::stringstream str;
1930  str << op;
1931  return str.str();
1932 }
1933 
1934 /** Formatted output of the Comparison Operations.
1935  *
1936  * @param[out] os Output stream.
1937  * @param[in] op Type to output.
1938  *
1939  * @return Modified output stream.
1940  */
1941 inline ::std::ostream &operator<<(::std::ostream &os, const ComparisonOperation &op)
1942 {
1943  switch(op)
1944  {
1946  os << "Equal";
1947  break;
1949  os << "NotEqual";
1950  break;
1952  os << "Greater";
1953  break;
1955  os << "GreaterEqual";
1956  break;
1958  os << "Less";
1959  break;
1961  os << "LessEqual";
1962  break;
1963  default:
1964  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1965  }
1966 
1967  return os;
1968 }
1969 
1970 /** Formatted output of the Elementwise unary Operations.
1971  *
1972  * @param[out] os Output stream.
1973  * @param[in] op Type to output.
1974  *
1975  * @return Modified output stream.
1976  */
1977 inline ::std::ostream &operator<<(::std::ostream &os, const ElementWiseUnary &op)
1978 {
1979  switch(op)
1980  {
1982  os << "RSQRT";
1983  break;
1984  case ElementWiseUnary::EXP:
1985  os << "EXP";
1986  break;
1987  case ElementWiseUnary::NEG:
1988  os << "NEG";
1989  break;
1990  case ElementWiseUnary::LOG:
1991  os << "LOG";
1992  break;
1993  case ElementWiseUnary::SIN:
1994  os << "SIN";
1995  break;
1996  case ElementWiseUnary::ABS:
1997  os << "ABS";
1998  break;
2000  os << "ROUND";
2001  break;
2003  os << "LOGICAL_NOT";
2004  break;
2005  default:
2006  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2007  }
2008 
2009  return os;
2010 }
2011 
2012 /** Formatted output of the Comparison Operations.
2013  *
2014  * @param[in] op Type to output.
2015  *
2016  * @return Formatted string.
2017  */
2018 inline std::string to_string(const ComparisonOperation &op)
2019 {
2020  std::stringstream str;
2021  str << op;
2022  return str.str();
2023 }
2024 
2025 /** Formatted output of the Elementwise unary Operations.
2026  *
2027  * @param[in] op Type to output.
2028  *
2029  * @return Formatted string.
2030  */
2031 inline std::string to_string(const ElementWiseUnary &op)
2032 {
2033  std::stringstream str;
2034  str << op;
2035  return str.str();
2036 }
2037 
2038 /** Formatted output of the Norm Type.
2039  *
2040  * @param[in] type Type to output.
2041  *
2042  * @return Formatted string.
2043  */
2044 inline std::string to_string(const NormType &type)
2045 {
2046  std::stringstream str;
2047  str << type;
2048  return str.str();
2049 }
2050 
2051 /** Formatted output of the Pooling Type.
2052  *
2053  * @param[in] type Type to output.
2054  *
2055  * @return Formatted string.
2056  */
2057 inline std::string to_string(const PoolingType &type)
2058 {
2059  std::stringstream str;
2060  str << type;
2061  return str.str();
2062 }
2063 
2064 /** Formatted output of the Pooling Layer Info.
2065  *
2066  * @param[in] info Type to output.
2067  *
2068  * @return Formatted string.
2069  */
2070 inline std::string to_string(const PoolingLayerInfo &info)
2071 {
2072  std::stringstream str;
2073  str << "{Type=" << info.pool_type << ","
2074  << "DataLayout=" << info.data_layout << ","
2075  << "IsGlobalPooling=" << info.is_global_pooling;
2076  if(!info.is_global_pooling)
2077  {
2078  str << ","
2079  << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2080  << "PadStride=" << info.pad_stride_info;
2081  }
2082  str << "}";
2083  return str.str();
2084 }
2085 
2086 /** Formatted output of the PriorBoxLayerInfo.
2087  *
2088  * @param[in] info Type to output.
2089  *
2090  * @return Formatted string.
2091  */
2092 inline std::string to_string(const PriorBoxLayerInfo &info)
2093 {
2094  std::stringstream str;
2095  str << "{";
2096  str << "Clip:" << info.clip()
2097  << "Flip:" << info.flip()
2098  << "StepX:" << info.steps()[0]
2099  << "StepY:" << info.steps()[1]
2100  << "MinSizes:" << info.min_sizes().size()
2101  << "MaxSizes:" << info.max_sizes().size()
2102  << "ImgSizeX:" << info.img_size().x
2103  << "ImgSizeY:" << info.img_size().y
2104  << "Offset:" << info.offset()
2105  << "Variances:" << info.variances().size();
2106  str << "}";
2107  return str.str();
2108 }
2109 
2110 /** Formatted output of the Size2D type.
2111  *
2112  * @param[out] os Output stream
2113  * @param[in] size Type to output
2114  *
2115  * @return Modified output stream.
2116  */
2117 inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2118 {
2119  os << size.width << "x" << size.height;
2120 
2121  return os;
2122 }
2123 
2124 /** Formatted output of the Size2D type.
2125  *
2126  * @param[in] type Type to output
2127  *
2128  * @return Formatted string.
2129  */
2130 inline std::string to_string(const Size2D &type)
2131 {
2132  std::stringstream str;
2133  str << type;
2134  return str.str();
2135 }
2136 
2137 /** Formatted output of the Size3D type.
2138  *
2139  * @param[out] os Output stream
2140  * @param[in] size Type to output
2141  *
2142  * @return Modified output stream.
2143  */
2144 inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2145 {
2146  os << size.width << "x" << size.height << "x" << size.depth;
2147 
2148  return os;
2149 }
2150 
2151 /** Formatted output of the Size2D type.
2152  *
2153  * @param[in] type Type to output
2154  *
2155  * @return Formatted string.
2156  */
2157 inline std::string to_string(const Size3D &type)
2158 {
2159  std::stringstream str;
2160  str << type;
2161  return str.str();
2162 }
2163 
2164 /** Formatted output of the ConvolutionMethod type.
2165  *
2166  * @param[out] os Output stream
2167  * @param[in] conv_method Type to output
2168  *
2169  * @return Modified output stream.
2170  */
2171 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2172 {
2173  switch(conv_method)
2174  {
2176  os << "GEMM";
2177  break;
2179  os << "DIRECT";
2180  break;
2182  os << "WINOGRAD";
2183  break;
2185  os << "FFT";
2186  break;
2188  os << "GEMM_CONV2D";
2189  break;
2190  default:
2191  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2192  }
2193 
2194  return os;
2195 }
2196 
2197 /** Formatted output of the ConvolutionMethod type.
2198  *
2199  * @param[in] conv_method Type to output
2200  *
2201  * @return Formatted string.
2202  */
2203 inline std::string to_string(const ConvolutionMethod &conv_method)
2204 {
2205  std::stringstream str;
2206  str << conv_method;
2207  return str.str();
2208 }
2209 
2210 /** Formatted output of the GPUTarget type.
2211  *
2212  * @param[out] os Output stream
2213  * @param[in] gpu_target Type to output
2214  *
2215  * @return Modified output stream.
2216  */
2217 inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2218 {
2219  switch(gpu_target)
2220  {
2222  os << "GPU_ARCH_MASK";
2223  break;
2224  case GPUTarget::MIDGARD:
2225  os << "MIDGARD";
2226  break;
2227  case GPUTarget::BIFROST:
2228  os << "BIFROST";
2229  break;
2230  case GPUTarget::VALHALL:
2231  os << "VALHALL";
2232  break;
2233  case GPUTarget::T600:
2234  os << "T600";
2235  break;
2236  case GPUTarget::T700:
2237  os << "T700";
2238  break;
2239  case GPUTarget::T800:
2240  os << "T800";
2241  break;
2242  case GPUTarget::G71:
2243  os << "G71";
2244  break;
2245  case GPUTarget::G72:
2246  os << "G72";
2247  break;
2248  case GPUTarget::G51:
2249  os << "G51";
2250  break;
2251  case GPUTarget::G51BIG:
2252  os << "G51BIG";
2253  break;
2254  case GPUTarget::G51LIT:
2255  os << "G51LIT";
2256  break;
2257  case GPUTarget::G76:
2258  os << "G76";
2259  break;
2260  case GPUTarget::G77:
2261  os << "G77";
2262  break;
2263  case GPUTarget::G78:
2264  os << "G78";
2265  break;
2266  case GPUTarget::G31:
2267  os << "G31";
2268  break;
2269  case GPUTarget::TODX:
2270  os << "TODX";
2271  break;
2272  default:
2273  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2274  }
2275 
2276  return os;
2277 }
2278 
2279 /** Formatted output of the GPUTarget type.
2280  *
2281  * @param[in] gpu_target Type to output
2282  *
2283  * @return Formatted string.
2284  */
2285 inline std::string to_string(const GPUTarget &gpu_target)
2286 {
2287  std::stringstream str;
2288  str << gpu_target;
2289  return str.str();
2290 }
2291 
2292 /** Formatted output of the DetectionWindow type.
2293  *
2294  * @param[out] os Output stream
2295  * @param[in] detection_window Type to output
2296  *
2297  * @return Modified output stream.
2298  */
2299 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2300 {
2301  os << "{x=" << detection_window.x << ","
2302  << "y=" << detection_window.y << ","
2303  << "width=" << detection_window.width << ","
2304  << "height=" << detection_window.height << ","
2305  << "idx_class=" << detection_window.idx_class << ","
2306  << "score=" << detection_window.score << "}";
2307 
2308  return os;
2309 }
2310 
2311 /** Formatted output of the DetectionOutputLayerCodeType type.
2312  *
2313  * @param[out] os Output stream
2314  * @param[in] detection_code Type to output
2315  *
2316  * @return Modified output stream.
2317  */
2318 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2319 {
2320  switch(detection_code)
2321  {
2323  os << "CENTER_SIZE";
2324  break;
2326  os << "CORNER";
2327  break;
2329  os << "CORNER_SIZE";
2330  break;
2332  os << "TF_CENTER";
2333  break;
2334  default:
2335  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2336  }
2337 
2338  return os;
2339 }
2340 /** Formatted output of the DetectionOutputLayerCodeType type.
2341  *
2342  * @param[in] detection_code Type to output
2343  *
2344  * @return Formatted string.
2345  */
2346 inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2347 {
2348  std::stringstream str;
2349  str << detection_code;
2350  return str.str();
2351 }
2352 
2353 /** Formatted output of the DetectionOutputLayerInfo type.
2354  *
2355  * @param[out] os Output stream
2356  * @param[in] detection_info Type to output
2357  *
2358  * @return Modified output stream.
2359  */
2360 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2361 {
2362  os << "{Classes=" << detection_info.num_classes() << ","
2363  << "ShareLocation=" << detection_info.share_location() << ","
2364  << "CodeType=" << detection_info.code_type() << ","
2365  << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2366  << "KeepTopK=" << detection_info.keep_top_k() << ","
2367  << "NMSThreshold=" << detection_info.nms_threshold() << ","
2368  << "Eta=" << detection_info.eta() << ","
2369  << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2370  << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2371  << "TopK=" << detection_info.top_k() << ","
2372  << "NumLocClasses=" << detection_info.num_loc_classes()
2373  << "}";
2374 
2375  return os;
2376 }
2377 
2378 /** Formatted output of the DetectionOutputLayerInfo type.
2379  *
2380  * @param[in] detection_info Type to output
2381  *
2382  * @return Formatted string.
2383  */
2384 inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2385 {
2386  std::stringstream str;
2387  str << detection_info;
2388  return str.str();
2389 }
2390 /** Formatted output of the DetectionPostProcessLayerInfo type.
2391  *
2392  * @param[out] os Output stream
2393  * @param[in] detection_info Type to output
2394  *
2395  * @return Modified output stream.
2396  */
2397 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2398 {
2399  os << "{MaxDetections=" << detection_info.max_detections() << ","
2400  << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2401  << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2402  << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2403  << "NumClasses=" << detection_info.num_classes() << ","
2404  << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2405  << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2406  << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2407  << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2408  << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2409  << "DetectionPerClass=" << detection_info.detection_per_class()
2410  << "}";
2411 
2412  return os;
2413 }
2414 
2415 /** Formatted output of the DetectionPostProcessLayerInfo type.
2416  *
2417  * @param[in] detection_info Type to output
2418  *
2419  * @return Formatted string.
2420  */
2421 inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2422 {
2423  std::stringstream str;
2424  str << detection_info;
2425  return str.str();
2426 }
2427 
2428 /** Formatted output of the DetectionWindow type.
2429  *
2430  * @param[in] detection_window Type to output
2431  *
2432  * @return Formatted string.
2433  */
2434 inline std::string to_string(const DetectionWindow &detection_window)
2435 {
2436  std::stringstream str;
2437  str << detection_window;
2438  return str.str();
2439 }
2440 
2441 /** Formatted output of @ref PriorBoxLayerInfo.
2442  *
2443  * @param[out] os Output stream.
2444  * @param[in] info Type to output.
2445  *
2446  * @return Modified output stream.
2447  */
2448 inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2449 {
2450  os << "Clip:" << info.clip()
2451  << "Flip:" << info.flip()
2452  << "StepX:" << info.steps()[0]
2453  << "StepY:" << info.steps()[1]
2454  << "MinSizes:" << info.min_sizes()
2455  << "MaxSizes:" << info.max_sizes()
2456  << "ImgSizeX:" << info.img_size().x
2457  << "ImgSizeY:" << info.img_size().y
2458  << "Offset:" << info.offset()
2459  << "Variances:" << info.variances();
2460 
2461  return os;
2462 }
2463 
2464 /** Formatted output of the WinogradInfo type. */
2465 inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2466 {
2467  os << "{OutputTileSize=" << info.output_tile_size << ","
2468  << "KernelSize=" << info.kernel_size << ","
2469  << "PadStride=" << info.convolution_info << ","
2470  << "OutputDataLayout=" << info.output_data_layout << "}";
2471 
2472  return os;
2473 }
2474 
2475 inline std::string to_string(const WinogradInfo &type)
2476 {
2477  std::stringstream str;
2478  str << type;
2479  return str.str();
2480 }
2481 
2482 /** Convert a CLTunerMode value to a string
2483  *
2484  * @param val CLTunerMode value to be converted
2485  *
2486  * @return String representing the corresponding CLTunerMode.
2487  */
2488 inline std::string to_string(const CLTunerMode val)
2489 {
2490  switch(val)
2491  {
2493  {
2494  return std::string("Exhaustive");
2495  }
2496  case CLTunerMode::NORMAL:
2497  {
2498  return std::string("Normal");
2499  }
2500  case CLTunerMode::RAPID:
2501  {
2502  return std::string("Rapid");
2503  }
2504  default:
2505  {
2506  ARM_COMPUTE_ERROR("Invalid tuner mode.");
2507  return std::string("UNDEFINED");
2508  }
2509  }
2510 }
2511 /** Converts a @ref CLGEMMKernelType to string
2512  *
2513  * @param[in] val CLGEMMKernelType value to be converted
2514  *
2515  * @return String representing the corresponding CLGEMMKernelType
2516  */
2517 inline std::string to_string(CLGEMMKernelType val)
2518 {
2519  switch(val)
2520  {
2522  {
2523  return "Native";
2524  }
2526  {
2527  return "Reshaped_Only_RHS";
2528  }
2530  {
2531  return "Reshaped";
2532  }
2533  default:
2534  {
2535  return "Unknown";
2536  }
2537  }
2538 }
2539 /** [Print CLTunerMode type] **/
2540 /** Formatted output of the CLTunerMode type.
2541  *
2542  * @param[out] os Output stream.
2543  * @param[in] val CLTunerMode to output.
2544  *
2545  * @return Modified output stream.
2546  */
2547 inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2548 {
2549  os << to_string(val);
2550  return os;
2551 }
2552 
2553 /** Formatted output of the ConvolutionInfo type.
2554  *
2555  * @param[out] os Output stream.
2556  * @param[in] conv_info ConvolutionInfo to output.
2557  *
2558  * @return Modified output stream.
2559  */
2560 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2561 {
2562  os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2563  << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2564  << "act_info=" << to_string(conv_info.act_info) << ", "
2565  << "dilation=" << conv_info.dilation << "}";
2566  return os;
2567 }
2568 
2569 /** Converts a @ref ConvolutionInfo to string
2570  *
2571  * @param[in] info ConvolutionInfo value to be converted
2572  *
2573  * @return String representing the corresponding ConvolutionInfo
2574  */
2575 inline std::string to_string(const ConvolutionInfo &info)
2576 {
2577  std::stringstream str;
2578  str << info;
2579  return str.str();
2580 }
2581 
2582 /** Formatted output of the FullyConnectedLayerInfo type.
2583  *
2584  * @param[out] os Output stream.
2585  * @param[in] layer_info FullyConnectedLayerInfo to output.
2586  *
2587  * @return Modified output stream.
2588  */
2589 inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2590 {
2591  os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2592  << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2593  << "transpose_weights=" << layer_info.transpose_weights << ", "
2594  << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2595  << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2596  << "constant_weights=" << layer_info.transpose_weights << ", "
2597  << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
2598  return os;
2599 }
2600 
2601 /** Converts a @ref FullyConnectedLayerInfo to string
2602  *
2603  * @param[in] info FullyConnectedLayerInfo value to be converted
2604  *
2605  * @return String representing the corresponding FullyConnectedLayerInfo
2606  */
2607 inline std::string to_string(const FullyConnectedLayerInfo &info)
2608 {
2609  std::stringstream str;
2610  str << info;
2611  return str.str();
2612 }
2613 
2614 /** Formatted output of the GEMMLowpOutputStageType type.
2615  *
2616  * @param[out] os Output stream.
2617  * @param[in] gemm_type GEMMLowpOutputStageType to output.
2618  *
2619  * @return Modified output stream.
2620  */
2621 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2622 {
2623  switch(gemm_type)
2624  {
2626  os << "NONE";
2627  break;
2629  os << "QUANTIZE_DOWN";
2630  break;
2632  os << "QUANTIZE_DOWN_FIXEDPOINT";
2633  break;
2635  os << "QUANTIZE_DOWN_FLOAT";
2636  break;
2637  default:
2638  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2639  }
2640  return os;
2641 }
2642 
2643 /** Converts a @ref GEMMLowpOutputStageType to string
2644  *
2645  * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2646  *
2647  * @return String representing the corresponding GEMMLowpOutputStageType
2648  */
2649 inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2650 {
2651  std::stringstream str;
2652  str << gemm_type;
2653  return str.str();
2654 }
2655 
2656 /** Formatted output of the GEMMLowpOutputStageInfo type.
2657  *
2658  * @param[out] os Output stream.
2659  * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2660  *
2661  * @return Modified output stream.
2662  */
2663 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2664 {
2665  os << "{type=" << gemm_info.type << ", "
2666  << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2667  << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2668  << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2669  << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2670  << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2671  << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2672  << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2673  << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2674  << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2675  << "output_data_type=" << gemm_info.output_data_type << "}";
2676  return os;
2677 }
2678 
2679 /** Converts a @ref GEMMLowpOutputStageInfo to string
2680  *
2681  * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2682  *
2683  * @return String representing the corresponding GEMMLowpOutputStageInfo
2684  */
2685 inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2686 {
2687  std::stringstream str;
2688  str << gemm_info;
2689  return str.str();
2690 }
2691 
2692 /** Formatted output of the Conv2dInfo type.
2693  *
2694  * @param[out] os Output stream.
2695  * @param[in] conv_info Conv2dInfo to output.
2696  *
2697  * @return Modified output stream.
2698  */
2699 inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2700 {
2701  os << "{conv_info=" << conv_info.conv_info << ", "
2702  << "dilation=" << conv_info.dilation << ", "
2703  << "act_info=" << to_string(conv_info.act_info) << ", "
2704  << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2705  << "num_groups=" << conv_info.num_groups << ","
2706  << "post_ops=" << conv_info.post_ops << "}";
2707  return os;
2708 }
2709 
2710 /** Converts a @ref Conv2dInfo to string
2711  *
2712  * @param[in] conv_info Conv2dInfo value to be converted
2713  *
2714  * @return String representing the corresponding Conv2dInfo
2715  */
2716 inline std::string to_string(const Conv2dInfo &conv_info)
2717 {
2718  std::stringstream str;
2719  str << conv_info;
2720  return str.str();
2721 }
2722 
2723 /** Formatted output of the PixelValue type.
2724  *
2725  * @param[out] os Output stream.
2726  * @param[in] pixel_value PixelValue to output.
2727  *
2728  * @return Modified output stream.
2729  */
2730 inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2731 {
2732  os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
2733  return os;
2734 }
2735 
2736 /** Converts a @ref PixelValue to string
2737  *
2738  * @param[in] pixel_value PixelValue value to be converted
2739  *
2740  * @return String representing the corresponding PixelValue
2741  */
2742 inline std::string to_string(const PixelValue &pixel_value)
2743 {
2744  std::stringstream str;
2745  str << pixel_value;
2746  return str.str();
2747 }
2748 
2749 /** Formatted output of the ScaleKernelInfo type.
2750  *
2751  * @param[out] os Output stream.
2752  * @param[in] scale_info ScaleKernelInfo to output.
2753  *
2754  * @return Modified output stream.
2755  */
2756 inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2757 {
2758  os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2759  << "BorderMode=" << scale_info.border_mode << ", "
2760  << "PixelValue=" << scale_info.constant_border_value << ", "
2761  << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2762  << "use_padding=" << scale_info.use_padding << ", "
2763  << "align_corners=" << scale_info.align_corners << ", "
2764  << "data_layout=" << scale_info.data_layout << "}";
2765  return os;
2766 }
2767 
2768 /** Converts a @ref ScaleKernelInfo to string
2769  *
2770  * @param[in] scale_info ScaleKernelInfo value to be converted
2771  *
2772  * @return String representing the corresponding ScaleKernelInfo
2773  */
2774 inline std::string to_string(const ScaleKernelInfo &scale_info)
2775 {
2776  std::stringstream str;
2777  str << scale_info;
2778  return str.str();
2779 }
2780 
2781 /** Formatted output of the FFTDirection type.
2782  *
2783  * @param[out] os Output stream.
2784  * @param[in] fft_dir FFTDirection to output.
2785  *
2786  * @return Modified output stream.
2787  */
2788 inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2789 {
2790  switch(fft_dir)
2791  {
2792  case FFTDirection::Forward:
2793  os << "Forward";
2794  break;
2795  case FFTDirection::Inverse:
2796  os << "Inverse";
2797  break;
2798  default:
2799  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2800  }
2801  return os;
2802 }
2803 
2804 /** Converts a @ref FFT1DInfo to string
2805  *
2806  * @param[in] fft_dir FFT1DInfo value to be converted
2807  *
2808  * @return String representing the corresponding FFT1DInfo
2809  */
2810 inline std::string to_string(const FFTDirection &fft_dir)
2811 {
2812  std::stringstream str;
2813  str << "{" << fft_dir << "}";
2814  return str.str();
2815 }
2816 
2817 /** Formatted output of the FFT1DInfo type.
2818  *
2819  * @param[out] os Output stream.
2820  * @param[in] fft1d_info FFT1DInfo to output.
2821  *
2822  * @return Modified output stream.
2823  */
2824 inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2825 {
2826  os << "{axis=" << fft1d_info.axis << ", "
2827  << "direction=" << fft1d_info.direction << "}";
2828  return os;
2829 }
2830 
2831 /** Converts a @ref FFT1DInfo to string
2832  *
2833  * @param[in] fft1d_info FFT1DInfo value to be converted
2834  *
2835  * @return String representing the corresponding FFT1DInfo
2836  */
2837 inline std::string to_string(const FFT1DInfo &fft1d_info)
2838 {
2839  std::stringstream str;
2840  str << fft1d_info;
2841  return str.str();
2842 }
2843 
2844 /** Formatted output of the FFT2DInfo type.
2845  *
2846  * @param[out] os Output stream.
2847  * @param[in] fft2d_info FFT2DInfo to output.
2848  *
2849  * @return Modified output stream.
2850  */
2851 inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2852 {
2853  os << "{axis=" << fft2d_info.axis0 << ", "
2854  << "axis=" << fft2d_info.axis1 << ", "
2855  << "direction=" << fft2d_info.direction << "}";
2856  return os;
2857 }
2858 
2859 /** Converts a @ref FFT2DInfo to string
2860  *
2861  * @param[in] fft2d_info FFT2DInfo value to be converted
2862  *
2863  * @return String representing the corresponding FFT2DInfo
2864  */
2865 inline std::string to_string(const FFT2DInfo &fft2d_info)
2866 {
2867  std::stringstream str;
2868  str << fft2d_info;
2869  return str.str();
2870 }
2871 
2872 /** Formatted output of the Coordinates2D type.
2873  *
2874  * @param[out] os Output stream.
2875  * @param[in] coord_2d Coordinates2D to output.
2876  *
2877  * @return Modified output stream.
2878  */
2879 inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2880 {
2881  os << "{x=" << coord_2d.x << ", "
2882  << "y=" << coord_2d.y << "}";
2883  return os;
2884 }
2885 
2886 /** Converts a @ref Coordinates2D to string
2887  *
2888  * @param[in] coord_2d Coordinates2D value to be converted
2889  *
2890  * @return String representing the corresponding Coordinates2D
2891  */
2892 inline std::string to_string(const Coordinates2D &coord_2d)
2893 {
2894  std::stringstream str;
2895  str << coord_2d;
2896  return str.str();
2897 }
2898 
2899 /** Formatted output of the FuseBatchNormalizationType type.
2900  *
2901  * @param[out] os Output stream.
2902  * @param[in] fuse_type FuseBatchNormalizationType to output.
2903  *
2904  * @return Modified output stream.
2905  */
2906 inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2907 {
2908  switch(fuse_type)
2909  {
2911  os << "CONVOLUTION";
2912  break;
2914  os << "DEPTHWISECONVOLUTION";
2915  break;
2916  default:
2917  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2918  }
2919  return os;
2920 }
2921 
2922 /** Converts a @ref FuseBatchNormalizationType to string
2923  *
2924  * @param[in] fuse_type FuseBatchNormalizationType value to be converted
2925  *
2926  * @return String representing the corresponding FuseBatchNormalizationType
2927  */
2928 inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
2929 {
2930  std::stringstream str;
2931  str << fuse_type;
2932  return str.str();
2933 }
2934 
2935 /** Formatted output of the SoftmaxKernelInfo type.
2936  *
2937  * @param[out] os Output stream.
2938  * @param[in] info SoftmaxKernelInfo to output.
2939  *
2940  * @return Modified output stream.
2941  */
2942 inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
2943 {
2944  os << "{beta=" << info.beta << ", "
2945  << "is_log=" << info.is_log << ", "
2946  << "input_data_type=" << info.input_data_type << ", "
2947  << "axis=" << info.axis << "}";
2948  return os;
2949 }
2950 
2951 /** Converts a @ref SoftmaxKernelInfo to string
2952  *
2953  * @param[in] info SoftmaxKernelInfo value to be converted
2954  *
2955  * @return String representing the corresponding SoftmaxKernelInfo
2956  */
2957 inline std::string to_string(const SoftmaxKernelInfo &info)
2958 {
2959  std::stringstream str;
2960  str << info;
2961  return str.str();
2962 }
2963 
2964 /** Formatted output of the ScaleKernelInfo type.
2965  *
2966  * @param[out] os Output stream.
2967  * @param[in] lstm_params LSTMParams to output.
2968  *
2969  * @return Modified output stream.
2970  */
2971 template <typename T>
2972 ::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
2973 {
2974  os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
2975  << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
2976  << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
2977  << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
2978  << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
2979  << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
2980  << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
2981  << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
2982  << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
2983  << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
2984  << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
2985  << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
2986  << "cell_clip=" << lstm_params.cell_clip() << ", "
2987  << "projection_clip=" << lstm_params.projection_clip() << ", "
2988  << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
2989  << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
2990  << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
2991  << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
2992  << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
2993  << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
2994  << "has_projection=" << lstm_params.has_projection() << ", "
2995  << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
2996  << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
2997  return os;
2998 }
2999 
3000 /** Converts a @ref LSTMParams to string
3001  *
3002  * @param[in] lstm_params LSTMParams<T> value to be converted
3003  *
3004  * @return String representing the corresponding LSTMParams
3005  */
3006 template <typename T>
3007 std::string to_string(const LSTMParams<T> &lstm_params)
3008 {
3009  std::stringstream str;
3010  str << lstm_params;
3011  return str.str();
3012 }
3013 
3014 /** Converts a @ref LSTMParams to string
3015  *
3016  * @param[in] num uint8_t value to be converted
3017  *
3018  * @return String representing the corresponding uint8_t
3019  */
3020 inline std::string to_string(const uint8_t num)
3021 {
3022  // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3023  return ::std::to_string(static_cast<int>(num));
3024 }
3025 
3026 /** Available non maxima suppression types */
3027 /** Formatted output of the NMSType type.
3028  *
3029  * @param[out] os Output stream.
3030  * @param[in] nms_type NMSType to output.
3031  *
3032  * @return Modified output stream.
3033  */
3034 inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3035 {
3036  switch(nms_type)
3037  {
3038  case NMSType::LINEAR:
3039  os << "LINEAR";
3040  break;
3041  case NMSType::GAUSSIAN:
3042  os << "GAUSSIAN";
3043  break;
3044  case NMSType::ORIGINAL:
3045  os << "ORIGINAL";
3046  break;
3047  default:
3048  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3049  }
3050  return os;
3051 }
3052 
3053 /** Converts a @ref NMSType to string
3054  *
3055  * @param[in] nms_type NMSType value to be converted
3056  *
3057  * @return String representing the corresponding NMSType
3058  */
3059 inline std::string to_string(const NMSType nms_type)
3060 {
3061  std::stringstream str;
3062  str << nms_type;
3063  return str.str();
3064 }
3065 
3066 /** Formatted output of the BoxNMSLimitInfo type.
3067  *
3068  * @param[out] os Output stream.
3069  * @param[in] info BoxNMSLimitInfo to output.
3070  *
3071  * @return Modified output stream.
3072  */
3073 inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3074 {
3075  os << "{score_thresh=" << info.score_thresh() << ", "
3076  << "nms=" << info.nms() << ", "
3077  << "detections_per_im=" << info.detections_per_im() << ", "
3078  << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3079  << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3080  << "suppress_size=" << info.suppress_size() << ", "
3081  << "min_size=" << info.min_size() << ", "
3082  << "im_width=" << info.im_width() << ", "
3083  << "im_height=" << info.im_height() << "}";
3084  return os;
3085 }
3086 
3087 /** Converts a @ref BoxNMSLimitInfo to string
3088  *
3089  * @param[in] info BoxNMSLimitInfo value to be converted
3090  *
3091  * @return String representing the corresponding BoxNMSLimitInfo
3092  */
3093 inline std::string to_string(const BoxNMSLimitInfo &info)
3094 {
3095  std::stringstream str;
3096  str << info;
3097  return str.str();
3098 }
3099 
3100 /** Formatted output of the DimensionRoundingType type.
3101  *
3102  * @param[out] os Output stream.
3103  * @param[in] rounding_type DimensionRoundingType to output.
3104  *
3105  * @return Modified output stream.
3106  */
3107 inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
3108 {
3109  switch(rounding_type)
3110  {
3112  os << "CEIL";
3113  break;
3115  os << "FLOOR";
3116  break;
3117  default:
3118  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3119  }
3120  return os;
3121 }
3122 
3123 /** Converts a @ref DimensionRoundingType to string
3124  *
3125  * @param[in] rounding_type DimensionRoundingType value to be converted
3126  *
3127  * @return String representing the corresponding DimensionRoundingType
3128  */
3129 inline std::string to_string(const DimensionRoundingType &rounding_type)
3130 {
3131  std::stringstream str;
3132  str << rounding_type;
3133  return str.str();
3134 }
3135 
3136 /** Formatted output of the Padding3D type.
3137  *
3138  * @param[out] os Output stream.
3139  * @param[in] padding3d Padding3D to output.
3140  *
3141  * @return Modified output stream.
3142  */
3143 inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
3144 {
3145  os << padding3d.left << "," << padding3d.right << ","
3146  << padding3d.top << "," << padding3d.bottom << ","
3147  << padding3d.front << "," << padding3d.back;
3148  return os;
3149 }
3150 
3151 /** Converts a @ref Padding3D to string
3152  *
3153  * @param[in] padding3d Padding3D value to be converted
3154  *
3155  * @return String representing the corresponding Padding3D
3156  */
3157 inline std::string to_string(const Padding3D &padding3d)
3158 {
3159  std::stringstream str;
3160  str << padding3d;
3161  return str.str();
3162 }
3163 
3164 /** Formatted output of the Conv3dInfo type.
3165  *
3166  * @param[out] os Output stream.
3167  * @param[in] conv3d_info Type to output.
3168  *
3169  * @return Modified output stream.
3170  */
3171 inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3172 {
3173  os << conv3d_info.stride;
3174  os << ";";
3175  os << conv3d_info.padding;
3176  os << ";";
3177  os << to_string(conv3d_info.act_info);
3178  os << ";";
3179  os << conv3d_info.dilation;
3180  os << ";";
3181  os << conv3d_info.round_type;
3182  os << ";";
3183  os << conv3d_info.enable_fast_math;
3184 
3185  return os;
3186 }
3187 
3188 /** Formatted output of the Conv3dInfo type.
3189  *
3190  * @param[in] conv3d_info Type to output.
3191  *
3192  * @return Formatted string.
3193  */
3194 inline std::string to_string(const Conv3dInfo &conv3d_info)
3195 {
3196  std::stringstream str;
3197  str << conv3d_info;
3198  return str.str();
3199 }
3200 
3201 } // namespace arm_compute
3202 
3203 #endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */
BorderMode
Methods available to handle borders.
Definition: Types.h:261
Rectangle type.
Definition: Types.h:413
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Definition: Utils.h:981
const std::vector< int32_t > & offset() const
Offset vector accessor.
BorderMode border_mode
Border mode policy.
unsigned int top
top of the border
Definition: Types.h:377
Class describing the value of a pixel for any image format.
Definition: PixelValue.h:34
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
bool broadcast_bias
Flag used to broadcast the bias addition.
ArithmeticOperation
Available element-wise operations.
Definition: Types.h:476
InterpolationPolicy
Interpolation method.
Definition: Types.h:398
int num_classes() const
Get num classes.
Definition: Types.h:984
int mult_interleave4x4_height() const
Multiplication factor for the height of the 4x4 interleaved block.
Definition: Types.h:1856
int mult_interleave4x4_height
Multiplication factor for the height of the 4x4 interleaved block.
int32_t gemmlowp_multiplier
GEMMLowp output stage multiplier used for quantizing to QASYMM8.
Definition: Types.h:1926
Generate Proposals Information class.
Definition: Types.h:1311
Second channel (used by formats with unknown channel types).
unsigned int axis
Axis to run the FFT on.
Shape of a tensor.
Definition: TensorShape.h:39
FFTDirection direction
Direction of the FFT.
Quantize using a fixed point multiplication.
experimental::PostOpList< ITensorInfo * > post_ops
bool share_location() const
Get share location.
Definition: Types.h:989
float im_width() const
Get image width (NMS may suppress boxes whose center sits beyond the image width) ...
Definition: Types.h:631
Descriptor used by the 3d Convolution function.
float scale_value_x() const
Get x scale value.
Definition: Types.h:1137
float score_thresh() const
Get the score threshold.
Definition: Types.h:586
DataLayout output_data_layout
Data layout to use for the output tensor once the convolution has been applied (NCHW or NHWC) ...
Definition: Types.h:2212
bool fp_mixed_precision
Flag used to indicate wider accumulators (32 bit instead of 16 for FP16).
quantized, symmetric fixed-point 16-bit number
Rounds to nearest value; half rounds away from zero.
Descriptor used by the GEMM kernels.
InterpolationPolicy interpolation_policy
Interpolation type to use.
uint16_t x
Top-left x coordinate.
Definition: Types.h:526
float score
Confidence value for the detection window.
Definition: Types.h:531
bool enabled() const
Check if initialised.
Definition: Types.h:1559
std::vector< PaddingInfo > PaddingList
List of padding information.
Definition: Types.h:440
ReductionOperation
Available reduction operations.
Definition: Types.h:463
Container for 2D border size.
Definition: Types.h:269
bool retain_internal_weights
Retain internal reshaped weights.
Definition: Types.h:1580
unsigned int max_detections() const
Get max detections.
Definition: Types.h:1096
ActivationLayerInfo act_info
Cr/V/Value channel.
unsigned int v0
Number of vertical blocks of size (m0xk0) stored on the same output row.
Definition: Types.h:1947
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
constexpr int step() const
Return the step of the dimension.
Definition: Window.h:104
float beta
A scaling factor for the exponent with default value 1.0.
unsigned int depth_output_gemm3d
Depth of the output tensor in case is reinterpreted as 3D.
DataLayoutDimension
[DataLayout enum definition]
Definition: Types.h:124
Descriptor used by the FFT1D function.
Descriptor used by the FFT2D function.
BoxWithNonMaximaSuppressionLimit Information class.
Definition: Types.h:560
Winograd information.
Definition: Types.h:2193
uint32_t norm_size() const
Get the normalization size.
Definition: Types.h:1633
1 channel, 1 U8 per channel
NormType type() const
Get the normalization type.
Definition: Types.h:1628
int mult_transpose1xW_width() const
Multiplication factor for the width of the 1xW transposed block.
Definition: Types.h:1848
float a() const
Get the alpha value.
Definition: Types.h:1549
GEMM reshape information class.
Definition: Types.h:1794
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
Definition: Types.h:2211
void get(uint8_t &v) const
Interpret the pixel value as a U8.
Definition: PixelValue.h:244
PostOpType
Type of Post Op.
Definition: IPostOp.h:36
std::string to_string(T &&value)
Convert integer and float values to string.
An elementwise n-ary operation that can be appended to and fused with (at kernel-level) other operato...
Definition: IPostOp.h:89
virtual DataType data_type() const =0
Data type used for each element of the tensor.
Class for specifying the size of a 3D shape or object.
Definition: Size3D.h:32
bool are_reshaped() const
Flag which specifies if the weights tensor has been reshaped.
Definition: Types.h:1752
1 channel, 1 F32 per channel
DimensionRoundingType
Dimension rounding type when down-scaling on CNNs.
Definition: Types.h:537
Searches a subset of LWS configurations while tuning.
Normalization Layer Information class.
Definition: Types.h:1610
Unknown channel format.
Output values are defined by bilinear interpolation between the pixels.
unsigned int h0
Number of horizontal blocks of size (k0xn0) stored on the same output row.
Definition: Types.h:1962
GEMMType gemm_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:567
Fully connected layer info.
Definition: Types.h:1572
bool align_corners
Align corners of input and output.
bool fp_mixed_precision() const
Flag which specifies if a wider accumulator should be used.
Definition: Types.h:2099
GEMM LHS (Left Hand Side) matrix information.
Definition: Types.h:1938
Store the tensor&#39;s metadata.
Definition: ITensorInfo.h:40
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
Quantization info when assuming per layer quantization.
Describe one of the image&#39;s dimensions with a start, end and step.
Definition: Window.h:77
quantized, asymmetric fixed-point 16-bit number
1 channel, 1 U16 per channel
unsigned int bottom
bottom of the border
Definition: Types.h:379
Reshaped GEMM kernel where only the rhs matrix is reshaped.
int32_t gemmlowp_offset
GEMMLowp output stage offset used for quantizing to QASYMM8.
Definition: Types.h:1925
float eta() const
Get eta.
Definition: Types.h:1014
int depth_output_gemm3d() const
Depth of the output when GEMM output is reinterpreted as 3D tensor.
Definition: Types.h:2059
bool use_padding
Indication of using padding.
unsigned int pooled_width() const
Get the pooled width of the layer.
Definition: Types.h:1283
unsigned int pad_top() const
Get the top padding.
Definition: Types.h:740
Output values are defined to match the source pixel whose center is nearest to the sample position...
int32_t gemmlowp_max_bound
GEMMLowp max value used to saturate down the output result before converting back to QASYMM8...
Definition: Types.h:1929
bool retain_internal_weights() const
Flag which specifies if the weights tensor has to be retained from previous run.
Definition: Types.h:2075
CLGEMMKernelType
OpenCL GEMM kernel types.
Definition: CLTypes.h:31
DetectionOutputLayerCodeType
Available Detection Output code types.
Definition: Types.h:926
ConvolutionMethod
Available ConvolutionMethod.
Definition: Types.h:134
Reshaped GEMM kernel where both lhs and rhs matrices are reshaped.
Activation Layer Information class.
Definition: Types.h:1509
GEMMLowpOutputStageType type
GEMMLowp output stage type.
Definition: Types.h:1924
decltype(strategy::transforms) typedef type
Interface for CPU tensor.
Definition: ITensor.h:36
float spatial_scale() const
Definition: Types.h:1423
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
bool use_regular_nms() const
Get if use regular nms.
Definition: Types.h:1126
bool transpose
True if the (k0xn0) block has to be transposed before been stored.
Definition: Types.h:1963
bool interleave
True if the v0 (m0xk0) blocks have to be interleaved in the output row.
Definition: Types.h:1949
bool export_to_cl_image
True if the reshaped rhs has to be exported to cl_image.
Definition: Types.h:1965
int top_k() const
Get top K.
Definition: Types.h:1029
Copyright (c) 2017-2021 Arm Limited.
bool suppress_size() const
Get if NMS will suppress boxes based on their size/position.
Definition: Types.h:621
size_t height
Height of the image region or rectangle.
Definition: Size2D.h:91
bool is_b_reshaped() const
Flag which specifies if the matrix B has been reshaped.
Definition: Types.h:2041
int32_t x
X coordinates.
Definition: Types.h:424
ActivationFunction
Available activation functions.
Definition: Types.h:1513
1 channel, 1 F16 per channel
Samples are taken at pixel center.
float iou_threshold() const
Get intersection over union threshold.
Definition: Types.h:1116
std::string to_string(const Conv3dInfo &conv3d_info)
Formatted output of the Conv3dInfo type.
Definition: TypePrinter.h:3194
NMSType
Available non maxima suppression types.
Definition: Types.h:552
bool is_quantized_per_channel
GEMMLowp quantized per-channel flag.
Definition: Types.h:1933
Convolution Layer Weights Information class.
Definition: Types.h:1728
1 channel, 1 S32 per channel
bool variance_encoded_in_target() const
Get if variance encoded in target.
Definition: Types.h:999
16-bit brain floating-point number
bool transpose
True if the (m0xk0) block has to be transposed before been stored.
Definition: Types.h:1948
signed 64-bit number
int n() const
Number of matrix B columns.
Definition: Types.h:1832
Searches a minimal subset of LWS configurations while tuning.
3 channels, 1 U8 per channel
unsigned int depth_multiplier
Multiplier to apply to input&#39;s depth to retrieve the output depth.
Definition: Types.h:1907
const DataType data_type
Definition: Im2Col.cpp:150
FuseBatchNormalizationType
Available FuseBatchNormalizationType.
Definition: Types.h:158
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:1961
unsigned int m
Number of LHS rows.
Quantization information.
unsigned int n
Number of RHS columns.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Definition: Utils.cpp:135
DimensionRoundingType round_type
int32_t y
Y coordinates.
Definition: Types.h:425
size_t front
Padding across the depth dimenstion on the front, in elements.
Definition: Types.h:793
std::array< float, 2 > steps() const
Get the step coordinates.
Definition: Types.h:873
float nms() const
Get the NMS.
Definition: Types.h:591
float nms_threshold() const
Get nms threshold.
Definition: Types.h:1009
Third channel (used by formats with unknown channel types).
1 channel, 1 U32 per channel
SamplingPolicy sampling_policy
Sampling policy used by the interpolation.
GEMM RHS (Right Hand Side) matrix information.
Definition: Types.h:1953
int32_t b_offset
Offset to be added to each element of the matrix B.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Normalization applied within the same map in 1D region.
Size2D output_tile_size
Width and height of the output tile.
Definition: Types.h:2208
Channel
Available channels.
Definition: Types.h:446
Format
Image colour formats.
Definition: Types.h:56
PaddingMode
Padding mode to use for PadLayer.
Definition: Types.h:165
uint16_t width
Width of the detection window.
Definition: Types.h:528
PadStrideInfo pad_stride_info
Convolution info (Pads, strides,...)
Definition: Types.h:1906
unsigned int n0
Number of columns processed by the matrix multiplication.
Definition: Types.h:1960
ActivationLayerInfo act_info
Fused activation to apply after convolution.
Definition: Types.h:1908
quantized, asymmetric fixed-point 8-bit number unsigned
bool are_weights_reshaped
Reshape the weights tensor if false.
Definition: Types.h:1579
size_t height
Height of the 3D shape or object.
Definition: Size3D.h:93
Coordinates of an item.
Definition: Coordinates.h:37
float scale_value_h() const
Get h scale value.
Definition: Types.h:1143
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
Definition: Types.h:704
float scale_value_w() const
Get w scale value.
Definition: Types.h:1149
Pooling Layer Information struct.
Definition: Types.h:1173
FFTDirection
FFT direction to use.
DataType input_data_type
Input tensor data type.
Size2D dilation
Dilation, in elements, across x and y.
Definition: Types.h:1909
UniformQuantizationInfo uniform() const
Return per layer quantization info.
bool is_log
Flag used to perform Log Softmax operation.
float nms_score_threshold() const
Get nms threshold.
Definition: Types.h:1111
float soft_nms_min_score_thres() const
Get soft nms min score threshold.
Definition: Types.h:616
Dimensions with dimensionality.
Definition: Dimensions.h:42
float gemmlowp_real_multiplier
GEMMLowp output stage real multiplier used for quantizing to QASYMM8.
Definition: Types.h:1932
bool reinterpret_input_as_3d
Flag used to reinterpret the input as 3D.
RoundingPolicy
Rounding method.
Definition: Rounding.h:30
GEMMLowp output stage info.
Definition: Types.h:1922
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
Samples are taken at pixel top left corner.
PriorBox layer info.
Definition: Types.h:798
float offset() const
Get the offset.
Definition: Types.h:883
Fourth channel (used by formats with unknown channel types).
DetectionOutputLayerCodeType code_type() const
Get detection output code type.
Definition: Types.h:994
unsigned int pad_right() const
Get the right padding.
Definition: Types.h:735
size_t top
Padding across the height dimenstion on the top, in elements.
Definition: Types.h:791
const std::vector< float > & scale() const
Scale vector accessor.
int k() const
Number of matrix A columns or matrix B rows.
Definition: Types.h:1840
Quantize using a floating point multiplication.
size_t left
Padding across the width dimenstion on the left, in elements.
Definition: Types.h:789
size_t width
Width of the 3D shape or object.
Definition: Size3D.h:92
Padding and stride information class.
Definition: Types.h:656
ComparisonOperation
Supported comparison operations.
Definition: Types.h:173
GEMMLowpOutputStageType
GEMMLowp output stage type.
Definition: Types.h:1913
Coordinates2D img_size() const
Get the image size coordinates.
Definition: Types.h:878
std::string to_string(const T &val)
Fallback method: try to use std::to_string:
Definition: TypePrinter.h:79
ActivationLayerInfo activation_info
Fused activation to apply after the matrix multiplication.
Definition: Types.h:1575
unsigned int num_kernels() const
Return the number of convolution kernels.
Definition: Types.h:1760
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
Definition: Types.h:2067
Bounding Box Transform information class.
Definition: Types.h:1442
unsigned int left
left of the border
Definition: Types.h:380
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
unsigned int right
right of the border
Definition: Types.h:378
::std::ostream & operator<<(::std::ostream &os, const std::vector< T > &args)
Formatted output of a vector of objects.
Definition: TypePrinter.h:95
Num samples, depth, height, width, channels.
Quantize using an integer multiplication.
1 channel, 1 S16 per channel
bool broadcast_bias() const
Flag which specifies whether to broadcast the shape of the bias tensor.
Definition: Types.h:2123
uint16_t idx_class
Index of the class.
Definition: Types.h:530
bool pretranspose_B() const
Flag which specifies whether b should be pre-transposed if supported.
Definition: Types.h:2131
int keep_top_k() const
Get the number of total bounding boxes to be kept per image.
Definition: Types.h:1004
Descriptor used by the 2d Convolution function.
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
Num samples, channels, depth, height, width.
quantized, symmetric fixed-point 8-bit number
size_t back
Padding across the depth dimenstion on the back, in elements.
Definition: Types.h:794
Num samples, channels, height, width.
unsigned int max_classes_per_detection() const
Get max_classes per detection.
Definition: Types.h:1101
bool is_a_reshaped() const
Flag which specifies if the matrix A has been reshaped.
Definition: Types.h:2033
float scale_value_y() const
Get y scale value.
Definition: Types.h:1131
uint16_t height
Height of the detection window.
Definition: Types.h:529
const experimental::PostOpList< ITensorInfo * > & post_ops() const
Post operations to apply after the matrix multiplication.
Definition: Types.h:2163
Strides of an item in bytes.
Definition: Strides.h:37
quantized, symmetric per channel fixed-point 8-bit number
Convolution using Winograd.
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
float min_size() const
Get size suppression threshold.
Definition: Types.h:626
int32_t a_offset
Offset to be added to each element of the matrix A.
int32_t gemmlowp_shift
GEMMLowp output stage shift used for quantizing to uint8.
Definition: Types.h:1927
Detection Output layer info.
Definition: Types.h:935
4 channels, 1 U8 per channel
experimental::PostOpList< ITensorInfo * > post_ops
PoolingType
Available pooling types.
Definition: Types.h:544
size_t right
Padding across the width dimenstion on the right, in elements.
Definition: Types.h:790
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Rounds to nearest value; half rounds to nearest even.
size_t depth
Depth of the 3D shape or object.
Definition: Size3D.h:94
Interface for OpenCL tensor.
Definition: ICLTensor.h:42
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
Definition: Utils.cpp:123
PadStrideInfo pad_stride_info
Definition: Types.h:1261
size_t width
Width of the image region or rectangle.
Definition: Size2D.h:90
Coordinate type.
Definition: Types.h:422
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34
unsigned int pooled_height() const
Get the pooled height of the layer.
Definition: Types.h:1288
int m() const
Number of matrix A rows.
Definition: Types.h:1824
Borders are left undefined.
ROI Pooling Layer Information class.
Definition: Types.h:1268
Pixels outside the image are assumed to have the same value as the closest image pixel.
Native GEMM kernel with configurable block size.
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
Detection window used for the object detection.
Definition: Types.h:524
DataLayout weights_trained_layout
Layout that the weights have been trained with.
Definition: Types.h:1577
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155
std::vector< float > max_sizes() const
Get max sizes.
Definition: Types.h:898
ComputeAnchors information class.
Definition: Types.h:1392
CLTunerMode
< OpenCL tuner modes
Definition: CLTunerTypes.h:35
uint16_t width
Width of the rectangle.
Definition: Types.h:417
Num samples, height, width, channels.
unsigned int detection_per_class() const
Get detection per class.
Definition: Types.h:1106
bool flip() const
Get the flip value.
Definition: Types.h:888
2 channel, 1 U8 per channel
uint16_t y
Top-left y coordinate.
Definition: Types.h:527
unsigned int k
Number of LHS columns or RHS rows.
bool fp_mixed_precision
Use wider accumulators (32 bit instead of 16 for FP16) to improve accuracy.
Definition: Types.h:1583
float spatial_scale() const
Get the spatial scale.
Definition: Types.h:1293
uint16_t y
Top-left y coordinate.
Definition: Types.h:416
Detection Output layer info.
Definition: Types.h:1054
bool interleave
True if the h0 (k0xn0) blocks have to be interleaved in the output row.
Definition: Types.h:1964
unsigned int num_classes() const
Get num classes.
Definition: Types.h:1121
Use box centers and size but flip x and y co-ordinates.
experimental::PostOpList< ITensorInfo * > post_ops
(EXPERIMENTAL_POST_OPS) Specifies a list of post ops to be fused after the main op.
unsigned int axis1
Axis to run second pass on.
std::vector< float > variances() const
Get min variances.
Definition: Types.h:868
bool transpose_weights
Transpose weights if true.
Definition: Types.h:1578
Size2D kernel_size
Width and height of the kernel.
Definition: Types.h:2209
std::array< float, 4 > weights() const
Definition: Types.h:1463
Store the tensor&#39;s metadata.
Definition: TensorInfo.h:43
PixelValue constant_border_value
Constant value to use for constant border mode policy.
bool reshape_b_only_on_first_run() const
Flag which specifies if the reshape of matrix B should executed only for the first.
Definition: Types.h:2051
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:1946
uint16_t x
Top-left x coordinate.
Definition: Types.h:415
GEMM information class.
Definition: Types.h:1974
unsigned int m0
Number of rows processed by the matrix multiplication.
Definition: Types.h:1945
FFTDirection direction
Direction of the FFT.
ActivationFunction activation() const
Get the type of activation function.
Definition: Types.h:1544
float b() const
Get the beta value.
Definition: Types.h:1554
quantized, asymmetric fixed-point 8-bit number signed
int32_t axis
The dimension in which to apply softmax.
64-bit floating-point number
constexpr int end() const
Return the end of the dimension.
Definition: Window.h:99
Descriptor used by the softmax kernels.
int32_t gemmlowp_min_bound
GEMMLowp min value used to saturate down the output result before converting back to QASYMM8...
Definition: Types.h:1928
int mult_transpose1xW_width
Multiplication factor for the width of the 1xW transposed block.
uint16_t height
Height of the rectangle.
Definition: Types.h:418
ActivationLayerInfo act_info
unsigned int pad_bottom() const
Get the bottom padding.
Definition: Types.h:745
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.
DataLayout data_layout
Data layout to use.
bool clip() const
Get the clip value.
Definition: Types.h:893
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Definition: Dimensions.h:46
unsigned 64-bit number
DataType output_data_type
Output tensor data type to use if the output is not initialized.
Definition: Types.h:1934
DataType
Available data types.
Definition: Types.h:79
Truncates the least significant values that are lost in operations.
unsigned int pad_left() const
Get the left padding.
Definition: Types.h:730
Searches all possible LWS configurations while tuning.
ElementWiseUnary
Available element wise unary operations.
Definition: Types.h:489
DataLayout
[DataLayout enum definition]
Definition: Types.h:113
std::vector< uint32_t > Multiples
Information to produce a tiled version of a Tensor.
Definition: Types.h:443
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:94
NormType
The normalization type used for the normalization layer.
Definition: Types.h:511
signed 8-bit number
A sequence of PostOps that can be appended to the end of other operators.
Definition: IPostOp.h:119
Normalization applied cross maps.
Convolution using GEMM.
Describe a multidimensional execution window.
Definition: Window.h:39
ConvertPolicy
Policy to handle integer overflow.
Definition: Types.h:391
unsigned int axis0
Axis to run first pass on.
int background_label_id() const
Get background label ID.
Definition: Types.h:1019
float im_height() const
Get image height (NMS may suppress boxes whose center sits beyond the image height) ...
Definition: Types.h:636
float confidence_threshold() const
Get confidence threshold.
Definition: Types.h:1024
Normalization applied within the same map in 2D region.
SamplingPolicy
Available Sampling Policies.
Definition: Types.h:104
std::pair< unsigned int, unsigned int > kernel_size() const
Return the width and height of the kernel.
Definition: Types.h:1768
int num_loc_classes() const
Get number of location classes.
Definition: Types.h:1034
size_t bottom
Padding across the height dimenstion on the bottom, in elements.
Definition: Types.h:792
bool soft_nms_enabled() const
Check if soft NMS is enabled.
Definition: Types.h:601
int detections_per_im() const
Get the number of detections.
Definition: Types.h:596
std::string to_string_if_not_null(T *arg)
Formatted output if arg is not null.
Definition: TypePrinter.h:60
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
std::vector< float > min_sizes() const
Get min sizes.
Definition: Types.h:863
Padding information for 3D operations like Conv3d.
Definition: Types.h:773