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