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