blob: d56407b52bdf33f9e17ff867a5d497730713336f [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
Giorgio Arena6e9d0e02020-01-03 15:02:04 +00002 * 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;
101 case NodeType::FlattenLayer:
102 os << "FlattenLayer";
103 break;
104 case NodeType::FullyConnectedLayer:
105 os << "FullyConnectedLayer";
106 break;
giuros01acce5042019-02-21 17:32:34 +0000107 case NodeType::FusedConvolutionBatchNormalizationLayer:
108 os << "FusedConvolutionBatchNormalizationLayer";
109 break;
Manuel Bottinibffb41e2019-06-20 16:00:27 +0100110 case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer:
111 os << "FusedDepthwiseConvolutionBatchNormalizationLayer";
112 break;
Manuel Bottini5209be52019-02-13 16:34:56 +0000113 case NodeType::GenerateProposalsLayer:
114 os << "GenerateProposalsLayer";
115 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100116 case NodeType::NormalizationLayer:
117 os << "NormalizationLayer";
118 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100119 case NodeType::NormalizePlanarYUVLayer:
120 os << "NormalizePlanarYUVLayer";
121 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100122 case NodeType::PadLayer:
123 os << "PadLayer";
124 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100125 case NodeType::PermuteLayer:
126 os << "PermuteLayer";
127 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100128 case NodeType::PoolingLayer:
129 os << "PoolingLayer";
130 break;
Georgios Pinitasf8c47492020-02-04 17:39:59 +0000131 case NodeType::PReluLayer:
132 os << "PReluLayer";
133 break;
Giorgio Arena6e9d0e02020-01-03 15:02:04 +0000134 case NodeType::PrintLayer:
135 os << "PrintLayer";
136 break;
Pablo Tello32521432018-11-15 14:43:10 +0000137 case NodeType::PriorBoxLayer:
138 os << "PriorBoxLayer";
139 break;
Isabella Gottardi3db1ba92019-05-17 12:35:20 +0100140 case NodeType::QuantizationLayer:
141 os << "QuantizationLayer";
142 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100143 case NodeType::ReorgLayer:
144 os << "ReorgLayer";
145 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100146 case NodeType::ReshapeLayer:
147 os << "ReshapeLayer";
148 break;
149 case NodeType::ResizeLayer:
150 os << "ResizeLayer";
151 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100152 case NodeType::ROIAlignLayer:
153 os << "ROIAlignLayer";
154 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100155 case NodeType::SoftmaxLayer:
156 os << "SoftmaxLayer";
157 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100158 case NodeType::SliceLayer:
159 os << "SliceLayer";
160 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100161 case NodeType::SplitLayer:
162 os << "SplitLayer";
163 break;
Michele Di Giorgioec699752019-03-22 15:25:32 +0000164 case NodeType::StackLayer:
165 os << "StackLayer";
166 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100167 case NodeType::UpsampleLayer:
168 os << "UpsampleLayer";
169 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100170 case NodeType::YOLOLayer:
171 os << "YOLOLayer";
172 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100173 case NodeType::Input:
174 os << "Input";
175 break;
176 case NodeType::Output:
177 os << "Output";
178 break;
179 case NodeType::Const:
180 os << "Const";
181 break;
182 case NodeType::Dummy:
183 os << "Dummy";
184 break;
185 default:
186 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
187 }
188
189 return os;
190}
191
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000192/** Formatted output of the EltwiseOperation type. */
193inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
194{
195 switch(eltwise_op)
196 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100197 case EltwiseOperation::Add:
198 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000199 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100200 case EltwiseOperation::Mul:
201 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000202 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100203 case EltwiseOperation::Sub:
204 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000205 break;
206 default:
207 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
208 }
209
210 return os;
211}
212
213/** Formatted output of the ConvolutionMethod type. */
214inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
215{
216 switch(method)
217 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100218 case ConvolutionMethod::Default:
219 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000220 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100221 case ConvolutionMethod::Direct:
222 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000223 break;
224 case ConvolutionMethod::GEMM:
225 os << "GEMM";
226 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100227 case ConvolutionMethod::Winograd:
228 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000229 break;
230 default:
231 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
232 }
233
234 return os;
235}
236
Giorgio Arena59631a12018-05-02 13:59:04 +0100237/** Formatted output of the FastMathHint type. */
238inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
239{
240 switch(hint)
241 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100242 case FastMathHint::Enabled:
243 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100244 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100245 case FastMathHint::Disabled:
246 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100247 break;
248 default:
249 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
250 }
251
252 return os;
253}
254
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000255/** Formatted output of the DepthwiseConvolutionMethod type. */
256inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
257{
258 switch(method)
259 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100260 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000261 os << "DEFAULT";
262 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100263 case DepthwiseConvolutionMethod::Optimized3x3:
264 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000265 break;
266 default:
267 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
268 }
269
270 return os;
271}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100272} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000273} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000274#endif /* ARM_COMPUTE_GRAPH_TYPE_PRINTER_H */