summaryrefslogtreecommitdiff
path: root/compiler/tflchef/proto/tflchef.proto
blob: 486aa8a67dda88600c70a7589d3ab1d4e3906247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
syntax = "proto2";

package tflchef;

//
// Initial version
//  - Our initial version
//
// Version 1
//  - Backward compatible with Initial version
//  - Added Graph to represent sub graphs
//  - Added name, version(default as 1), graph in ModelRecipe
//

// This enum value corresponds to TensorType in TensorFlow Lite schema
enum TensorType {
  FLOAT32 = 0;
  INT32 = 2;
  UINT8 = 3;
  INT64 = 4;
  BOOL = 6;
}

message TensorShape {
  repeated uint32 dim = 3;
}

message TensorFiller {
  optional string tag = 1;
  repeated string arg = 2;
}

message TensorQuantization {
  repeated float min = 1;
  repeated float max = 2;
  repeated float scale = 3;
  repeated int64 zero_point = 4;
}

message Operand {
  optional string name = 1;
  optional TensorType type = 2;
  optional TensorShape shape = 3;
  optional TensorFiller filler = 4;
  optional TensorQuantization quant = 5;
}

// This enum value corresponds to Padding in TensorFlow Lite schema
enum Padding {
  SAME = 0;
  VALID = 1;
}

// This enum value corresponds to ActivationFunctionType in TensorFlow Lite schema
enum Activation {
  NONE = 0;
  RELU = 1;
  RELU6 = 3;
}

message Conv2DOptions
{
  optional Padding padding = 1 [default = VALID];
  optional int32 stride_w = 2 [default = 1];
  optional int32 stride_h = 3 [default = 1];
  optional Activation activation = 4 [default = NONE];
}

message Pool2DOptions {
  optional Padding padding = 1 [default = VALID];
  optional int32 stride_w = 2 [default = 1];
  optional int32 stride_h = 3 [default = 1];
  optional int32 filter_width = 4 [default = 1];
  optional int32 filter_height = 5 [ default = 1];
  optional Activation activation = 6 [default = NONE];
}

message ConcatenationOptions {
  optional int32 axis = 1 [default = 0];
  optional Activation activation = 2 [default = NONE];
}

message ReshapeOptions {
  repeated int32 new_shape = 1;
}

message DepthwiseConv2DOptions
{
  optional Padding padding = 1 [default = VALID];
  optional int32 stride_w = 2 [default = 1];
  optional int32 stride_h = 3 [default = 1];
  optional int32 depth_multiplier = 4 [default = 1];
  optional Activation activation = 5 [default = NONE];
}

message SubOptions {
  optional Activation activation = 1 [default = NONE];
}

message DivOptions {
  optional Activation activation = 1 [default = NONE];
}

message FloorDivOptions {
  // None
}

message FullyConnectedOptions {
  optional Activation activation = 1 [default = NONE];
}

message AddOptions {
  optional Activation activation = 1 [default = NONE];
}

message ArgMaxOptions {
  optional TensorType output_type = 1 [default = INT64];
}

message PackOptions {
  optional int32 values_count = 1;
  optional int32 axis = 2 [default = 0];
}

message PadOptions {
  // None
}

message SoftmaxOptions {
  optional float beta = 1 [default = 0.0];
}

message MulOptions {
  optional Activation activation = 1 [default = NONE];
}

message ReducerOptions {
  optional bool keep_dims = 1 [ default = false ];
}

message LogicalOrOptions {
  // None
}

message LogicalNotOptions {
  // None
}

message LogicalAndOptions {
  // None
}

message TransposeOptions {
  // None
}

message AbsOptions {
  // None
}

message CosOptions {
  // None
}

message EqualOptions {
  // None
}

message ShapeOptions {
  optional TensorType out_type = 1 [default = INT32];
}

message BatchToSpaceNDOptions {
  // None
}

message ExpOptions {
  // None
}

message Operation {
  optional string type = 1;
  repeated string input = 2;
  repeated string output = 3;

  optional Conv2DOptions conv2d_options = 100;
  optional Pool2DOptions averagepool2d_options = 101;
  optional ConcatenationOptions concatenation_options = 102;
  optional Pool2DOptions maxpool2d_options = 103;
  optional ReshapeOptions reshape_options = 104;
  optional DepthwiseConv2DOptions depthwiseconv2d_options = 105;
  optional SubOptions sub_options = 106;
  optional DivOptions div_options = 107;
  optional FullyConnectedOptions fullyconnected_options = 108;
  optional AddOptions add_options = 109;
  optional ArgMaxOptions argmax_options = 110;
  optional PadOptions pad_options = 111;
  optional SoftmaxOptions softmax_options = 112;
  optional MulOptions mul_options = 113;
  optional ReducerOptions mean_options = 114;
  optional TransposeOptions transpose_options = 115;
  optional PackOptions pack_options = 116;
  optional LogicalOrOptions logical_or_options = 117;
  optional LogicalNotOptions logical_not_options = 118;
  optional LogicalAndOptions logical_and_options = 119;
  optional AbsOptions abs_options = 120;
  optional CosOptions cos_options = 121;
  optional EqualOptions equal_options = 122;
  optional ShapeOptions shape_options = 123;
  optional FloorDivOptions floordiv_options = 124;
  optional BatchToSpaceNDOptions batch_to_space_options = 125;
  optional ExpOptions exp_options = 126;
}

// For additional subgraphs
message Graph {
  repeated Operand operand = 1;
  repeated Operation operation = 2;
  repeated string input = 3;
  repeated string output = 4;
  optional string name = 5;
}

message ModelRecipe {
  repeated Operand operand = 1;
  repeated Operation operation = 2;
  repeated string input = 3;
  repeated string output = 4;
  optional string name = 5;
  optional uint32 version = 6 [default = 1];
  repeated Graph graph = 7;
}