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