817371dcfe4161eef93b8cda4bc6c43a4215cea4
[platform/core/ml/nnfw.git] / compiler / circledump / src / OpPrinter.cpp
1 /*
2  * Copyright (c) 2020 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 "OpPrinter.h"
18
19 #include <mio_circle/Helper.h>
20
21 #include <memory>
22
23 #include <flatbuffers/flexbuffers.h>
24
25 using std::make_unique;
26
27 namespace circledump
28 {
29
30 // TODO move to some header
31 std::ostream &operator<<(std::ostream &os, const std::vector<int32_t> &vect);
32
33 // TODO Re-arrange in alphabetical order
34
35 class AddPrinter : public OpPrinter
36 {
37 public:
38   void options(const circle::Operator *op, std::ostream &os) const override
39   {
40     if (auto *params = op->builtin_options_as_AddOptions())
41     {
42       os << "    ";
43       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
44          << ") ";
45       os << std::endl;
46     }
47   }
48 };
49
50 class ArgMaxPrinter : public OpPrinter
51 {
52 public:
53   void options(const circle::Operator *op, std::ostream &os) const override
54   {
55     if (auto *params = op->builtin_options_as_ArgMaxOptions())
56     {
57       os << "    ";
58       os << "OutputType(" << EnumNameTensorType(params->output_type()) << ") ";
59       os << std::endl;
60     }
61   }
62 };
63
64 class ArgMinPrinter : public OpPrinter
65 {
66 public:
67   void options(const circle::Operator *op, std::ostream &os) const override
68   {
69     if (auto *params = op->builtin_options_as_ArgMinOptions())
70     {
71       os << "    ";
72       os << "OutputType(" << EnumNameTensorType(params->output_type()) << ") ";
73       os << std::endl;
74     }
75   }
76 };
77
78 class BatchMatMulPrinter : public OpPrinter
79 {
80 public:
81   void options(const circle::Operator *op, std::ostream &os) const override
82   {
83     if (auto *params = op->builtin_options_as_BatchMatMulOptions())
84     {
85       os << "    ";
86       os << std::boolalpha;
87       os << "adjoint_lhs(" << params->adjoint_lhs() << ") ";
88       os << "adjoint_rhs(" << params->adjoint_rhs() << ") ";
89       os << std::noboolalpha;
90       os << std::endl;
91     }
92   }
93 };
94
95 class BidirectionalSequenceLSTMPrinter : public OpPrinter
96 {
97 public:
98   void options(const circle::Operator *op, std::ostream &os) const override
99   {
100     if (auto *params = op->builtin_options_as_BidirectionalSequenceLSTMOptions())
101     {
102       os << "    ";
103       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
104          << ") ";
105       os << "cell_clip(" << params->cell_clip() << ") ";
106       os << "proj_clip(" << params->proj_clip() << ") ";
107       os << "time_major(" << params->time_major() << ") ";
108       os << "asymmetric_quantize_inputs(" << params->asymmetric_quantize_inputs() << ") ";
109       os << "merge_outputs(" << params->merge_outputs() << ") ";
110       os << std::endl;
111     }
112   }
113 };
114
115 class CastPrinter : public OpPrinter
116 {
117 public:
118   void options(const circle::Operator *op, std::ostream &os) const override
119   {
120     if (auto cast_params = op->builtin_options_as_CastOptions())
121     {
122       os << "    ";
123       os << "in_data_type(" << circle::EnumNameTensorType(cast_params->in_data_type()) << ") ";
124       os << "out_data_type(" << circle::EnumNameTensorType(cast_params->out_data_type()) << ") ";
125       os << std::endl;
126     }
127   }
128 };
129
130 class Conv2DPrinter : public OpPrinter
131 {
132 public:
133   void options(const circle::Operator *op, std::ostream &os) const override
134   {
135     if (auto conv_params = op->builtin_options_as_Conv2DOptions())
136     {
137       os << "    ";
138       os << "Padding(" << conv_params->padding() << ") ";
139       os << "Stride.W(" << conv_params->stride_w() << ") ";
140       os << "Stride.H(" << conv_params->stride_h() << ") ";
141       os << "Dilation.W(" << conv_params->dilation_w_factor() << ") ";
142       os << "Dilation.H(" << conv_params->dilation_h_factor() << ") ";
143       os << "Activation("
144          << EnumNameActivationFunctionType(conv_params->fused_activation_function()) << ")";
145       os << std::endl;
146     }
147   }
148 };
149
150 class DepthToSpacePrinter : public OpPrinter
151 {
152 public:
153   void options(const circle::Operator *op, std::ostream &os) const override
154   {
155     if (auto *std_params = op->builtin_options_as_DepthToSpaceOptions())
156     {
157       os << "    ";
158       os << "BlockSize(" << std_params->block_size() << ")";
159       os << std::endl;
160     }
161   }
162 };
163
164 class DivPrinter : public OpPrinter
165 {
166 public:
167   void options(const circle::Operator *op, std::ostream &os) const override
168   {
169     if (auto *params = op->builtin_options_as_DivOptions())
170     {
171       os << "    ";
172       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
173          << ") ";
174       os << std::endl;
175     }
176   }
177 };
178
179 class Pool2DPrinter : public OpPrinter
180 {
181 public:
182   void options(const circle::Operator *op, std::ostream &os) const override
183   {
184     if (auto pool_params = op->builtin_options_as_Pool2DOptions())
185     {
186       os << "    ";
187       os << "Padding(" << pool_params->padding() << ") ";
188       os << "Stride.W(" << pool_params->stride_w() << ") ";
189       os << "Stride.H(" << pool_params->stride_h() << ") ";
190       os << "Filter.W(" << pool_params->filter_width() << ") ";
191       os << "Filter.H(" << pool_params->filter_height() << ") ";
192       os << "Activation("
193          << EnumNameActivationFunctionType(pool_params->fused_activation_function()) << ")";
194       os << std::endl;
195     }
196   }
197 };
198
199 class ConcatenationPrinter : public OpPrinter
200 {
201 public:
202   void options(const circle::Operator *op, std::ostream &os) const override
203   {
204     if (auto *concatenation_params = op->builtin_options_as_ConcatenationOptions())
205     {
206       os << "    ";
207       os << "Activation("
208          << EnumNameActivationFunctionType(concatenation_params->fused_activation_function())
209          << ") ";
210       os << "Axis(" << concatenation_params->axis() << ")";
211       os << std::endl;
212     }
213   }
214 };
215
216 class ReducerPrinter : public OpPrinter
217 {
218 public:
219   void options(const circle::Operator *op, std::ostream &os) const override
220   {
221     if (auto reducer_params = op->builtin_options_as_ReducerOptions())
222     {
223       os << "    ";
224       os << "keep_dims(" << reducer_params->keep_dims() << ") ";
225       os << std::endl;
226     }
227   }
228 };
229
230 class ReshapePrinter : public OpPrinter
231 {
232 public:
233   void options(const circle::Operator *op, std::ostream &os) const override
234   {
235     if (auto *reshape_params = op->builtin_options_as_ReshapeOptions())
236     {
237       auto new_shape = mio::circle::as_index_vector(reshape_params->new_shape());
238       os << "    ";
239       os << "NewShape(" << new_shape << ")";
240       os << std::endl;
241     }
242   }
243 };
244
245 class ResizeBilinearPrinter : public OpPrinter
246 {
247 public:
248   void options(const circle::Operator *op, std::ostream &os) const override
249   {
250     if (auto *resize_params = op->builtin_options_as_ResizeBilinearOptions())
251     {
252       os << "    ";
253       os << std::boolalpha;
254       os << "align_corners(" << resize_params->align_corners() << ")";
255       os << "half_pixel_centers(" << resize_params->half_pixel_centers() << ")";
256       os << std::noboolalpha;
257       os << std::endl;
258     }
259   }
260 };
261
262 class ResizeNearestNeighborPrinter : public OpPrinter
263 {
264 public:
265   void options(const circle::Operator *op, std::ostream &os) const override
266   {
267     if (auto *resize_params = op->builtin_options_as_ResizeNearestNeighborOptions())
268     {
269       os << "    ";
270       os << std::boolalpha;
271       os << "align_corners(" << resize_params->align_corners() << ")";
272       os << std::noboolalpha;
273       os << std::endl;
274     }
275   }
276 };
277
278 class ReverseSequencePrinter : public OpPrinter
279 {
280 public:
281   void options(const circle::Operator *op, std::ostream &os) const override
282   {
283     if (auto *params = op->builtin_options_as_ReverseSequenceOptions())
284     {
285       os << "    ";
286       os << "seq_dim(" << params->seq_dim() << ") ";
287       os << "batch_dim(" << params->batch_dim() << ") ";
288       os << std::endl;
289     }
290   }
291 };
292
293 class DepthwiseConv2DPrinter : public OpPrinter
294 {
295 public:
296   void options(const circle::Operator *op, std::ostream &os) const override
297   {
298     if (auto conv_params = op->builtin_options_as_DepthwiseConv2DOptions())
299     {
300       os << "    ";
301       os << "Padding(" << conv_params->padding() << ") ";
302       os << "Stride.W(" << conv_params->stride_w() << ") ";
303       os << "Stride.H(" << conv_params->stride_h() << ") ";
304       os << "DepthMultiplier(" << conv_params->depth_multiplier() << ") ";
305       os << "Dilation.W(" << conv_params->dilation_w_factor() << ") ";
306       os << "Dilation.H(" << conv_params->dilation_h_factor() << ") ";
307       os << "Activation("
308          << EnumNameActivationFunctionType(conv_params->fused_activation_function()) << ") ";
309       os << std::endl;
310     }
311   }
312 };
313
314 class FakeQuantPrinter : public OpPrinter
315 {
316 public:
317   void options(const circle::Operator *op, std::ostream &os) const override
318   {
319     if (auto *params = op->builtin_options_as_FakeQuantOptions())
320     {
321       os << "    ";
322       os << "Min(" << params->min() << ") ";
323       os << "Max(" << params->max() << ") ";
324       os << "NumBits(" << params->num_bits() << ") ";
325       os << std::boolalpha;
326       os << "NarrowRange(" << params->narrow_range() << ") ";
327       os << std::noboolalpha;
328       os << std::endl;
329     }
330   }
331 };
332
333 class FullyConnectedPrinter : public OpPrinter
334 {
335 public:
336   void options(const circle::Operator *op, std::ostream &os) const override
337   {
338     if (auto *params = op->builtin_options_as_FullyConnectedOptions())
339     {
340       os << "    ";
341       os << "WeightFormat(" << EnumNameFullyConnectedOptionsWeightsFormat(params->weights_format())
342          << ") ";
343       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
344          << ") ";
345       os << "keep_num_dims(" << params->keep_num_dims() << ") ";
346
347       os << std::endl;
348     }
349   }
350 };
351
352 class GatherPrinter : public OpPrinter
353 {
354 public:
355   void options(const circle::Operator *op, std::ostream &os) const override
356   {
357     if (auto *params = op->builtin_options_as_GatherOptions())
358     {
359       os << "    ";
360       os << "Axis(" << params->axis() << ") ";
361
362       os << std::endl;
363     }
364   }
365 };
366
367 class IfPrinter : public OpPrinter
368 {
369 public:
370   void options(const circle::Operator *op, std::ostream &os) const override
371   {
372     if (auto *params = op->builtin_options_as_IfOptions())
373     {
374       os << "    ";
375       os << "then_subgraph_index(" << params->then_subgraph_index() << ") ";
376       os << "else_subgraph_index(" << params->else_subgraph_index() << ") ";
377       os << std::endl;
378     }
379   }
380 };
381
382 class L2NormPrinter : public OpPrinter
383 {
384 public:
385   void options(const circle::Operator *op, std::ostream &os) const override
386   {
387     if (auto *params = op->builtin_options_as_L2NormOptions())
388     {
389       os << "    ";
390       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
391          << ") ";
392       os << std::endl;
393     }
394   }
395 };
396
397 class LeakyReluPrinter : public OpPrinter
398 {
399 public:
400   void options(const circle::Operator *op, std::ostream &os) const override
401   {
402     if (auto *params = op->builtin_options_as_LeakyReluOptions())
403     {
404       os << "    ";
405       os << "alpha(" << params->alpha() << ") ";
406     }
407   }
408 };
409
410 class LocalResponseNormalizationPrinter : public OpPrinter
411 {
412 public:
413   void options(const circle::Operator *op, std::ostream &os) const override
414   {
415     if (auto *params = op->builtin_options_as_LocalResponseNormalizationOptions())
416     {
417       os << "    ";
418       os << "radius(" << params->radius() << ") ";
419       os << "bias(" << params->bias() << ") ";
420       os << "alpha(" << params->alpha() << ") ";
421       os << "beta(" << params->beta() << ") ";
422       os << std::endl;
423     }
424   }
425 };
426
427 class MirrorPadPrinter : public OpPrinter
428 {
429 public:
430   void options(const circle::Operator *op, std::ostream &os) const override
431   {
432     if (auto *params = op->builtin_options_as_MirrorPadOptions())
433     {
434       os << "    ";
435       os << "mode(" << EnumNameMirrorPadMode(params->mode()) << ") ";
436       os << std::endl;
437     }
438   }
439 };
440
441 class MulPrinter : public OpPrinter
442 {
443 public:
444   void options(const circle::Operator *op, std::ostream &os) const override
445   {
446     if (auto *params = op->builtin_options_as_MulOptions())
447     {
448       os << "    ";
449       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
450          << ") ";
451       os << std::endl;
452     }
453   }
454 };
455
456 class OneHotPrinter : public OpPrinter
457 {
458 public:
459   void options(const circle::Operator *op, std::ostream &os) const override
460   {
461     if (auto *params = op->builtin_options_as_OneHotOptions())
462     {
463       os << "    ";
464       os << "Axis(" << params->axis() << ") ";
465
466       os << std::endl;
467     }
468   }
469 };
470
471 class PackPrinter : public OpPrinter
472 {
473 public:
474   void options(const circle::Operator *op, std::ostream &os) const override
475   {
476     if (auto *params = op->builtin_options_as_PackOptions())
477     {
478       os << "    ";
479       os << "ValuesCount(" << params->values_count() << ") ";
480       os << "Axis(" << params->axis() << ") ";
481       os << std::endl;
482     }
483   }
484 };
485
486 class ShapePrinter : public OpPrinter
487 {
488 public:
489   void options(const circle::Operator *op, std::ostream &os) const override
490   {
491     if (auto *params = op->builtin_options_as_ShapeOptions())
492     {
493       os << "    ";
494       os << "out_type(" << EnumNameTensorType(params->out_type()) << ") ";
495       os << std::endl;
496     }
497   }
498 };
499
500 class SoftmaxPrinter : public OpPrinter
501 {
502 public:
503   void options(const circle::Operator *op, std::ostream &os) const override
504   {
505     if (auto *softmax_params = op->builtin_options_as_SoftmaxOptions())
506     {
507       os << "    ";
508       os << "Beta(" << softmax_params->beta() << ")";
509       os << std::endl;
510     }
511   }
512 };
513
514 class SpaceToDepthPrinter : public OpPrinter
515 {
516 public:
517   void options(const circle::Operator *op, std::ostream &os) const override
518   {
519     if (auto *std_params = op->builtin_options_as_SpaceToDepthOptions())
520     {
521       os << "    ";
522       os << "BlockSize(" << std_params->block_size() << ")";
523       os << std::endl;
524     }
525   }
526 };
527
528 class SparseToDensePrinter : public OpPrinter
529 {
530 public:
531   void options(const circle::Operator *op, std::ostream &os) const override
532   {
533     if (auto *std_params = op->builtin_options_as_SparseToDenseOptions())
534     {
535       os << "    ";
536       os << "ValidateIndices(" << std_params->validate_indices() << ")";
537       os << std::endl;
538     }
539   }
540 };
541
542 class SplitPrinter : public OpPrinter
543 {
544 public:
545   void options(const circle::Operator *op, std::ostream &os) const override
546   {
547     if (auto *params = op->builtin_options_as_SplitOptions())
548     {
549       os << "    ";
550       os << "num_splits(" << params->num_splits() << ") ";
551       os << std::endl;
552     }
553   }
554 };
555
556 class SplitVPrinter : public OpPrinter
557 {
558 public:
559   void options(const circle::Operator *op, std::ostream &os) const override
560   {
561     if (auto *params = op->builtin_options_as_SplitVOptions())
562     {
563       os << "    ";
564       os << "num_splits(" << params->num_splits() << ") ";
565       os << std::endl;
566     }
567   }
568 };
569
570 class SqueezePrinter : public OpPrinter
571 {
572 public:
573   void options(const circle::Operator *op, std::ostream &os) const override
574   {
575     if (auto *params = op->builtin_options_as_SqueezeOptions())
576     {
577       os << "    ";
578       os << "SqueezeDims(";
579       for (int i = 0; i < params->squeeze_dims()->size(); ++i)
580       {
581         if (i != 0)
582           os << ", ";
583         os << params->squeeze_dims()->Get(i);
584       }
585       os << ")";
586       os << std::endl;
587     }
588   }
589 };
590
591 class StridedSlicePrinter : public OpPrinter
592 {
593 public:
594   void options(const circle::Operator *op, std::ostream &os) const override
595   {
596     if (auto *strided_slice_params = op->builtin_options_as_StridedSliceOptions())
597     {
598       os << "    ";
599       os << "begin_mask(" << strided_slice_params->begin_mask() << ") ";
600       os << "end_mask(" << strided_slice_params->end_mask() << ") ";
601       os << "ellipsis_mask(" << strided_slice_params->ellipsis_mask() << ") ";
602       os << "new_axis_mask(" << strided_slice_params->new_axis_mask() << ") ";
603       os << "shrink_axis_mask(" << strided_slice_params->shrink_axis_mask() << ") ";
604       os << std::endl;
605     }
606   }
607 };
608
609 class SubPrinter : public OpPrinter
610 {
611 public:
612   void options(const circle::Operator *op, std::ostream &os) const override
613   {
614     if (auto *params = op->builtin_options_as_SubOptions())
615     {
616       os << "    ";
617       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
618          << ") ";
619       os << std::endl;
620     }
621   }
622 };
623
624 class SVDFPrinter : public OpPrinter
625 {
626 public:
627   void options(const circle::Operator *op, std::ostream &os) const override
628   {
629     if (auto *params = op->builtin_options_as_SVDFOptions())
630     {
631       os << "    ";
632       os << "rank(" << params->rank() << ") ";
633       os << "activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
634          << ") ";
635       os << "asymmetric_quantize_inputs(" << params->asymmetric_quantize_inputs() << ") ";
636       os << std::endl;
637     }
638   }
639 };
640
641 class TransposeConvPrinter : public OpPrinter
642 {
643 public:
644   void options(const circle::Operator *op, std::ostream &os) const override
645   {
646     if (auto conv_params = op->builtin_options_as_TransposeConvOptions())
647     {
648       os << "    ";
649       os << "Padding(" << conv_params->padding() << ") ";
650       os << "Stride.W(" << conv_params->stride_w() << ") ";
651       os << "Stride.H(" << conv_params->stride_h() << ") ";
652       os << std::endl;
653     }
654   }
655 };
656
657 class UnidirectionalSequenceLSTMPrinter : public OpPrinter
658 {
659 public:
660   void options(const circle::Operator *op, std::ostream &os) const override
661   {
662     if (auto *params = op->builtin_options_as_UnidirectionalSequenceLSTMOptions())
663     {
664       os << "    ";
665       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
666          << ") ";
667       os << "cell_clip(" << params->cell_clip() << ") ";
668       os << "proj_clip(" << params->proj_clip() << ") ";
669       os << "time_major(" << params->time_major() << ") ";
670       os << "asymmetric_quantize_inputs(" << params->asymmetric_quantize_inputs() << ") ";
671       os << std::endl;
672     }
673   }
674 };
675
676 class UniquePrinter : public OpPrinter
677 {
678 public:
679   void options(const circle::Operator *op, std::ostream &os) const override
680   {
681     if (auto *params = op->builtin_options_as_UniqueOptions())
682     {
683       os << "    ";
684       os << "idx_out_type(" << EnumNameTensorType(params->idx_out_type()) << ") ";
685       os << std::endl;
686     }
687   }
688 };
689
690 class WhilePrinter : public OpPrinter
691 {
692 public:
693   void options(const circle::Operator *op, std::ostream &os) const override
694   {
695     if (auto *params = op->builtin_options_as_WhileOptions())
696     {
697       os << "    ";
698       os << "cond_subgraph_index(" << params->cond_subgraph_index() << ") ";
699       os << "body_subgraph_index(" << params->body_subgraph_index() << ") ";
700       os << std::endl;
701     }
702   }
703 };
704
705 class CustomOpPrinter : public OpPrinter
706 {
707 public:
708   void options(const circle::Operator *op, std::ostream &os) const override
709   {
710     if (op->custom_options_format() != circle::CustomOptionsFormat::CustomOptionsFormat_FLEXBUFFERS)
711     {
712       os << "    ";
713       os << "Unknown custom option format";
714       return;
715     }
716
717     const flatbuffers::Vector<uint8_t> *option_buf = op->custom_options();
718
719     if (option_buf == nullptr || option_buf->size() == 0)
720     {
721       os << "No attrs found." << std::endl;
722       return;
723     }
724
725     // printing attrs
726     // attrs of custom ops are encoded in flexbuffer format
727     auto attr_map = flexbuffers::GetRoot(option_buf->data(), option_buf->size()).AsMap();
728
729     os << "    ";
730     auto keys = attr_map.Keys();
731     for (int i = 0; i < keys.size(); i++)
732     {
733       auto key = keys[i].ToString();
734       os << key << "(" << attr_map[key].ToString() << ") ";
735     }
736
737     // Note: attr in "Shape" type does not seem to be converted by circle_convert.
738     // When the converted circle file (with custom op) is opened with hexa editory,
739     // attrs names can be found but attr name in "Shape" type is not found.
740
741     os << std::endl;
742   }
743 };
744
745 class BCQFullyConnectedPrinter : public OpPrinter
746 {
747 public:
748   void options(const circle::Operator *op, std::ostream &os) const override
749   {
750     if (auto *params = op->builtin_options_as_BCQFullyConnectedOptions())
751     {
752       os << "    ";
753       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
754          << ") ";
755       os << "weights_hidden_size(" << params->weights_hidden_size() << ") ";
756       os << std::endl;
757     }
758   }
759 };
760
761 class BCQGatherPrinter : public OpPrinter
762 {
763 public:
764   void options(const circle::Operator *op, std::ostream &os) const override
765   {
766     if (auto *params = op->builtin_options_as_BCQGatherOptions())
767     {
768       os << "    ";
769       os << "axis(" << params->axis() << ") ";
770       os << "weights_hidden_size(" << params->input_hidden_size() << ") ";
771       os << std::endl;
772     }
773   }
774 };
775
776 class InstanceNormPrinter : public OpPrinter
777 {
778 public:
779   void options(const circle::Operator *op, std::ostream &os) const override
780   {
781     if (auto *params = op->builtin_options_as_InstanceNormOptions())
782     {
783       os << "    ";
784       os << "epsilon(" << params->epsilon() << ") ";
785       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
786          << ") ";
787       os << std::endl;
788     }
789   }
790 };
791
792 OpPrinterRegistry::OpPrinterRegistry()
793 {
794   _op_map[circle::BuiltinOperator_ADD] = make_unique<AddPrinter>();
795   // There is no Option for ADD_N
796   _op_map[circle::BuiltinOperator_ARG_MAX] = make_unique<ArgMaxPrinter>();
797   _op_map[circle::BuiltinOperator_ARG_MIN] = make_unique<ArgMinPrinter>();
798   _op_map[circle::BuiltinOperator_AVERAGE_POOL_2D] = make_unique<Pool2DPrinter>();
799   _op_map[circle::BuiltinOperator_BATCH_MATMUL] = make_unique<BatchMatMulPrinter>();
800   _op_map[circle::BuiltinOperator_BIDIRECTIONAL_SEQUENCE_LSTM] =
801     make_unique<BidirectionalSequenceLSTMPrinter>();
802   _op_map[circle::BuiltinOperator_CAST] = make_unique<CastPrinter>();
803   // There is no Option for CEIL
804   _op_map[circle::BuiltinOperator_CONCATENATION] = make_unique<ConcatenationPrinter>();
805   _op_map[circle::BuiltinOperator_CONV_2D] = make_unique<Conv2DPrinter>();
806   // There is no Option for DENSIFY
807   _op_map[circle::BuiltinOperator_DEPTH_TO_SPACE] = make_unique<DepthToSpacePrinter>();
808   _op_map[circle::BuiltinOperator_DEPTHWISE_CONV_2D] = make_unique<DepthwiseConv2DPrinter>();
809   // There is no Option for DEQUANTIZE
810   _op_map[circle::BuiltinOperator_DIV] = make_unique<DivPrinter>();
811   _op_map[circle::BuiltinOperator_FAKE_QUANT] = make_unique<FakeQuantPrinter>();
812   // There is no Option for FLOOR
813   // There is no Option for FLOOR_MOD
814   _op_map[circle::BuiltinOperator_FULLY_CONNECTED] = make_unique<FullyConnectedPrinter>();
815   _op_map[circle::BuiltinOperator_GATHER] = make_unique<GatherPrinter>();
816   _op_map[circle::BuiltinOperator_IF] = make_unique<IfPrinter>();
817   _op_map[circle::BuiltinOperator_L2_NORMALIZATION] = make_unique<L2NormPrinter>();
818   _op_map[circle::BuiltinOperator_L2_POOL_2D] = make_unique<Pool2DPrinter>();
819   _op_map[circle::BuiltinOperator_LEAKY_RELU] = make_unique<LeakyReluPrinter>();
820   _op_map[circle::BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION] =
821     make_unique<LocalResponseNormalizationPrinter>();
822   // There is no Option for LOG
823   // There is no Option for LOGISTIC
824   // There is no Option for LOG_SOFTMAX
825   _op_map[circle::BuiltinOperator_MAX_POOL_2D] = make_unique<Pool2DPrinter>();
826   _op_map[circle::BuiltinOperator_MIRROR_PAD] = make_unique<MirrorPadPrinter>();
827   _op_map[circle::BuiltinOperator_MUL] = make_unique<MulPrinter>();
828   // There is no Option for NON_MAX_SUPPRESSION_V4
829   // There is no Option for NON_MAX_SUPPRESSION_V5
830   _op_map[circle::BuiltinOperator_ONE_HOT] = make_unique<OneHotPrinter>();
831   _op_map[circle::BuiltinOperator_PACK] = make_unique<PackPrinter>();
832   // There is no Option for PAD
833   // There is no Option for PADV2
834   // There is no Option for PRELU
835   // There is no Option for RELU
836   // There is no Option for RELU6
837   // There is no Option for RELU_N1_TO_1
838   _op_map[circle::BuiltinOperator_REDUCE_ANY] = make_unique<ReducerPrinter>();
839   _op_map[circle::BuiltinOperator_REDUCE_MAX] = make_unique<ReducerPrinter>();
840   _op_map[circle::BuiltinOperator_REDUCE_MIN] = make_unique<ReducerPrinter>();
841   _op_map[circle::BuiltinOperator_REDUCE_PROD] = make_unique<ReducerPrinter>();
842   _op_map[circle::BuiltinOperator_RESHAPE] = make_unique<ReshapePrinter>();
843   _op_map[circle::BuiltinOperator_RESIZE_BILINEAR] = make_unique<ResizeBilinearPrinter>();
844   _op_map[circle::BuiltinOperator_RESIZE_NEAREST_NEIGHBOR] =
845     make_unique<ResizeNearestNeighborPrinter>();
846   _op_map[circle::BuiltinOperator_REVERSE_SEQUENCE] = make_unique<ReverseSequencePrinter>();
847   // There is no Option for ROUND
848   // There is no Option for SELECT
849   // There is no Option for SELECT_V2
850   _op_map[circle::BuiltinOperator_SHAPE] = make_unique<ShapePrinter>();
851   // There is no Option for SIN
852   // There is no Option for SLICE
853   _op_map[circle::BuiltinOperator_SOFTMAX] = make_unique<SoftmaxPrinter>();
854   _op_map[circle::BuiltinOperator_SPACE_TO_DEPTH] = make_unique<SpaceToDepthPrinter>();
855   // There is no Option for SPACE_TO_BATCH_ND
856   _op_map[circle::BuiltinOperator_SPARSE_TO_DENSE] = make_unique<SparseToDensePrinter>();
857   _op_map[circle::BuiltinOperator_SPLIT] = make_unique<SplitPrinter>();
858   _op_map[circle::BuiltinOperator_SPLIT_V] = make_unique<SplitVPrinter>();
859   _op_map[circle::BuiltinOperator_SQUEEZE] = make_unique<SqueezePrinter>();
860   _op_map[circle::BuiltinOperator_STRIDED_SLICE] = make_unique<StridedSlicePrinter>();
861   _op_map[circle::BuiltinOperator_SUB] = make_unique<SubPrinter>();
862   _op_map[circle::BuiltinOperator_SUM] = make_unique<ReducerPrinter>();
863   _op_map[circle::BuiltinOperator_SVDF] = make_unique<SVDFPrinter>();
864   _op_map[circle::BuiltinOperator_TRANSPOSE_CONV] = make_unique<TransposeConvPrinter>();
865   // There is no Option for TOPK_V2
866   _op_map[circle::BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM] =
867     make_unique<UnidirectionalSequenceLSTMPrinter>();
868   _op_map[circle::BuiltinOperator_UNIQUE] = make_unique<UniquePrinter>();
869   _op_map[circle::BuiltinOperator_WHILE] = make_unique<WhilePrinter>();
870   _op_map[circle::BuiltinOperator_CUSTOM] = make_unique<CustomOpPrinter>();
871
872   // Circle only
873   _op_map[circle::BuiltinOperator_BCQ_FULLY_CONNECTED] = make_unique<BCQFullyConnectedPrinter>();
874   _op_map[circle::BuiltinOperator_BCQ_GATHER] = make_unique<BCQGatherPrinter>();
875   _op_map[circle::BuiltinOperator_INSTANCE_NORM] = make_unique<InstanceNormPrinter>();
876 }
877
878 } // namespace circledump