blob: d633091d16a26e45cc624abcb8ebb4f38c84a29a [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
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;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010086 case NodeType::DepthwiseConvolutionLayer:
87 os << "DepthwiseConvolutionLayer";
88 break;
89 case NodeType::EltwiseLayer:
90 os << "EltwiseLayer";
91 break;
92 case NodeType::FlattenLayer:
93 os << "FlattenLayer";
94 break;
95 case NodeType::FullyConnectedLayer:
96 os << "FullyConnectedLayer";
97 break;
Michele Di Giorgio47e6fed2018-11-13 12:04:25 +000098 case NodeType::GenerateProposalsLayer:
99 os << "GenerateProposalsLayer";
100 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100101 case NodeType::NormalizationLayer:
102 os << "NormalizationLayer";
103 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100104 case NodeType::NormalizePlanarYUVLayer:
105 os << "NormalizePlanarYUVLayer";
106 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100107 case NodeType::PadLayer:
108 os << "PadLayer";
109 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100110 case NodeType::PermuteLayer:
111 os << "PermuteLayer";
112 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100113 case NodeType::PoolingLayer:
114 os << "PoolingLayer";
115 break;
Pablo Tello32521432018-11-15 14:43:10 +0000116 case NodeType::PriorBoxLayer:
117 os << "PriorBoxLayer";
118 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100119 case NodeType::ReorgLayer:
120 os << "ReorgLayer";
121 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100122 case NodeType::ReshapeLayer:
123 os << "ReshapeLayer";
124 break;
125 case NodeType::ResizeLayer:
126 os << "ResizeLayer";
127 break;
Manuel Bottini3f9d4d72018-10-19 14:04:42 +0100128 case NodeType::ROIAlignLayer:
129 os << "ROIAlignLayer";
130 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100131 case NodeType::SoftmaxLayer:
132 os << "SoftmaxLayer";
133 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100134 case NodeType::SliceLayer:
135 os << "SliceLayer";
136 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100137 case NodeType::SplitLayer:
138 os << "SplitLayer";
139 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100140 case NodeType::UpsampleLayer:
141 os << "UpsampleLayer";
142 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100143 case NodeType::YOLOLayer:
144 os << "YOLOLayer";
145 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100146 case NodeType::Input:
147 os << "Input";
148 break;
149 case NodeType::Output:
150 os << "Output";
151 break;
152 case NodeType::Const:
153 os << "Const";
154 break;
155 case NodeType::Dummy:
156 os << "Dummy";
157 break;
158 default:
159 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
160 }
161
162 return os;
163}
164
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000165/** Formatted output of the EltwiseOperation type. */
166inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
167{
168 switch(eltwise_op)
169 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100170 case EltwiseOperation::Add:
171 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000172 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100173 case EltwiseOperation::Mul:
174 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000175 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100176 case EltwiseOperation::Sub:
177 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000178 break;
179 default:
180 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
181 }
182
183 return os;
184}
185
186/** Formatted output of the ConvolutionMethod type. */
187inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
188{
189 switch(method)
190 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100191 case ConvolutionMethod::Default:
192 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000193 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100194 case ConvolutionMethod::Direct:
195 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000196 break;
197 case ConvolutionMethod::GEMM:
198 os << "GEMM";
199 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100200 case ConvolutionMethod::Winograd:
201 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000202 break;
203 default:
204 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
205 }
206
207 return os;
208}
209
Giorgio Arena59631a12018-05-02 13:59:04 +0100210/** Formatted output of the FastMathHint type. */
211inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
212{
213 switch(hint)
214 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100215 case FastMathHint::Enabled:
216 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100217 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100218 case FastMathHint::Disabled:
219 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100220 break;
221 default:
222 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
223 }
224
225 return os;
226}
227
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000228/** Formatted output of the DepthwiseConvolutionMethod type. */
229inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
230{
231 switch(method)
232 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100233 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000234 os << "DEFAULT";
235 break;
236 case DepthwiseConvolutionMethod::GEMV:
237 os << "GEMV";
238 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100239 case DepthwiseConvolutionMethod::Optimized3x3:
240 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000241 break;
242 default:
243 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
244 }
245
246 return os;
247}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100248} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000249} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100250#endif /* __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ */