Imported Upstream version 1.9.0
[platform/core/ml/nnfw.git] / compiler / tflchef / proto / tflchef.proto
1 syntax = "proto2";
2
3 package tflchef;
4
5 //
6 // Initial version
7 //  - Our initial version
8 //
9 // Version 1
10 //  - Backward compatible with Initial version
11 //  - Added Graph to represent sub graphs
12 //  - Added name, version(default as 1), graph in ModelRecipe
13 //
14
15 // This enum value corresponds to TensorType in TensorFlow Lite schema
16 enum TensorType {
17   FLOAT32 = 0;
18   INT32 = 2;
19   UINT8 = 3;
20   INT64 = 4;
21   BOOL = 6;
22 }
23
24 message TensorShape {
25   repeated uint32 dim = 3;
26 }
27
28 message TensorFiller {
29   optional string tag = 1;
30   repeated string arg = 2;
31 }
32
33 message TensorQuantization {
34   repeated float min = 1;
35   repeated float max = 2;
36   repeated float scale = 3;
37   repeated int64 zero_point = 4;
38   optional int32 quantized_dimension = 5 [default = 0];
39 }
40
41 message Operand {
42   optional string name = 1;
43   optional TensorType type = 2;
44   optional TensorShape shape = 3;
45   optional TensorFiller filler = 4;
46   optional TensorQuantization quant = 5;
47 }
48
49 // This enum value corresponds to Padding in TensorFlow Lite schema
50 enum Padding {
51   SAME = 0;
52   VALID = 1;
53 }
54
55 // This enum value corresponds to ActivationFunctionType in TensorFlow Lite schema
56 enum Activation {
57   NONE = 0;
58   RELU = 1;
59   RELU_N1_TO_1 = 2;
60   RELU6 = 3;
61 }
62
63 // This enum value corresponds to MirrorPadMode in TensorFlow Lite schema
64 enum MirrorPadMode {
65   REFLECT = 0;
66   SYMMETRIC = 1;
67 }
68
69 message Conv2DOptions
70 {
71   optional Padding padding = 1 [default = VALID];
72   optional int32 stride_w = 2 [default = 1];
73   optional int32 stride_h = 3 [default = 1];
74   optional Activation activation = 4 [default = NONE];
75   optional int32 dilation_w_factor = 5 [default = 1];
76   optional int32 dilation_h_factor = 6 [default = 1];
77 }
78
79 message Pool2DOptions {
80   optional Padding padding = 1 [default = VALID];
81   optional int32 stride_w = 2 [default = 1];
82   optional int32 stride_h = 3 [default = 1];
83   optional int32 filter_width = 4 [default = 1];
84   optional int32 filter_height = 5 [ default = 1];
85   optional Activation activation = 6 [default = NONE];
86 }
87
88 message ConcatenationOptions {
89   optional int32 axis = 1 [default = 0];
90   optional Activation activation = 2 [default = NONE];
91 }
92
93 message ReshapeOptions {
94   repeated int32 new_shape = 1;
95 }
96
97 message DepthwiseConv2DOptions
98 {
99   optional Padding padding = 1 [default = VALID];
100   optional int32 stride_w = 2 [default = 1];
101   optional int32 stride_h = 3 [default = 1];
102   optional int32 depth_multiplier = 4 [default = 1];
103   optional Activation activation = 5 [default = NONE];
104   optional int32 dilation_w_factor = 6 [default = 1];
105   optional int32 dilation_h_factor = 7 [default = 1];
106 }
107
108 message ScatterNdOptions {
109   // None
110 }
111
112 message SubOptions {
113   optional Activation activation = 1 [default = NONE];
114 }
115
116 message DivOptions {
117   optional Activation activation = 1 [default = NONE];
118 }
119
120 message FloorDivOptions {
121   // None
122 }
123
124 message FloorModOptions {
125   // None
126 }
127
128 message FullyConnectedOptions {
129   optional Activation activation = 1 [default = NONE];
130 }
131
132 message AddOptions {
133   optional Activation activation = 1 [default = NONE];
134 }
135
136 message AddNOptions {
137   // None
138 }
139
140 message ArgMaxOptions {
141   optional TensorType output_type = 1 [default = INT64];
142 }
143
144 message ArgMinOptions {
145   optional TensorType output_type = 1 [default = INT64];
146 }
147
148 message PackOptions {
149   optional int32 values_count = 1;
150   optional int32 axis = 2 [default = 0];
151 }
152
153 message PadOptions {
154   // None
155 }
156
157 message PadV2Options {
158   // None
159 }
160
161 message MirrorPadOptions {
162   optional MirrorPadMode mode = 1 [default = REFLECT];
163 }
164
165 message SoftmaxOptions {
166   optional float beta = 1 [default = 0.0];
167 }
168
169 message MulOptions {
170   optional Activation activation = 1 [default = NONE];
171 }
172
173 message NegOptions {
174   // None
175 }
176
177 message RangeOptions {
178   // None
179 }
180
181 message ReducerOptions {
182   optional bool keep_dims = 1 [ default = false ];
183 }
184
185 message SpaceToDepthOptions {
186   optional int32 block_size = 1;
187 }
188
189 message LogicalOrOptions {
190   // None
191 }
192
193 message LogicalNotOptions {
194   // None
195 }
196
197 message LogicalAndOptions {
198   // None
199 }
200
201 message TransposeOptions {
202   // None
203 }
204
205 message AbsOptions {
206   // None
207 }
208
209 message CosOptions {
210   // None
211 }
212
213 message EqualOptions {
214   // None
215 }
216
217 message ShapeOptions {
218   optional TensorType out_type = 1 [default = INT32];
219 }
220
221 message BatchToSpaceNDOptions {
222   // None
223 }
224
225 message SpaceToBatchNDOptions {
226   // None
227 }
228
229 message StridedSliceOptions {
230   optional int32 begin_mask = 1;
231   optional int32 end_mask = 2;
232   optional int32 ellipsis_mask = 3;
233   optional int32 new_axis_mask = 4;
234   optional int32 shrink_axis_mask = 5;
235 }
236
237 message SliceOptions {
238   // None
239 }
240
241 message ExpOptions {
242   // None
243 }
244
245 message ExpandDimsOptions {
246   // None
247 }
248
249 message UnpackOptions {
250   optional int32 num = 1;
251   optional int32 axis = 2 [default = 0];
252 }
253
254 message GatherOptions {
255   optional int32 axis = 1 [default = 0];
256 }
257
258 message TileOptions {
259   // None
260 }
261
262 message BatchMatMulOptions {
263   optional bool adj_x = 1 [default = false];
264   optional bool adj_y = 2 [default = false];
265 }
266
267 message IfOptions {
268   optional int32 then_subgraph_index = 1;
269   optional int32 else_subgraph_index = 2;
270 }
271
272 message WhileOptions {
273   optional int32 cond_subgraph_index = 1;
274   optional int32 body_subgraph_index = 2;
275 }
276
277 message CastOptions {
278   optional TensorType in_data_type = 1 [default = FLOAT32];
279   optional TensorType out_data_type = 2 [default = FLOAT32];
280 }
281
282 message SquareOptions {
283   // None
284 }
285
286 message MaximumMinimumOptions {
287   //None
288 }
289
290 message GreaterEqualOptions {
291   // None
292 }
293
294 message SelectOptions {
295   // None
296 }
297
298 message SelectV2Options {
299   // None
300 }
301
302 message SplitOptions {
303   optional int32 num_splits = 1;
304 }
305
306 message SplitVOptions {
307   optional int32 num_splits = 1;
308 }
309
310 message SquaredDifferenceOptions {
311   // None
312 }
313
314 message FillOptions {
315   // None
316 }
317
318 message GreaterOptions {
319   // None 
320 }
321
322 message L2NormOptions {
323   optional Activation activation = 1 [default = NONE];
324 }
325
326 message LessOptions {
327   // None
328 }
329
330 message LessEqualOptions {
331   // None
332 }
333
334 message LocalResponseNormalizationOptions {
335   optional int32 radius = 1 [default = 5];
336   optional float bias = 2 [default = 1.0];
337   optional float alpha = 3 [default = 1.0];
338   optional float beta = 4 [default = 0.5];
339 }
340
341 message MatMulOptions {
342   optional bool transpose_a = 1 [default = false];
343   optional bool transpose_b = 2 [default = false];
344 }
345
346 message SqueezeOptions {
347   repeated int32 squeeze_dim = 1;
348 }
349
350 message OneHotOptions {
351   optional int32 axis = 1 [default = -1];
352 }
353
354 message TopKV2Options {
355   // None
356 }
357
358 message LogSoftmaxOptions {
359   // None
360 }
361
362 message ZerosLikeOptions {
363   // None
364 }
365
366 message GatherNdOptions {
367   // None
368 }
369
370 message NonMaxSuppressionV4Options {
371   // None
372 }
373
374 message NonMaxSuppressionV5Options {
375   // None
376 }
377
378 message NotEqualOptions {
379   // None
380 }
381
382 message PowOptions {
383   // None
384 }
385
386 message LeakyReluOptions {
387   optional float alpha = 1 [default = 0.2];
388 }
389
390 message ResizeNearestNeighborOptions {
391   optional bool align_corners = 1 [default = false];
392 }
393
394 message ResizeBilinearOptions {
395   optional bool align_corners = 1 [default = false];
396   optional bool half_pixel_centers = 2 [default = false];
397 }
398
399 message DepthToSpaceOptions {
400   optional int32 block_size = 1;
401 }
402
403 message TransposeConvOptions {
404   optional Padding padding = 1 [default = VALID];
405   optional int32 stride_w = 2 [default = 1];
406   optional int32 stride_h = 3 [default = 1];
407 }
408
409 message ReverseSequenceOptions {
410   optional int32 seq_dim = 1 [default = 0];
411   optional int32 batch_dim = 2 [default = 0];
412 }
413
414 message RankOptions {
415   // NONE
416 }
417
418 message SegmentSumOptions {
419   // NONE
420 }
421
422 message UniqueOptions {
423   optional TensorType idx_out_type = 1 [default = INT32];
424 }
425
426 message WhereOptions {
427  // None
428 }
429
430 message SparseToDenseOptions {
431   optional bool validate_indices = 1 [default = true];
432 }
433
434 message ReverseV2Options {
435   // None
436 }
437
438 message MatrixDiagOptions {
439   // NONE
440 }
441
442 message MatrixSetDiagOptions {
443   // NONE
444 }
445
446 message Operation {
447   optional string type = 1;
448   repeated string input = 2;
449   repeated string output = 3;
450   optional int32 version = 4 [default = 1];
451
452   optional Conv2DOptions conv2d_options = 100;
453   optional Pool2DOptions averagepool2d_options = 101;
454   optional ConcatenationOptions concatenation_options = 102;
455   optional Pool2DOptions maxpool2d_options = 103;
456   optional ReshapeOptions reshape_options = 104;
457   optional DepthwiseConv2DOptions depthwiseconv2d_options = 105;
458   optional SubOptions sub_options = 106;
459   optional DivOptions div_options = 107;
460   optional FullyConnectedOptions fullyconnected_options = 108;
461   optional AddOptions add_options = 109;
462   optional ArgMaxOptions argmax_options = 110;
463   optional PadOptions pad_options = 111;
464   optional SoftmaxOptions softmax_options = 112;
465   optional MulOptions mul_options = 113;
466   optional ReducerOptions mean_options = 114;
467   optional TransposeOptions transpose_options = 115;
468   optional PackOptions pack_options = 116;
469   optional LogicalOrOptions logical_or_options = 117;
470   optional LogicalNotOptions logical_not_options = 118;
471   optional LogicalAndOptions logical_and_options = 119;
472   optional AbsOptions abs_options = 120;
473   optional CosOptions cos_options = 121;
474   optional EqualOptions equal_options = 122;
475   optional ShapeOptions shape_options = 123;
476   optional FloorDivOptions floordiv_options = 124;
477   optional BatchToSpaceNDOptions batch_to_space_options = 125;
478   optional ExpOptions exp_options = 126;
479   optional UnpackOptions unpack_options = 127;
480   optional GatherOptions gather_options = 128;
481   optional BatchMatMulOptions batch_matmul_options = 129;
482   optional TileOptions tile_options = 130;
483   optional IfOptions if_options = 131;
484   optional WhileOptions while_options = 132;
485   optional SpaceToBatchNDOptions space_to_batch_nd_options = 133;
486   optional CastOptions cast_options = 134;
487   optional GreaterEqualOptions greaterequal_options = 135;
488   optional MaximumMinimumOptions maximum_options = 136;
489   optional StridedSliceOptions strided_slice_options = 137;
490   optional SquaredDifferenceOptions squared_difference_options = 138;
491   optional FillOptions fill_options = 139;
492   optional SelectOptions select_options = 140;
493   optional ReducerOptions reduce_prod_options = 141;
494   optional SplitOptions split_options = 142;
495   optional SplitVOptions split_v_options = 143;
496   optional ReducerOptions sum_options = 144;
497   optional GreaterOptions greater_options = 145;
498   optional SqueezeOptions squeeze_options = 146;
499   optional FloorModOptions floormod_options = 147;
500   optional OneHotOptions onehot_options = 148;
501   optional LessOptions less_options = 149;
502   optional ReducerOptions reduce_max_options = 150;
503   optional MaximumMinimumOptions minimum_options = 151;
504   optional ReducerOptions reduce_any_options = 152;
505   optional ZerosLikeOptions zeros_like_options = 153;
506   // ConcatEmbeddingsOptions 154
507   // LSHProjectionOptions 155
508   // SVDFOptions 156
509   // RNNOptions 157
510   optional L2NormOptions l2norm_options = 158;
511   optional LocalResponseNormalizationOptions local_response_normalization_options = 159;
512   // LSTMOptions 160
513   optional ResizeBilinearOptions resize_bilinear_options = 161;
514   // CallOptions 162
515   // SkipGramOptions 163
516   optional SpaceToDepthOptions space_to_depth_options = 164;
517   // EmbeddingLookupSparseOptions 165
518   // SequenceRNNOptions 166
519   optional TopKV2Options topk_v2_options = 167;
520   optional LogSoftmaxOptions log_softmax_options = 168;
521   // DequantizeOptions 169
522   optional NegOptions neg_options = 170;
523   optional PadV2Options padv2_options = 171;
524   optional LessEqualOptions lessequal_options = 172;
525   optional SliceOptions slice_options = 173;
526   optional TransposeConvOptions transpose_conv_options = 174;
527   optional SparseToDenseOptions sparse_to_dense_options = 175;
528   optional PowOptions pow_options = 176;
529   optional ArgMinOptions argmin_options = 177;
530   // FakeQuantOptions 178
531   // BidirectionalSequenceLSTMOptions 179
532   // BidirectionalSequenceRNNOptions 180
533   // UnidirectionalSequenceLSTMOptions 181
534   optional RangeOptions range_options = 182;
535   optional ResizeNearestNeighborOptions resize_nearest_neighbor_options = 183;
536   optional LeakyReluOptions leaky_relu_options = 184;
537   optional MirrorPadOptions mirrorpad_options = 185;
538   optional UniqueOptions unique_options = 186;
539   optional ReverseV2Options reversev2_options = 187;
540   // AddNOptions 188
541   optional GatherNdOptions gather_nd_options = 189;
542   optional WhereOptions where_options = 190;
543   optional RankOptions rank_options = 191;
544   optional ReverseSequenceOptions reverse_sequence_options = 192;
545   optional MatrixDiagOptions matrix_diag_options = 193;
546   // QuantizeOptions 194
547   optional MatrixSetDiagOptions matrix_set_diag_options = 195;
548   // HardSwishOptions 196
549   optional DepthToSpaceOptions depth_to_space_options = 197;
550   optional NonMaxSuppressionV4Options non_max_suppression_v4_options = 198;
551   optional NonMaxSuppressionV5Options non_max_suppression_v5_options = 199;
552   optional ScatterNdOptions scatter_nd_options = 200;
553   optional NotEqualOptions notequal_options = 201;
554   optional ExpandDimsOptions expand_dims_options = 202;
555   optional Pool2DOptions l2pool2d_options = 203;
556   optional ReducerOptions all_options = 204;
557   optional ReducerOptions reduce_min_options = 205;
558   optional SegmentSumOptions segment_sum_options = 206;
559   optional AddNOptions add_n_options = 207;
560   optional MatMulOptions matmul_options = 208;
561
562   // NOTE if there are more than two options with same type of Options
563   // use the number not listed in the above reserve list
564 }
565
566 // For additional subgraphs
567 message Graph {
568   repeated Operand operand = 1;
569   repeated Operation operation = 2;
570   repeated string input = 3;
571   repeated string output = 4;
572   optional string name = 5;
573 }
574
575 message ModelRecipe {
576   repeated Operand operand = 1;
577   repeated Operation operation = 2;
578   repeated string input = 3;
579   repeated string output = 4;
580   optional string name = 5;
581   optional uint32 version = 6 [default = 1];
582   repeated Graph graph = 7;
583 }