blob: 5d6c9f308dde58560a02aa38ec20c019263b5f8c [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;
68 case NodeType::BatchNormalizationLayer:
69 os << "BatchNormalizationLayer";
70 break;
Manuel Bottinid2048ce2018-10-23 17:00:42 +010071 case NodeType::BoundingBoxTransformLayer:
72 os << "BoundingBoxTransformLayer";
73 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010074 case NodeType::ChannelShuffleLayer:
75 os << "ChannelShuffleLayer";
76 break;
Georgios Pinitase2220552018-07-20 13:23:44 +010077 case NodeType::ConcatenateLayer:
78 os << "ConcatenateLayer";
79 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010080 case NodeType::ConvolutionLayer:
81 os << "ConvolutionLayer";
82 break;
83 case NodeType::DeconvolutionLayer:
84 os << "DeconvolutionLayer";
85 break;
Isabella Gottardicd4e9ab2019-11-05 17:50:27 +000086 case NodeType::DequantizationLayer:
87 os << "DequantizationLayer";
88 break;
Isabella Gottardi7234ed82018-11-27 08:51:10 +000089 case NodeType::DetectionOutputLayer:
90 os << "DetectionOutputLayer";
91 break;
Isabella Gottardia7acb3c2019-01-08 13:48:44 +000092 case NodeType::DetectionPostProcessLayer:
93 os << "DetectionPostProcessLayer";
94 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010095 case NodeType::DepthwiseConvolutionLayer:
96 os << "DepthwiseConvolutionLayer";
97 break;
98 case NodeType::EltwiseLayer:
99 os << "EltwiseLayer";
100 break;
Sheri Zhang16dddd22020-05-27 15:03:48 +0100101 case NodeType::UnaryEltwiseLayer:
102 os << "UnaryEltwiseLayer";
103 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100104 case NodeType::FlattenLayer:
105 os << "FlattenLayer";
106 break;
107 case NodeType::FullyConnectedLayer:
108 os << "FullyConnectedLayer";
109 break;
giuros01acce5042019-02-21 17:32:34 +0000110 case NodeType::FusedConvolutionBatchNormalizationLayer:
111 os << "FusedConvolutionBatchNormalizationLayer";
112 break;
Manuel Bottinibffb41e2019-06-20 16:00:27 +0100113 case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer:
114 os << "FusedDepthwiseConvolutionBatchNormalizationLayer";
115 break;
Manuel Bottini5209be52019-02-13 16:34:56 +0000116 case NodeType::GenerateProposalsLayer:
117 os << "GenerateProposalsLayer";
118 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100119 case NodeType::NormalizationLayer:
120 os << "NormalizationLayer";
121 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100122 case NodeType::NormalizePlanarYUVLayer:
123 os << "NormalizePlanarYUVLayer";
124 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100125 case NodeType::PadLayer:
126 os << "PadLayer";
127 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100128 case NodeType::PermuteLayer:
129 os << "PermuteLayer";
130 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100131 case NodeType::PoolingLayer:
132 os << "PoolingLayer";
133 break;
Georgios Pinitasf8c47492020-02-04 17:39:59 +0000134 case NodeType::PReluLayer:
135 os << "PReluLayer";
136 break;
Giorgio Arena6e9d0e02020-01-03 15:02:04 +0000137 case NodeType::PrintLayer:
138 os << "PrintLayer";
139 break;
Pablo Tello32521432018-11-15 14:43:10 +0000140 case NodeType::PriorBoxLayer:
141 os << "PriorBoxLayer";
142 break;
Isabella Gottardi3db1ba92019-05-17 12:35:20 +0100143 case NodeType::QuantizationLayer:
144 os << "QuantizationLayer";
145 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100146 case NodeType::ReorgLayer:
147 os << "ReorgLayer";
148 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100149 case NodeType::ReshapeLayer:
150 os << "ReshapeLayer";
151 break;
152 case NodeType::ResizeLayer:
153 os << "ResizeLayer";
154 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100155 case NodeType::ROIAlignLayer:
156 os << "ROIAlignLayer";
157 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100158 case NodeType::SoftmaxLayer:
159 os << "SoftmaxLayer";
160 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100161 case NodeType::SliceLayer:
162 os << "SliceLayer";
163 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100164 case NodeType::SplitLayer:
165 os << "SplitLayer";
166 break;
Michele Di Giorgioec699752019-03-22 15:25:32 +0000167 case NodeType::StackLayer:
168 os << "StackLayer";
169 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100170 case NodeType::UpsampleLayer:
171 os << "UpsampleLayer";
172 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100173 case NodeType::YOLOLayer:
174 os << "YOLOLayer";
175 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100176 case NodeType::Input:
177 os << "Input";
178 break;
179 case NodeType::Output:
180 os << "Output";
181 break;
182 case NodeType::Const:
183 os << "Const";
184 break;
185 case NodeType::Dummy:
186 os << "Dummy";
187 break;
188 default:
189 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
190 }
191
192 return os;
193}
194
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000195/** Formatted output of the EltwiseOperation type. */
196inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
197{
198 switch(eltwise_op)
199 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100200 case EltwiseOperation::Add:
201 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000202 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100203 case EltwiseOperation::Mul:
204 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000205 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100206 case EltwiseOperation::Sub:
207 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000208 break;
209 default:
210 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
211 }
212
213 return os;
214}
215
216/** Formatted output of the ConvolutionMethod type. */
217inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
218{
219 switch(method)
220 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100221 case ConvolutionMethod::Default:
222 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000223 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100224 case ConvolutionMethod::Direct:
225 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000226 break;
227 case ConvolutionMethod::GEMM:
228 os << "GEMM";
229 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100230 case ConvolutionMethod::Winograd:
231 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000232 break;
233 default:
234 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
235 }
236
237 return os;
238}
239
Giorgio Arena59631a12018-05-02 13:59:04 +0100240/** Formatted output of the FastMathHint type. */
241inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
242{
243 switch(hint)
244 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100245 case FastMathHint::Enabled:
246 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100247 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100248 case FastMathHint::Disabled:
249 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100250 break;
251 default:
252 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
253 }
254
255 return os;
256}
257
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000258/** Formatted output of the DepthwiseConvolutionMethod type. */
259inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
260{
261 switch(method)
262 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100263 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000264 os << "DEFAULT";
265 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100266 case DepthwiseConvolutionMethod::Optimized3x3:
267 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000268 break;
269 default:
270 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
271 }
272
273 return os;
274}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100275} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000276} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000277#endif /* ARM_COMPUTE_GRAPH_TYPE_PRINTER_H */