blob: 9da0e6157c45c03fc537eac64ae440bbbc0e2e30 [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
Giuseppe Rossinibb365de2019-02-15 10:24:47 +00002 * Copyright (c) 2018-2019 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 */
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010024#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 Gottardi7234ed82018-11-27 08:51:10 +000086 case NodeType::DetectionOutputLayer:
87 os << "DetectionOutputLayer";
88 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010089 case NodeType::DepthwiseConvolutionLayer:
90 os << "DepthwiseConvolutionLayer";
91 break;
92 case NodeType::EltwiseLayer:
93 os << "EltwiseLayer";
94 break;
95 case NodeType::FlattenLayer:
96 os << "FlattenLayer";
97 break;
98 case NodeType::FullyConnectedLayer:
99 os << "FullyConnectedLayer";
100 break;
giuros01acce5042019-02-21 17:32:34 +0000101 case NodeType::FusedConvolutionBatchNormalizationLayer:
102 os << "FusedConvolutionBatchNormalizationLayer";
103 break;
Manuel Bottinibffb41e2019-06-20 16:00:27 +0100104 case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer:
105 os << "FusedDepthwiseConvolutionBatchNormalizationLayer";
106 break;
Manuel Bottini5209be52019-02-13 16:34:56 +0000107 case NodeType::GenerateProposalsLayer:
108 os << "GenerateProposalsLayer";
109 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100110 case NodeType::NormalizationLayer:
111 os << "NormalizationLayer";
112 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100113 case NodeType::NormalizePlanarYUVLayer:
114 os << "NormalizePlanarYUVLayer";
115 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100116 case NodeType::PadLayer:
117 os << "PadLayer";
118 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100119 case NodeType::PermuteLayer:
120 os << "PermuteLayer";
121 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100122 case NodeType::PoolingLayer:
123 os << "PoolingLayer";
124 break;
Pablo Tello32521432018-11-15 14:43:10 +0000125 case NodeType::PriorBoxLayer:
126 os << "PriorBoxLayer";
127 break;
Isabella Gottardi3db1ba92019-05-17 12:35:20 +0100128 case NodeType::QuantizationLayer:
129 os << "QuantizationLayer";
130 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100131 case NodeType::ReorgLayer:
132 os << "ReorgLayer";
133 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100134 case NodeType::ReshapeLayer:
135 os << "ReshapeLayer";
136 break;
137 case NodeType::ResizeLayer:
138 os << "ResizeLayer";
139 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100140 case NodeType::ROIAlignLayer:
141 os << "ROIAlignLayer";
142 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100143 case NodeType::SoftmaxLayer:
144 os << "SoftmaxLayer";
145 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100146 case NodeType::SliceLayer:
147 os << "SliceLayer";
148 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100149 case NodeType::SplitLayer:
150 os << "SplitLayer";
151 break;
Michele Di Giorgioec699752019-03-22 15:25:32 +0000152 case NodeType::StackLayer:
153 os << "StackLayer";
154 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100155 case NodeType::UpsampleLayer:
156 os << "UpsampleLayer";
157 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100158 case NodeType::YOLOLayer:
159 os << "YOLOLayer";
160 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100161 case NodeType::Input:
162 os << "Input";
163 break;
164 case NodeType::Output:
165 os << "Output";
166 break;
167 case NodeType::Const:
168 os << "Const";
169 break;
170 case NodeType::Dummy:
171 os << "Dummy";
172 break;
173 default:
174 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
175 }
176
177 return os;
178}
179
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000180/** Formatted output of the EltwiseOperation type. */
181inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
182{
183 switch(eltwise_op)
184 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100185 case EltwiseOperation::Add:
186 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000187 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100188 case EltwiseOperation::Mul:
189 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000190 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100191 case EltwiseOperation::Sub:
192 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000193 break;
194 default:
195 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
196 }
197
198 return os;
199}
200
201/** Formatted output of the ConvolutionMethod type. */
202inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
203{
204 switch(method)
205 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100206 case ConvolutionMethod::Default:
207 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000208 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100209 case ConvolutionMethod::Direct:
210 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000211 break;
212 case ConvolutionMethod::GEMM:
213 os << "GEMM";
214 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100215 case ConvolutionMethod::Winograd:
216 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000217 break;
218 default:
219 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
220 }
221
222 return os;
223}
224
Giorgio Arena59631a12018-05-02 13:59:04 +0100225/** Formatted output of the FastMathHint type. */
226inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
227{
228 switch(hint)
229 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100230 case FastMathHint::Enabled:
231 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100232 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100233 case FastMathHint::Disabled:
234 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100235 break;
236 default:
237 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
238 }
239
240 return os;
241}
242
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000243/** Formatted output of the DepthwiseConvolutionMethod type. */
244inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
245{
246 switch(method)
247 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100248 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000249 os << "DEFAULT";
250 break;
251 case DepthwiseConvolutionMethod::GEMV:
252 os << "GEMV";
253 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100254 case DepthwiseConvolutionMethod::Optimized3x3:
255 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000256 break;
257 default:
258 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
259 }
260
261 return os;
262}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100263} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000264} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100265#endif /* __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ */