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