1/*
2 * Copyright (C) 2019 The Android Open Source Project
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
17syntax = "proto3";
18
19package android.nn.fuzz;
20
21enum OperandType {
22    FLOAT32 = 0;
23    INT32 = 1;
24    UINT32 = 2;
25    TENSOR_FLOAT32 = 3;
26    TENSOR_INT32 = 4;
27    TENSOR_QUANT8_ASYMM = 5;
28    BOOL = 6;
29    TENSOR_QUANT16_SYMM = 7;
30    TENSOR_FLOAT16 = 8;
31    TENSOR_BOOL8 = 9;
32    FLOAT16 = 10;
33    TENSOR_QUANT8_SYMM_PER_CHANNEL = 11;
34    TENSOR_QUANT16_ASYMM = 12;
35    TENSOR_QUANT8_SYMM = 13;
36    TENSOR_QUANT8_ASYMM_SIGNED = 14;
37    SUBGRAPH_OPERAND = 15;
38}
39
40enum OperationType {
41    ADD = 0;
42    AVERAGE_POOL_2D = 1;
43    CONCATENATION = 2;
44    CONV_2D = 3;
45    DEPTHWISE_CONV_2D = 4;
46    DEPTH_TO_SPACE = 5;
47    DEQUANTIZE = 6;
48    EMBEDDING_LOOKUP = 7;
49    FLOOR = 8;
50    FULLY_CONNECTED = 9;
51    HASHTABLE_LOOKUP = 10;
52    L2_NORMALIZATION = 11;
53    L2_POOL_2D = 12;
54    LOCAL_RESPONSE_NORMALIZATION = 13;
55    LOGISTIC = 14;
56    LSH_PROJECTION = 15;
57    LSTM = 16;
58    MAX_POOL_2D = 17;
59    MUL = 18;
60    RELU = 19;
61    RELU1 = 20;
62    RELU6 = 21;
63    RESHAPE = 22;
64    RESIZE_BILINEAR = 23;
65    RNN = 24;
66    SOFTMAX = 25;
67    SPACE_TO_DEPTH = 26;
68    SVDF = 27;
69    TANH = 28;
70    BATCH_TO_SPACE_ND = 29;
71    DIV = 30;
72    MEAN = 31;
73    PAD = 32;
74    SPACE_TO_BATCH_ND = 33;
75    SQUEEZE = 34;
76    STRIDED_SLICE = 35;
77    SUB = 36;
78    TRANSPOSE = 37;
79    ABS = 38;
80    ARGMAX = 39;
81    ARGMIN = 40;
82    AXIS_ALIGNED_BBOX_TRANSFORM = 41;
83    BIDIRECTIONAL_SEQUENCE_LSTM = 42;
84    BIDIRECTIONAL_SEQUENCE_RNN = 43;
85    BOX_WITH_NMS_LIMIT = 44;
86    CAST = 45;
87    CHANNEL_SHUFFLE = 46;
88    DETECTION_POSTPROCESSING = 47;
89    EQUAL = 48;
90    EXP = 49;
91    EXPAND_DIMS = 50;
92    GATHER = 51;
93    GENERATE_PROPOSALS = 52;
94    GREATER = 53;
95    GREATER_EQUAL = 54;
96    GROUPED_CONV_2D = 55;
97    HEATMAP_MAX_KEYPOINT = 56;
98    INSTANCE_NORMALIZATION = 57;
99    LESS = 58;
100    LESS_EQUAL = 59;
101    LOG = 60;
102    LOGICAL_AND = 61;
103    LOGICAL_NOT = 62;
104    LOGICAL_OR = 63;
105    LOG_SOFTMAX = 64;
106    MAXIMUM = 65;
107    MINIMUM = 66;
108    NEG = 67;
109    NOT_EQUAL = 68;
110    PAD_V2 = 69;
111    POW = 70;
112    PRELU = 71;
113    QUANTIZE = 72;
114    QUANTIZED_16BIT_LSTM = 73;
115    RANDOM_MULTINOMIAL = 74;
116    REDUCE_ALL = 75;
117    REDUCE_ANY = 76;
118    REDUCE_MAX = 77;
119    REDUCE_MIN = 78;
120    REDUCE_PROD = 79;
121    REDUCE_SUM = 80;
122    ROI_ALIGN = 81;
123    ROI_POOLING = 82;
124    RSQRT = 83;
125    SELECT = 84;
126    SIN = 85;
127    SLICE = 86;
128    SPLIT = 87;
129    SQRT = 88;
130    TILE = 89;
131    TOPK_V2 = 90;
132    TRANSPOSE_CONV_2D = 91;
133    UNIDIRECTIONAL_SEQUENCE_LSTM = 92;
134    UNIDIRECTIONAL_SEQUENCE_RNN = 93;
135    RESIZE_NEAREST_NEIGHBOR = 94;
136    QUANTIZED_LSTM = 95;
137    IF = 96;
138    WHILE = 97;
139    ELU = 98;
140    HARD_SWISH = 99;
141    FILL = 100;
142    RANK = 101;
143    BATCH_MATMUL = 102;
144    PACK = 103;
145    MIRROR_PAD = 104;
146    REVERSE = 105;
147}
148
149enum OperandLifeTime {
150    TEMPORARY_VARIABLE = 0;
151    SUBGRAPH_INPUT = 1;
152    SUBGRAPH_OUTPUT = 2;
153    CONSTANT_COPY = 3;
154    CONSTANT_REFERENCE = 4;
155    NO_VALUE = 5;
156    SUBGRAPH_LIFETIME = 6;
157}
158
159message EmptyBuffer {}
160
161message Buffer {
162    oneof type {
163        EmptyBuffer empty = 1;
164        uint32 scalar = 2;
165        uint32 random_seed = 3;
166    }
167}
168
169message Scales {
170    repeated float scale = 1;
171}
172
173message SymmPerChannelQuantParams {
174    Scales scales = 1;
175    uint32 channel_dim = 2;
176}
177
178message Dimensions {
179    repeated uint32 dimension = 1;
180}
181
182message Operand {
183    OperandType type = 1;
184    Dimensions dimensions = 2;
185    float scale = 4;
186    int32 zero_point = 5;
187    OperandLifeTime lifetime = 6;
188    SymmPerChannelQuantParams channel_quant = 7;
189    Buffer data = 8;
190}
191
192message Operands {
193    repeated Operand operand = 1;
194}
195
196message Indexes {
197    repeated uint32 index = 1;
198}
199
200message Operation {
201    OperationType type = 1;
202    Indexes inputs = 2;
203    Indexes outputs = 3;
204}
205
206message Operations {
207    repeated Operation operation = 1;
208}
209
210message Subgraph {
211    Operands operands = 1;
212    Operations operations = 2;
213    Indexes input_indexes = 3;
214    Indexes output_indexes = 4;
215}
216
217message Subgraphs {
218    repeated Subgraph subgraph = 1;
219}
220
221message Model {
222    Subgraph main = 1;
223    Subgraphs referenced = 2;
224    bool is_relaxed = 3;
225}
226
227message Test {
228    Model model = 1;
229}
230