summaryrefslogtreecommitdiff
path: root/runtimes/neurun/core/src/graph/dumper/Dumper.cc
blob: 315e2cebf3d2f26ace1c1abc7a8e4320e03dd5ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
/*
 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "Dumper.h"

#include <string>

#include "util/logging.h"

namespace neurun
{
namespace graph
{
namespace dumper
{

using namespace neurun::model::operation;

void Dumper::visit(const AbsNode &node)
{
  VERBOSE(LIR) << "* Abs" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(AbsNode::Input::INPUT).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const AddNode &node)
{
  VERBOSE(LIR) << "* Add" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(AddNode::Input::LHS).value() << ", "
               << node.getInputs().at(AddNode::Input::RHS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ArgMaxNode &node)
{
  VERBOSE(LIR) << "* ArgMax" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ArgMaxNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const AvgPool2DNode &node)
{
  VERBOSE(LIR) << "* AvgPool2D(Implicit)" << std::endl;
  VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(AvgPool2DNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const CastNode &node)
{
  VERBOSE(LIR) << "* Cast" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(CastNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ComparisonNode &node)
{
  VERBOSE(LIR) << "* Comparison" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(ComparisonNode::Input::INPUT0).value() << ", "
               << node.getInputs().at(ComparisonNode::Input::INPUT1).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ConcatNode &node)
{
  VERBOSE(LIR) << "* Concat" << std::endl;
  std::string inputs;
  for (auto i : node.getInputs())
  {
    inputs += std::to_string(i.value()) + ",";
  }
  VERBOSE(LIR) << "  - Inputs : IFM(" << inputs << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const Conv2DNode &node)
{
  std::string padding_type =
      node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
  VERBOSE(LIR) << "* Conv2D(" << padding_type << ")" << std::endl;
  VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(Conv2DNode::Input::INPUT).value()
               << ") Kernel(" << node.getInputs().at(Conv2DNode::Input::KERNEL).value() << ") Bias("
               << node.getInputs().at(Conv2DNode::Input::BIAS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const DepthToSpaceNode &node)
{
  VERBOSE(LIR) << "* DepthToSpace" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(DepthToSpaceNode::Input::INPUT).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const DepthwiseConv2DNode &node)
{
  std::string padding_type =
      node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
  VERBOSE(LIR) << "* DepthwiseConv2D(" << padding_type << ")" << std::endl;
  VERBOSE(LIR) << "  - Inputs : IFM("
               << node.getInputs().at(DepthwiseConv2DNode::Input::INPUT).value() << ") Kernel("
               << node.getInputs().at(DepthwiseConv2DNode::Input::KERNEL).value() << ") Bias("
               << node.getInputs().at(DepthwiseConv2DNode::Input::BIAS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const DequantizeNode &node)
{
  VERBOSE(LIR) << "* Dequantize" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(DequantizeNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const DivNode &node)
{
  VERBOSE(LIR) << "* Div" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(DivNode::Input::LHS).value() << ", "
               << node.getInputs().at(DivNode::Input::RHS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const EmbeddingLookupNode &node)
{
  VERBOSE(LIR) << "* EmbeddingLookup" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Lookups("
               << node.getInputs().at(EmbeddingLookupNode::Input::LOOKUPS).value() << ") VALUES("
               << node.getInputs().at(EmbeddingLookupNode::Input::VALUES).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ExpNode &node)
{
  VERBOSE(LIR) << "* Exp" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ExpNode::Input::INPUT).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const FloorNode &node)
{
  VERBOSE(LIR) << "* Floor" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(FloorNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const FullyConnectedNode &node)
{
  VERBOSE(LIR) << "* FullyConnected" << std::endl;
  VERBOSE(LIR) << "  - Inputs : IFM("
               << node.getInputs().at(FullyConnectedNode::Input::INPUT).value() << ") Weight("
               << node.getInputs().at(FullyConnectedNode::Input::WEIGHT).value() << ") Bias("
               << node.getInputs().at(FullyConnectedNode::Input::BIAS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const GatherNode &node)
{
  VERBOSE(LIR) << "* Gather" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(GatherNode::Input::INPUT).value()
               << ") Indices(" << node.getInputs().at(GatherNode::Input::INDICES).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const HashtableLookupNode &node)
{
  VERBOSE(LIR) << "* HashTableLookup" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Lookups("
               << node.getInputs().at(HashtableLookupNode::Input::LOOKUPS).value() << ") Keys("
               << node.getInputs().at(HashtableLookupNode::Input::KEYS).value() << ") Values("
               << node.getInputs().at(HashtableLookupNode::Input::VALUES).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Outputs : Output("
               << node.getInputs().at(HashtableLookupNode::Output::OUTPUT).value() << ") Hits("
               << node.getInputs().at(HashtableLookupNode::Output::HITS).value() << ")"
               << std::endl;
}

void Dumper::visit(const L2NormalizationNode &node)
{
  VERBOSE(LIR) << "* L2Normalization" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(L2NormalizationNode::Input::INPUT).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const L2Pool2DNode &node)
{
  VERBOSE(LIR) << "* L2Pool2D" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(L2Pool2DNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const LocalResponseNormalizationNode &node)
{
  VERBOSE(LIR) << "* LocalResponseNormalization" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(LocalResponseNormalizationNode::Input::INPUT).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const LSTMNode &node)
{
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LSTMNode::Input::INPUT).value()
               << ") Input To Input Weights("
               << node.getInputs().at(LSTMNode::Input::INPUT_TO_INPUT_WEIGHTS).value()
               << ") Input To Forget Weights("
               << node.getInputs().at(LSTMNode::Input::INPUT_TO_FORGET_WEIGHTS).value()
               << ") Input To Cell Weights("
               << node.getInputs().at(LSTMNode::Input::INPUT_TO_CELL_WEIGHTS).value()
               << ") Input To Output Weights("
               << node.getInputs().at(LSTMNode::Input::INPUT_TO_OUTPUT_WEIGHTS).value()
               << ") Recurrent To Input Weights("
               << node.getInputs().at(LSTMNode::Input::RECURRENT_TO_INPUT_WEIGHTS).value()
               << ") Recurrent To Forget Weights("
               << node.getInputs().at(LSTMNode::Input::RECURRENT_TO_FORGET_WEIGHTS).value()
               << ") Recurrent To Cell Weights("
               << node.getInputs().at(LSTMNode::Input::RECURRENT_TO_CELL_WEIGHTS).value()
               << ") Recurrent To Output Weights("
               << node.getInputs().at(LSTMNode::Input::RECURRENT_TO_OUTPUT_WEIGHTS).value()
               << ") Cell To Input Weights("
               << node.getInputs().at(LSTMNode::Input::CELL_TO_INPUT_WEIGHTS).value()
               << ") Cell To Forget Weights("
               << node.getInputs().at(LSTMNode::Input::CELL_TO_FORGET_WEIGHTS).value()
               << ") Cell To OUTPUT Weights("
               << node.getInputs().at(LSTMNode::Input::CELL_TO_OUTPUT_WEIGHTS).value()
               << ") Input Gate Bias("
               << node.getInputs().at(LSTMNode::Input::INPUT_GATE_BIAS).value()
               << ") Forget Gate Bias("
               << node.getInputs().at(LSTMNode::Input::FORGET_GATE_BIAS).value() << ") Cell Bias("
               << node.getInputs().at(LSTMNode::Input::CELL_BIAS).value() << ") Output Gate Bias("
               << node.getInputs().at(LSTMNode::Input::OUTPUT_GATE_BIAS).value()
               << ") Projection Weights("
               << node.getInputs().at(LSTMNode::Input::PROJECTION_WEIGHTS).value()
               << ") Projection Bias("
               << node.getInputs().at(LSTMNode::Input::PROJECTION_BIAS).value()
               << ") Output State In("
               << node.getInputs().at(LSTMNode::Input::OUTPUT_STATE_IN).value()
               << ") Cell State In(" << node.getInputs().at(LSTMNode::Input::CELL_STATE_IN).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Scratch Buffer("
               << node.getOutputs().at(LSTMNode::Output::SCRATCH_BUFFER).value()
               << ") Output State Out("
               << node.getInputs().at(LSTMNode::Output::OUTPUT_STATE_OUT).value()
               << ") Cell State Out("
               << node.getInputs().at(LSTMNode::Output::CELL_STATE_OUT).value() << ") Output("
               << node.getInputs().at(LSTMNode::Output::OUTPUT).value() << ")" << std::endl;
}

void Dumper::visit(const LogicalAndNode &node)
{
  VERBOSE(LIR) << "* LogicalAnd" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(LogicalAndNode::Input::INPUT0).value() << ", "
               << node.getInputs().at(LogicalAndNode::Input::INPUT1).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const LogicalNotNode &node)
{
  VERBOSE(LIR) << "* LogicalNot" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogicalNotNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const LogicalOrNode &node)
{
  VERBOSE(LIR) << "* LogicalOr" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogicalOrNode::Input::INPUT0).value()
               << ", " << node.getInputs().at(LogicalOrNode::Input::INPUT1).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const LogisticNode &node)
{
  VERBOSE(LIR) << "* Logistic" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(LogisticNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const MaxPool2DNode &node)
{
  std::string padding_type =
      node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
  VERBOSE(LIR) << "* MaxPool2D(" << padding_type << ")" << std::endl;
  VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(MaxPool2DNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const MeanNode &node)
{
  VERBOSE(LIR) << "* Mean" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(MeanNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const MulNode &node)
{
  VERBOSE(LIR) << "* Mul" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(MulNode::Input::LHS).value() << ", "
               << node.getInputs().at(MulNode::Input::RHS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const NegNode &node)
{
  VERBOSE(LIR) << "* Neg" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(NegNode::Input::INPUT).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const PermuteNode &node)
{
  std::string permute_type = "Unknown";
  switch (node.getPermuteType())
  {
    case PermuteNode::Type::COPY:
      permute_type = "Copy";
      break;
    case PermuteNode::Type::NHWC_TO_NCHW:
      permute_type = "NHWC to NCHW";
      break;
    case PermuteNode::Type::NCHW_TO_NHWC:
      permute_type = "NCHW to NHWC";
      break;
  }

  VERBOSE(LIR) << "* Permute(" + permute_type + ")" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(0).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const PReLUNode &node)
{
  VERBOSE(LIR) << "* PReLU" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(PReLUNode::Input::INPUT).value()
               << ") Alpha(" << node.getInputs().at(PReLUNode::Input::ALPHA).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReduceMaxNode &node)
{
  VERBOSE(LIR) << "* ReduceMax" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReduceMaxNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReduceMinNode &node)
{
  VERBOSE(LIR) << "* ReduceMin" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReduceMinNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReduceSumNode &node)
{
  VERBOSE(LIR) << "* ReduceSum" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReduceSumNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReLUNode &node)
{
  VERBOSE(LIR) << "* ReLU" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLUNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReLU1Node &node)
{
  VERBOSE(LIR) << "* ReLU1" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLU1Node::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReLU6Node &node)
{
  VERBOSE(LIR) << "* ReLU6" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReLU6Node::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ReshapeNode &node)
{
  VERBOSE(LIR) << "* Reshape" << std::endl;
  // TODO The shape index should be "node.getInputs().at(1).value()" but not valid for now
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(ReshapeNode::Input::INPUT).value()
               << ") Shape("
               << "?"
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const ResizeBilinearNode &node)
{
  VERBOSE(LIR) << "* ResizeBilinear" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(ResizeBilinearNode::Input::INPUT).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const RNNNode &node)
{
  VERBOSE(LIR) << "* RNN" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(RNNNode::Input::INPUT).value()
               << ") Weights" << node.getInputs().at(RNNNode::Input::WEIGHTS).value()
               << ") Recurrent Weights"
               << node.getInputs().at(RNNNode::Input::RECURRENT_WEIGHTS).value() << ") Bias"
               << node.getInputs().at(RNNNode::Input::BIAS).value() << ") Hidden State"
               << node.getInputs().at(RNNNode::Input::HIDDEN_STATE_IN).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(RNNNode::Output::OUTPUT).value()
               << ") Hidden State" << node.getInputs().at(RNNNode::Output::HIDDEN_STATE_OUT).value()
               << ")" << std::endl;
}

void Dumper::visit(const RSQRTNode &node)
{
  VERBOSE(LIR) << "* RSQRT" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(RSQRTNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SoftmaxNode &node)
{
  VERBOSE(LIR) << "* Softmax" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SoftmaxNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SpaceToDepthNode &node)
{
  VERBOSE(LIR) << "* SpaceToDepth" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(SpaceToDepthNode::Input::INPUT).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SplitNode &node)
{
  VERBOSE(LIR) << "* Split" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SplitNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SQRTNode &node)
{
  VERBOSE(LIR) << "* SQRT" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SQRTNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SquaredDifferenceNode &node)
{
  VERBOSE(LIR) << "* SquaredDifference" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(SquaredDifferenceNode::Input::LHS).value() << ", "
               << node.getInputs().at(SquaredDifferenceNode::Input::RHS).value() << ")"
               << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SqueezeNode &node)
{
  VERBOSE(LIR) << "* Squeeze" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SqueezeNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const StridedSliceNode &node)
{
  VERBOSE(LIR) << "* StridedSlice" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input("
               << node.getInputs().at(StridedSliceNode::Input::INPUT).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const SubNode &node)
{
  VERBOSE(LIR) << "* Sub" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(SubNode::Input::LHS).value() << ", "
               << node.getInputs().at(SubNode::Input::RHS).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const TanhNode &node)
{
  VERBOSE(LIR) << "* TanH" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(TanhNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const TopKV2Node &node)
{
  VERBOSE(LIR) << "* TopKV2" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(TopKV2Node::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Outputs : Values("
               << node.getOutputs().at(TopKV2Node::Output::OUTPUT_VALUES).value() << ") Indices("
               << node.getOutputs().at(TopKV2Node::Output::OUTPUT_INDICES).value() << ")"
               << std::endl;
}

void Dumper::visit(const TransposeConvNode &node)
{
  std::string padding_type =
      node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
  VERBOSE(LIR) << "* TransposeConv(" << padding_type << ")" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Output Shape("
               << node.getInputs().at(TransposeConvNode::Input::OUTPUT_SHAPE).value() << ") KERNEL("
               << node.getInputs().at(TransposeConvNode::Input::KERNEL).value() << ") IFM("
               << node.getInputs().at(TransposeConvNode::Input::INPUT).value() << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const TransposeNode &node)
{
  VERBOSE(LIR) << "* Transpose" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(TransposeNode::Input::INPUT).value()
               << ")" << std::endl;
  VERBOSE(LIR) << "  - Output : Output(" << node.getOutputs().at(0).value() << ")" << std::endl;
}

void Dumper::visit(const model::operation::UnpackNode &node)
{
  VERBOSE(LIR) << "* Unpack" << std::endl;
  VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(UnpackNode::Input::INPUT).value()
               << ")" << std::endl;
  std::string outputs;
  const auto &output_indices = node.getOutputs();
  for (auto it = std::begin(output_indices); it != std::end(output_indices); ++it)
  {
    outputs += std::to_string(it->value());
    if (std::next(it) != std::end(output_indices))
      outputs += ", ";
  }
  VERBOSE(LIR) << "  - Outputs : Outputs(" << outputs << ")" << std::endl;
}

} // namespace dumper
} // namespace graph
} // namespace neurun