blob: 9cdd7b77735aae29de77cc2573b107a1e25af134 [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;
71 case NodeType::ChannelShuffleLayer:
72 os << "ChannelShuffleLayer";
73 break;
Georgios Pinitase2220552018-07-20 13:23:44 +010074 case NodeType::ConcatenateLayer:
75 os << "ConcatenateLayer";
76 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010077 case NodeType::ConvolutionLayer:
78 os << "ConvolutionLayer";
79 break;
80 case NodeType::DeconvolutionLayer:
81 os << "DeconvolutionLayer";
82 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +010083 case NodeType::DepthwiseConvolutionLayer:
84 os << "DepthwiseConvolutionLayer";
85 break;
86 case NodeType::EltwiseLayer:
87 os << "EltwiseLayer";
88 break;
89 case NodeType::FlattenLayer:
90 os << "FlattenLayer";
91 break;
92 case NodeType::FullyConnectedLayer:
93 os << "FullyConnectedLayer";
94 break;
95 case NodeType::NormalizationLayer:
96 os << "NormalizationLayer";
97 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +010098 case NodeType::NormalizePlanarYUVLayer:
99 os << "NormalizePlanarYUVLayer";
100 break;
Michele Di Giorgio4bb17332018-09-26 13:56:51 +0100101 case NodeType::PadLayer:
102 os << "PadLayer";
103 break;
Georgios Pinitas57c48242018-08-02 13:41:49 +0100104 case NodeType::PermuteLayer:
105 os << "PermuteLayer";
106 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100107 case NodeType::PoolingLayer:
108 os << "PoolingLayer";
109 break;
Michele Di Giorgio555d1102018-09-12 13:51:59 +0100110 case NodeType::ReorgLayer:
111 os << "ReorgLayer";
112 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100113 case NodeType::ReshapeLayer:
114 os << "ReshapeLayer";
115 break;
116 case NodeType::ResizeLayer:
117 os << "ResizeLayer";
118 break;
119 case NodeType::SoftmaxLayer:
120 os << "SoftmaxLayer";
121 break;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +0100122 case NodeType::SliceLayer:
123 os << "SliceLayer";
124 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100125 case NodeType::SplitLayer:
126 os << "SplitLayer";
127 break;
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +0100128 case NodeType::UpsampleLayer:
129 os << "UpsampleLayer";
130 break;
Michalis Spyrou96f67692018-09-13 11:39:28 +0100131 case NodeType::YOLOLayer:
132 os << "YOLOLayer";
133 break;
Georgios Pinitasda2491f2018-06-01 17:49:09 +0100134 case NodeType::Input:
135 os << "Input";
136 break;
137 case NodeType::Output:
138 os << "Output";
139 break;
140 case NodeType::Const:
141 os << "Const";
142 break;
143 case NodeType::Dummy:
144 os << "Dummy";
145 break;
146 default:
147 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
148 }
149
150 return os;
151}
152
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000153/** Formatted output of the EltwiseOperation type. */
154inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
155{
156 switch(eltwise_op)
157 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100158 case EltwiseOperation::Add:
159 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000160 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100161 case EltwiseOperation::Mul:
162 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000163 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100164 case EltwiseOperation::Sub:
165 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000166 break;
167 default:
168 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
169 }
170
171 return os;
172}
173
174/** Formatted output of the ConvolutionMethod type. */
175inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
176{
177 switch(method)
178 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100179 case ConvolutionMethod::Default:
180 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000181 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100182 case ConvolutionMethod::Direct:
183 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000184 break;
185 case ConvolutionMethod::GEMM:
186 os << "GEMM";
187 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100188 case ConvolutionMethod::Winograd:
189 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000190 break;
191 default:
192 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
193 }
194
195 return os;
196}
197
Giorgio Arena59631a12018-05-02 13:59:04 +0100198/** Formatted output of the FastMathHint type. */
199inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
200{
201 switch(hint)
202 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100203 case FastMathHint::Enabled:
204 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100205 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100206 case FastMathHint::Disabled:
207 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100208 break;
209 default:
210 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
211 }
212
213 return os;
214}
215
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000216/** Formatted output of the DepthwiseConvolutionMethod type. */
217inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
218{
219 switch(method)
220 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100221 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000222 os << "DEFAULT";
223 break;
224 case DepthwiseConvolutionMethod::GEMV:
225 os << "GEMV";
226 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100227 case DepthwiseConvolutionMethod::Optimized3x3:
228 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000229 break;
230 default:
231 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
232 }
233
234 return os;
235}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100236} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000237} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100238#endif /* __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ */