2e8e7134fb792c7d8935fc070112ccdb5e2a6f94
[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 IfPrinter : 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_IfOptions())
368     {
369       os << "    ";
370       os << "then_subgraph_index(" << params->then_subgraph_index() << ") ";
371       os << "else_subgraph_index(" << params->else_subgraph_index() << ") ";
372       os << std::endl;
373     }
374   }
375 };
376
377 class L2NormPrinter : public OpPrinter
378 {
379 public:
380   void options(const tflite::Operator *op, std::ostream &os) const override
381   {
382     if (auto *params = op->builtin_options_as_L2NormOptions())
383     {
384       os << "    ";
385       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
386          << ") ";
387       os << std::endl;
388     }
389   }
390 };
391
392 class LeakyReluPrinter : public OpPrinter
393 {
394 public:
395   void options(const tflite::Operator *op, std::ostream &os) const override
396   {
397     if (auto *params = op->builtin_options_as_LeakyReluOptions())
398     {
399       os << "    ";
400       os << "alpha(" << params->alpha() << ") ";
401     }
402   }
403 };
404
405 class LocalResponseNormalizationPrinter : 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_LocalResponseNormalizationOptions())
411     {
412       os << "    ";
413       os << "radius(" << params->radius() << ") ";
414       os << "bias(" << params->bias() << ") ";
415       os << "alpha(" << params->alpha() << ") ";
416       os << "beta(" << params->beta() << ") ";
417       os << std::endl;
418     }
419   }
420 };
421
422 class MirrorPadPrinter : public OpPrinter
423 {
424 public:
425   void options(const tflite::Operator *op, std::ostream &os) const override
426   {
427     if (auto *params = op->builtin_options_as_MirrorPadOptions())
428     {
429       os << "    ";
430       os << "mode(" << EnumNameMirrorPadMode(params->mode()) << ") ";
431       os << std::endl;
432     }
433   }
434 };
435
436 class MulPrinter : public OpPrinter
437 {
438 public:
439   void options(const tflite::Operator *op, std::ostream &os) const override
440   {
441     if (auto *params = op->builtin_options_as_MulOptions())
442     {
443       os << "    ";
444       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
445          << ") ";
446       os << std::endl;
447     }
448   }
449 };
450
451 class PackPrinter : public OpPrinter
452 {
453 public:
454   void options(const tflite::Operator *op, std::ostream &os) const override
455   {
456     if (auto *params = op->builtin_options_as_PackOptions())
457     {
458       os << "    ";
459       os << "ValuesCount(" << params->values_count() << ") ";
460       os << "Axis(" << params->axis() << ") ";
461       os << std::endl;
462     }
463   }
464 };
465
466 class OneHotPrinter : public OpPrinter
467 {
468 public:
469   void options(const tflite::Operator *op, std::ostream &os) const override
470   {
471     if (auto *params = op->builtin_options_as_OneHotOptions())
472     {
473       os << "    ";
474       os << "Axis(" << params->axis() << ") ";
475
476       os << std::endl;
477     }
478   }
479 };
480
481 class ShapePrinter : public OpPrinter
482 {
483 public:
484   void options(const tflite::Operator *op, std::ostream &os) const override
485   {
486     if (auto *params = op->builtin_options_as_ShapeOptions())
487     {
488       os << "    ";
489       os << "out_type(" << EnumNameTensorType(params->out_type()) << ") ";
490       os << std::endl;
491     }
492   }
493 };
494
495 class SoftmaxPrinter : public OpPrinter
496 {
497 public:
498   void options(const tflite::Operator *op, std::ostream &os) const override
499   {
500     if (auto *softmax_params = op->builtin_options_as_SoftmaxOptions())
501     {
502       os << "    ";
503       os << "Beta(" << softmax_params->beta() << ")";
504       os << std::endl;
505     }
506   }
507 };
508
509 class SpaceToDepthPrinter : public OpPrinter
510 {
511 public:
512   void options(const tflite::Operator *op, std::ostream &os) const override
513   {
514     if (auto *std_params = op->builtin_options_as_SpaceToDepthOptions())
515     {
516       os << "    ";
517       os << "BlockSize(" << std_params->block_size() << ")";
518       os << std::endl;
519     }
520   }
521 };
522
523 class SqueezePrinter : public OpPrinter
524 {
525 public:
526   void options(const tflite::Operator *op, std::ostream &os) const override
527   {
528     if (auto *params = op->builtin_options_as_SqueezeOptions())
529     {
530       os << "    ";
531       os << "SqueezeDims(";
532       for (int i = 0; i < params->squeeze_dims()->size(); ++i)
533       {
534         if (i != 0)
535           os << ", ";
536         os << params->squeeze_dims()->Get(i);
537       }
538       os << ")";
539       os << std::endl;
540     }
541   }
542 };
543
544 class StridedSlicePrinter : public OpPrinter
545 {
546 public:
547   void options(const tflite::Operator *op, std::ostream &os) const override
548   {
549     if (auto *strided_slice_params = op->builtin_options_as_StridedSliceOptions())
550     {
551       os << "    ";
552       os << "begin_mask(" << strided_slice_params->begin_mask() << ") ";
553       os << "end_mask(" << strided_slice_params->end_mask() << ") ";
554       os << "ellipsis_mask(" << strided_slice_params->ellipsis_mask() << ") ";
555       os << "new_axis_mask(" << strided_slice_params->new_axis_mask() << ") ";
556       os << "shrink_axis_mask(" << strided_slice_params->shrink_axis_mask() << ") ";
557       os << std::endl;
558     }
559   }
560 };
561
562 class SplitPrinter : public OpPrinter
563 {
564 public:
565   void options(const tflite::Operator *op, std::ostream &os) const override
566   {
567     if (auto *params = op->builtin_options_as_SplitOptions())
568     {
569       os << "    ";
570       os << "num_splits(" << params->num_splits() << ") ";
571       os << std::endl;
572     }
573   }
574 };
575
576 class SplitVPrinter : public OpPrinter
577 {
578 public:
579   void options(const tflite::Operator *op, std::ostream &os) const override
580   {
581     if (auto *params = op->builtin_options_as_SplitVOptions())
582     {
583       os << "    ";
584       os << "num_splits(" << params->num_splits() << ") ";
585       os << std::endl;
586     }
587   }
588 };
589
590 class SubPrinter : public OpPrinter
591 {
592 public:
593   void options(const tflite::Operator *op, std::ostream &os) const override
594   {
595     if (auto *params = op->builtin_options_as_SubOptions())
596     {
597       os << "    ";
598       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
599          << ") ";
600       os << std::endl;
601     }
602   }
603 };
604
605 class SVDFPrinter : public OpPrinter
606 {
607 public:
608   void options(const tflite::Operator *op, std::ostream &os) const override
609   {
610     if (auto *params = op->builtin_options_as_SVDFOptions())
611     {
612       os << "    ";
613       os << "rank(" << params->rank() << ") ";
614       os << "activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
615          << ") ";
616       os << "asymmetric_quantize_inputs(" << params->asymmetric_quantize_inputs() << ") ";
617       os << std::endl;
618     }
619   }
620 };
621
622 class TransposeConvPrinter : public OpPrinter
623 {
624 public:
625   void options(const tflite::Operator *op, std::ostream &os) const override
626   {
627     if (auto *params = op->builtin_options_as_TransposeConvOptions())
628     {
629       os << "    ";
630       os << "Padding(" << params->padding() << ") ";
631       os << "Stride.W(" << params->stride_w() << ") ";
632       os << "Stride.H(" << params->stride_h() << ") ";
633       os << std::endl;
634     }
635   }
636 };
637
638 class WhilePrinter : public OpPrinter
639 {
640 public:
641   void options(const tflite::Operator *op, std::ostream &os) const override
642   {
643     if (auto *params = op->builtin_options_as_WhileOptions())
644     {
645       os << "    ";
646       os << "cond_subgraph_index(" << params->cond_subgraph_index() << ") ";
647       os << "body_subgraph_index(" << params->body_subgraph_index() << ") ";
648       os << std::endl;
649     }
650   }
651 };
652
653 class UnidirectionalSequenceLSTMPrinter : 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_UnidirectionalSequenceLSTMOptions())
659     {
660       os << "    ";
661       os << "Activation(" << EnumNameActivationFunctionType(params->fused_activation_function())
662          << ") ";
663       os << "cell_clip(" << params->cell_clip() << ") ";
664       os << "proj_clip(" << params->proj_clip() << ") ";
665       os << "time_major(" << params->time_major() << ") ";
666       os << "asymmetric_quantize_inputs(" << params->asymmetric_quantize_inputs() << ") ";
667       os << std::endl;
668     }
669   }
670 };
671
672 class UniquePrinter : public OpPrinter
673 {
674 public:
675   void options(const tflite::Operator *op, std::ostream &os) const override
676   {
677     if (auto *params = op->builtin_options_as_UniqueOptions())
678     {
679       os << "    ";
680       os << "idx_out_type(" << EnumNameTensorType(params->idx_out_type()) << ") ";
681       os << std::endl;
682     }
683   }
684 };
685
686 class CustomOpPrinter : public OpPrinter
687 {
688 public:
689   void options(const tflite::Operator *op, std::ostream &os) const override
690   {
691     if (op->custom_options_format() != tflite::CustomOptionsFormat::CustomOptionsFormat_FLEXBUFFERS)
692     {
693       os << "    ";
694       os << "Unknown custom option format";
695       return;
696     }
697
698     const flatbuffers::Vector<uint8_t> *option_buf = op->custom_options();
699
700     if (option_buf == nullptr || option_buf->size() == 0)
701     {
702       os << "No attrs found." << std::endl;
703       return;
704     }
705
706     // printing attrs
707     // attrs of custom ops are encoded in flexbuffer format
708     auto attr_map = flexbuffers::GetRoot(option_buf->data(), option_buf->size()).AsMap();
709
710     os << "    ";
711     auto keys = attr_map.Keys();
712     for (int i = 0; i < keys.size(); i++)
713     {
714       auto key = keys[i].ToString();
715       os << key << "(" << attr_map[key].ToString() << ") ";
716     }
717
718     // Note: attr in "Shape" type does not seem to be converted by tflite_convert.
719     // When the converted tflite file (with custom op) is opened with hexa editory,
720     // attrs names can be found but attr name in "Shape" type is not found.
721
722     os << std::endl;
723   }
724 };
725
726 OpPrinterRegistry::OpPrinterRegistry()
727 {
728   _op_map[tflite::BuiltinOperator_ADD] = make_unique<AddPrinter>();
729   // There is no Option for ADD_N
730   _op_map[tflite::BuiltinOperator_ARG_MAX] = make_unique<ArgMaxPrinter>();
731   _op_map[tflite::BuiltinOperator_ARG_MIN] = make_unique<ArgMinPrinter>();
732   _op_map[tflite::BuiltinOperator_AVERAGE_POOL_2D] = make_unique<Pool2DPrinter>();
733   _op_map[tflite::BuiltinOperator_BIDIRECTIONAL_SEQUENCE_LSTM] =
734     make_unique<BidirectionalSequenceLSTMPrinter>();
735   _op_map[tflite::BuiltinOperator_CAST] = make_unique<CastPrinter>();
736   // There is no Option for CEIL
737   _op_map[tflite::BuiltinOperator_CONCATENATION] = make_unique<ConcatenationPrinter>();
738   _op_map[tflite::BuiltinOperator_CONV_2D] = make_unique<Conv2DPrinter>();
739   // There is no Option for DENSIFY
740   _op_map[tflite::BuiltinOperator_DEPTH_TO_SPACE] = make_unique<DepthToSpacePrinter>();
741   _op_map[tflite::BuiltinOperator_DEPTHWISE_CONV_2D] = make_unique<DepthwiseConv2DPrinter>();
742   // There is no Option for DEQUANTIZE
743   _op_map[tflite::BuiltinOperator_DIV] = make_unique<DivPrinter>();
744   _op_map[tflite::BuiltinOperator_FAKE_QUANT] = make_unique<FakeQuantPrinter>();
745   // There is no Option for FLOOR
746   // There is no Option for FLOOR_MOD
747   _op_map[tflite::BuiltinOperator_FULLY_CONNECTED] = make_unique<FullyConnectedPrinter>();
748   _op_map[tflite::BuiltinOperator_GATHER] = make_unique<GatherPrinter>();
749   _op_map[tflite::BuiltinOperator_IF] = make_unique<IfPrinter>();
750   _op_map[tflite::BuiltinOperator_L2_POOL_2D] = make_unique<Pool2DPrinter>();
751   _op_map[tflite::BuiltinOperator_L2_NORMALIZATION] = make_unique<L2NormPrinter>();
752   _op_map[tflite::BuiltinOperator_LEAKY_RELU] = make_unique<LeakyReluPrinter>();
753   _op_map[tflite::BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION] =
754     make_unique<LocalResponseNormalizationPrinter>();
755   // There is no Option for LOG
756   // There is no Option for LOGISTIC
757   // There is no Option for LOG_SOFTMAX
758   _op_map[tflite::BuiltinOperator_MAX_POOL_2D] = make_unique<Pool2DPrinter>();
759   _op_map[tflite::BuiltinOperator_MEAN] = make_unique<ReducerPrinter>();
760   _op_map[tflite::BuiltinOperator_MIRROR_PAD] = make_unique<MirrorPadPrinter>();
761   _op_map[tflite::BuiltinOperator_MUL] = make_unique<MulPrinter>();
762   // There is no Option for NON_MAX_SUPPRESSION_V4
763   // There is no Option for NON_MAX_SUPPRESSION_V5
764   _op_map[tflite::BuiltinOperator_ONE_HOT] = make_unique<OneHotPrinter>();
765   _op_map[tflite::BuiltinOperator_PACK] = make_unique<PackPrinter>();
766   // There is no Option for PAD
767   // There is no Option for PADV2
768   // There is no Option for PRELU
769   // There is no Option for RELU
770   // There is no Option for RELU6
771   // There is no Option for RELU_N1_TO_1
772   _op_map[tflite::BuiltinOperator_REDUCE_ANY] = make_unique<ReducerPrinter>();
773   _op_map[tflite::BuiltinOperator_REDUCE_MAX] = make_unique<ReducerPrinter>();
774   _op_map[tflite::BuiltinOperator_REDUCE_MIN] = make_unique<ReducerPrinter>();
775   _op_map[tflite::BuiltinOperator_REDUCE_PROD] = make_unique<ReducerPrinter>();
776   _op_map[tflite::BuiltinOperator_RESHAPE] = make_unique<ReshapePrinter>();
777   _op_map[tflite::BuiltinOperator_RESIZE_BILINEAR] = make_unique<ResizeBilinearPrinter>();
778   _op_map[tflite::BuiltinOperator_RESIZE_NEAREST_NEIGHBOR] =
779     make_unique<ResizeNearestNeighborPrinter>();
780   _op_map[tflite::BuiltinOperator_REVERSE_SEQUENCE] = make_unique<ReverseSequencePrinter>();
781   // There is no Option for ROUND
782   // There is no Option for SELECT
783   // There is no Option for SELECT_V2
784   _op_map[tflite::BuiltinOperator_SHAPE] = make_unique<ShapePrinter>();
785   // There is no Option for SIN
786   // There is no Option for SLICE
787   _op_map[tflite::BuiltinOperator_SOFTMAX] = make_unique<SoftmaxPrinter>();
788   _op_map[tflite::BuiltinOperator_SPACE_TO_DEPTH] = make_unique<SpaceToDepthPrinter>();
789   // There is no Option for SPACE_TO_BATCH_ND
790   _op_map[tflite::BuiltinOperator_SPARSE_TO_DENSE] = make_unique<SparseToDensePrinter>();
791   _op_map[tflite::BuiltinOperator_SPLIT] = make_unique<SplitPrinter>();
792   _op_map[tflite::BuiltinOperator_SPLIT_V] = make_unique<SplitVPrinter>();
793   _op_map[tflite::BuiltinOperator_SQUEEZE] = make_unique<SqueezePrinter>();
794   _op_map[tflite::BuiltinOperator_STRIDED_SLICE] = make_unique<StridedSlicePrinter>();
795   _op_map[tflite::BuiltinOperator_SUB] = make_unique<SubPrinter>();
796   _op_map[tflite::BuiltinOperator_SUM] = make_unique<ReducerPrinter>();
797   _op_map[tflite::BuiltinOperator_SVDF] = make_unique<SVDFPrinter>();
798   _op_map[tflite::BuiltinOperator_TRANSPOSE_CONV] = make_unique<TransposeConvPrinter>();
799   // There is no Option for TOPK_V2
800   _op_map[tflite::BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM] =
801     make_unique<UnidirectionalSequenceLSTMPrinter>();
802   _op_map[tflite::BuiltinOperator_UNIQUE] = make_unique<UniquePrinter>();
803   _op_map[tflite::BuiltinOperator_WHILE] = make_unique<WhilePrinter>();
804   _op_map[tflite::BuiltinOperator_CUSTOM] = make_unique<CustomOpPrinter>();
805 }
806
807 } // namespace tfldump