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