blob: 5e83820ab3bf66d20672858123c6d91f23673386 [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01002 * Copyright (c) 2018-2021, 2023 Arm Limited.
Georgios Pinitasd8734b52017-12-22 15:27:52 +00003 *
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 */
Jakub Sujak0d27b2e2023-08-24 14:01:20 +010024#ifndef ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H
25#define ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H
Georgios Pinitasd8734b52017-12-22 15:27:52 +000026
27#include "arm_compute/core/Error.h"
28#include "arm_compute/core/Types.h"
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010029#include "arm_compute/graph/Types.h"
Georgios Pinitasd8734b52017-12-22 15:27:52 +000030
Georgios Pinitas12be7ab2018-07-03 12:06:23 +010031#include "utils/TypePrinter.h"
32
Georgios Pinitasd8734b52017-12-22 15:27:52 +000033namespace arm_compute
34{
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010035namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +000036{
Georgios Pinitasd8734b52017-12-22 15:27:52 +000037/** Formatted output of the Target. */
38inline ::std::ostream &operator<<(::std::ostream &os, const Target &target)
39{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010040 switch (target)
Georgios Pinitasd8734b52017-12-22 15:27:52 +000041 {
42 case Target::UNSPECIFIED:
43 os << "UNSPECIFIED";
44 break;
45 case Target::NEON:
Sheri Zhangac6499a2021-02-10 15:32:38 +000046 os << "Neon";
Georgios Pinitasd8734b52017-12-22 15:27:52 +000047 break;
48 case Target::CL:
49 os << "CL";
50 break;
Michalis Spyrou402740d2021-04-20 11:26:21 +010051 case Target::CLVK:
52 os << "CLVK";
53 break;
Georgios Pinitasd8734b52017-12-22 15:27:52 +000054 default:
55 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
56 }
57
58 return os;
59}
60
Georgios Pinitasda2491f2018-06-01 17:49:09 +010061inline ::std::ostream &operator<<(::std::ostream &os, const NodeType &node_type)
62{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010063 switch (node_type)
Georgios Pinitasda2491f2018-06-01 17:49:09 +010064 {
65 case NodeType::ActivationLayer:
66 os << "ActivationLayer";
67 break;
thecha01e8f05da2020-08-24 17:21:41 +010068 case NodeType::ArgMinMaxLayer:
69 os << "ArgMinMaxLayer";
70 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010071 case NodeType::BatchNormalizationLayer:
72 os << "BatchNormalizationLayer";
73 break;
Manuel Bottinid2048ce2018-10-23 17:00:42 +010074 case NodeType::BoundingBoxTransformLayer:
75 os << "BoundingBoxTransformLayer";
76 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010077 case NodeType::ChannelShuffleLayer:
78 os << "ChannelShuffleLayer";
79 break;
Georgios Pinitase2220552018-07-20 13:23:44 +010080 case NodeType::ConcatenateLayer:
81 os << "ConcatenateLayer";
82 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010083 case NodeType::ConvolutionLayer:
84 os << "ConvolutionLayer";
85 break;
86 case NodeType::DeconvolutionLayer:
87 os << "DeconvolutionLayer";
88 break;
thecha010a05e6a2020-08-28 18:40:38 +010089 case NodeType::DepthToSpaceLayer:
90 os << "DepthToSpaceLayer";
91 break;
Isabella Gottardicd4e9ab2019-11-05 17:50:27 +000092 case NodeType::DequantizationLayer:
93 os << "DequantizationLayer";
94 break;
Isabella Gottardi7234ed82018-11-27 08:51:10 +000095 case NodeType::DetectionOutputLayer:
96 os << "DetectionOutputLayer";
97 break;
Isabella Gottardia7acb3c2019-01-08 13:48:44 +000098 case NodeType::DetectionPostProcessLayer:
99 os << "DetectionPostProcessLayer";
100 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100101 case NodeType::DepthwiseConvolutionLayer:
102 os << "DepthwiseConvolutionLayer";
103 break;
104 case NodeType::EltwiseLayer:
105 os << "EltwiseLayer";
106 break;
Sheri Zhang16dddd22020-05-27 15:03:48 +0100107 case NodeType::UnaryEltwiseLayer:
108 os << "UnaryEltwiseLayer";
109 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100110 case NodeType::FlattenLayer:
111 os << "FlattenLayer";
112 break;
113 case NodeType::FullyConnectedLayer:
114 os << "FullyConnectedLayer";
115 break;
giuros01acce5042019-02-21 17:32:34 +0000116 case NodeType::FusedConvolutionBatchNormalizationLayer:
117 os << "FusedConvolutionBatchNormalizationLayer";
118 break;
Manuel Bottinibffb41e2019-06-20 16:00:27 +0100119 case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer:
120 os << "FusedDepthwiseConvolutionBatchNormalizationLayer";
121 break;
Manuel Bottini5209be52019-02-13 16:34:56 +0000122 case NodeType::GenerateProposalsLayer:
123 os << "GenerateProposalsLayer";
124 break;
thecha013603aff2020-09-01 14:52:38 +0100125 case NodeType::L2NormalizeLayer:
126 os << "L2NormalizeLayer";
Michalis Spyrou84392f42020-10-06 20:41:21 +0100127 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100128 case NodeType::NormalizationLayer:
129 os << "NormalizationLayer";
130 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100131 case NodeType::NormalizePlanarYUVLayer:
132 os << "NormalizePlanarYUVLayer";
133 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100134 case NodeType::PadLayer:
135 os << "PadLayer";
136 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100137 case NodeType::PermuteLayer:
138 os << "PermuteLayer";
139 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100140 case NodeType::PoolingLayer:
141 os << "PoolingLayer";
142 break;
Georgios Pinitasf8c47492020-02-04 17:39:59 +0000143 case NodeType::PReluLayer:
144 os << "PReluLayer";
145 break;
Giorgio Arena6e9d0e02020-01-03 15:02:04 +0000146 case NodeType::PrintLayer:
147 os << "PrintLayer";
148 break;
Pablo Tello32521432018-11-15 14:43:10 +0000149 case NodeType::PriorBoxLayer:
150 os << "PriorBoxLayer";
151 break;
Isabella Gottardi3db1ba92019-05-17 12:35:20 +0100152 case NodeType::QuantizationLayer:
153 os << "QuantizationLayer";
154 break;
thecha01d64444b2020-09-07 14:50:21 +0100155 case NodeType::ReductionOperationLayer:
156 os << "ReductionOperationLayer";
157 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100158 case NodeType::ReorgLayer:
159 os << "ReorgLayer";
160 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100161 case NodeType::ReshapeLayer:
162 os << "ReshapeLayer";
163 break;
164 case NodeType::ResizeLayer:
165 os << "ResizeLayer";
166 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100167 case NodeType::ROIAlignLayer:
168 os << "ROIAlignLayer";
169 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100170 case NodeType::SoftmaxLayer:
171 os << "SoftmaxLayer";
172 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100173 case NodeType::SliceLayer:
174 os << "SliceLayer";
175 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100176 case NodeType::SplitLayer:
177 os << "SplitLayer";
178 break;
Michele Di Giorgioec699752019-03-22 15:25:32 +0000179 case NodeType::StackLayer:
180 os << "StackLayer";
181 break;
thecha012bfadd92020-08-12 17:25:51 +0100182 case NodeType::StridedSliceLayer:
183 os << "StridedSliceLayer";
184 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100185 case NodeType::UpsampleLayer:
186 os << "UpsampleLayer";
187 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100188 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
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000207/** Formatted output of the EltwiseOperation type. */
208inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
209{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100210 switch (eltwise_op)
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000211 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100212 case EltwiseOperation::Add:
213 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000214 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100215 case EltwiseOperation::Mul:
216 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000217 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100218 case EltwiseOperation::Sub:
219 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000220 break;
Alessandro Navone6413e492021-02-02 11:39:05 +0000221 case EltwiseOperation::Div:
222 os << "Div";
223 break;
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000224 default:
225 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
226 }
227
228 return os;
229}
230
231/** Formatted output of the ConvolutionMethod type. */
232inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
233{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100234 switch (method)
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000235 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100236 case ConvolutionMethod::Default:
237 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000238 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100239 case ConvolutionMethod::Direct:
240 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000241 break;
242 case ConvolutionMethod::GEMM:
243 os << "GEMM";
244 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100245 case ConvolutionMethod::Winograd:
246 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000247 break;
248 default:
249 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
250 }
251
252 return os;
253}
254
Giorgio Arena59631a12018-05-02 13:59:04 +0100255/** Formatted output of the FastMathHint type. */
256inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
257{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100258 switch (hint)
Giorgio Arena59631a12018-05-02 13:59:04 +0100259 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100260 case FastMathHint::Enabled:
261 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100262 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100263 case FastMathHint::Disabled:
264 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100265 break;
266 default:
267 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
268 }
269
270 return os;
271}
272
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000273/** Formatted output of the DepthwiseConvolutionMethod type. */
274inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
275{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100276 switch (method)
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000277 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100278 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000279 os << "DEFAULT";
280 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100281 case DepthwiseConvolutionMethod::Optimized3x3:
282 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000283 break;
284 default:
285 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
286 }
287
288 return os;
289}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100290} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000291} // namespace arm_compute
Jakub Sujak0d27b2e2023-08-24 14:01:20 +0100292#endif // ACL_ARM_COMPUTE_GRAPH_TYPEPRINTER_H