Compute Library
 23.11
TypePrinter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2021, 2023 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 ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H
25 #define ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H
26 
27 #include "arm_compute/core/Error.h"
28 #include "arm_compute/core/Types.h"
30 
31 #include "utils/TypePrinter.h"
32 
33 namespace arm_compute
34 {
35 namespace graph
36 {
37 /** Formatted output of the Target. */
38 inline ::std::ostream &operator<<(::std::ostream &os, const Target &target)
39 {
40  switch (target)
41  {
43  os << "UNSPECIFIED";
44  break;
45  case Target::NEON:
46  os << "Neon";
47  break;
48  case Target::CL:
49  os << "CL";
50  break;
51  case Target::CLVK:
52  os << "CLVK";
53  break;
54  default:
55  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
56  }
57 
58  return os;
59 }
60 
61 inline ::std::ostream &operator<<(::std::ostream &os, const NodeType &node_type)
62 {
63  switch (node_type)
64  {
66  os << "ActivationLayer";
67  break;
69  os << "ArgMinMaxLayer";
70  break;
72  os << "BatchNormalizationLayer";
73  break;
75  os << "BoundingBoxTransformLayer";
76  break;
78  os << "ChannelShuffleLayer";
79  break;
81  os << "ConcatenateLayer";
82  break;
84  os << "ConvolutionLayer";
85  break;
87  os << "DeconvolutionLayer";
88  break;
90  os << "DepthToSpaceLayer";
91  break;
93  os << "DequantizationLayer";
94  break;
96  os << "DetectionOutputLayer";
97  break;
99  os << "DetectionPostProcessLayer";
100  break;
102  os << "DepthwiseConvolutionLayer";
103  break;
105  os << "EltwiseLayer";
106  break;
108  os << "UnaryEltwiseLayer";
109  break;
111  os << "FlattenLayer";
112  break;
114  os << "FullyConnectedLayer";
115  break;
117  os << "FusedConvolutionBatchNormalizationLayer";
118  break;
120  os << "FusedDepthwiseConvolutionBatchNormalizationLayer";
121  break;
123  os << "GenerateProposalsLayer";
124  break;
126  os << "L2NormalizeLayer";
127  break;
129  os << "NormalizationLayer";
130  break;
132  os << "NormalizePlanarYUVLayer";
133  break;
134  case NodeType::PadLayer:
135  os << "PadLayer";
136  break;
138  os << "PermuteLayer";
139  break;
141  os << "PoolingLayer";
142  break;
144  os << "PReluLayer";
145  break;
147  os << "PrintLayer";
148  break;
150  os << "PriorBoxLayer";
151  break;
153  os << "QuantizationLayer";
154  break;
156  os << "ReductionOperationLayer";
157  break;
159  os << "ReorgLayer";
160  break;
162  os << "ReshapeLayer";
163  break;
165  os << "ResizeLayer";
166  break;
168  os << "ROIAlignLayer";
169  break;
171  os << "SoftmaxLayer";
172  break;
174  os << "SliceLayer";
175  break;
177  os << "SplitLayer";
178  break;
180  os << "StackLayer";
181  break;
183  os << "StridedSliceLayer";
184  break;
186  os << "UpsampleLayer";
187  break;
188  case NodeType::Input:
189  os << "Input";
190  break;
191  case NodeType::Output:
192  os << "Output";
193  break;
194  case NodeType::Const:
195  os << "Const";
196  break;
197  case NodeType::Dummy:
198  os << "Dummy";
199  break;
200  default:
201  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
202  }
203 
204  return os;
205 }
206 
207 /** Formatted output of the EltwiseOperation type. */
208 inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
209 {
210  switch (eltwise_op)
211  {
213  os << "Add";
214  break;
216  os << "Mul";
217  break;
219  os << "Sub";
220  break;
222  os << "Div";
223  break;
224  default:
225  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
226  }
227 
228  return os;
229 }
230 
231 /** Formatted output of the ConvolutionMethod type. */
232 inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
233 {
234  switch (method)
235  {
237  os << "Default";
238  break;
240  os << "Direct";
241  break;
243  os << "GEMM";
244  break;
246  os << "Winograd";
247  break;
248  default:
249  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
250  }
251 
252  return os;
253 }
254 
255 /** Formatted output of the FastMathHint type. */
256 inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
257 {
258  switch (hint)
259  {
261  os << "Enabled";
262  break;
264  os << "Disabled";
265  break;
266  default:
267  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
268  }
269 
270  return os;
271 }
272 
273 /** Formatted output of the DepthwiseConvolutionMethod type. */
274 inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
275 {
276  switch (method)
277  {
279  os << "DEFAULT";
280  break;
282  os << "Optimized3x3";
283  break;
284  default:
285  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
286  }
287 
288  return os;
289 }
290 } // namespace graph
291 } // namespace arm_compute
292 #endif // ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H
arm_compute::graph::ConvolutionMethod::Default
@ Default
Default approach using internal heuristics.
arm_compute::graph::EltwiseOperation::Mul
@ Mul
Arithmetic multiplication.
arm_compute::graph::NodeType::DepthToSpaceLayer
@ DepthToSpaceLayer
arm_compute::graph::NodeType::DetectionOutputLayer
@ DetectionOutputLayer
arm_compute::graph::Target::CL
@ CL
OpenCL capable target device.
arm_compute::graph::NodeType::FlattenLayer
@ FlattenLayer
arm_compute::graph::FastMathHint::Enabled
@ Enabled
Fast math enabled for Convolution layer.
arm_compute::graph::ConvolutionMethod::Direct
@ Direct
Deep direct convolution.
arm_compute::graph::NodeType::QuantizationLayer
@ QuantizationLayer
arm_compute::graph::NodeType::NormalizePlanarYUVLayer
@ NormalizePlanarYUVLayer
arm_compute::graph::NodeType::DeconvolutionLayer
@ DeconvolutionLayer
arm_compute::graph::NodeType::PriorBoxLayer
@ PriorBoxLayer
arm_compute::graph::Target::NEON
@ NEON
Arm® Neon™ capable target device.
Types.h
arm_compute::graph::NodeType::UpsampleLayer
@ UpsampleLayer
arm_compute::graph::NodeType::ActivationLayer
@ ActivationLayer
ARM_COMPUTE_ERROR
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:354
arm_compute::graph::NodeType::PoolingLayer
@ PoolingLayer
arm_compute::graph::NodeType::Dummy
@ Dummy
arm_compute::graph::NodeType::PermuteLayer
@ PermuteLayer
arm_compute::graph::NodeType::PadLayer
@ PadLayer
arm_compute::graph::operator<<
inline ::std::ostream & operator<<(::std::ostream &os, const Target &target)
Formatted output of the Target.
Definition: TypePrinter.h:38
arm_compute::graph::NodeType::BoundingBoxTransformLayer
@ BoundingBoxTransformLayer
arm_compute::graph::Target::CLVK
@ CLVK
CLVK capable target device.
arm_compute::graph::NodeType::ROIAlignLayer
@ ROIAlignLayer
arm_compute::graph::NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer
@ FusedDepthwiseConvolutionBatchNormalizationLayer
Error.h
arm_compute::graph::EltwiseOperation::Sub
@ Sub
Arithmetic subtraction.
arm_compute::graph::NodeType::NormalizationLayer
@ NormalizationLayer
arm_compute::graph::EltwiseOperation::Div
@ Div
Arithmetic division.
arm_compute::graph::Target
Target
Definition: Types.h:104
TypePrinter.h
arm_compute::graph::NodeType::EltwiseLayer
@ EltwiseLayer
arm_compute::graph::NodeType::PReluLayer
@ PReluLayer
arm_compute::graph::NodeType::StridedSliceLayer
@ StridedSliceLayer
arm_compute::graph::NodeType::DequantizationLayer
@ DequantizationLayer
arm_compute::graph::Target::UNSPECIFIED
@ UNSPECIFIED
Unspecified Target.
arm_compute::graph::NodeType
NodeType
Supported nodes.
Definition: Types.h:154
arm_compute::graph::NodeType::FullyConnectedLayer
@ FullyConnectedLayer
arm_compute::graph::FastMathHint::Disabled
@ Disabled
Fast math disabled for Convolution layer.
arm_compute::graph::NodeType::ReshapeLayer
@ ReshapeLayer
arm_compute::graph::NodeType::DetectionPostProcessLayer
@ DetectionPostProcessLayer
arm_compute::graph::NodeType::L2NormalizeLayer
@ L2NormalizeLayer
arm_compute::graph::ConvolutionMethod::GEMM
@ GEMM
GEMM based convolution.
arm_compute::graph::NodeType::SoftmaxLayer
@ SoftmaxLayer
arm_compute::graph::NodeType::SplitLayer
@ SplitLayer
arm_compute::graph::NodeType::UnaryEltwiseLayer
@ UnaryEltwiseLayer
arm_compute::graph::NodeType::Input
@ Input
arm_compute::graph::NodeType::ChannelShuffleLayer
@ ChannelShuffleLayer
arm_compute::graph::NodeType::ResizeLayer
@ ResizeLayer
Types.h
arm_compute::graph::FastMathHint
FastMathHint
Enable or disable fast math for Convolution layer.
Definition: Types.h:147
arm_compute::graph::NodeType::ConvolutionLayer
@ ConvolutionLayer
arm_compute::graph::NodeType::ArgMinMaxLayer
@ ArgMinMaxLayer
arm_compute::graph::ConvolutionMethod
ConvolutionMethod
Supported Convolution layer methods.
Definition: Types.h:130
arm_compute::graph::EltwiseOperation::Add
@ Add
Arithmetic addition.
arm_compute::graph::NodeType::Const
@ Const
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::graph::NodeType::PrintLayer
@ PrintLayer
arm_compute::graph::DepthwiseConvolutionMethod::Optimized3x3
@ Optimized3x3
Optimized 3x3 direct depthwise convolution.
arm_compute::graph::NodeType::FusedConvolutionBatchNormalizationLayer
@ FusedConvolutionBatchNormalizationLayer
arm_compute::graph::NodeType::Output
@ Output
arm_compute::graph::DepthwiseConvolutionMethod
DepthwiseConvolutionMethod
Supported Depthwise Convolution layer methods.
Definition: Types.h:139
arm_compute::graph::DepthwiseConvolutionMethod::Default
@ Default
Default approach using internal heuristics.
arm_compute::graph::NodeType::SliceLayer
@ SliceLayer
arm_compute::graph::EltwiseOperation
EltwiseOperation
Supported Element-wise operations.
Definition: Types.h:113
arm_compute::graph::ConvolutionMethod::Winograd
@ Winograd
Winograd based convolution.
arm_compute::graph::NodeType::BatchNormalizationLayer
@ BatchNormalizationLayer
arm_compute::graph::NodeType::ReorgLayer
@ ReorgLayer
arm_compute::graph::NodeType::ConcatenateLayer
@ ConcatenateLayer
arm_compute::graph::NodeType::DepthwiseConvolutionLayer
@ DepthwiseConvolutionLayer
arm_compute::graph::NodeType::ReductionOperationLayer
@ ReductionOperationLayer
arm_compute::graph::NodeType::GenerateProposalsLayer
@ GenerateProposalsLayer
arm_compute::graph::NodeType::StackLayer
@ StackLayer