e3cbce57a71c749ddf07e642b3780beb7ecc5042
[platform/core/ml/nnfw.git] / runtime / onert / core / src / ir / OperationDumper.cc
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "OperationDumper.h"
18
19 #include <string>
20
21 #include "util/logging.h"
22
23 namespace onert
24 {
25 namespace ir
26 {
27
28 using namespace operation;
29
30 OperationDumper::OperationDumper(const std::string &start_msg)
31 {
32   VERBOSE(LIR) << start_msg << std::endl;
33 }
34
35 void OperationDumper::visit(const Abs &node)
36 {
37   VERBOSE(LIR) << "* Abs" << std::endl;
38   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Abs::Input::INPUT) << ")"
39                << std::endl;
40   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
41 }
42
43 void OperationDumper::visit(const Add &node)
44 {
45   VERBOSE(LIR) << "* Add" << std::endl;
46   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Add::Input::LHS) << ", "
47                << node.getInputs().at(Add::Input::RHS) << ")" << std::endl;
48   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
49 }
50
51 void OperationDumper::visit(const ArgMax &node)
52 {
53   VERBOSE(LIR) << "* ArgMax" << std::endl;
54   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ArgMax::Input::INPUT) << ")"
55                << std::endl;
56   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
57 }
58
59 void OperationDumper::visit(const AvgPool2D &node)
60 {
61   VERBOSE(LIR) << "* AvgPool2D(Implicit)" << std::endl;
62   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(AvgPool2D::Input::INPUT) << ")"
63                << std::endl;
64   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
65 }
66
67 void OperationDumper::visit(const BatchToSpaceND &node)
68 {
69   VERBOSE(LIR) << "* BatchToSpaceND" << std::endl;
70   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(BatchToSpaceND::Input::INPUT) << ")"
71                << " BlockSize(" << node.getInputs().at(BatchToSpaceND::Input::BLOCK_SIZE) << ")"
72                << std::endl;
73   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
74 }
75
76 void OperationDumper::visit(const operation::BroadcastTo &node)
77 {
78   VERBOSE(LIR) << "* BroadcastTo" << std::endl;
79   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(BroadcastTo::Input::INPUT) << ", "
80                << node.getInputs().at(BroadcastTo::Input::SHAPE) << ")" << std::endl;
81   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
82 }
83
84 void OperationDumper::visit(const Cast &node)
85 {
86   VERBOSE(LIR) << "* Cast" << std::endl;
87   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Cast::Input::INPUT) << ")"
88                << std::endl;
89   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
90 }
91
92 void OperationDumper::visit(const Comparison &node)
93 {
94   VERBOSE(LIR) << "* Comparison" << std::endl;
95   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Comparison::Input::INPUT0) << ", "
96                << node.getInputs().at(Comparison::Input::INPUT1) << ")" << std::endl;
97   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
98 }
99
100 void OperationDumper::visit(const Concat &node)
101 {
102   VERBOSE(LIR) << "* Concat" << std::endl;
103   std::string inputs;
104   for (auto i : node.getInputs())
105   {
106     inputs += std::to_string(i.value()) + ",";
107   }
108   VERBOSE(LIR) << "  - Inputs : IFM(" << inputs << ")" << std::endl;
109   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
110 }
111
112 void OperationDumper::visit(const Conv2D &node)
113 {
114   std::string padding_type =
115       node.param().padding.type == PaddingType::EXPLICIT ? "Explicit" : "Implicit";
116   VERBOSE(LIR) << "* Conv2D(" << padding_type << ")" << std::endl;
117   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(Conv2D::Input::INPUT) << ") Kernel("
118                << node.getInputs().at(Conv2D::Input::KERNEL) << ") Bias("
119                << node.getInputs().at(Conv2D::Input::BIAS) << ")" << std::endl;
120   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
121 }
122
123 void OperationDumper::visit(const ConvertFp16ToFp32 &node)
124 {
125   VERBOSE(LIR) << "* ConvertFp16ToFp32" << std::endl;
126   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ConvertFp16ToFp32::Input::INPUT)
127                << ")" << std::endl;
128   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
129 }
130
131 void OperationDumper::visit(const ConvertFp32ToFp16 &node)
132 {
133   VERBOSE(LIR) << "* ConvertFp32ToFp16" << std::endl;
134   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ConvertFp32ToFp16::Input::INPUT)
135                << ")" << std::endl;
136   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
137 }
138
139 void OperationDumper::visit(const Cos &node)
140 {
141   VERBOSE(LIR) << "* Cos" << std::endl;
142   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Cos::Input::INPUT) << ")"
143                << std::endl;
144   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
145 }
146
147 void OperationDumper::visit(const DepthToSpace &node)
148 {
149   VERBOSE(LIR) << "* DepthToSpace" << std::endl;
150   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(DepthToSpace::Input::INPUT) << ")"
151                << std::endl;
152   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
153 }
154
155 void OperationDumper::visit(const DepthwiseConv2D &node)
156 {
157   std::string padding_type =
158       node.param().padding.type == PaddingType::EXPLICIT ? "Explicit" : "Implicit";
159   VERBOSE(LIR) << "* DepthwiseConv2D(" << padding_type << ")" << std::endl;
160   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(DepthwiseConv2D::Input::INPUT)
161                << ") Kernel(" << node.getInputs().at(DepthwiseConv2D::Input::KERNEL) << ") Bias("
162                << node.getInputs().at(DepthwiseConv2D::Input::BIAS) << ")" << std::endl;
163   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
164 }
165
166 void OperationDumper::visit(const Dequantize &node)
167 {
168   VERBOSE(LIR) << "* Dequantize" << std::endl;
169   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Dequantize::Input::INPUT) << ")"
170                << std::endl;
171   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
172 }
173
174 void OperationDumper::visit(const Div &node)
175 {
176   VERBOSE(LIR) << "* Div" << std::endl;
177   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Div::Input::LHS) << ", "
178                << node.getInputs().at(Div::Input::RHS) << ")" << std::endl;
179   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
180 }
181
182 void OperationDumper::visit(const EmbeddingLookup &node)
183 {
184   VERBOSE(LIR) << "* EmbeddingLookup" << std::endl;
185   VERBOSE(LIR) << "  - Inputs : Lookups(" << node.getInputs().at(EmbeddingLookup::Input::LOOKUPS)
186                << ") VALUES(" << node.getInputs().at(EmbeddingLookup::Input::VALUES) << ")"
187                << std::endl;
188   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
189 }
190
191 void OperationDumper::visit(const Exp &node)
192 {
193   VERBOSE(LIR) << "* Exp" << std::endl;
194   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Exp::Input::INPUT) << ")"
195                << std::endl;
196   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
197 }
198
199 void OperationDumper::visit(const ExpandDims &node)
200 {
201   VERBOSE(LIR) << "* ExpandDims" << std::endl;
202   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ExpandDims::Input::INPUT)
203                << ") AXIS(" << node.getInputs().at(ExpandDims::Input::AXIS) << ")" << std::endl;
204   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
205 }
206
207 void OperationDumper::visit(const Floor &node)
208 {
209   VERBOSE(LIR) << "* Floor" << std::endl;
210   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Floor::Input::INPUT) << ")"
211                << std::endl;
212   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
213 }
214
215 void OperationDumper::visit(const FullyConnected &node)
216 {
217   VERBOSE(LIR) << "* FullyConnected" << std::endl;
218   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(FullyConnected::Input::INPUT)
219                << ") Weight(" << node.getInputs().at(FullyConnected::Input::WEIGHT) << ") Bias("
220                << node.getInputs().at(FullyConnected::Input::BIAS) << ")" << std::endl;
221   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
222 }
223
224 void OperationDumper::visit(const Gather &node)
225 {
226   VERBOSE(LIR) << "* Gather" << std::endl;
227   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Gather::Input::INPUT) << ") Indices("
228                << node.getInputs().at(Gather::Input::INDICES) << ")" << std::endl;
229   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
230 }
231
232 void OperationDumper::visit(const HashtableLookup &node)
233 {
234   VERBOSE(LIR) << "* HashTableLookup" << std::endl;
235   VERBOSE(LIR) << "  - Inputs : Lookups(" << node.getInputs().at(HashtableLookup::Input::LOOKUPS)
236                << ") Keys(" << node.getInputs().at(HashtableLookup::Input::KEYS) << ") Values("
237                << node.getInputs().at(HashtableLookup::Input::VALUES) << ")" << std::endl;
238   VERBOSE(LIR) << "  - Outputs : Output(" << node.getInputs().at(HashtableLookup::Output::OUTPUT)
239                << ") Hits(" << node.getInputs().at(HashtableLookup::Output::HITS) << ")"
240                << std::endl;
241 }
242
243 void OperationDumper::visit(const InstanceNorm &node)
244 {
245   VERBOSE(LIR) << "* InstanceNorm" << std::endl;
246   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(InstanceNorm::Input::INPUT)
247                << ") Gamma(" << node.getInputs().at(InstanceNorm::Input::GAMMA) << ") Beta("
248                << node.getInputs().at(InstanceNorm::Input::BETA) << ")" << std::endl;
249   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
250 }
251
252 void OperationDumper::visit(const L2Normalization &node)
253 {
254   VERBOSE(LIR) << "* L2Normalization" << std::endl;
255   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(L2Normalization::Input::INPUT) << ")"
256                << std::endl;
257   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
258 }
259
260 void OperationDumper::visit(const L2Pool2D &node)
261 {
262   VERBOSE(LIR) << "* L2Pool2D" << std::endl;
263   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(L2Pool2D::Input::INPUT) << ")"
264                << std::endl;
265   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
266 }
267
268 void OperationDumper::visit(const LocalResponseNormalization &node)
269 {
270   VERBOSE(LIR) << "* LocalResponseNormalization" << std::endl;
271   VERBOSE(LIR) << "  - Inputs : Input("
272                << node.getInputs().at(LocalResponseNormalization::Input::INPUT) << ")" << std::endl;
273   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
274 }
275
276 void OperationDumper::visit(const LSTM &node)
277 {
278   VERBOSE(LIR)
279       << "  - Inputs : Input(" << node.getInputs().at(LSTM::Input::INPUT)
280       << ") Input To Input Weights(" << node.getInputs().at(LSTM::Input::INPUT_TO_INPUT_WEIGHTS)
281       << ") Input To Forget Weights(" << node.getInputs().at(LSTM::Input::INPUT_TO_FORGET_WEIGHTS)
282       << ") Input To Cell Weights(" << node.getInputs().at(LSTM::Input::INPUT_TO_CELL_WEIGHTS)
283       << ") Input To Output Weights(" << node.getInputs().at(LSTM::Input::INPUT_TO_OUTPUT_WEIGHTS)
284       << ") Recurrent To Input Weights("
285       << node.getInputs().at(LSTM::Input::RECURRENT_TO_INPUT_WEIGHTS)
286       << ") Recurrent To Forget Weights("
287       << node.getInputs().at(LSTM::Input::RECURRENT_TO_FORGET_WEIGHTS)
288       << ") Recurrent To Cell Weights("
289       << node.getInputs().at(LSTM::Input::RECURRENT_TO_CELL_WEIGHTS)
290       << ") Recurrent To Output Weights("
291       << node.getInputs().at(LSTM::Input::RECURRENT_TO_OUTPUT_WEIGHTS) << ") Cell To Input Weights("
292       << node.getInputs().at(LSTM::Input::CELL_TO_INPUT_WEIGHTS) << ") Cell To Forget Weights("
293       << node.getInputs().at(LSTM::Input::CELL_TO_FORGET_WEIGHTS) << ") Cell To OUTPUT Weights("
294       << node.getInputs().at(LSTM::Input::CELL_TO_OUTPUT_WEIGHTS) << ") Input Gate Bias("
295       << node.getInputs().at(LSTM::Input::INPUT_GATE_BIAS) << ") Forget Gate Bias("
296       << node.getInputs().at(LSTM::Input::FORGET_GATE_BIAS) << ") Cell Bias("
297       << node.getInputs().at(LSTM::Input::CELL_BIAS) << ") Output Gate Bias("
298       << node.getInputs().at(LSTM::Input::OUTPUT_GATE_BIAS) << ") Projection Weights("
299       << node.getInputs().at(LSTM::Input::PROJECTION_WEIGHTS) << ") Projection Bias("
300       << node.getInputs().at(LSTM::Input::PROJECTION_BIAS) << ") Output State In("
301       << node.getInputs().at(LSTM::Input::OUTPUT_STATE_IN) << ") Cell State In("
302       << node.getInputs().at(LSTM::Input::CELL_STATE_IN) << ")" << std::endl;
303   VERBOSE(LIR) << "  - Output : Scratch Buffer("
304                << node.getOutputs().at(LSTM::Output::SCRATCH_BUFFER) << ") Output State Out("
305                << node.getInputs().at(LSTM::Output::OUTPUT_STATE_OUT) << ") Cell State Out("
306                << node.getInputs().at(LSTM::Output::CELL_STATE_OUT) << ") Output("
307                << node.getInputs().at(LSTM::Output::OUTPUT) << ")" << std::endl;
308 }
309
310 void OperationDumper::visit(const Log &node)
311 {
312   VERBOSE(LIR) << "* Log" << std::endl;
313   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Log::Input::INPUT) << ")"
314                << std::endl;
315   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
316 }
317
318 void OperationDumper::visit(const LogicalAnd &node)
319 {
320   VERBOSE(LIR) << "* LogicalAnd" << std::endl;
321   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogicalAnd::Input::INPUT0) << ", "
322                << node.getInputs().at(LogicalAnd::Input::INPUT1) << ")" << std::endl;
323   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
324 }
325
326 void OperationDumper::visit(const LogicalNot &node)
327 {
328   VERBOSE(LIR) << "* LogicalNot" << std::endl;
329   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogicalNot::Input::INPUT) << ")"
330                << std::endl;
331   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
332 }
333
334 void OperationDumper::visit(const LogicalOr &node)
335 {
336   VERBOSE(LIR) << "* LogicalOr" << std::endl;
337   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogicalOr::Input::INPUT0) << ", "
338                << node.getInputs().at(LogicalOr::Input::INPUT1) << ")" << std::endl;
339   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
340 }
341
342 void OperationDumper::visit(const Logistic &node)
343 {
344   VERBOSE(LIR) << "* Logistic" << std::endl;
345   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Logistic::Input::INPUT) << ")"
346                << std::endl;
347   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
348 }
349
350 void OperationDumper::visit(const MaxPool2D &node)
351 {
352   std::string padding_type =
353       node.param().padding.type == PaddingType::EXPLICIT ? "Explicit" : "Implicit";
354   VERBOSE(LIR) << "* MaxPool2D(" << padding_type << ")" << std::endl;
355   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(MaxPool2D::Input::INPUT) << ")"
356                << std::endl;
357   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
358 }
359
360 void OperationDumper::visit(const Mul &node)
361 {
362   VERBOSE(LIR) << "* Mul" << std::endl;
363   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Mul::Input::LHS) << ", "
364                << node.getInputs().at(Mul::Input::RHS) << ")" << std::endl;
365   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
366 }
367
368 void OperationDumper::visit(const Neg &node)
369 {
370   VERBOSE(LIR) << "* Neg" << std::endl;
371   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Neg::Input::INPUT) << ")"
372                << std::endl;
373   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
374 }
375
376 void OperationDumper::visit(const Pack &node)
377 {
378   VERBOSE(LIR) << "* Pack" << std::endl;
379   std::string inputs;
380   const auto &input_indices = node.getInputs();
381   for (auto it = std::begin(input_indices); it != std::end(input_indices); ++it)
382   {
383     inputs += std::to_string(it->value());
384     if (std::next(it) != std::end(input_indices))
385       inputs += ", ";
386   }
387   VERBOSE(LIR) << "  - Inputs : Inputs(" << inputs << ")" << std::endl;
388   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
389 }
390
391 void OperationDumper::visit(const Pad &node)
392 {
393   VERBOSE(LIR) << "* Pad" << std::endl;
394   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Pad::Input::INPUT) << ") Pad("
395                << node.getInputs().at(Pad::Input::PAD) << ")" << std::endl;
396   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
397 }
398
399 void OperationDumper::visit(const Permute &node)
400 {
401   std::string permute_type = "Unknown";
402   switch (node.getPermuteType())
403   {
404     case Permute::Type::COPY:
405       permute_type = "Copy";
406       break;
407     case Permute::Type::NHWC_TO_NCHW:
408       permute_type = "NHWC to NCHW";
409       break;
410     case Permute::Type::NCHW_TO_NHWC:
411       permute_type = "NCHW to NHWC";
412       break;
413   }
414
415   VERBOSE(LIR) << "* Permute(" + permute_type + ")" << std::endl;
416   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(0) << ")" << std::endl;
417   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
418 }
419
420 void OperationDumper::visit(const Pow &node)
421 {
422   VERBOSE(LIR) << "* Pow" << std::endl;
423   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Pow::Input::LHS) << ", "
424                << node.getInputs().at(Pow::Input::RHS) << ")" << std::endl;
425   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
426 }
427
428 void OperationDumper::visit(const PReLU &node)
429 {
430   VERBOSE(LIR) << "* PReLU" << std::endl;
431   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(PReLU::Input::INPUT) << ") Alpha("
432                << node.getInputs().at(PReLU::Input::ALPHA) << ")" << std::endl;
433   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
434 }
435
436 void OperationDumper::visit(const Reduce &node)
437 {
438   VERBOSE(LIR) << "* " + node.name() << std::endl;
439   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Reduce::Input::INPUT) << ")"
440                << std::endl;
441   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
442 }
443
444 void OperationDumper::visit(const ReLU &node)
445 {
446   VERBOSE(LIR) << "* ReLU" << std::endl;
447   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLU::Input::INPUT) << ")"
448                << std::endl;
449   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
450 }
451
452 void OperationDumper::visit(const ReLU1 &node)
453 {
454   VERBOSE(LIR) << "* ReLU1" << std::endl;
455   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLU1::Input::INPUT) << ")"
456                << std::endl;
457   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
458 }
459
460 void OperationDumper::visit(const ReLU6 &node)
461 {
462   VERBOSE(LIR) << "* ReLU6" << std::endl;
463   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLU6::Input::INPUT) << ")"
464                << std::endl;
465   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
466 }
467
468 void OperationDumper::visit(const Reshape &node)
469 {
470   VERBOSE(LIR) << "* Reshape" << std::endl;
471   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Reshape::Input::INPUT) << ")";
472   // optional param
473   if (node.getInputs().size() == 2)
474   {
475     VERBOSE(LIR) << " Shape(" << node.getInputs().at(Reshape::Input::SHAPE) << ")";
476   }
477   else
478   {
479     VERBOSE(LIR) << " Shape(not provided)";
480   }
481   VERBOSE(LIR) << std::endl;
482
483   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
484 }
485
486 void OperationDumper::visit(const ResizeBilinear &node)
487 {
488   VERBOSE(LIR) << "* ResizeBilinear" << std::endl;
489   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ResizeBilinear::Input::INPUT) << ")"
490                << std::endl;
491   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
492 }
493
494 void OperationDumper::visit(const Reverse &node)
495 {
496   VERBOSE(LIR) << "* Reverse" << std::endl;
497   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Reverse::Input::INPUT) << ") Axis("
498                << node.getInputs().at(Reverse::Input::AXIS) << ")" << std::endl;
499   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
500 }
501
502 void OperationDumper::visit(const RNN &node)
503 {
504   VERBOSE(LIR) << "* RNN" << std::endl;
505   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(RNN::Input::INPUT) << ") Weights("
506                << node.getInputs().at(RNN::Input::WEIGHTS) << ") Recurrent Weights("
507                << node.getInputs().at(RNN::Input::RECURRENT_WEIGHTS) << ") Bias("
508                << node.getInputs().at(RNN::Input::BIAS) << ") Hidden State("
509                << node.getInputs().at(RNN::Input::HIDDEN_STATE_IN) << ")" << std::endl;
510   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(RNN::Output::OUTPUT)
511                << ") Hidden State(" << node.getInputs().at(RNN::Output::HIDDEN_STATE_OUT) << ")"
512                << std::endl;
513 }
514
515 void OperationDumper::visit(const Round &node)
516 {
517   VERBOSE(LIR) << "* Round" << std::endl;
518   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Round::Input::INPUT) << ")"
519                << std::endl;
520   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
521 }
522
523 void OperationDumper::visit(const Range &node)
524 {
525   VERBOSE(LIR) << "* Range" << std::endl;
526   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Range::Input::START) << ")"
527                << " Limit(" << node.getInputs().at(Range::Input::LIMIT) << ")"
528                << " Delta(" << node.getInputs().at(Range::Input::DELTA) << ")" << std::endl;
529   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
530 }
531
532 void OperationDumper::visit(const RSQRT &node)
533 {
534   VERBOSE(LIR) << "* RSQRT" << std::endl;
535   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(RSQRT::Input::INPUT) << ")"
536                << std::endl;
537   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
538 }
539
540 void OperationDumper::visit(const Select &node)
541 {
542   VERBOSE(LIR) << "* Select" << std::endl;
543   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Select::Input::CONDITION) << ")"
544                << " Input_X(" << node.getInputs().at(Select::Input::INPUT_TRUE) << ")"
545                << " Input_Y(" << node.getInputs().at(Select::Input::INPUT_FALSE) << ")"
546                << std::endl;
547   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
548 }
549
550 void OperationDumper::visit(const ir::operation::Shape &node)
551 {
552   VERBOSE(LIR) << "* Shape" << std::endl;
553   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ir::operation::Shape::Input::INPUT)
554                << ")" << std::endl;
555   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
556 }
557
558 void OperationDumper::visit(const Sin &node)
559 {
560   VERBOSE(LIR) << "* Sin" << std::endl;
561   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Sin::Input::INPUT) << ")"
562                << std::endl;
563   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
564 }
565
566 void OperationDumper::visit(const Softmax &node)
567 {
568   VERBOSE(LIR) << "* Softmax" << std::endl;
569   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Softmax::Input::INPUT) << ")"
570                << std::endl;
571   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
572 }
573
574 void OperationDumper::visit(const SpaceToBatchND &node)
575 {
576   VERBOSE(LIR) << "* SpaceToBatchND" << std::endl;
577   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SpaceToBatchND::Input::INPUT)
578                << ") BlockSize(" << node.getInputs().at(SpaceToBatchND::Input::BLOCK_SIZE)
579                << ") Paddings(" << node.getInputs().at(SpaceToBatchND::Input::PADDINGS) << ")"
580                << std::endl;
581   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
582 }
583
584 void OperationDumper::visit(const SpaceToDepth &node)
585 {
586   VERBOSE(LIR) << "* SpaceToDepth" << std::endl;
587   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SpaceToDepth::Input::INPUT) << ")"
588                << std::endl;
589   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
590 }
591
592 void OperationDumper::visit(const Split &node)
593 {
594   VERBOSE(LIR) << "* Split" << std::endl;
595   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Split::Input::INPUT) << ")"
596                << std::endl;
597   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
598 }
599
600 void OperationDumper::visit(const SQRT &node)
601 {
602   VERBOSE(LIR) << "* SQRT" << std::endl;
603   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SQRT::Input::INPUT) << ")"
604                << std::endl;
605   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
606 }
607
608 void OperationDumper::visit(const SquaredDifference &node)
609 {
610   VERBOSE(LIR) << "* SquaredDifference" << std::endl;
611   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SquaredDifference::Input::LHS)
612                << ", " << node.getInputs().at(SquaredDifference::Input::RHS) << ")" << std::endl;
613   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
614 }
615
616 void OperationDumper::visit(const StatelessRandomUniform &node)
617 {
618   VERBOSE(LIR) << "* StatelessRandomUniform" << std::endl;
619   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(StatelessRandomUniform::Input::SHAPE)
620                << ", " << node.getInputs().at(StatelessRandomUniform::Input::SEED) << ")"
621                << std::endl;
622   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
623 }
624
625 void OperationDumper::visit(const Squeeze &node)
626 {
627   VERBOSE(LIR) << "* Squeeze" << std::endl;
628   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Squeeze::Input::INPUT) << ")"
629                << std::endl;
630   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
631 }
632
633 void OperationDumper::visit(const Slice &node)
634 {
635   VERBOSE(LIR) << "* Slice" << std::endl;
636   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Slice::Input::INPUT) << ")"
637                << std::endl;
638   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
639 }
640
641 void OperationDumper::visit(const StridedSlice &node)
642 {
643   VERBOSE(LIR) << "* StridedSlice" << std::endl;
644   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(StridedSlice::Input::INPUT) << ")"
645                << std::endl;
646   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
647 }
648
649 void OperationDumper::visit(const Sub &node)
650 {
651   VERBOSE(LIR) << "* Sub" << std::endl;
652   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Sub::Input::LHS) << ", "
653                << node.getInputs().at(Sub::Input::RHS) << ")" << std::endl;
654   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
655 }
656
657 void OperationDumper::visit(const Tanh &node)
658 {
659   VERBOSE(LIR) << "* TanH" << std::endl;
660   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Tanh::Input::INPUT) << ")"
661                << std::endl;
662   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
663 }
664
665 void OperationDumper::visit(const Tile &node)
666 {
667   VERBOSE(LIR) << "* Tile" << std::endl;
668   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Tile::Input::INPUT) << ", "
669                << node.getInputs().at(Tile::Input::MULTIPLES) << ")" << std::endl;
670   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
671 }
672
673 void OperationDumper::visit(const TopKV2 &node)
674 {
675   VERBOSE(LIR) << "* TopKV2" << std::endl;
676   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(TopKV2::Input::INPUT) << ")"
677                << std::endl;
678   VERBOSE(LIR) << "  - Outputs : Values(" << node.getOutputs().at(TopKV2::Output::OUTPUT_VALUES)
679                << ") Indices(" << node.getOutputs().at(TopKV2::Output::OUTPUT_INDICES) << ")"
680                << std::endl;
681 }
682
683 void OperationDumper::visit(const TransposeConv &node)
684 {
685   std::string padding_type =
686       node.param().padding.type == PaddingType::EXPLICIT ? "Explicit" : "Implicit";
687   VERBOSE(LIR) << "* TransposeConv(" << padding_type << ")" << std::endl;
688   VERBOSE(LIR) << "  - Inputs : Output Shape("
689                << node.getInputs().at(TransposeConv::Input::OUTPUT_SHAPE) << ") KERNEL("
690                << node.getInputs().at(TransposeConv::Input::KERNEL) << ") IFM("
691                << node.getInputs().at(TransposeConv::Input::INPUT) << ")" << std::endl;
692   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0) << ")" << std::endl;
693 }
694
695 void OperationDumper::visit(const Transpose &node)
696 {
697   VERBOSE(LIR) << "* Transpose" << std::endl;
698   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Transpose::Input::INPUT) << ")"
699                << std::endl;
700   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
701 }
702
703 void OperationDumper::visit(const Unpack &node)
704 {
705   VERBOSE(LIR) << "* Unpack" << std::endl;
706   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Unpack::Input::INPUT) << ")"
707                << std::endl;
708   std::string outputs;
709   const auto &output_indices = node.getOutputs();
710   for (auto it = std::begin(output_indices); it != std::end(output_indices); ++it)
711   {
712     outputs += std::to_string(it->value());
713     if (std::next(it) != std::end(output_indices))
714       outputs += ", ";
715   }
716   VERBOSE(LIR) << "  - Outputs : Outputs(" << outputs << ")" << std::endl;
717 }
718
719 void OperationDumper::visit(const Min &node)
720 {
721   VERBOSE(LIR) << "* Min" << std::endl;
722   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Min::Input::LHS) << ", "
723                << node.getInputs().at(Min::Input::RHS) << ")" << std::endl;
724   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
725 }
726
727 void OperationDumper::visit(const Max &node)
728 {
729   VERBOSE(LIR) << "* Max" << std::endl;
730   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(Max::Input::LHS) << ", "
731                << node.getInputs().at(Max::Input::RHS) << ")" << std::endl;
732   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
733 }
734
735 void OperationDumper::visit(const OneHot &node)
736 {
737   VERBOSE(LIR) << "* OneHot" << std::endl;
738   VERBOSE(LIR) << "  - Inputs : "
739                << "Indices(" << node.getInputs().at(OneHot::Input::INDICES) << ") " << std::endl;
740   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
741 }
742
743 void OperationDumper::visit(const If &node)
744 {
745   VERBOSE(LIR) << "* If" << std::endl;
746   std::string inputs;
747   const auto &input_indices = node.getInputs();
748   for (auto it = std::begin(input_indices); it != std::end(input_indices); ++it)
749   {
750     inputs += std::to_string(it->value());
751     if (std::next(it) != std::end(input_indices))
752       inputs += ", ";
753   }
754   VERBOSE(LIR) << "  - Inputs : "
755                << "Then subgraph (" << node.param().then_subg_index << ") Else subgraph ("
756                << node.param().else_subg_index << ") Inputs(" << inputs << ")" << std::endl;
757   std::string outputs;
758   const auto &output_indices = node.getOutputs();
759   for (auto it = std::begin(output_indices); it != std::end(output_indices); ++it)
760   {
761     outputs += std::to_string(it->value());
762     if (std::next(it) != std::end(output_indices))
763       outputs += ", ";
764   }
765   VERBOSE(LIR) << "  - Output : Outputs(" << outputs << ")" << std::endl;
766 }
767
768 void OperationDumper::visit(const While &node)
769 {
770   VERBOSE(LIR) << "* While" << std::endl;
771   std::string inputs;
772   const auto &input_indices = node.getInputs();
773   for (auto it = std::begin(input_indices); it != std::end(input_indices); ++it)
774   {
775     inputs += std::to_string(it->value());
776     if (std::next(it) != std::end(input_indices))
777       inputs += ", ";
778   }
779   VERBOSE(LIR) << "  - Inputs : "
780                << "Cond subgraph (" << node.param().cond_subg_index << ") Body subgraph ("
781                << node.param().cond_subg_index << ") Inputs(" << inputs << ")" << std::endl;
782   std::string outputs;
783   const auto &output_indices = node.getOutputs();
784   for (auto it = std::begin(output_indices); it != std::end(output_indices); ++it)
785   {
786     outputs += std::to_string(it->value());
787     if (std::next(it) != std::end(output_indices))
788       outputs += ", ";
789   }
790   VERBOSE(LIR) << "  - Output : Outputs(" << outputs << ")" << std::endl;
791 }
792
793 void OperationDumper::visit(const ZerosLike &node)
794 {
795   VERBOSE(LIR) << "* RoZerosLike" << std::endl;
796   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ZerosLike::Input::INPUT) << ")"
797                << std::endl;
798   VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0) << ")" << std::endl;
799 }
800
801 } // namespace ir
802 } // namespace onert