blob: 22b96a04c3f57c02d7fd1f74bc0967c1e6e9ba62 [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2020 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 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_GRAPH_TYPE_PRINTER_H
25#define ARM_COMPUTE_GRAPH_TYPE_PRINTER_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{
40 switch(target)
41 {
42 case Target::UNSPECIFIED:
43 os << "UNSPECIFIED";
44 break;
45 case Target::NEON:
46 os << "NEON";
47 break;
48 case Target::CL:
49 os << "CL";
50 break;
Georgios Pinitas2e01e182018-06-06 14:35:15 +010051 case Target::GC:
52 os << "GC";
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{
63 switch(node_type)
64 {
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";
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100127 case NodeType::NormalizationLayer:
128 os << "NormalizationLayer";
129 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100130 case NodeType::NormalizePlanarYUVLayer:
131 os << "NormalizePlanarYUVLayer";
132 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100133 case NodeType::PadLayer:
134 os << "PadLayer";
135 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100136 case NodeType::PermuteLayer:
137 os << "PermuteLayer";
138 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100139 case NodeType::PoolingLayer:
140 os << "PoolingLayer";
141 break;
Georgios Pinitasf8c47492020-02-04 17:39:59 +0000142 case NodeType::PReluLayer:
143 os << "PReluLayer";
144 break;
Giorgio Arena6e9d0e02020-01-03 15:02:04 +0000145 case NodeType::PrintLayer:
146 os << "PrintLayer";
147 break;
Pablo Tello32521432018-11-15 14:43:10 +0000148 case NodeType::PriorBoxLayer:
149 os << "PriorBoxLayer";
150 break;
Isabella Gottardi3db1ba92019-05-17 12:35:20 +0100151 case NodeType::QuantizationLayer:
152 os << "QuantizationLayer";
153 break;
thecha01d64444b2020-09-07 14:50:21 +0100154 case NodeType::ReductionOperationLayer:
155 os << "ReductionOperationLayer";
156 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100157 case NodeType::ReorgLayer:
158 os << "ReorgLayer";
159 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100160 case NodeType::ReshapeLayer:
161 os << "ReshapeLayer";
162 break;
163 case NodeType::ResizeLayer:
164 os << "ResizeLayer";
165 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100166 case NodeType::ROIAlignLayer:
167 os << "ROIAlignLayer";
168 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100169 case NodeType::SoftmaxLayer:
170 os << "SoftmaxLayer";
171 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100172 case NodeType::SliceLayer:
173 os << "SliceLayer";
174 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100175 case NodeType::SplitLayer:
176 os << "SplitLayer";
177 break;
Michele Di Giorgioec699752019-03-22 15:25:32 +0000178 case NodeType::StackLayer:
179 os << "StackLayer";
180 break;
thecha012bfadd92020-08-12 17:25:51 +0100181 case NodeType::StridedSliceLayer:
182 os << "StridedSliceLayer";
183 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100184 case NodeType::UpsampleLayer:
185 os << "UpsampleLayer";
186 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100187 case NodeType::YOLOLayer:
188 os << "YOLOLayer";
189 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100190 case NodeType::Input:
191 os << "Input";
192 break;
193 case NodeType::Output:
194 os << "Output";
195 break;
196 case NodeType::Const:
197 os << "Const";
198 break;
199 case NodeType::Dummy:
200 os << "Dummy";
201 break;
202 default:
203 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
204 }
205
206 return os;
207}
208
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000209/** Formatted output of the EltwiseOperation type. */
210inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
211{
212 switch(eltwise_op)
213 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100214 case EltwiseOperation::Add:
215 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000216 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100217 case EltwiseOperation::Mul:
218 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000219 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100220 case EltwiseOperation::Sub:
221 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000222 break;
223 default:
224 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
225 }
226
227 return os;
228}
229
230/** Formatted output of the ConvolutionMethod type. */
231inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
232{
233 switch(method)
234 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100235 case ConvolutionMethod::Default:
236 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000237 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100238 case ConvolutionMethod::Direct:
239 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000240 break;
241 case ConvolutionMethod::GEMM:
242 os << "GEMM";
243 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100244 case ConvolutionMethod::Winograd:
245 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000246 break;
247 default:
248 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
249 }
250
251 return os;
252}
253
Giorgio Arena59631a12018-05-02 13:59:04 +0100254/** Formatted output of the FastMathHint type. */
255inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
256{
257 switch(hint)
258 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100259 case FastMathHint::Enabled:
260 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100261 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100262 case FastMathHint::Disabled:
263 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100264 break;
265 default:
266 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
267 }
268
269 return os;
270}
271
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000272/** Formatted output of the DepthwiseConvolutionMethod type. */
273inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
274{
275 switch(method)
276 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100277 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000278 os << "DEFAULT";
279 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100280 case DepthwiseConvolutionMethod::Optimized3x3:
281 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000282 break;
283 default:
284 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
285 }
286
287 return os;
288}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100289} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000290} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000291#endif /* ARM_COMPUTE_GRAPH_TYPE_PRINTER_H */