1 // clang-format off
2 // Generated file (from: bbox_graph.mod.py). Do not edit
CreateModel_zero_sized(Model * model)3 void CreateModel_zero_sized(Model *model) {
4 OperandType type0(Type::BOOL, {});
5 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
6 OperandType type10(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
7 OperandType type11(Type::TENSOR_FLOAT32, {8, 4});
8 OperandType type12(Type::TENSOR_FLOAT32, {8});
9 OperandType type13(Type::TENSOR_FLOAT32, {0, 8});
10 OperandType type14(Type::TENSOR_FLOAT32, {2, 4});
11 OperandType type15(Type::TENSOR_FLOAT32, {2});
12 OperandType type16(Type::TENSOR_FLOAT32, {0, 2});
13 OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
14 OperandType type3(Type::TENSOR_FLOAT32, {1, 4});
15 OperandType type4(Type::TENSOR_FLOAT32, {1, 2});
16 OperandType type5(Type::TENSOR_FLOAT32, {0});
17 OperandType type6(Type::TENSOR_FLOAT32, {0, 4});
18 OperandType type7(Type::TENSOR_INT32, {0});
19 OperandType type8(Type::FLOAT32, {});
20 OperandType type9(Type::INT32, {});
21 // Phase 1, operands
22 auto scores = model->addOperand(&type1);
23 auto deltas = model->addOperand(&type2);
24 auto anchors = model->addOperand(&type3);
25 auto imageInfo = model->addOperand(&type4);
26 auto param = model->addOperand(&type8);
27 auto param1 = model->addOperand(&type8);
28 auto param2 = model->addOperand(&type9);
29 auto param3 = model->addOperand(&type9);
30 auto param4 = model->addOperand(&type8);
31 auto param5 = model->addOperand(&type8);
32 auto layout = model->addOperand(&type0);
33 auto scores1 = model->addOperand(&type5);
34 auto roi = model->addOperand(&type6);
35 auto batches = model->addOperand(&type7);
36 auto featureMap = model->addOperand(&type1);
37 auto param6 = model->addOperand(&type9);
38 auto param7 = model->addOperand(&type9);
39 auto param8 = model->addOperand(&type8);
40 auto param9 = model->addOperand(&type8);
41 auto param10 = model->addOperand(&type9);
42 auto param11 = model->addOperand(&type9);
43 auto scores2 = model->addOperand(&type10);
44 auto weights = model->addOperand(&type11);
45 auto bias = model->addOperand(&type12);
46 auto param12 = model->addOperand(&type9);
47 auto delta = model->addOperand(&type13);
48 auto weights1 = model->addOperand(&type14);
49 auto bias1 = model->addOperand(&type15);
50 auto param13 = model->addOperand(&type9);
51 auto scores3 = model->addOperand(&type16);
52 auto roi1 = model->addOperand(&type13);
53 auto param14 = model->addOperand(&type8);
54 auto param15 = model->addOperand(&type9);
55 auto param16 = model->addOperand(&type9);
56 auto param17 = model->addOperand(&type8);
57 auto param18 = model->addOperand(&type8);
58 auto param19 = model->addOperand(&type8);
59 auto scores4 = model->addOperand(&type5);
60 auto roi2 = model->addOperand(&type6);
61 auto classes = model->addOperand(&type7);
62 auto batches1 = model->addOperand(&type7);
63 // Phase 2, operations
64 static float param_init[] = {1.0f};
65 model->setOperandValue(param, param_init, sizeof(float) * 1);
66 static float param1_init[] = {1.0f};
67 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
68 static int32_t param2_init[] = {-1};
69 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
70 static int32_t param3_init[] = {-1};
71 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
72 static float param4_init[] = {0.3f};
73 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
74 static float param5_init[] = {10.0f};
75 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
76 static bool8 layout_init[] = {false};
77 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
78 static int32_t param6_init[] = {2};
79 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
80 static int32_t param7_init[] = {2};
81 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
82 static float param8_init[] = {1.0f};
83 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
84 static float param9_init[] = {1.0f};
85 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
86 static int32_t param10_init[] = {4};
87 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
88 static int32_t param11_init[] = {4};
89 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
90 static float weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
91 model->setOperandValue(weights, weights_init, sizeof(float) * 32);
92 static float bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
93 model->setOperandValue(bias, bias_init, sizeof(float) * 8);
94 static int32_t param12_init[] = {0};
95 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
96 static float weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
97 model->setOperandValue(weights1, weights1_init, sizeof(float) * 8);
98 static float bias1_init[] = {1.0f, 1.0f};
99 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2);
100 static int32_t param13_init[] = {0};
101 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
102 static float param14_init[] = {0.1f};
103 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
104 static int32_t param15_init[] = {-1};
105 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
106 static int32_t param16_init[] = {0};
107 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
108 static float param17_init[] = {0.3f};
109 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
110 static float param18_init[] = {1.0f};
111 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
112 static float param19_init[] = {0.1f};
113 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
114 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
115 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
116 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
117 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
118 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
119 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
120 // Phase 3, inputs and outputs
121 model->identifyInputsAndOutputs(
122 {scores, deltas, anchors, imageInfo, featureMap},
123 {scores1, scores4, roi2, classes, batches1});
124 assert(model->isValid());
125 }
126
is_ignored_zero_sized(int i)127 inline bool is_ignored_zero_sized(int i) {
128 static std::set<int> ignore = {};
129 return ignore.find(i) != ignore.end();
130 }
131
CreateModel_zero_sized_relaxed(Model * model)132 void CreateModel_zero_sized_relaxed(Model *model) {
133 OperandType type0(Type::BOOL, {});
134 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
135 OperandType type10(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
136 OperandType type11(Type::TENSOR_FLOAT32, {8, 4});
137 OperandType type12(Type::TENSOR_FLOAT32, {8});
138 OperandType type13(Type::TENSOR_FLOAT32, {0, 8});
139 OperandType type14(Type::TENSOR_FLOAT32, {2, 4});
140 OperandType type15(Type::TENSOR_FLOAT32, {2});
141 OperandType type16(Type::TENSOR_FLOAT32, {0, 2});
142 OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
143 OperandType type3(Type::TENSOR_FLOAT32, {1, 4});
144 OperandType type4(Type::TENSOR_FLOAT32, {1, 2});
145 OperandType type5(Type::TENSOR_FLOAT32, {0});
146 OperandType type6(Type::TENSOR_FLOAT32, {0, 4});
147 OperandType type7(Type::TENSOR_INT32, {0});
148 OperandType type8(Type::FLOAT32, {});
149 OperandType type9(Type::INT32, {});
150 // Phase 1, operands
151 auto scores = model->addOperand(&type1);
152 auto deltas = model->addOperand(&type2);
153 auto anchors = model->addOperand(&type3);
154 auto imageInfo = model->addOperand(&type4);
155 auto param = model->addOperand(&type8);
156 auto param1 = model->addOperand(&type8);
157 auto param2 = model->addOperand(&type9);
158 auto param3 = model->addOperand(&type9);
159 auto param4 = model->addOperand(&type8);
160 auto param5 = model->addOperand(&type8);
161 auto layout = model->addOperand(&type0);
162 auto scores1 = model->addOperand(&type5);
163 auto roi = model->addOperand(&type6);
164 auto batches = model->addOperand(&type7);
165 auto featureMap = model->addOperand(&type1);
166 auto param6 = model->addOperand(&type9);
167 auto param7 = model->addOperand(&type9);
168 auto param8 = model->addOperand(&type8);
169 auto param9 = model->addOperand(&type8);
170 auto param10 = model->addOperand(&type9);
171 auto param11 = model->addOperand(&type9);
172 auto scores2 = model->addOperand(&type10);
173 auto weights = model->addOperand(&type11);
174 auto bias = model->addOperand(&type12);
175 auto param12 = model->addOperand(&type9);
176 auto delta = model->addOperand(&type13);
177 auto weights1 = model->addOperand(&type14);
178 auto bias1 = model->addOperand(&type15);
179 auto param13 = model->addOperand(&type9);
180 auto scores3 = model->addOperand(&type16);
181 auto roi1 = model->addOperand(&type13);
182 auto param14 = model->addOperand(&type8);
183 auto param15 = model->addOperand(&type9);
184 auto param16 = model->addOperand(&type9);
185 auto param17 = model->addOperand(&type8);
186 auto param18 = model->addOperand(&type8);
187 auto param19 = model->addOperand(&type8);
188 auto scores4 = model->addOperand(&type5);
189 auto roi2 = model->addOperand(&type6);
190 auto classes = model->addOperand(&type7);
191 auto batches1 = model->addOperand(&type7);
192 // Phase 2, operations
193 static float param_init[] = {1.0f};
194 model->setOperandValue(param, param_init, sizeof(float) * 1);
195 static float param1_init[] = {1.0f};
196 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
197 static int32_t param2_init[] = {-1};
198 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
199 static int32_t param3_init[] = {-1};
200 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
201 static float param4_init[] = {0.3f};
202 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
203 static float param5_init[] = {10.0f};
204 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
205 static bool8 layout_init[] = {false};
206 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
207 static int32_t param6_init[] = {2};
208 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
209 static int32_t param7_init[] = {2};
210 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
211 static float param8_init[] = {1.0f};
212 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
213 static float param9_init[] = {1.0f};
214 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
215 static int32_t param10_init[] = {4};
216 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
217 static int32_t param11_init[] = {4};
218 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
219 static float weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
220 model->setOperandValue(weights, weights_init, sizeof(float) * 32);
221 static float bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
222 model->setOperandValue(bias, bias_init, sizeof(float) * 8);
223 static int32_t param12_init[] = {0};
224 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
225 static float weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
226 model->setOperandValue(weights1, weights1_init, sizeof(float) * 8);
227 static float bias1_init[] = {1.0f, 1.0f};
228 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2);
229 static int32_t param13_init[] = {0};
230 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
231 static float param14_init[] = {0.1f};
232 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
233 static int32_t param15_init[] = {-1};
234 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
235 static int32_t param16_init[] = {0};
236 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
237 static float param17_init[] = {0.3f};
238 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
239 static float param18_init[] = {1.0f};
240 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
241 static float param19_init[] = {0.1f};
242 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
243 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
244 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
245 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
246 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
247 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
248 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
249 // Phase 3, inputs and outputs
250 model->identifyInputsAndOutputs(
251 {scores, deltas, anchors, imageInfo, featureMap},
252 {scores1, scores4, roi2, classes, batches1});
253 // Phase 4: set relaxed execution
254 model->relaxComputationFloat32toFloat16(true);
255 assert(model->isValid());
256 }
257
is_ignored_zero_sized_relaxed(int i)258 inline bool is_ignored_zero_sized_relaxed(int i) {
259 static std::set<int> ignore = {};
260 return ignore.find(i) != ignore.end();
261 }
262
CreateModel_zero_sized_float16(Model * model)263 void CreateModel_zero_sized_float16(Model *model) {
264 OperandType type0(Type::BOOL, {});
265 OperandType type17(Type::TENSOR_FLOAT16, {1, 4});
266 OperandType type18(Type::TENSOR_FLOAT16, {8});
267 OperandType type19(Type::TENSOR_FLOAT16, {2});
268 OperandType type20(Type::TENSOR_FLOAT16, {0, 8});
269 OperandType type21(Type::TENSOR_FLOAT16, {1, 1, 1, 4});
270 OperandType type22(Type::TENSOR_FLOAT16, {1, 1, 1, 1});
271 OperandType type23(Type::TENSOR_FLOAT16, {1, 2});
272 OperandType type24(Type::FLOAT16, {});
273 OperandType type25(Type::TENSOR_FLOAT16, {0, 4});
274 OperandType type26(Type::TENSOR_FLOAT16, {0});
275 OperandType type27(Type::TENSOR_FLOAT16, {0, 2, 2, 1});
276 OperandType type28(Type::TENSOR_FLOAT16, {0, 2});
277 OperandType type29(Type::TENSOR_FLOAT16, {8, 4});
278 OperandType type30(Type::TENSOR_FLOAT16, {2, 4});
279 OperandType type7(Type::TENSOR_INT32, {0});
280 OperandType type9(Type::INT32, {});
281 // Phase 1, operands
282 auto scores = model->addOperand(&type22);
283 auto deltas = model->addOperand(&type21);
284 auto anchors = model->addOperand(&type17);
285 auto imageInfo = model->addOperand(&type23);
286 auto param = model->addOperand(&type24);
287 auto param1 = model->addOperand(&type24);
288 auto param2 = model->addOperand(&type9);
289 auto param3 = model->addOperand(&type9);
290 auto param4 = model->addOperand(&type24);
291 auto param5 = model->addOperand(&type24);
292 auto layout = model->addOperand(&type0);
293 auto scores1 = model->addOperand(&type26);
294 auto roi = model->addOperand(&type25);
295 auto batches = model->addOperand(&type7);
296 auto featureMap = model->addOperand(&type22);
297 auto param6 = model->addOperand(&type9);
298 auto param7 = model->addOperand(&type9);
299 auto param8 = model->addOperand(&type24);
300 auto param9 = model->addOperand(&type24);
301 auto param10 = model->addOperand(&type9);
302 auto param11 = model->addOperand(&type9);
303 auto scores2 = model->addOperand(&type27);
304 auto weights = model->addOperand(&type29);
305 auto bias = model->addOperand(&type18);
306 auto param12 = model->addOperand(&type9);
307 auto delta = model->addOperand(&type20);
308 auto weights1 = model->addOperand(&type30);
309 auto bias1 = model->addOperand(&type19);
310 auto param13 = model->addOperand(&type9);
311 auto scores3 = model->addOperand(&type28);
312 auto roi1 = model->addOperand(&type20);
313 auto param14 = model->addOperand(&type24);
314 auto param15 = model->addOperand(&type9);
315 auto param16 = model->addOperand(&type9);
316 auto param17 = model->addOperand(&type24);
317 auto param18 = model->addOperand(&type24);
318 auto param19 = model->addOperand(&type24);
319 auto scores4 = model->addOperand(&type26);
320 auto roi2 = model->addOperand(&type25);
321 auto classes = model->addOperand(&type7);
322 auto batches1 = model->addOperand(&type7);
323 // Phase 2, operations
324 static _Float16 param_init[] = {1.0f};
325 model->setOperandValue(param, param_init, sizeof(_Float16) * 1);
326 static _Float16 param1_init[] = {1.0f};
327 model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
328 static int32_t param2_init[] = {-1};
329 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
330 static int32_t param3_init[] = {-1};
331 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
332 static _Float16 param4_init[] = {0.30000001192092896f};
333 model->setOperandValue(param4, param4_init, sizeof(_Float16) * 1);
334 static _Float16 param5_init[] = {10.0f};
335 model->setOperandValue(param5, param5_init, sizeof(_Float16) * 1);
336 static bool8 layout_init[] = {false};
337 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
338 static int32_t param6_init[] = {2};
339 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
340 static int32_t param7_init[] = {2};
341 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
342 static _Float16 param8_init[] = {1.0f};
343 model->setOperandValue(param8, param8_init, sizeof(_Float16) * 1);
344 static _Float16 param9_init[] = {1.0f};
345 model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
346 static int32_t param10_init[] = {4};
347 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
348 static int32_t param11_init[] = {4};
349 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
350 static _Float16 weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
351 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 32);
352 static _Float16 bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
353 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 8);
354 static int32_t param12_init[] = {0};
355 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
356 static _Float16 weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
357 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 8);
358 static _Float16 bias1_init[] = {1.0f, 1.0f};
359 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2);
360 static int32_t param13_init[] = {0};
361 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
362 static _Float16 param14_init[] = {0.10000000149011612f};
363 model->setOperandValue(param14, param14_init, sizeof(_Float16) * 1);
364 static int32_t param15_init[] = {-1};
365 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
366 static int32_t param16_init[] = {0};
367 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
368 static _Float16 param17_init[] = {0.30000001192092896f};
369 model->setOperandValue(param17, param17_init, sizeof(_Float16) * 1);
370 static _Float16 param18_init[] = {1.0f};
371 model->setOperandValue(param18, param18_init, sizeof(_Float16) * 1);
372 static _Float16 param19_init[] = {0.10000000149011612f};
373 model->setOperandValue(param19, param19_init, sizeof(_Float16) * 1);
374 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
375 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
376 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
377 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
378 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
379 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
380 // Phase 3, inputs and outputs
381 model->identifyInputsAndOutputs(
382 {scores, deltas, anchors, imageInfo, featureMap},
383 {scores1, scores4, roi2, classes, batches1});
384 assert(model->isValid());
385 }
386
is_ignored_zero_sized_float16(int i)387 inline bool is_ignored_zero_sized_float16(int i) {
388 static std::set<int> ignore = {};
389 return ignore.find(i) != ignore.end();
390 }
391
CreateModel_zero_sized_quant8(Model * model)392 void CreateModel_zero_sized_quant8(Model *model) {
393 OperandType type0(Type::BOOL, {});
394 OperandType type31(Type::TENSOR_QUANT16_SYMM, {1, 4}, 0.125f, 0);
395 OperandType type32(Type::TENSOR_INT32, {8}, 0.01f, 0);
396 OperandType type33(Type::TENSOR_INT32, {2}, 0.01f, 0);
397 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {0, 8}, 0.1f, 128);
398 OperandType type35(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 0.1f, 128);
399 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128);
400 OperandType type37(Type::TENSOR_QUANT16_ASYMM, {1, 2}, 0.125f, 0);
401 OperandType type38(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0);
402 OperandType type39(Type::TENSOR_QUANT16_ASYMM, {0, 8}, 0.125f, 0);
403 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128);
404 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128);
405 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {0, 2}, 0.1f, 128);
406 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {8, 4}, 0.1f, 128);
407 OperandType type44(Type::TENSOR_QUANT8_ASYMM, {2, 4}, 0.1f, 128);
408 OperandType type7(Type::TENSOR_INT32, {0});
409 OperandType type8(Type::FLOAT32, {});
410 OperandType type9(Type::INT32, {});
411 // Phase 1, operands
412 auto scores = model->addOperand(&type36);
413 auto deltas = model->addOperand(&type35);
414 auto anchors = model->addOperand(&type31);
415 auto imageInfo = model->addOperand(&type37);
416 auto param = model->addOperand(&type8);
417 auto param1 = model->addOperand(&type8);
418 auto param2 = model->addOperand(&type9);
419 auto param3 = model->addOperand(&type9);
420 auto param4 = model->addOperand(&type8);
421 auto param5 = model->addOperand(&type8);
422 auto layout = model->addOperand(&type0);
423 auto scores1 = model->addOperand(&type40);
424 auto roi = model->addOperand(&type38);
425 auto batches = model->addOperand(&type7);
426 auto featureMap = model->addOperand(&type36);
427 auto param6 = model->addOperand(&type9);
428 auto param7 = model->addOperand(&type9);
429 auto param8 = model->addOperand(&type8);
430 auto param9 = model->addOperand(&type8);
431 auto param10 = model->addOperand(&type9);
432 auto param11 = model->addOperand(&type9);
433 auto scores2 = model->addOperand(&type41);
434 auto weights = model->addOperand(&type43);
435 auto bias = model->addOperand(&type32);
436 auto param12 = model->addOperand(&type9);
437 auto delta = model->addOperand(&type34);
438 auto weights1 = model->addOperand(&type44);
439 auto bias1 = model->addOperand(&type33);
440 auto param13 = model->addOperand(&type9);
441 auto scores3 = model->addOperand(&type42);
442 auto roi1 = model->addOperand(&type39);
443 auto param14 = model->addOperand(&type8);
444 auto param15 = model->addOperand(&type9);
445 auto param16 = model->addOperand(&type9);
446 auto param17 = model->addOperand(&type8);
447 auto param18 = model->addOperand(&type8);
448 auto param19 = model->addOperand(&type8);
449 auto scores4 = model->addOperand(&type40);
450 auto roi2 = model->addOperand(&type38);
451 auto classes = model->addOperand(&type7);
452 auto batches1 = model->addOperand(&type7);
453 // Phase 2, operations
454 static float param_init[] = {1.0f};
455 model->setOperandValue(param, param_init, sizeof(float) * 1);
456 static float param1_init[] = {1.0f};
457 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
458 static int32_t param2_init[] = {-1};
459 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
460 static int32_t param3_init[] = {-1};
461 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
462 static float param4_init[] = {0.3f};
463 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
464 static float param5_init[] = {10.0f};
465 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
466 static bool8 layout_init[] = {false};
467 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
468 static int32_t param6_init[] = {2};
469 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
470 static int32_t param7_init[] = {2};
471 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
472 static float param8_init[] = {1.0f};
473 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
474 static float param9_init[] = {1.0f};
475 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
476 static int32_t param10_init[] = {4};
477 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
478 static int32_t param11_init[] = {4};
479 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
480 static uint8_t weights_init[] = {138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138};
481 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 32);
482 static int32_t bias_init[] = {100, 100, 100, 100, 100, 100, 100, 100};
483 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 8);
484 static int32_t param12_init[] = {0};
485 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
486 static uint8_t weights1_init[] = {138, 138, 138, 138, 138, 138, 138, 138};
487 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 8);
488 static int32_t bias1_init[] = {100, 100};
489 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2);
490 static int32_t param13_init[] = {0};
491 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
492 static float param14_init[] = {0.1f};
493 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
494 static int32_t param15_init[] = {-1};
495 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
496 static int32_t param16_init[] = {0};
497 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
498 static float param17_init[] = {0.3f};
499 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
500 static float param18_init[] = {1.0f};
501 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
502 static float param19_init[] = {0.1f};
503 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
504 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
505 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
506 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
507 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
508 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
509 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
510 // Phase 3, inputs and outputs
511 model->identifyInputsAndOutputs(
512 {scores, deltas, anchors, imageInfo, featureMap},
513 {scores1, scores4, roi2, classes, batches1});
514 assert(model->isValid());
515 }
516
is_ignored_zero_sized_quant8(int i)517 inline bool is_ignored_zero_sized_quant8(int i) {
518 static std::set<int> ignore = {};
519 return ignore.find(i) != ignore.end();
520 }
521
CreateModel_zero_sized_dynamic_output_shape(Model * model)522 void CreateModel_zero_sized_dynamic_output_shape(Model *model) {
523 OperandType type0(Type::BOOL, {});
524 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
525 OperandType type10(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
526 OperandType type11(Type::TENSOR_FLOAT32, {8, 4});
527 OperandType type12(Type::TENSOR_FLOAT32, {8});
528 OperandType type13(Type::TENSOR_FLOAT32, {0, 8});
529 OperandType type14(Type::TENSOR_FLOAT32, {2, 4});
530 OperandType type15(Type::TENSOR_FLOAT32, {2});
531 OperandType type16(Type::TENSOR_FLOAT32, {0, 2});
532 OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
533 OperandType type3(Type::TENSOR_FLOAT32, {1, 4});
534 OperandType type4(Type::TENSOR_FLOAT32, {1, 2});
535 OperandType type45(Type::TENSOR_FLOAT32, {0, 0});
536 OperandType type5(Type::TENSOR_FLOAT32, {0});
537 OperandType type6(Type::TENSOR_FLOAT32, {0, 4});
538 OperandType type7(Type::TENSOR_INT32, {0});
539 OperandType type8(Type::FLOAT32, {});
540 OperandType type9(Type::INT32, {});
541 // Phase 1, operands
542 auto scores = model->addOperand(&type1);
543 auto deltas = model->addOperand(&type2);
544 auto anchors = model->addOperand(&type3);
545 auto imageInfo = model->addOperand(&type4);
546 auto param = model->addOperand(&type8);
547 auto param1 = model->addOperand(&type8);
548 auto param2 = model->addOperand(&type9);
549 auto param3 = model->addOperand(&type9);
550 auto param4 = model->addOperand(&type8);
551 auto param5 = model->addOperand(&type8);
552 auto layout = model->addOperand(&type0);
553 auto scores1 = model->addOperand(&type5);
554 auto roi = model->addOperand(&type6);
555 auto batches = model->addOperand(&type7);
556 auto featureMap = model->addOperand(&type1);
557 auto param6 = model->addOperand(&type9);
558 auto param7 = model->addOperand(&type9);
559 auto param8 = model->addOperand(&type8);
560 auto param9 = model->addOperand(&type8);
561 auto param10 = model->addOperand(&type9);
562 auto param11 = model->addOperand(&type9);
563 auto scores2 = model->addOperand(&type10);
564 auto weights = model->addOperand(&type11);
565 auto bias = model->addOperand(&type12);
566 auto param12 = model->addOperand(&type9);
567 auto delta = model->addOperand(&type13);
568 auto weights1 = model->addOperand(&type14);
569 auto bias1 = model->addOperand(&type15);
570 auto param13 = model->addOperand(&type9);
571 auto scores3 = model->addOperand(&type16);
572 auto roi1 = model->addOperand(&type13);
573 auto param14 = model->addOperand(&type8);
574 auto param15 = model->addOperand(&type9);
575 auto param16 = model->addOperand(&type9);
576 auto param17 = model->addOperand(&type8);
577 auto param18 = model->addOperand(&type8);
578 auto param19 = model->addOperand(&type8);
579 auto scores4 = model->addOperand(&type5);
580 auto roi2 = model->addOperand(&type45);
581 auto classes = model->addOperand(&type7);
582 auto batches1 = model->addOperand(&type7);
583 // Phase 2, operations
584 static float param_init[] = {1.0f};
585 model->setOperandValue(param, param_init, sizeof(float) * 1);
586 static float param1_init[] = {1.0f};
587 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
588 static int32_t param2_init[] = {-1};
589 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
590 static int32_t param3_init[] = {-1};
591 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
592 static float param4_init[] = {0.3f};
593 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
594 static float param5_init[] = {10.0f};
595 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
596 static bool8 layout_init[] = {false};
597 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
598 static int32_t param6_init[] = {2};
599 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
600 static int32_t param7_init[] = {2};
601 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
602 static float param8_init[] = {1.0f};
603 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
604 static float param9_init[] = {1.0f};
605 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
606 static int32_t param10_init[] = {4};
607 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
608 static int32_t param11_init[] = {4};
609 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
610 static float weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
611 model->setOperandValue(weights, weights_init, sizeof(float) * 32);
612 static float bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
613 model->setOperandValue(bias, bias_init, sizeof(float) * 8);
614 static int32_t param12_init[] = {0};
615 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
616 static float weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
617 model->setOperandValue(weights1, weights1_init, sizeof(float) * 8);
618 static float bias1_init[] = {1.0f, 1.0f};
619 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2);
620 static int32_t param13_init[] = {0};
621 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
622 static float param14_init[] = {0.1f};
623 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
624 static int32_t param15_init[] = {-1};
625 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
626 static int32_t param16_init[] = {0};
627 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
628 static float param17_init[] = {0.3f};
629 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
630 static float param18_init[] = {1.0f};
631 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
632 static float param19_init[] = {0.1f};
633 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
634 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
635 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
636 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
637 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
638 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
639 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
640 // Phase 3, inputs and outputs
641 model->identifyInputsAndOutputs(
642 {scores, deltas, anchors, imageInfo, featureMap},
643 {scores1, scores4, roi2, classes, batches1});
644 assert(model->isValid());
645 }
646
is_ignored_zero_sized_dynamic_output_shape(int i)647 inline bool is_ignored_zero_sized_dynamic_output_shape(int i) {
648 static std::set<int> ignore = {};
649 return ignore.find(i) != ignore.end();
650 }
651
CreateModel_zero_sized_dynamic_output_shape_relaxed(Model * model)652 void CreateModel_zero_sized_dynamic_output_shape_relaxed(Model *model) {
653 OperandType type0(Type::BOOL, {});
654 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
655 OperandType type10(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
656 OperandType type11(Type::TENSOR_FLOAT32, {8, 4});
657 OperandType type12(Type::TENSOR_FLOAT32, {8});
658 OperandType type13(Type::TENSOR_FLOAT32, {0, 8});
659 OperandType type14(Type::TENSOR_FLOAT32, {2, 4});
660 OperandType type15(Type::TENSOR_FLOAT32, {2});
661 OperandType type16(Type::TENSOR_FLOAT32, {0, 2});
662 OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
663 OperandType type3(Type::TENSOR_FLOAT32, {1, 4});
664 OperandType type4(Type::TENSOR_FLOAT32, {1, 2});
665 OperandType type45(Type::TENSOR_FLOAT32, {0, 0});
666 OperandType type5(Type::TENSOR_FLOAT32, {0});
667 OperandType type6(Type::TENSOR_FLOAT32, {0, 4});
668 OperandType type7(Type::TENSOR_INT32, {0});
669 OperandType type8(Type::FLOAT32, {});
670 OperandType type9(Type::INT32, {});
671 // Phase 1, operands
672 auto scores = model->addOperand(&type1);
673 auto deltas = model->addOperand(&type2);
674 auto anchors = model->addOperand(&type3);
675 auto imageInfo = model->addOperand(&type4);
676 auto param = model->addOperand(&type8);
677 auto param1 = model->addOperand(&type8);
678 auto param2 = model->addOperand(&type9);
679 auto param3 = model->addOperand(&type9);
680 auto param4 = model->addOperand(&type8);
681 auto param5 = model->addOperand(&type8);
682 auto layout = model->addOperand(&type0);
683 auto scores1 = model->addOperand(&type5);
684 auto roi = model->addOperand(&type6);
685 auto batches = model->addOperand(&type7);
686 auto featureMap = model->addOperand(&type1);
687 auto param6 = model->addOperand(&type9);
688 auto param7 = model->addOperand(&type9);
689 auto param8 = model->addOperand(&type8);
690 auto param9 = model->addOperand(&type8);
691 auto param10 = model->addOperand(&type9);
692 auto param11 = model->addOperand(&type9);
693 auto scores2 = model->addOperand(&type10);
694 auto weights = model->addOperand(&type11);
695 auto bias = model->addOperand(&type12);
696 auto param12 = model->addOperand(&type9);
697 auto delta = model->addOperand(&type13);
698 auto weights1 = model->addOperand(&type14);
699 auto bias1 = model->addOperand(&type15);
700 auto param13 = model->addOperand(&type9);
701 auto scores3 = model->addOperand(&type16);
702 auto roi1 = model->addOperand(&type13);
703 auto param14 = model->addOperand(&type8);
704 auto param15 = model->addOperand(&type9);
705 auto param16 = model->addOperand(&type9);
706 auto param17 = model->addOperand(&type8);
707 auto param18 = model->addOperand(&type8);
708 auto param19 = model->addOperand(&type8);
709 auto scores4 = model->addOperand(&type5);
710 auto roi2 = model->addOperand(&type45);
711 auto classes = model->addOperand(&type7);
712 auto batches1 = model->addOperand(&type7);
713 // Phase 2, operations
714 static float param_init[] = {1.0f};
715 model->setOperandValue(param, param_init, sizeof(float) * 1);
716 static float param1_init[] = {1.0f};
717 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
718 static int32_t param2_init[] = {-1};
719 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
720 static int32_t param3_init[] = {-1};
721 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
722 static float param4_init[] = {0.3f};
723 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
724 static float param5_init[] = {10.0f};
725 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
726 static bool8 layout_init[] = {false};
727 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
728 static int32_t param6_init[] = {2};
729 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
730 static int32_t param7_init[] = {2};
731 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
732 static float param8_init[] = {1.0f};
733 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
734 static float param9_init[] = {1.0f};
735 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
736 static int32_t param10_init[] = {4};
737 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
738 static int32_t param11_init[] = {4};
739 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
740 static float weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
741 model->setOperandValue(weights, weights_init, sizeof(float) * 32);
742 static float bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
743 model->setOperandValue(bias, bias_init, sizeof(float) * 8);
744 static int32_t param12_init[] = {0};
745 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
746 static float weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
747 model->setOperandValue(weights1, weights1_init, sizeof(float) * 8);
748 static float bias1_init[] = {1.0f, 1.0f};
749 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2);
750 static int32_t param13_init[] = {0};
751 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
752 static float param14_init[] = {0.1f};
753 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
754 static int32_t param15_init[] = {-1};
755 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
756 static int32_t param16_init[] = {0};
757 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
758 static float param17_init[] = {0.3f};
759 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
760 static float param18_init[] = {1.0f};
761 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
762 static float param19_init[] = {0.1f};
763 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
764 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
765 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
766 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
767 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
768 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
769 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
770 // Phase 3, inputs and outputs
771 model->identifyInputsAndOutputs(
772 {scores, deltas, anchors, imageInfo, featureMap},
773 {scores1, scores4, roi2, classes, batches1});
774 // Phase 4: set relaxed execution
775 model->relaxComputationFloat32toFloat16(true);
776 assert(model->isValid());
777 }
778
is_ignored_zero_sized_dynamic_output_shape_relaxed(int i)779 inline bool is_ignored_zero_sized_dynamic_output_shape_relaxed(int i) {
780 static std::set<int> ignore = {};
781 return ignore.find(i) != ignore.end();
782 }
783
CreateModel_zero_sized_dynamic_output_shape_float16(Model * model)784 void CreateModel_zero_sized_dynamic_output_shape_float16(Model *model) {
785 OperandType type0(Type::BOOL, {});
786 OperandType type17(Type::TENSOR_FLOAT16, {1, 4});
787 OperandType type18(Type::TENSOR_FLOAT16, {8});
788 OperandType type19(Type::TENSOR_FLOAT16, {2});
789 OperandType type20(Type::TENSOR_FLOAT16, {0, 8});
790 OperandType type21(Type::TENSOR_FLOAT16, {1, 1, 1, 4});
791 OperandType type22(Type::TENSOR_FLOAT16, {1, 1, 1, 1});
792 OperandType type23(Type::TENSOR_FLOAT16, {1, 2});
793 OperandType type24(Type::FLOAT16, {});
794 OperandType type25(Type::TENSOR_FLOAT16, {0, 4});
795 OperandType type27(Type::TENSOR_FLOAT16, {0, 2, 2, 1});
796 OperandType type28(Type::TENSOR_FLOAT16, {0, 2});
797 OperandType type29(Type::TENSOR_FLOAT16, {8, 4});
798 OperandType type30(Type::TENSOR_FLOAT16, {2, 4});
799 OperandType type46(Type::TENSOR_FLOAT16, {0});
800 OperandType type47(Type::TENSOR_FLOAT16, {0, 0});
801 OperandType type7(Type::TENSOR_INT32, {0});
802 OperandType type9(Type::INT32, {});
803 // Phase 1, operands
804 auto scores = model->addOperand(&type22);
805 auto deltas = model->addOperand(&type21);
806 auto anchors = model->addOperand(&type17);
807 auto imageInfo = model->addOperand(&type23);
808 auto param = model->addOperand(&type24);
809 auto param1 = model->addOperand(&type24);
810 auto param2 = model->addOperand(&type9);
811 auto param3 = model->addOperand(&type9);
812 auto param4 = model->addOperand(&type24);
813 auto param5 = model->addOperand(&type24);
814 auto layout = model->addOperand(&type0);
815 auto scores1 = model->addOperand(&type46);
816 auto roi = model->addOperand(&type25);
817 auto batches = model->addOperand(&type7);
818 auto featureMap = model->addOperand(&type22);
819 auto param6 = model->addOperand(&type9);
820 auto param7 = model->addOperand(&type9);
821 auto param8 = model->addOperand(&type24);
822 auto param9 = model->addOperand(&type24);
823 auto param10 = model->addOperand(&type9);
824 auto param11 = model->addOperand(&type9);
825 auto scores2 = model->addOperand(&type27);
826 auto weights = model->addOperand(&type29);
827 auto bias = model->addOperand(&type18);
828 auto param12 = model->addOperand(&type9);
829 auto delta = model->addOperand(&type20);
830 auto weights1 = model->addOperand(&type30);
831 auto bias1 = model->addOperand(&type19);
832 auto param13 = model->addOperand(&type9);
833 auto scores3 = model->addOperand(&type28);
834 auto roi1 = model->addOperand(&type20);
835 auto param14 = model->addOperand(&type24);
836 auto param15 = model->addOperand(&type9);
837 auto param16 = model->addOperand(&type9);
838 auto param17 = model->addOperand(&type24);
839 auto param18 = model->addOperand(&type24);
840 auto param19 = model->addOperand(&type24);
841 auto scores4 = model->addOperand(&type46);
842 auto roi2 = model->addOperand(&type47);
843 auto classes = model->addOperand(&type7);
844 auto batches1 = model->addOperand(&type7);
845 // Phase 2, operations
846 static _Float16 param_init[] = {1.0f};
847 model->setOperandValue(param, param_init, sizeof(_Float16) * 1);
848 static _Float16 param1_init[] = {1.0f};
849 model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
850 static int32_t param2_init[] = {-1};
851 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
852 static int32_t param3_init[] = {-1};
853 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
854 static _Float16 param4_init[] = {0.30000001192092896f};
855 model->setOperandValue(param4, param4_init, sizeof(_Float16) * 1);
856 static _Float16 param5_init[] = {10.0f};
857 model->setOperandValue(param5, param5_init, sizeof(_Float16) * 1);
858 static bool8 layout_init[] = {false};
859 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
860 static int32_t param6_init[] = {2};
861 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
862 static int32_t param7_init[] = {2};
863 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
864 static _Float16 param8_init[] = {1.0f};
865 model->setOperandValue(param8, param8_init, sizeof(_Float16) * 1);
866 static _Float16 param9_init[] = {1.0f};
867 model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
868 static int32_t param10_init[] = {4};
869 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
870 static int32_t param11_init[] = {4};
871 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
872 static _Float16 weights_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
873 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 32);
874 static _Float16 bias_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
875 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 8);
876 static int32_t param12_init[] = {0};
877 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
878 static _Float16 weights1_init[] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
879 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 8);
880 static _Float16 bias1_init[] = {1.0f, 1.0f};
881 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2);
882 static int32_t param13_init[] = {0};
883 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
884 static _Float16 param14_init[] = {0.10000000149011612f};
885 model->setOperandValue(param14, param14_init, sizeof(_Float16) * 1);
886 static int32_t param15_init[] = {-1};
887 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
888 static int32_t param16_init[] = {0};
889 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
890 static _Float16 param17_init[] = {0.30000001192092896f};
891 model->setOperandValue(param17, param17_init, sizeof(_Float16) * 1);
892 static _Float16 param18_init[] = {1.0f};
893 model->setOperandValue(param18, param18_init, sizeof(_Float16) * 1);
894 static _Float16 param19_init[] = {0.10000000149011612f};
895 model->setOperandValue(param19, param19_init, sizeof(_Float16) * 1);
896 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
897 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
898 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
899 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
900 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
901 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
902 // Phase 3, inputs and outputs
903 model->identifyInputsAndOutputs(
904 {scores, deltas, anchors, imageInfo, featureMap},
905 {scores1, scores4, roi2, classes, batches1});
906 assert(model->isValid());
907 }
908
is_ignored_zero_sized_dynamic_output_shape_float16(int i)909 inline bool is_ignored_zero_sized_dynamic_output_shape_float16(int i) {
910 static std::set<int> ignore = {};
911 return ignore.find(i) != ignore.end();
912 }
913
CreateModel_zero_sized_dynamic_output_shape_quant8(Model * model)914 void CreateModel_zero_sized_dynamic_output_shape_quant8(Model *model) {
915 OperandType type0(Type::BOOL, {});
916 OperandType type31(Type::TENSOR_QUANT16_SYMM, {1, 4}, 0.125f, 0);
917 OperandType type32(Type::TENSOR_INT32, {8}, 0.01f, 0);
918 OperandType type33(Type::TENSOR_INT32, {2}, 0.01f, 0);
919 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {0, 8}, 0.1f, 128);
920 OperandType type35(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 0.1f, 128);
921 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128);
922 OperandType type37(Type::TENSOR_QUANT16_ASYMM, {1, 2}, 0.125f, 0);
923 OperandType type38(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0);
924 OperandType type39(Type::TENSOR_QUANT16_ASYMM, {0, 8}, 0.125f, 0);
925 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128);
926 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128);
927 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {0, 2}, 0.1f, 128);
928 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {8, 4}, 0.1f, 128);
929 OperandType type44(Type::TENSOR_QUANT8_ASYMM, {2, 4}, 0.1f, 128);
930 OperandType type48(Type::TENSOR_QUANT16_ASYMM, {0, 0}, 0.125f, 0);
931 OperandType type7(Type::TENSOR_INT32, {0});
932 OperandType type8(Type::FLOAT32, {});
933 OperandType type9(Type::INT32, {});
934 // Phase 1, operands
935 auto scores = model->addOperand(&type36);
936 auto deltas = model->addOperand(&type35);
937 auto anchors = model->addOperand(&type31);
938 auto imageInfo = model->addOperand(&type37);
939 auto param = model->addOperand(&type8);
940 auto param1 = model->addOperand(&type8);
941 auto param2 = model->addOperand(&type9);
942 auto param3 = model->addOperand(&type9);
943 auto param4 = model->addOperand(&type8);
944 auto param5 = model->addOperand(&type8);
945 auto layout = model->addOperand(&type0);
946 auto scores1 = model->addOperand(&type40);
947 auto roi = model->addOperand(&type38);
948 auto batches = model->addOperand(&type7);
949 auto featureMap = model->addOperand(&type36);
950 auto param6 = model->addOperand(&type9);
951 auto param7 = model->addOperand(&type9);
952 auto param8 = model->addOperand(&type8);
953 auto param9 = model->addOperand(&type8);
954 auto param10 = model->addOperand(&type9);
955 auto param11 = model->addOperand(&type9);
956 auto scores2 = model->addOperand(&type41);
957 auto weights = model->addOperand(&type43);
958 auto bias = model->addOperand(&type32);
959 auto param12 = model->addOperand(&type9);
960 auto delta = model->addOperand(&type34);
961 auto weights1 = model->addOperand(&type44);
962 auto bias1 = model->addOperand(&type33);
963 auto param13 = model->addOperand(&type9);
964 auto scores3 = model->addOperand(&type42);
965 auto roi1 = model->addOperand(&type39);
966 auto param14 = model->addOperand(&type8);
967 auto param15 = model->addOperand(&type9);
968 auto param16 = model->addOperand(&type9);
969 auto param17 = model->addOperand(&type8);
970 auto param18 = model->addOperand(&type8);
971 auto param19 = model->addOperand(&type8);
972 auto scores4 = model->addOperand(&type40);
973 auto roi2 = model->addOperand(&type48);
974 auto classes = model->addOperand(&type7);
975 auto batches1 = model->addOperand(&type7);
976 // Phase 2, operations
977 static float param_init[] = {1.0f};
978 model->setOperandValue(param, param_init, sizeof(float) * 1);
979 static float param1_init[] = {1.0f};
980 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
981 static int32_t param2_init[] = {-1};
982 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
983 static int32_t param3_init[] = {-1};
984 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
985 static float param4_init[] = {0.3f};
986 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
987 static float param5_init[] = {10.0f};
988 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
989 static bool8 layout_init[] = {false};
990 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
991 static int32_t param6_init[] = {2};
992 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
993 static int32_t param7_init[] = {2};
994 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
995 static float param8_init[] = {1.0f};
996 model->setOperandValue(param8, param8_init, sizeof(float) * 1);
997 static float param9_init[] = {1.0f};
998 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
999 static int32_t param10_init[] = {4};
1000 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
1001 static int32_t param11_init[] = {4};
1002 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1003 static uint8_t weights_init[] = {138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138};
1004 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 32);
1005 static int32_t bias_init[] = {100, 100, 100, 100, 100, 100, 100, 100};
1006 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 8);
1007 static int32_t param12_init[] = {0};
1008 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1009 static uint8_t weights1_init[] = {138, 138, 138, 138, 138, 138, 138, 138};
1010 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 8);
1011 static int32_t bias1_init[] = {100, 100};
1012 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2);
1013 static int32_t param13_init[] = {0};
1014 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
1015 static float param14_init[] = {0.1f};
1016 model->setOperandValue(param14, param14_init, sizeof(float) * 1);
1017 static int32_t param15_init[] = {-1};
1018 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
1019 static int32_t param16_init[] = {0};
1020 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
1021 static float param17_init[] = {0.3f};
1022 model->setOperandValue(param17, param17_init, sizeof(float) * 1);
1023 static float param18_init[] = {1.0f};
1024 model->setOperandValue(param18, param18_init, sizeof(float) * 1);
1025 static float param19_init[] = {0.1f};
1026 model->setOperandValue(param19, param19_init, sizeof(float) * 1);
1027 model->addOperation(ANEURALNETWORKS_GENERATE_PROPOSALS, {scores, deltas, anchors, imageInfo, param, param1, param2, param3, param4, param5, layout}, {scores1, roi, batches});
1028 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {featureMap, roi, batches, param6, param7, param8, param9, param10, param11, layout}, {scores2});
1029 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights, bias, param12}, {delta});
1030 model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {scores2, weights1, bias1, param13}, {scores3});
1031 model->addOperation(ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM, {roi, delta, batches, imageInfo}, {roi1});
1032 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores3, roi1, batches, param14, param15, param16, param17, param18, param19}, {scores4, roi2, classes, batches1});
1033 // Phase 3, inputs and outputs
1034 model->identifyInputsAndOutputs(
1035 {scores, deltas, anchors, imageInfo, featureMap},
1036 {scores1, scores4, roi2, classes, batches1});
1037 assert(model->isValid());
1038 }
1039
is_ignored_zero_sized_dynamic_output_shape_quant8(int i)1040 inline bool is_ignored_zero_sized_dynamic_output_shape_quant8(int i) {
1041 static std::set<int> ignore = {};
1042 return ignore.find(i) != ignore.end();
1043 }
1044
1045