blob: 7c0bd8cfddf24143b02e14f068ec7102b3dc1a96 [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;
98 case NodeType::PoolingLayer:
99 os << "PoolingLayer";
100 break;
101 case NodeType::ReshapeLayer:
102 os << "ReshapeLayer";
103 break;
104 case NodeType::ResizeLayer:
105 os << "ResizeLayer";
106 break;
107 case NodeType::SoftmaxLayer:
108 os << "SoftmaxLayer";
109 break;
110 case NodeType::SplitLayer:
111 os << "SplitLayer";
112 break;
113 case NodeType::Input:
114 os << "Input";
115 break;
116 case NodeType::Output:
117 os << "Output";
118 break;
119 case NodeType::Const:
120 os << "Const";
121 break;
122 case NodeType::Dummy:
123 os << "Dummy";
124 break;
125 default:
126 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
127 }
128
129 return os;
130}
131
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000132/** Formatted output of the EltwiseOperation type. */
133inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op)
134{
135 switch(eltwise_op)
136 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100137 case EltwiseOperation::Add:
138 os << "Add";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000139 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100140 case EltwiseOperation::Mul:
141 os << "Mul";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000142 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100143 case EltwiseOperation::Sub:
144 os << "Sub";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000145 break;
146 default:
147 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
148 }
149
150 return os;
151}
152
153/** Formatted output of the ConvolutionMethod type. */
154inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method)
155{
156 switch(method)
157 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100158 case ConvolutionMethod::Default:
159 os << "Default";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000160 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100161 case ConvolutionMethod::Direct:
162 os << "Direct";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000163 break;
164 case ConvolutionMethod::GEMM:
165 os << "GEMM";
166 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100167 case ConvolutionMethod::Winograd:
168 os << "Winograd";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000169 break;
170 default:
171 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
172 }
173
174 return os;
175}
176
Giorgio Arena59631a12018-05-02 13:59:04 +0100177/** Formatted output of the FastMathHint type. */
178inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint)
179{
180 switch(hint)
181 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100182 case FastMathHint::Enabled:
183 os << "Enabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100184 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100185 case FastMathHint::Disabled:
186 os << "Disabled";
Giorgio Arena59631a12018-05-02 13:59:04 +0100187 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 DepthwiseConvolutionMethod type. */
196inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method)
197{
198 switch(method)
199 {
Georgios Pinitase2220552018-07-20 13:23:44 +0100200 case DepthwiseConvolutionMethod::Default:
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000201 os << "DEFAULT";
202 break;
203 case DepthwiseConvolutionMethod::GEMV:
204 os << "GEMV";
205 break;
Georgios Pinitase2220552018-07-20 13:23:44 +0100206 case DepthwiseConvolutionMethod::Optimized3x3:
207 os << "Optimized3x3";
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000208 break;
209 default:
210 ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
211 }
212
213 return os;
214}
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100215} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000216} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100217#endif /* __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ */