Compute Library
 22.05
TypePrinter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2022 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 Size3D type.
2087  *
2088  * @param[out] os Output stream
2089  * @param[in] size Type to output
2090  *
2091  * @return Modified output stream.
2092  */
2093 inline ::std::ostream &operator<<(::std::ostream &os, const Size3D &size)
2094 {
2095  os << size.width << "x" << size.height << "x" << size.depth;
2096 
2097  return os;
2098 }
2099 
2100 /** Formatted output of the Size3D type.
2101  *
2102  * @param[in] type Type to output
2103  *
2104  * @return Formatted string.
2105  */
2106 inline std::string to_string(const Size3D &type)
2107 {
2108  std::stringstream str;
2109  str << type;
2110  return str.str();
2111 }
2112 
2113 /** Formatted output of the Padding3D type.
2114  *
2115  * @param[out] os Output stream.
2116  * @param[in] padding3d Padding info for 3D spatial dimension shape.
2117  *
2118  * @return Modified output stream.
2119  */
2120 inline ::std::ostream &operator<<(::std::ostream &os, const Padding3D &padding3d)
2121 {
2122  os << padding3d.left << "," << padding3d.right << ","
2123  << padding3d.top << "," << padding3d.bottom << ","
2124  << padding3d.front << "," << padding3d.back;
2125  return os;
2126 }
2127 
2128 /** Converts a @ref Padding3D to string
2129  *
2130  * @param[in] padding3d Padding3D value to be converted
2131  *
2132  * @return String representing the corresponding Padding3D
2133  */
2134 inline std::string to_string(const Padding3D &padding3d)
2135 {
2136  std::stringstream str;
2137  str << padding3d;
2138  return str.str();
2139 }
2140 
2141 /** Formatted output of the DimensionRoundingType type.
2142  *
2143  * @param[out] os Output stream.
2144  * @param[in] rounding_type DimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
2145  *
2146  * @return Modified output stream.
2147  */
2148 inline ::std::ostream &operator<<(::std::ostream &os, const DimensionRoundingType &rounding_type)
2149 {
2150  switch(rounding_type)
2151  {
2153  os << "CEIL";
2154  break;
2156  os << "FLOOR";
2157  break;
2158  default:
2159  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2160  }
2161  return os;
2162 }
2163 
2164 /** Formatted output of the Pooling 3d Layer Info.
2165  *
2166  * @param[out] os Output stream.
2167  * @param[in] info Pooling 3D layer info to print to output stream.
2168  *
2169  * @return Modified output stream.
2170  */
2171 inline ::std::ostream &operator<<(::std::ostream &os, const Pooling3dLayerInfo &info)
2172 {
2173  os << "{Type=" << info.pool_type << ","
2174  << "IsGlobalPooling=" << info.is_global_pooling;
2175  if(!info.is_global_pooling)
2176  {
2177  os << ","
2178  << "PoolSize=" << info.pool_size << ", "
2179  << "Stride=" << info.stride << ", "
2180  << "Padding=" << info.padding << ", "
2181  << "Exclude Padding=" << info.exclude_padding << ", "
2182  << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2183  << "DimensionRoundingType=" << info.round_type;
2184  }
2185  os << "}";
2186  return os;
2187 }
2188 
2189 /** Formatted output of the Pooling 3d Layer Info.
2190  *
2191  * @param[in] info Type to output.
2192  *
2193  * @return Formatted string.
2194  */
2195 inline std::string to_string(const Pooling3dLayerInfo &info)
2196 {
2197  std::stringstream str;
2198  str << info;
2199  return str.str();
2200 }
2201 
2202 /** Formatted output of the PriorBoxLayerInfo.
2203  *
2204  * @param[in] info Type to output.
2205  *
2206  * @return Formatted string.
2207  */
2208 inline std::string to_string(const PriorBoxLayerInfo &info)
2209 {
2210  std::stringstream str;
2211  str << "{";
2212  str << "Clip:" << info.clip()
2213  << "Flip:" << info.flip()
2214  << "StepX:" << info.steps()[0]
2215  << "StepY:" << info.steps()[1]
2216  << "MinSizes:" << info.min_sizes().size()
2217  << "MaxSizes:" << info.max_sizes().size()
2218  << "ImgSizeX:" << info.img_size().x
2219  << "ImgSizeY:" << info.img_size().y
2220  << "Offset:" << info.offset()
2221  << "Variances:" << info.variances().size();
2222  str << "}";
2223  return str.str();
2224 }
2225 
2226 /** Formatted output of the Size2D type.
2227  *
2228  * @param[out] os Output stream
2229  * @param[in] size Type to output
2230  *
2231  * @return Modified output stream.
2232  */
2233 inline ::std::ostream &operator<<(::std::ostream &os, const Size2D &size)
2234 {
2235  os << size.width << "x" << size.height;
2236 
2237  return os;
2238 }
2239 
2240 /** Formatted output of the Size2D type.
2241  *
2242  * @param[in] type Type to output
2243  *
2244  * @return Formatted string.
2245  */
2246 inline std::string to_string(const Size2D &type)
2247 {
2248  std::stringstream str;
2249  str << type;
2250  return str.str();
2251 }
2252 
2253 /** Formatted output of the ConvolutionMethod type.
2254  *
2255  * @param[out] os Output stream
2256  * @param[in] conv_method Type to output
2257  *
2258  * @return Modified output stream.
2259  */
2260 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &conv_method)
2261 {
2262  switch(conv_method)
2263  {
2265  os << "GEMM";
2266  break;
2268  os << "DIRECT";
2269  break;
2271  os << "WINOGRAD";
2272  break;
2274  os << "FFT";
2275  break;
2277  os << "GEMM_CONV2D";
2278  break;
2279  default:
2280  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2281  }
2282 
2283  return os;
2284 }
2285 
2286 /** Formatted output of the ConvolutionMethod type.
2287  *
2288  * @param[in] conv_method Type to output
2289  *
2290  * @return Formatted string.
2291  */
2292 inline std::string to_string(const ConvolutionMethod &conv_method)
2293 {
2294  std::stringstream str;
2295  str << conv_method;
2296  return str.str();
2297 }
2298 
2299 /** Formatted output of the GPUTarget type.
2300  *
2301  * @param[out] os Output stream
2302  * @param[in] gpu_target Type to output
2303  *
2304  * @return Modified output stream.
2305  */
2306 inline ::std::ostream &operator<<(::std::ostream &os, const GPUTarget &gpu_target)
2307 {
2308  switch(gpu_target)
2309  {
2311  os << "GPU_ARCH_MASK";
2312  break;
2313  case GPUTarget::MIDGARD:
2314  os << "MIDGARD";
2315  break;
2316  case GPUTarget::BIFROST:
2317  os << "BIFROST";
2318  break;
2319  case GPUTarget::VALHALL:
2320  os << "VALHALL";
2321  break;
2322  case GPUTarget::T600:
2323  os << "T600";
2324  break;
2325  case GPUTarget::T700:
2326  os << "T700";
2327  break;
2328  case GPUTarget::T800:
2329  os << "T800";
2330  break;
2331  case GPUTarget::G71:
2332  os << "G71";
2333  break;
2334  case GPUTarget::G72:
2335  os << "G72";
2336  break;
2337  case GPUTarget::G51:
2338  os << "G51";
2339  break;
2340  case GPUTarget::G51BIG:
2341  os << "G51BIG";
2342  break;
2343  case GPUTarget::G51LIT:
2344  os << "G51LIT";
2345  break;
2346  case GPUTarget::G76:
2347  os << "G76";
2348  break;
2349  case GPUTarget::G77:
2350  os << "G77";
2351  break;
2352  case GPUTarget::G78:
2353  os << "G78";
2354  break;
2355  case GPUTarget::G31:
2356  os << "G31";
2357  break;
2358  case GPUTarget::G710:
2359  os << "G710";
2360  break;
2361  default:
2362  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2363  }
2364 
2365  return os;
2366 }
2367 
2368 /** Formatted output of the GPUTarget type.
2369  *
2370  * @param[in] gpu_target Type to output
2371  *
2372  * @return Formatted string.
2373  */
2374 inline std::string to_string(const GPUTarget &gpu_target)
2375 {
2376  std::stringstream str;
2377  str << gpu_target;
2378  return str.str();
2379 }
2380 
2381 /** Formatted output of the DetectionWindow type.
2382  *
2383  * @param[out] os Output stream
2384  * @param[in] detection_window Type to output
2385  *
2386  * @return Modified output stream.
2387  */
2388 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionWindow &detection_window)
2389 {
2390  os << "{x=" << detection_window.x << ","
2391  << "y=" << detection_window.y << ","
2392  << "width=" << detection_window.width << ","
2393  << "height=" << detection_window.height << ","
2394  << "idx_class=" << detection_window.idx_class << ","
2395  << "score=" << detection_window.score << "}";
2396 
2397  return os;
2398 }
2399 
2400 /** Formatted output of the DetectionOutputLayerCodeType type.
2401  *
2402  * @param[out] os Output stream
2403  * @param[in] detection_code Type to output
2404  *
2405  * @return Modified output stream.
2406  */
2407 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
2408 {
2409  switch(detection_code)
2410  {
2412  os << "CENTER_SIZE";
2413  break;
2415  os << "CORNER";
2416  break;
2418  os << "CORNER_SIZE";
2419  break;
2421  os << "TF_CENTER";
2422  break;
2423  default:
2424  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2425  }
2426 
2427  return os;
2428 }
2429 /** Formatted output of the DetectionOutputLayerCodeType type.
2430  *
2431  * @param[in] detection_code Type to output
2432  *
2433  * @return Formatted string.
2434  */
2435 inline std::string to_string(const DetectionOutputLayerCodeType &detection_code)
2436 {
2437  std::stringstream str;
2438  str << detection_code;
2439  return str.str();
2440 }
2441 
2442 /** Formatted output of the DetectionOutputLayerInfo type.
2443  *
2444  * @param[out] os Output stream
2445  * @param[in] detection_info Type to output
2446  *
2447  * @return Modified output stream.
2448  */
2449 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
2450 {
2451  os << "{Classes=" << detection_info.num_classes() << ","
2452  << "ShareLocation=" << detection_info.share_location() << ","
2453  << "CodeType=" << detection_info.code_type() << ","
2454  << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2455  << "KeepTopK=" << detection_info.keep_top_k() << ","
2456  << "NMSThreshold=" << detection_info.nms_threshold() << ","
2457  << "Eta=" << detection_info.eta() << ","
2458  << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2459  << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2460  << "TopK=" << detection_info.top_k() << ","
2461  << "NumLocClasses=" << detection_info.num_loc_classes()
2462  << "}";
2463 
2464  return os;
2465 }
2466 
2467 /** Formatted output of the DetectionOutputLayerInfo type.
2468  *
2469  * @param[in] detection_info Type to output
2470  *
2471  * @return Formatted string.
2472  */
2473 inline std::string to_string(const DetectionOutputLayerInfo &detection_info)
2474 {
2475  std::stringstream str;
2476  str << detection_info;
2477  return str.str();
2478 }
2479 /** Formatted output of the DetectionPostProcessLayerInfo type.
2480  *
2481  * @param[out] os Output stream
2482  * @param[in] detection_info Type to output
2483  *
2484  * @return Modified output stream.
2485  */
2486 inline ::std::ostream &operator<<(::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
2487 {
2488  os << "{MaxDetections=" << detection_info.max_detections() << ","
2489  << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2490  << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2491  << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2492  << "NumClasses=" << detection_info.num_classes() << ","
2493  << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2494  << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2495  << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2496  << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2497  << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2498  << "DetectionPerClass=" << detection_info.detection_per_class()
2499  << "}";
2500 
2501  return os;
2502 }
2503 
2504 /** Formatted output of the DetectionPostProcessLayerInfo type.
2505  *
2506  * @param[in] detection_info Type to output
2507  *
2508  * @return Formatted string.
2509  */
2510 inline std::string to_string(const DetectionPostProcessLayerInfo &detection_info)
2511 {
2512  std::stringstream str;
2513  str << detection_info;
2514  return str.str();
2515 }
2516 
2517 /** Formatted output of the DetectionWindow type.
2518  *
2519  * @param[in] detection_window Type to output
2520  *
2521  * @return Formatted string.
2522  */
2523 inline std::string to_string(const DetectionWindow &detection_window)
2524 {
2525  std::stringstream str;
2526  str << detection_window;
2527  return str.str();
2528 }
2529 
2530 /** Formatted output of @ref PriorBoxLayerInfo.
2531  *
2532  * @param[out] os Output stream.
2533  * @param[in] info Type to output.
2534  *
2535  * @return Modified output stream.
2536  */
2537 inline ::std::ostream &operator<<(::std::ostream &os, const PriorBoxLayerInfo &info)
2538 {
2539  os << "Clip:" << info.clip()
2540  << "Flip:" << info.flip()
2541  << "StepX:" << info.steps()[0]
2542  << "StepY:" << info.steps()[1]
2543  << "MinSizes:" << info.min_sizes()
2544  << "MaxSizes:" << info.max_sizes()
2545  << "ImgSizeX:" << info.img_size().x
2546  << "ImgSizeY:" << info.img_size().y
2547  << "Offset:" << info.offset()
2548  << "Variances:" << info.variances();
2549 
2550  return os;
2551 }
2552 
2553 /** Formatted output of the WinogradInfo type. */
2554 inline ::std::ostream &operator<<(::std::ostream &os, const WinogradInfo &info)
2555 {
2556  os << "{OutputTileSize=" << info.output_tile_size << ","
2557  << "KernelSize=" << info.kernel_size << ","
2558  << "PadStride=" << info.convolution_info << ","
2559  << "OutputDataLayout=" << info.output_data_layout << "}";
2560 
2561  return os;
2562 }
2563 
2564 inline std::string to_string(const WinogradInfo &type)
2565 {
2566  std::stringstream str;
2567  str << type;
2568  return str.str();
2569 }
2570 
2571 /** Convert a CLTunerMode value to a string
2572  *
2573  * @param val CLTunerMode value to be converted
2574  *
2575  * @return String representing the corresponding CLTunerMode.
2576  */
2577 inline std::string to_string(const CLTunerMode val)
2578 {
2579  switch(val)
2580  {
2582  {
2583  return std::string("Exhaustive");
2584  }
2585  case CLTunerMode::NORMAL:
2586  {
2587  return std::string("Normal");
2588  }
2589  case CLTunerMode::RAPID:
2590  {
2591  return std::string("Rapid");
2592  }
2593  default:
2594  {
2595  ARM_COMPUTE_ERROR("Invalid tuner mode.");
2596  return std::string("UNDEFINED");
2597  }
2598  }
2599 }
2600 /** Converts a @ref CLGEMMKernelType to string
2601  *
2602  * @param[in] val CLGEMMKernelType value to be converted
2603  *
2604  * @return String representing the corresponding CLGEMMKernelType
2605  */
2606 inline std::string to_string(CLGEMMKernelType val)
2607 {
2608  switch(val)
2609  {
2611  {
2612  return "Native";
2613  }
2615  {
2616  return "Reshaped_Only_RHS";
2617  }
2619  {
2620  return "Reshaped";
2621  }
2622  default:
2623  {
2624  return "Unknown";
2625  }
2626  }
2627 }
2628 /** [Print CLTunerMode type] **/
2629 /** Formatted output of the CLTunerMode type.
2630  *
2631  * @param[out] os Output stream.
2632  * @param[in] val CLTunerMode to output.
2633  *
2634  * @return Modified output stream.
2635  */
2636 inline ::std::ostream &operator<<(::std::ostream &os, const CLTunerMode &val)
2637 {
2638  os << to_string(val);
2639  return os;
2640 }
2641 
2642 /** Formatted output of the ConvolutionInfo type.
2643  *
2644  * @param[out] os Output stream.
2645  * @param[in] conv_info ConvolutionInfo to output.
2646  *
2647  * @return Modified output stream.
2648  */
2649 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionInfo &conv_info)
2650 {
2651  os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2652  << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2653  << "act_info=" << to_string(conv_info.act_info) << ", "
2654  << "dilation=" << conv_info.dilation << "}";
2655  return os;
2656 }
2657 
2658 /** Converts a @ref ConvolutionInfo to string
2659  *
2660  * @param[in] info ConvolutionInfo value to be converted
2661  *
2662  * @return String representing the corresponding ConvolutionInfo
2663  */
2664 inline std::string to_string(const ConvolutionInfo &info)
2665 {
2666  std::stringstream str;
2667  str << info;
2668  return str.str();
2669 }
2670 
2671 /** Formatted output of the FullyConnectedLayerInfo type.
2672  *
2673  * @param[out] os Output stream.
2674  * @param[in] layer_info FullyConnectedLayerInfo to output.
2675  *
2676  * @return Modified output stream.
2677  */
2678 inline ::std::ostream &operator<<(::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
2679 {
2680  os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2681  << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2682  << "transpose_weights=" << layer_info.transpose_weights << ", "
2683  << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2684  << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2685  << "constant_weights=" << layer_info.transpose_weights << ", "
2686  << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
2687  return os;
2688 }
2689 
2690 /** Converts a @ref FullyConnectedLayerInfo to string
2691  *
2692  * @param[in] info FullyConnectedLayerInfo value to be converted
2693  *
2694  * @return String representing the corresponding FullyConnectedLayerInfo
2695  */
2696 inline std::string to_string(const FullyConnectedLayerInfo &info)
2697 {
2698  std::stringstream str;
2699  str << info;
2700  return str.str();
2701 }
2702 
2703 /** Formatted output of the GEMMLowpOutputStageType type.
2704  *
2705  * @param[out] os Output stream.
2706  * @param[in] gemm_type GEMMLowpOutputStageType to output.
2707  *
2708  * @return Modified output stream.
2709  */
2710 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
2711 {
2712  switch(gemm_type)
2713  {
2715  os << "NONE";
2716  break;
2718  os << "QUANTIZE_DOWN";
2719  break;
2721  os << "QUANTIZE_DOWN_FIXEDPOINT";
2722  break;
2724  os << "QUANTIZE_DOWN_FLOAT";
2725  break;
2726  default:
2727  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2728  }
2729  return os;
2730 }
2731 
2732 /** Converts a @ref GEMMLowpOutputStageType to string
2733  *
2734  * @param[in] gemm_type GEMMLowpOutputStageType value to be converted
2735  *
2736  * @return String representing the corresponding GEMMLowpOutputStageType
2737  */
2738 inline std::string to_string(const GEMMLowpOutputStageType &gemm_type)
2739 {
2740  std::stringstream str;
2741  str << gemm_type;
2742  return str.str();
2743 }
2744 
2745 /** Formatted output of the GEMMLowpOutputStageInfo type.
2746  *
2747  * @param[out] os Output stream.
2748  * @param[in] gemm_info GEMMLowpOutputStageInfo to output.
2749  *
2750  * @return Modified output stream.
2751  */
2752 inline ::std::ostream &operator<<(::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
2753 {
2754  os << "{type=" << gemm_info.type << ", "
2755  << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2756  << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2757  << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2758  << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2759  << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2760  << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2761  << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2762  << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2763  << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2764  << "output_data_type=" << gemm_info.output_data_type << "}";
2765  return os;
2766 }
2767 
2768 /** Converts a @ref GEMMLowpOutputStageInfo to string
2769  *
2770  * @param[in] gemm_info GEMMLowpOutputStageInfo value to be converted
2771  *
2772  * @return String representing the corresponding GEMMLowpOutputStageInfo
2773  */
2774 inline std::string to_string(const GEMMLowpOutputStageInfo &gemm_info)
2775 {
2776  std::stringstream str;
2777  str << gemm_info;
2778  return str.str();
2779 }
2780 
2781 /** Formatted output of the Conv2dInfo type.
2782  *
2783  * @param[out] os Output stream.
2784  * @param[in] conv_info Conv2dInfo to output.
2785  *
2786  * @return Modified output stream.
2787  */
2788 inline ::std::ostream &operator<<(::std::ostream &os, const Conv2dInfo &conv_info)
2789 {
2790  os << "{conv_info=" << conv_info.conv_info << ", "
2791  << "dilation=" << conv_info.dilation << ", "
2792  << "act_info=" << to_string(conv_info.act_info) << ", "
2793  << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2794  << "num_groups=" << conv_info.num_groups << ","
2795  << "post_ops=" << conv_info.post_ops << "}";
2796  return os;
2797 }
2798 
2799 /** Converts a @ref Conv2dInfo to string
2800  *
2801  * @param[in] conv_info Conv2dInfo value to be converted
2802  *
2803  * @return String representing the corresponding Conv2dInfo
2804  */
2805 inline std::string to_string(const Conv2dInfo &conv_info)
2806 {
2807  std::stringstream str;
2808  str << conv_info;
2809  return str.str();
2810 }
2811 
2812 /** Formatted output of the PixelValue type.
2813  *
2814  * @param[out] os Output stream.
2815  * @param[in] pixel_value PixelValue to output.
2816  *
2817  * @return Modified output stream.
2818  */
2819 inline ::std::ostream &operator<<(::std::ostream &os, const PixelValue &pixel_value)
2820 {
2821  os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
2822  return os;
2823 }
2824 
2825 /** Converts a @ref PixelValue to string
2826  *
2827  * @param[in] pixel_value PixelValue value to be converted
2828  *
2829  * @return String representing the corresponding PixelValue
2830  */
2831 inline std::string to_string(const PixelValue &pixel_value)
2832 {
2833  std::stringstream str;
2834  str << pixel_value;
2835  return str.str();
2836 }
2837 
2838 /** Formatted output of the ScaleKernelInfo type.
2839  *
2840  * @param[out] os Output stream.
2841  * @param[in] scale_info ScaleKernelInfo to output.
2842  *
2843  * @return Modified output stream.
2844  */
2845 inline ::std::ostream &operator<<(::std::ostream &os, const ScaleKernelInfo &scale_info)
2846 {
2847  os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2848  << "BorderMode=" << scale_info.border_mode << ", "
2849  << "PixelValue=" << scale_info.constant_border_value << ", "
2850  << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2851  << "use_padding=" << scale_info.use_padding << ", "
2852  << "align_corners=" << scale_info.align_corners << ", "
2853  << "data_layout=" << scale_info.data_layout << "}";
2854  return os;
2855 }
2856 
2857 /** Converts a @ref ScaleKernelInfo to string
2858  *
2859  * @param[in] scale_info ScaleKernelInfo value to be converted
2860  *
2861  * @return String representing the corresponding ScaleKernelInfo
2862  */
2863 inline std::string to_string(const ScaleKernelInfo &scale_info)
2864 {
2865  std::stringstream str;
2866  str << scale_info;
2867  return str.str();
2868 }
2869 
2870 /** Formatted output of the FFTDirection type.
2871  *
2872  * @param[out] os Output stream.
2873  * @param[in] fft_dir FFTDirection to output.
2874  *
2875  * @return Modified output stream.
2876  */
2877 inline ::std::ostream &operator<<(::std::ostream &os, const FFTDirection &fft_dir)
2878 {
2879  switch(fft_dir)
2880  {
2881  case FFTDirection::Forward:
2882  os << "Forward";
2883  break;
2884  case FFTDirection::Inverse:
2885  os << "Inverse";
2886  break;
2887  default:
2888  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2889  }
2890  return os;
2891 }
2892 
2893 /** Converts a @ref FFT1DInfo to string
2894  *
2895  * @param[in] fft_dir FFT1DInfo value to be converted
2896  *
2897  * @return String representing the corresponding FFT1DInfo
2898  */
2899 inline std::string to_string(const FFTDirection &fft_dir)
2900 {
2901  std::stringstream str;
2902  str << "{" << fft_dir << "}";
2903  return str.str();
2904 }
2905 
2906 /** Formatted output of the FFT1DInfo type.
2907  *
2908  * @param[out] os Output stream.
2909  * @param[in] fft1d_info FFT1DInfo to output.
2910  *
2911  * @return Modified output stream.
2912  */
2913 inline ::std::ostream &operator<<(::std::ostream &os, const FFT1DInfo &fft1d_info)
2914 {
2915  os << "{axis=" << fft1d_info.axis << ", "
2916  << "direction=" << fft1d_info.direction << "}";
2917  return os;
2918 }
2919 
2920 /** Converts a @ref FFT1DInfo to string
2921  *
2922  * @param[in] fft1d_info FFT1DInfo value to be converted
2923  *
2924  * @return String representing the corresponding FFT1DInfo
2925  */
2926 inline std::string to_string(const FFT1DInfo &fft1d_info)
2927 {
2928  std::stringstream str;
2929  str << fft1d_info;
2930  return str.str();
2931 }
2932 
2933 /** Formatted output of the FFT2DInfo type.
2934  *
2935  * @param[out] os Output stream.
2936  * @param[in] fft2d_info FFT2DInfo to output.
2937  *
2938  * @return Modified output stream.
2939  */
2940 inline ::std::ostream &operator<<(::std::ostream &os, const FFT2DInfo &fft2d_info)
2941 {
2942  os << "{axis=" << fft2d_info.axis0 << ", "
2943  << "axis=" << fft2d_info.axis1 << ", "
2944  << "direction=" << fft2d_info.direction << "}";
2945  return os;
2946 }
2947 
2948 /** Converts a @ref FFT2DInfo to string
2949  *
2950  * @param[in] fft2d_info FFT2DInfo value to be converted
2951  *
2952  * @return String representing the corresponding FFT2DInfo
2953  */
2954 inline std::string to_string(const FFT2DInfo &fft2d_info)
2955 {
2956  std::stringstream str;
2957  str << fft2d_info;
2958  return str.str();
2959 }
2960 
2961 /** Formatted output of the Coordinates2D type.
2962  *
2963  * @param[out] os Output stream.
2964  * @param[in] coord_2d Coordinates2D to output.
2965  *
2966  * @return Modified output stream.
2967  */
2968 inline ::std::ostream &operator<<(::std::ostream &os, const Coordinates2D &coord_2d)
2969 {
2970  os << "{x=" << coord_2d.x << ", "
2971  << "y=" << coord_2d.y << "}";
2972  return os;
2973 }
2974 
2975 /** Converts a @ref Coordinates2D to string
2976  *
2977  * @param[in] coord_2d Coordinates2D value to be converted
2978  *
2979  * @return String representing the corresponding Coordinates2D
2980  */
2981 inline std::string to_string(const Coordinates2D &coord_2d)
2982 {
2983  std::stringstream str;
2984  str << coord_2d;
2985  return str.str();
2986 }
2987 
2988 /** Formatted output of the FuseBatchNormalizationType type.
2989  *
2990  * @param[out] os Output stream.
2991  * @param[in] fuse_type FuseBatchNormalizationType to output.
2992  *
2993  * @return Modified output stream.
2994  */
2995 inline ::std::ostream &operator<<(::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
2996 {
2997  switch(fuse_type)
2998  {
3000  os << "CONVOLUTION";
3001  break;
3003  os << "DEPTHWISECONVOLUTION";
3004  break;
3005  default:
3006  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3007  }
3008  return os;
3009 }
3010 
3011 /** Converts a @ref FuseBatchNormalizationType to string
3012  *
3013  * @param[in] fuse_type FuseBatchNormalizationType value to be converted
3014  *
3015  * @return String representing the corresponding FuseBatchNormalizationType
3016  */
3017 inline std::string to_string(const FuseBatchNormalizationType &fuse_type)
3018 {
3019  std::stringstream str;
3020  str << fuse_type;
3021  return str.str();
3022 }
3023 
3024 /** Formatted output of the SoftmaxKernelInfo type.
3025  *
3026  * @param[out] os Output stream.
3027  * @param[in] info SoftmaxKernelInfo to output.
3028  *
3029  * @return Modified output stream.
3030  */
3031 inline ::std::ostream &operator<<(::std::ostream &os, const SoftmaxKernelInfo &info)
3032 {
3033  os << "{beta=" << info.beta << ", "
3034  << "is_log=" << info.is_log << ", "
3035  << "input_data_type=" << info.input_data_type << ", "
3036  << "axis=" << info.axis << "}";
3037  return os;
3038 }
3039 
3040 /** Converts a @ref SoftmaxKernelInfo to string
3041  *
3042  * @param[in] info SoftmaxKernelInfo value to be converted
3043  *
3044  * @return String representing the corresponding SoftmaxKernelInfo
3045  */
3046 inline std::string to_string(const SoftmaxKernelInfo &info)
3047 {
3048  std::stringstream str;
3049  str << info;
3050  return str.str();
3051 }
3052 
3053 /** Formatted output of the ScaleKernelInfo type.
3054  *
3055  * @param[out] os Output stream.
3056  * @param[in] lstm_params LSTMParams to output.
3057  *
3058  * @return Modified output stream.
3059  */
3060 template <typename T>
3061 ::std::ostream &operator<<(::std::ostream &os, const LSTMParams<T> &lstm_params)
3062 {
3063  os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3064  << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3065  << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3066  << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3067  << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3068  << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3069  << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3070  << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3071  << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3072  << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3073  << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3074  << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
3075  << "cell_clip=" << lstm_params.cell_clip() << ", "
3076  << "projection_clip=" << lstm_params.projection_clip() << ", "
3077  << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3078  << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3079  << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3080  << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3081  << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3082  << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3083  << "has_projection=" << lstm_params.has_projection() << ", "
3084  << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3085  << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3086  return os;
3087 }
3088 
3089 /** Converts a @ref LSTMParams to string
3090  *
3091  * @param[in] lstm_params LSTMParams<T> value to be converted
3092  *
3093  * @return String representing the corresponding LSTMParams
3094  */
3095 template <typename T>
3096 std::string to_string(const LSTMParams<T> &lstm_params)
3097 {
3098  std::stringstream str;
3099  str << lstm_params;
3100  return str.str();
3101 }
3102 
3103 /** Converts a @ref LSTMParams to string
3104  *
3105  * @param[in] num uint8_t value to be converted
3106  *
3107  * @return String representing the corresponding uint8_t
3108  */
3109 inline std::string to_string(const uint8_t num)
3110 {
3111  // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3112  return ::std::to_string(static_cast<int>(num));
3113 }
3114 
3115 /** Available non maxima suppression types */
3116 /** Formatted output of the NMSType type.
3117  *
3118  * @param[out] os Output stream.
3119  * @param[in] nms_type NMSType to output.
3120  *
3121  * @return Modified output stream.
3122  */
3123 inline ::std::ostream &operator<<(::std::ostream &os, const NMSType &nms_type)
3124 {
3125  switch(nms_type)
3126  {
3127  case NMSType::LINEAR:
3128  os << "LINEAR";
3129  break;
3130  case NMSType::GAUSSIAN:
3131  os << "GAUSSIAN";
3132  break;
3133  case NMSType::ORIGINAL:
3134  os << "ORIGINAL";
3135  break;
3136  default:
3137  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3138  }
3139  return os;
3140 }
3141 
3142 /** Converts a @ref NMSType to string
3143  *
3144  * @param[in] nms_type NMSType value to be converted
3145  *
3146  * @return String representing the corresponding NMSType
3147  */
3148 inline std::string to_string(const NMSType nms_type)
3149 {
3150  std::stringstream str;
3151  str << nms_type;
3152  return str.str();
3153 }
3154 
3155 /** Formatted output of the BoxNMSLimitInfo type.
3156  *
3157  * @param[out] os Output stream.
3158  * @param[in] info BoxNMSLimitInfo to output.
3159  *
3160  * @return Modified output stream.
3161  */
3162 inline ::std::ostream &operator<<(::std::ostream &os, const BoxNMSLimitInfo &info)
3163 {
3164  os << "{score_thresh=" << info.score_thresh() << ", "
3165  << "nms=" << info.nms() << ", "
3166  << "detections_per_im=" << info.detections_per_im() << ", "
3167  << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3168  << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3169  << "suppress_size=" << info.suppress_size() << ", "
3170  << "min_size=" << info.min_size() << ", "
3171  << "im_width=" << info.im_width() << ", "
3172  << "im_height=" << info.im_height() << "}";
3173  return os;
3174 }
3175 
3176 /** Converts a @ref BoxNMSLimitInfo to string
3177  *
3178  * @param[in] info BoxNMSLimitInfo value to be converted
3179  *
3180  * @return String representing the corresponding BoxNMSLimitInfo
3181  */
3182 inline std::string to_string(const BoxNMSLimitInfo &info)
3183 {
3184  std::stringstream str;
3185  str << info;
3186  return str.str();
3187 }
3188 
3189 /** Converts a @ref DimensionRoundingType to string
3190  *
3191  * @param[in] rounding_type DimensionRoundingType value to be converted
3192  *
3193  * @return String representing the corresponding DimensionRoundingType
3194  */
3195 inline std::string to_string(const DimensionRoundingType &rounding_type)
3196 {
3197  std::stringstream str;
3198  str << rounding_type;
3199  return str.str();
3200 }
3201 
3202 /** Formatted output of the Conv3dInfo type.
3203  *
3204  * @param[out] os Output stream.
3205  * @param[in] conv3d_info Type to output.
3206  *
3207  * @return Modified output stream.
3208  */
3209 inline ::std::ostream &operator<<(::std::ostream &os, const Conv3dInfo &conv3d_info)
3210 {
3211  os << conv3d_info.stride;
3212  os << ";";
3213  os << conv3d_info.padding;
3214  os << ";";
3215  os << to_string(conv3d_info.act_info);
3216  os << ";";
3217  os << conv3d_info.dilation;
3218  os << ";";
3219  os << conv3d_info.round_type;
3220  os << ";";
3221  os << conv3d_info.enable_fast_math;
3222 
3223  return os;
3224 }
3225 
3226 /** Formatted output of the Conv3dInfo type.
3227  *
3228  * @param[in] conv3d_info Type to output.
3229  *
3230  * @return Formatted string.
3231  */
3232 inline std::string to_string(const Conv3dInfo &conv3d_info)
3233 {
3234  std::stringstream str;
3235  str << conv3d_info;
3236  return str.str();
3237 }
3238 
3239 } // namespace arm_compute
3240 
3241 #endif /* __ARM_COMPUTE_TYPE_PRINTER_H__ */
BorderMode
Methods available to handle borders.
Definition: Types.h:274
Rectangle type.
Definition: Types.h:426
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Definition: Utils.h:1030
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:390
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:489
InterpolationPolicy
Interpolation method.
Definition: Types.h:411
int num_classes() const
Get num classes.
Definition: Types.h:997
int mult_interleave4x4_height() const
Multiplication factor for the height of the 4x4 interleaved block.
Definition: Types.h:1972
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:2042
Generate Proposals Information class.
Definition: Types.h:1427
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:1002
float im_width() const
Get image width (NMS may suppress boxes whose center sits beyond the image width) ...
Definition: Types.h:644
Descriptor used by the 3d Convolution function.
float scale_value_x() const
Get x scale value.
Definition: Types.h:1150
float score_thresh() const
Get the score threshold.
Definition: Types.h:599
DataLayout output_data_layout
Data layout to use for the output tensor once the convolution has been applied (NCHW or NHWC) ...
Definition: Types.h:2347
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:539
float score
Confidence value for the detection window.
Definition: Types.h:544
bool enabled() const
Check if initialised.
Definition: Types.h:1675
std::vector< PaddingInfo > PaddingList
List of padding information.
Definition: Types.h:453
ReductionOperation
Available reduction operations.
Definition: Types.h:476
Container for 2D border size.
Definition: Types.h:282
bool retain_internal_weights
Retain internal reshaped weights.
Definition: Types.h:1696
unsigned int max_detections() const
Get max detections.
Definition: Types.h:1109
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:2063
#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:106
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:573
Winograd information.
Definition: Types.h:2328
uint32_t norm_size() const
Get the normalization size.
Definition: Types.h:1749
1 channel, 1 U8 per channel
NormType type() const
Get the normalization type.
Definition: Types.h:1744
int mult_transpose1xW_width() const
Multiplication factor for the width of the 1xW transposed block.
Definition: Types.h:1964
float a() const
Get the alpha value.
Definition: Types.h:1665
GEMM reshape information class.
Definition: Types.h:1910
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
Definition: Types.h:2346
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:1868
1 channel, 1 F32 per channel
DimensionRoundingType
Dimension rounding type when down-scaling on CNNs.
Definition: Types.h:550
Searches a subset of LWS configurations while tuning.
Normalization Layer Information class.
Definition: Types.h:1726
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:2078
GEMMType gemm_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:567
Fully connected layer info.
Definition: Types.h:1688
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:2217
GEMM LHS (Left Hand Side) matrix information.
Definition: Types.h:2054
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:79
quantized, asymmetric fixed-point 16-bit number
1 channel, 1 U16 per channel
unsigned int bottom
bottom of the border
Definition: Types.h:392
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:2041
float eta() const
Get eta.
Definition: Types.h:1027
int depth_output_gemm3d() const
Depth of the output when GEMM output is reinterpreted as 3D tensor.
Definition: Types.h:2177
bool use_padding
Indication of using padding.
unsigned int pooled_width() const
Get the pooled width of the layer.
Definition: Types.h:1399
unsigned int pad_top() const
Get the top padding.
Definition: Types.h:753
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:2045
bool retain_internal_weights() const
Flag which specifies if the weights tensor has to be retained from previous run.
Definition: Types.h:2193
CLGEMMKernelType
OpenCL GEMM kernel types.
Definition: CLTypes.h:31
DetectionOutputLayerCodeType
Available Detection Output code types.
Definition: Types.h:939
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:1625
GEMMLowpOutputStageType type
GEMMLowp output stage type.
Definition: Types.h:2040
decltype(strategy::transforms) typedef type
Interface for CPU tensor.
Definition: ITensor.h:36
float spatial_scale() const
Definition: Types.h:1539
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:1139
bool transpose
True if the (k0xn0) block has to be transposed before been stored.
Definition: Types.h:2079
bool interleave
True if the v0 (m0xk0) blocks have to be interleaved in the output row.
Definition: Types.h:2065
bool export_to_cl_image
True if the reshaped rhs has to be exported to cl_image.
Definition: Types.h:2081
int top_k() const
Get top K.
Definition: Types.h:1042
Copyright (c) 2017-2022 Arm Limited.
bool suppress_size() const
Get if NMS will suppress boxes based on their size/position.
Definition: Types.h:634
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:2159
int32_t x
X coordinates.
Definition: Types.h:437
ActivationFunction
Available activation functions.
Definition: Types.h:1629
1 channel, 1 F16 per channel
Samples are taken at pixel center.
float iou_threshold() const
Get intersection over union threshold.
Definition: Types.h:1129
std::string to_string(const Conv3dInfo &conv3d_info)
Formatted output of the Conv3dInfo type.
Definition: TypePrinter.h:3232
NMSType
Available non maxima suppression types.
Definition: Types.h:565
bool is_quantized_per_channel
GEMMLowp quantized per-channel flag.
Definition: Types.h:2049
Convolution Layer Weights Information class.
Definition: Types.h:1844
1 channel, 1 S32 per channel
bool variance_encoded_in_target() const
Get if variance encoded in target.
Definition: Types.h:1012
16-bit brain floating-point number
bool transpose
True if the (m0xk0) block has to be transposed before been stored.
Definition: Types.h:2064
signed 64-bit number
int n() const
Number of matrix B columns.
Definition: Types.h:1948
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:2023
FuseBatchNormalizationType
Available FuseBatchNormalizationType.
Definition: Types.h:158
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:2077
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:438
size_t front
Padding across the depth dimenstion on the front, in elements.
Definition: Types.h:806
std::array< float, 2 > steps() const
Get the step coordinates.
Definition: Types.h:886
float nms() const
Get the NMS.
Definition: Types.h:604
float nms_threshold() const
Get nms threshold.
Definition: Types.h:1022
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:2069
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:2343
Channel
Available channels.
Definition: Types.h:459
Format
Image colour formats.
Definition: Types.h:56
PaddingMode
Padding mode to use for PadLayer.
Definition: Types.h:165
DimensionRoundingType round_type
Definition: Types.h:1380
uint16_t width
Width of the detection window.
Definition: Types.h:541
PadStrideInfo pad_stride_info
Convolution info (Pads, strides,...)
Definition: Types.h:2022
unsigned int n0
Number of columns processed by the matrix multiplication.
Definition: Types.h:2076
ActivationLayerInfo act_info
Fused activation to apply after convolution.
Definition: Types.h:2024
quantized, asymmetric fixed-point 8-bit number unsigned
bool are_weights_reshaped
Reshape the weights tensor if false.
Definition: Types.h:1695
size_t height
Height of the 3D shape or object.
Definition: Size3D.h:93
Coordinates of an item.
Definition: Coordinates.h:37
Pooling Layer Information struct.
Definition: Types.h:1281
float scale_value_h() const
Get h scale value.
Definition: Types.h:1156
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
Definition: Types.h:717
float scale_value_w() const
Get w scale value.
Definition: Types.h:1162
Pooling Layer Information struct.
Definition: Types.h:1186
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:2025
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:1124
float soft_nms_min_score_thres() const
Get soft nms min score threshold.
Definition: Types.h:629
Dimensions with dimensionality.
Definition: Dimensions.h:42
float gemmlowp_real_multiplier
GEMMLowp output stage real multiplier used for quantizing to QASYMM8.
Definition: Types.h:2048
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:2038
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:811
float offset() const
Get the offset.
Definition: Types.h:896
Fourth channel (used by formats with unknown channel types).
DetectionOutputLayerCodeType code_type() const
Get detection output code type.
Definition: Types.h:1007
unsigned int pad_right() const
Get the right padding.
Definition: Types.h:748
size_t top
Padding across the height dimenstion on the top, in elements.
Definition: Types.h:804
const std::vector< float > & scale() const
Scale vector accessor.
int k() const
Number of matrix A columns or matrix B rows.
Definition: Types.h:1956
Quantize using a floating point multiplication.
size_t left
Padding across the width dimenstion on the left, in elements.
Definition: Types.h:802
size_t width
Width of the 3D shape or object.
Definition: Size3D.h:92
Padding and stride information class.
Definition: Types.h:669
ComparisonOperation
Supported comparison operations.
Definition: Types.h:173
GEMMLowpOutputStageType
GEMMLowp output stage type.
Definition: Types.h:2029
Coordinates2D img_size() const
Get the image size coordinates.
Definition: Types.h:891
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:1691
unsigned int num_kernels() const
Return the number of convolution kernels.
Definition: Types.h:1876
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
Definition: Types.h:2185
Bounding Box Transform information class.
Definition: Types.h:1558
unsigned int left
left of the border
Definition: Types.h:393
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:391
::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:2241
uint16_t idx_class
Index of the class.
Definition: Types.h:543
bool pretranspose_B() const
Flag which specifies whether b should be pre-transposed if supported.
Definition: Types.h:2265
int keep_top_k() const
Get the number of total bounding boxes to be kept per image.
Definition: Types.h:1017
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:807
Num samples, channels, height, width.
unsigned int max_classes_per_detection() const
Get max_classes per detection.
Definition: Types.h:1114
bool is_a_reshaped() const
Flag which specifies if the matrix A has been reshaped.
Definition: Types.h:2151
float scale_value_y() const
Get y scale value.
Definition: Types.h:1144
uint16_t height
Height of the detection window.
Definition: Types.h:542
const experimental::PostOpList< ITensorInfo * > & post_ops() const
Post operations to apply after the matrix multiplication.
Definition: Types.h:2297
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:639
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:2043
Detection Output layer info.
Definition: Types.h:948
4 channels, 1 U8 per channel
experimental::PostOpList< ITensorInfo * > post_ops
PoolingType
Available pooling types.
Definition: Types.h:557
size_t right
Padding across the width dimenstion on the right, in elements.
Definition: Types.h:803
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:1274
size_t width
Width of the image region or rectangle.
Definition: Size2D.h:90
Coordinate type.
Definition: Types.h:435
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34
unsigned int pooled_height() const
Get the pooled height of the layer.
Definition: Types.h:1404
int m() const
Number of matrix A rows.
Definition: Types.h:1940
Borders are left undefined.
ROI Pooling Layer Information class.
Definition: Types.h:1384
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:537
DataLayout weights_trained_layout
Layout that the weights have been trained with.
Definition: Types.h:1693
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155
std::vector< float > max_sizes() const
Get max sizes.
Definition: Types.h:911
ComputeAnchors information class.
Definition: Types.h:1508
CLTunerMode
< OpenCL tuner modes
Definition: CLTunerTypes.h:35
uint16_t width
Width of the rectangle.
Definition: Types.h:430
Num samples, height, width, channels.
unsigned int detection_per_class() const
Get detection per class.
Definition: Types.h:1119
bool flip() const
Get the flip value.
Definition: Types.h:901
2 channel, 1 U8 per channel
uint16_t y
Top-left y coordinate.
Definition: Types.h:540
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:1699
float spatial_scale() const
Get the spatial scale.
Definition: Types.h:1409
uint16_t y
Top-left y coordinate.
Definition: Types.h:429
Detection Output layer info.
Definition: Types.h:1067
bool interleave
True if the h0 (k0xn0) blocks have to be interleaved in the output row.
Definition: Types.h:2080
unsigned int num_classes() const
Get num classes.
Definition: Types.h:1134
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:881
bool transpose_weights
Transpose weights if true.
Definition: Types.h:1694
Size2D kernel_size
Width and height of the kernel.
Definition: Types.h:2344
std::array< float, 4 > weights() const
Definition: Types.h:1579
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:2169
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:2062
uint16_t x
Top-left x coordinate.
Definition: Types.h:428
GEMM information class.
Definition: Types.h:2090
unsigned int m0
Number of rows processed by the matrix multiplication.
Definition: Types.h:2061
FFTDirection direction
Direction of the FFT.
ActivationFunction activation() const
Get the type of activation function.
Definition: Types.h:1660
float b() const
Get the beta value.
Definition: Types.h:1670
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:101
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:2044
int mult_transpose1xW_width
Multiplication factor for the width of the 1xW transposed block.
uint16_t height
Height of the rectangle.
Definition: Types.h:431
ActivationLayerInfo act_info
unsigned int pad_bottom() const
Get the bottom padding.
Definition: Types.h:758
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:906
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:2050
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:743
Searches all possible LWS configurations while tuning.
ElementWiseUnary
Available element wise unary operations.
Definition: Types.h:502
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:456
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:96
NormType
The normalization type used for the normalization layer.
Definition: Types.h:524
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:404
unsigned int axis0
Axis to run first pass on.
int background_label_id() const
Get background label ID.
Definition: Types.h:1032
float im_height() const
Get image height (NMS may suppress boxes whose center sits beyond the image height) ...
Definition: Types.h:649
float confidence_threshold() const
Get confidence threshold.
Definition: Types.h:1037
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:1884
int num_loc_classes() const
Get number of location classes.
Definition: Types.h:1047
size_t bottom
Padding across the height dimenstion on the bottom, in elements.
Definition: Types.h:805
bool soft_nms_enabled() const
Check if soft NMS is enabled.
Definition: Types.h:614
int detections_per_im() const
Get the number of detections.
Definition: Types.h:609
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:876
Padding information for 3D operations like Conv3d.
Definition: Types.h:786