1 // clang-format off
2 // Generated file (from: slice.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {4});
5 OperandType type1(Type::TENSOR_INT32, {1});
6 OperandType type2(Type::TENSOR_FLOAT32, {2});
7 // Phase 1, operands
8 auto input = model->addOperand(&type0);
9 auto begin = model->addOperand(&type1);
10 auto size = model->addOperand(&type1);
11 auto output = model->addOperand(&type2);
12 // Phase 2, operations
13 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
14 // Phase 3, inputs and outputs
15 model->identifyInputsAndOutputs(
16 {input, begin, size},
17 {output});
18 assert(model->isValid());
19 }
20
is_ignored(int i)21 inline bool is_ignored(int i) {
22 static std::set<int> ignore = {};
23 return ignore.find(i) != ignore.end();
24 }
25
CreateModel_relaxed(Model * model)26 void CreateModel_relaxed(Model *model) {
27 OperandType type0(Type::TENSOR_FLOAT32, {4});
28 OperandType type1(Type::TENSOR_INT32, {1});
29 OperandType type2(Type::TENSOR_FLOAT32, {2});
30 // Phase 1, operands
31 auto input = model->addOperand(&type0);
32 auto begin = model->addOperand(&type1);
33 auto size = model->addOperand(&type1);
34 auto output = model->addOperand(&type2);
35 // Phase 2, operations
36 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
37 // Phase 3, inputs and outputs
38 model->identifyInputsAndOutputs(
39 {input, begin, size},
40 {output});
41 // Phase 4: set relaxed execution
42 model->relaxComputationFloat32toFloat16(true);
43 assert(model->isValid());
44 }
45
is_ignored_relaxed(int i)46 inline bool is_ignored_relaxed(int i) {
47 static std::set<int> ignore = {};
48 return ignore.find(i) != ignore.end();
49 }
50
CreateModel_float16(Model * model)51 void CreateModel_float16(Model *model) {
52 OperandType type1(Type::TENSOR_INT32, {1});
53 OperandType type28(Type::TENSOR_FLOAT16, {4});
54 OperandType type29(Type::TENSOR_FLOAT16, {2});
55 // Phase 1, operands
56 auto input = model->addOperand(&type28);
57 auto begin = model->addOperand(&type1);
58 auto size = model->addOperand(&type1);
59 auto output = model->addOperand(&type29);
60 // Phase 2, operations
61 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
62 // Phase 3, inputs and outputs
63 model->identifyInputsAndOutputs(
64 {input, begin, size},
65 {output});
66 assert(model->isValid());
67 }
68
is_ignored_float16(int i)69 inline bool is_ignored_float16(int i) {
70 static std::set<int> ignore = {};
71 return ignore.find(i) != ignore.end();
72 }
73
CreateModel_dynamic_output_shape(Model * model)74 void CreateModel_dynamic_output_shape(Model *model) {
75 OperandType type0(Type::TENSOR_FLOAT32, {4});
76 OperandType type1(Type::TENSOR_INT32, {1});
77 OperandType type17(Type::TENSOR_FLOAT32, {0});
78 // Phase 1, operands
79 auto input = model->addOperand(&type0);
80 auto begin = model->addOperand(&type1);
81 auto size = model->addOperand(&type1);
82 auto output = model->addOperand(&type17);
83 // Phase 2, operations
84 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
85 // Phase 3, inputs and outputs
86 model->identifyInputsAndOutputs(
87 {input, begin, size},
88 {output});
89 assert(model->isValid());
90 }
91
is_ignored_dynamic_output_shape(int i)92 inline bool is_ignored_dynamic_output_shape(int i) {
93 static std::set<int> ignore = {};
94 return ignore.find(i) != ignore.end();
95 }
96
CreateModel_dynamic_output_shape_relaxed(Model * model)97 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
98 OperandType type0(Type::TENSOR_FLOAT32, {4});
99 OperandType type1(Type::TENSOR_INT32, {1});
100 OperandType type17(Type::TENSOR_FLOAT32, {0});
101 // Phase 1, operands
102 auto input = model->addOperand(&type0);
103 auto begin = model->addOperand(&type1);
104 auto size = model->addOperand(&type1);
105 auto output = model->addOperand(&type17);
106 // Phase 2, operations
107 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
108 // Phase 3, inputs and outputs
109 model->identifyInputsAndOutputs(
110 {input, begin, size},
111 {output});
112 // Phase 4: set relaxed execution
113 model->relaxComputationFloat32toFloat16(true);
114 assert(model->isValid());
115 }
116
is_ignored_dynamic_output_shape_relaxed(int i)117 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
118 static std::set<int> ignore = {};
119 return ignore.find(i) != ignore.end();
120 }
121
CreateModel_dynamic_output_shape_float16(Model * model)122 void CreateModel_dynamic_output_shape_float16(Model *model) {
123 OperandType type1(Type::TENSOR_INT32, {1});
124 OperandType type28(Type::TENSOR_FLOAT16, {4});
125 OperandType type30(Type::TENSOR_FLOAT16, {0});
126 // Phase 1, operands
127 auto input = model->addOperand(&type28);
128 auto begin = model->addOperand(&type1);
129 auto size = model->addOperand(&type1);
130 auto output = model->addOperand(&type30);
131 // Phase 2, operations
132 model->addOperation(ANEURALNETWORKS_SLICE, {input, begin, size}, {output});
133 // Phase 3, inputs and outputs
134 model->identifyInputsAndOutputs(
135 {input, begin, size},
136 {output});
137 assert(model->isValid());
138 }
139
is_ignored_dynamic_output_shape_float16(int i)140 inline bool is_ignored_dynamic_output_shape_float16(int i) {
141 static std::set<int> ignore = {};
142 return ignore.find(i) != ignore.end();
143 }
144
CreateModel_2(Model * model)145 void CreateModel_2(Model *model) {
146 OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
147 OperandType type4(Type::TENSOR_INT32, {2});
148 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
149 // Phase 1, operands
150 auto input1 = model->addOperand(&type3);
151 auto begin1 = model->addOperand(&type4);
152 auto size1 = model->addOperand(&type4);
153 auto output1 = model->addOperand(&type5);
154 // Phase 2, operations
155 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
156 // Phase 3, inputs and outputs
157 model->identifyInputsAndOutputs(
158 {input1, begin1, size1},
159 {output1});
160 assert(model->isValid());
161 }
162
is_ignored_2(int i)163 inline bool is_ignored_2(int i) {
164 static std::set<int> ignore = {};
165 return ignore.find(i) != ignore.end();
166 }
167
CreateModel_relaxed_2(Model * model)168 void CreateModel_relaxed_2(Model *model) {
169 OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
170 OperandType type4(Type::TENSOR_INT32, {2});
171 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
172 // Phase 1, operands
173 auto input1 = model->addOperand(&type3);
174 auto begin1 = model->addOperand(&type4);
175 auto size1 = model->addOperand(&type4);
176 auto output1 = model->addOperand(&type5);
177 // Phase 2, operations
178 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
179 // Phase 3, inputs and outputs
180 model->identifyInputsAndOutputs(
181 {input1, begin1, size1},
182 {output1});
183 // Phase 4: set relaxed execution
184 model->relaxComputationFloat32toFloat16(true);
185 assert(model->isValid());
186 }
187
is_ignored_relaxed_2(int i)188 inline bool is_ignored_relaxed_2(int i) {
189 static std::set<int> ignore = {};
190 return ignore.find(i) != ignore.end();
191 }
192
CreateModel_float16_2(Model * model)193 void CreateModel_float16_2(Model *model) {
194 OperandType type31(Type::TENSOR_FLOAT16, {2, 3});
195 OperandType type32(Type::TENSOR_FLOAT16, {1, 2});
196 OperandType type4(Type::TENSOR_INT32, {2});
197 // Phase 1, operands
198 auto input1 = model->addOperand(&type31);
199 auto begin1 = model->addOperand(&type4);
200 auto size1 = model->addOperand(&type4);
201 auto output1 = model->addOperand(&type32);
202 // Phase 2, operations
203 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
204 // Phase 3, inputs and outputs
205 model->identifyInputsAndOutputs(
206 {input1, begin1, size1},
207 {output1});
208 assert(model->isValid());
209 }
210
is_ignored_float16_2(int i)211 inline bool is_ignored_float16_2(int i) {
212 static std::set<int> ignore = {};
213 return ignore.find(i) != ignore.end();
214 }
215
CreateModel_dynamic_output_shape_2(Model * model)216 void CreateModel_dynamic_output_shape_2(Model *model) {
217 OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
218 OperandType type33(Type::TENSOR_FLOAT32, {0, 0});
219 OperandType type4(Type::TENSOR_INT32, {2});
220 // Phase 1, operands
221 auto input1 = model->addOperand(&type3);
222 auto begin1 = model->addOperand(&type4);
223 auto size1 = model->addOperand(&type4);
224 auto output1 = model->addOperand(&type33);
225 // Phase 2, operations
226 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
227 // Phase 3, inputs and outputs
228 model->identifyInputsAndOutputs(
229 {input1, begin1, size1},
230 {output1});
231 assert(model->isValid());
232 }
233
is_ignored_dynamic_output_shape_2(int i)234 inline bool is_ignored_dynamic_output_shape_2(int i) {
235 static std::set<int> ignore = {};
236 return ignore.find(i) != ignore.end();
237 }
238
CreateModel_dynamic_output_shape_relaxed_2(Model * model)239 void CreateModel_dynamic_output_shape_relaxed_2(Model *model) {
240 OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
241 OperandType type33(Type::TENSOR_FLOAT32, {0, 0});
242 OperandType type4(Type::TENSOR_INT32, {2});
243 // Phase 1, operands
244 auto input1 = model->addOperand(&type3);
245 auto begin1 = model->addOperand(&type4);
246 auto size1 = model->addOperand(&type4);
247 auto output1 = model->addOperand(&type33);
248 // Phase 2, operations
249 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
250 // Phase 3, inputs and outputs
251 model->identifyInputsAndOutputs(
252 {input1, begin1, size1},
253 {output1});
254 // Phase 4: set relaxed execution
255 model->relaxComputationFloat32toFloat16(true);
256 assert(model->isValid());
257 }
258
is_ignored_dynamic_output_shape_relaxed_2(int i)259 inline bool is_ignored_dynamic_output_shape_relaxed_2(int i) {
260 static std::set<int> ignore = {};
261 return ignore.find(i) != ignore.end();
262 }
263
CreateModel_dynamic_output_shape_float16_2(Model * model)264 void CreateModel_dynamic_output_shape_float16_2(Model *model) {
265 OperandType type31(Type::TENSOR_FLOAT16, {2, 3});
266 OperandType type34(Type::TENSOR_FLOAT16, {0, 0});
267 OperandType type4(Type::TENSOR_INT32, {2});
268 // Phase 1, operands
269 auto input1 = model->addOperand(&type31);
270 auto begin1 = model->addOperand(&type4);
271 auto size1 = model->addOperand(&type4);
272 auto output1 = model->addOperand(&type34);
273 // Phase 2, operations
274 model->addOperation(ANEURALNETWORKS_SLICE, {input1, begin1, size1}, {output1});
275 // Phase 3, inputs and outputs
276 model->identifyInputsAndOutputs(
277 {input1, begin1, size1},
278 {output1});
279 assert(model->isValid());
280 }
281
is_ignored_dynamic_output_shape_float16_2(int i)282 inline bool is_ignored_dynamic_output_shape_float16_2(int i) {
283 static std::set<int> ignore = {};
284 return ignore.find(i) != ignore.end();
285 }
286
CreateModel_3(Model * model)287 void CreateModel_3(Model *model) {
288 OperandType type6(Type::TENSOR_FLOAT32, {2, 3, 2});
289 OperandType type7(Type::TENSOR_INT32, {3});
290 // Phase 1, operands
291 auto input2 = model->addOperand(&type6);
292 auto begin2 = model->addOperand(&type7);
293 auto size2 = model->addOperand(&type7);
294 auto output2 = model->addOperand(&type6);
295 // Phase 2, operations
296 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
297 // Phase 3, inputs and outputs
298 model->identifyInputsAndOutputs(
299 {input2, begin2, size2},
300 {output2});
301 assert(model->isValid());
302 }
303
is_ignored_3(int i)304 inline bool is_ignored_3(int i) {
305 static std::set<int> ignore = {};
306 return ignore.find(i) != ignore.end();
307 }
308
CreateModel_relaxed_3(Model * model)309 void CreateModel_relaxed_3(Model *model) {
310 OperandType type6(Type::TENSOR_FLOAT32, {2, 3, 2});
311 OperandType type7(Type::TENSOR_INT32, {3});
312 // Phase 1, operands
313 auto input2 = model->addOperand(&type6);
314 auto begin2 = model->addOperand(&type7);
315 auto size2 = model->addOperand(&type7);
316 auto output2 = model->addOperand(&type6);
317 // Phase 2, operations
318 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
319 // Phase 3, inputs and outputs
320 model->identifyInputsAndOutputs(
321 {input2, begin2, size2},
322 {output2});
323 // Phase 4: set relaxed execution
324 model->relaxComputationFloat32toFloat16(true);
325 assert(model->isValid());
326 }
327
is_ignored_relaxed_3(int i)328 inline bool is_ignored_relaxed_3(int i) {
329 static std::set<int> ignore = {};
330 return ignore.find(i) != ignore.end();
331 }
332
CreateModel_float16_3(Model * model)333 void CreateModel_float16_3(Model *model) {
334 OperandType type35(Type::TENSOR_FLOAT16, {2, 3, 2});
335 OperandType type7(Type::TENSOR_INT32, {3});
336 // Phase 1, operands
337 auto input2 = model->addOperand(&type35);
338 auto begin2 = model->addOperand(&type7);
339 auto size2 = model->addOperand(&type7);
340 auto output2 = model->addOperand(&type35);
341 // Phase 2, operations
342 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
343 // Phase 3, inputs and outputs
344 model->identifyInputsAndOutputs(
345 {input2, begin2, size2},
346 {output2});
347 assert(model->isValid());
348 }
349
is_ignored_float16_3(int i)350 inline bool is_ignored_float16_3(int i) {
351 static std::set<int> ignore = {};
352 return ignore.find(i) != ignore.end();
353 }
354
CreateModel_dynamic_output_shape_3(Model * model)355 void CreateModel_dynamic_output_shape_3(Model *model) {
356 OperandType type36(Type::TENSOR_FLOAT32, {0, 0, 0});
357 OperandType type6(Type::TENSOR_FLOAT32, {2, 3, 2});
358 OperandType type7(Type::TENSOR_INT32, {3});
359 // Phase 1, operands
360 auto input2 = model->addOperand(&type6);
361 auto begin2 = model->addOperand(&type7);
362 auto size2 = model->addOperand(&type7);
363 auto output2 = model->addOperand(&type36);
364 // Phase 2, operations
365 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
366 // Phase 3, inputs and outputs
367 model->identifyInputsAndOutputs(
368 {input2, begin2, size2},
369 {output2});
370 assert(model->isValid());
371 }
372
is_ignored_dynamic_output_shape_3(int i)373 inline bool is_ignored_dynamic_output_shape_3(int i) {
374 static std::set<int> ignore = {};
375 return ignore.find(i) != ignore.end();
376 }
377
CreateModel_dynamic_output_shape_relaxed_3(Model * model)378 void CreateModel_dynamic_output_shape_relaxed_3(Model *model) {
379 OperandType type36(Type::TENSOR_FLOAT32, {0, 0, 0});
380 OperandType type6(Type::TENSOR_FLOAT32, {2, 3, 2});
381 OperandType type7(Type::TENSOR_INT32, {3});
382 // Phase 1, operands
383 auto input2 = model->addOperand(&type6);
384 auto begin2 = model->addOperand(&type7);
385 auto size2 = model->addOperand(&type7);
386 auto output2 = model->addOperand(&type36);
387 // Phase 2, operations
388 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
389 // Phase 3, inputs and outputs
390 model->identifyInputsAndOutputs(
391 {input2, begin2, size2},
392 {output2});
393 // Phase 4: set relaxed execution
394 model->relaxComputationFloat32toFloat16(true);
395 assert(model->isValid());
396 }
397
is_ignored_dynamic_output_shape_relaxed_3(int i)398 inline bool is_ignored_dynamic_output_shape_relaxed_3(int i) {
399 static std::set<int> ignore = {};
400 return ignore.find(i) != ignore.end();
401 }
402
CreateModel_dynamic_output_shape_float16_3(Model * model)403 void CreateModel_dynamic_output_shape_float16_3(Model *model) {
404 OperandType type35(Type::TENSOR_FLOAT16, {2, 3, 2});
405 OperandType type37(Type::TENSOR_FLOAT16, {0, 0, 0});
406 OperandType type7(Type::TENSOR_INT32, {3});
407 // Phase 1, operands
408 auto input2 = model->addOperand(&type35);
409 auto begin2 = model->addOperand(&type7);
410 auto size2 = model->addOperand(&type7);
411 auto output2 = model->addOperand(&type37);
412 // Phase 2, operations
413 model->addOperation(ANEURALNETWORKS_SLICE, {input2, begin2, size2}, {output2});
414 // Phase 3, inputs and outputs
415 model->identifyInputsAndOutputs(
416 {input2, begin2, size2},
417 {output2});
418 assert(model->isValid());
419 }
420
is_ignored_dynamic_output_shape_float16_3(int i)421 inline bool is_ignored_dynamic_output_shape_float16_3(int i) {
422 static std::set<int> ignore = {};
423 return ignore.find(i) != ignore.end();
424 }
425
CreateModel_4(Model * model)426 void CreateModel_4(Model *model) {
427 OperandType type10(Type::TENSOR_FLOAT32, {3, 1, 1, 1});
428 OperandType type8(Type::TENSOR_FLOAT32, {4, 1, 1, 1});
429 OperandType type9(Type::TENSOR_INT32, {4});
430 // Phase 1, operands
431 auto input3 = model->addOperand(&type8);
432 auto begin3 = model->addOperand(&type9);
433 auto size3 = model->addOperand(&type9);
434 auto output3 = model->addOperand(&type10);
435 // Phase 2, operations
436 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
437 // Phase 3, inputs and outputs
438 model->identifyInputsAndOutputs(
439 {input3, begin3, size3},
440 {output3});
441 assert(model->isValid());
442 }
443
is_ignored_4(int i)444 inline bool is_ignored_4(int i) {
445 static std::set<int> ignore = {};
446 return ignore.find(i) != ignore.end();
447 }
448
CreateModel_relaxed_4(Model * model)449 void CreateModel_relaxed_4(Model *model) {
450 OperandType type10(Type::TENSOR_FLOAT32, {3, 1, 1, 1});
451 OperandType type8(Type::TENSOR_FLOAT32, {4, 1, 1, 1});
452 OperandType type9(Type::TENSOR_INT32, {4});
453 // Phase 1, operands
454 auto input3 = model->addOperand(&type8);
455 auto begin3 = model->addOperand(&type9);
456 auto size3 = model->addOperand(&type9);
457 auto output3 = model->addOperand(&type10);
458 // Phase 2, operations
459 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
460 // Phase 3, inputs and outputs
461 model->identifyInputsAndOutputs(
462 {input3, begin3, size3},
463 {output3});
464 // Phase 4: set relaxed execution
465 model->relaxComputationFloat32toFloat16(true);
466 assert(model->isValid());
467 }
468
is_ignored_relaxed_4(int i)469 inline bool is_ignored_relaxed_4(int i) {
470 static std::set<int> ignore = {};
471 return ignore.find(i) != ignore.end();
472 }
473
CreateModel_float16_4(Model * model)474 void CreateModel_float16_4(Model *model) {
475 OperandType type38(Type::TENSOR_FLOAT16, {4, 1, 1, 1});
476 OperandType type39(Type::TENSOR_FLOAT16, {3, 1, 1, 1});
477 OperandType type9(Type::TENSOR_INT32, {4});
478 // Phase 1, operands
479 auto input3 = model->addOperand(&type38);
480 auto begin3 = model->addOperand(&type9);
481 auto size3 = model->addOperand(&type9);
482 auto output3 = model->addOperand(&type39);
483 // Phase 2, operations
484 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
485 // Phase 3, inputs and outputs
486 model->identifyInputsAndOutputs(
487 {input3, begin3, size3},
488 {output3});
489 assert(model->isValid());
490 }
491
is_ignored_float16_4(int i)492 inline bool is_ignored_float16_4(int i) {
493 static std::set<int> ignore = {};
494 return ignore.find(i) != ignore.end();
495 }
496
CreateModel_dynamic_output_shape_4(Model * model)497 void CreateModel_dynamic_output_shape_4(Model *model) {
498 OperandType type40(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
499 OperandType type8(Type::TENSOR_FLOAT32, {4, 1, 1, 1});
500 OperandType type9(Type::TENSOR_INT32, {4});
501 // Phase 1, operands
502 auto input3 = model->addOperand(&type8);
503 auto begin3 = model->addOperand(&type9);
504 auto size3 = model->addOperand(&type9);
505 auto output3 = model->addOperand(&type40);
506 // Phase 2, operations
507 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
508 // Phase 3, inputs and outputs
509 model->identifyInputsAndOutputs(
510 {input3, begin3, size3},
511 {output3});
512 assert(model->isValid());
513 }
514
is_ignored_dynamic_output_shape_4(int i)515 inline bool is_ignored_dynamic_output_shape_4(int i) {
516 static std::set<int> ignore = {};
517 return ignore.find(i) != ignore.end();
518 }
519
CreateModel_dynamic_output_shape_relaxed_4(Model * model)520 void CreateModel_dynamic_output_shape_relaxed_4(Model *model) {
521 OperandType type40(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
522 OperandType type8(Type::TENSOR_FLOAT32, {4, 1, 1, 1});
523 OperandType type9(Type::TENSOR_INT32, {4});
524 // Phase 1, operands
525 auto input3 = model->addOperand(&type8);
526 auto begin3 = model->addOperand(&type9);
527 auto size3 = model->addOperand(&type9);
528 auto output3 = model->addOperand(&type40);
529 // Phase 2, operations
530 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
531 // Phase 3, inputs and outputs
532 model->identifyInputsAndOutputs(
533 {input3, begin3, size3},
534 {output3});
535 // Phase 4: set relaxed execution
536 model->relaxComputationFloat32toFloat16(true);
537 assert(model->isValid());
538 }
539
is_ignored_dynamic_output_shape_relaxed_4(int i)540 inline bool is_ignored_dynamic_output_shape_relaxed_4(int i) {
541 static std::set<int> ignore = {};
542 return ignore.find(i) != ignore.end();
543 }
544
CreateModel_dynamic_output_shape_float16_4(Model * model)545 void CreateModel_dynamic_output_shape_float16_4(Model *model) {
546 OperandType type38(Type::TENSOR_FLOAT16, {4, 1, 1, 1});
547 OperandType type41(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
548 OperandType type9(Type::TENSOR_INT32, {4});
549 // Phase 1, operands
550 auto input3 = model->addOperand(&type38);
551 auto begin3 = model->addOperand(&type9);
552 auto size3 = model->addOperand(&type9);
553 auto output3 = model->addOperand(&type41);
554 // Phase 2, operations
555 model->addOperation(ANEURALNETWORKS_SLICE, {input3, begin3, size3}, {output3});
556 // Phase 3, inputs and outputs
557 model->identifyInputsAndOutputs(
558 {input3, begin3, size3},
559 {output3});
560 assert(model->isValid());
561 }
562
is_ignored_dynamic_output_shape_float16_4(int i)563 inline bool is_ignored_dynamic_output_shape_float16_4(int i) {
564 static std::set<int> ignore = {};
565 return ignore.find(i) != ignore.end();
566 }
567
CreateModel_5(Model * model)568 void CreateModel_5(Model *model) {
569 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
570 OperandType type12(Type::TENSOR_INT32, {1, 1, 3, 1});
571 OperandType type9(Type::TENSOR_INT32, {4});
572 // Phase 1, operands
573 auto input4 = model->addOperand(&type11);
574 auto begin4 = model->addOperand(&type9);
575 auto size4 = model->addOperand(&type9);
576 auto output4 = model->addOperand(&type12);
577 // Phase 2, operations
578 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
579 // Phase 3, inputs and outputs
580 model->identifyInputsAndOutputs(
581 {input4, begin4, size4},
582 {output4});
583 assert(model->isValid());
584 }
585
is_ignored_5(int i)586 inline bool is_ignored_5(int i) {
587 static std::set<int> ignore = {};
588 return ignore.find(i) != ignore.end();
589 }
590
CreateModel_relaxed_5(Model * model)591 void CreateModel_relaxed_5(Model *model) {
592 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
593 OperandType type12(Type::TENSOR_INT32, {1, 1, 3, 1});
594 OperandType type9(Type::TENSOR_INT32, {4});
595 // Phase 1, operands
596 auto input4 = model->addOperand(&type11);
597 auto begin4 = model->addOperand(&type9);
598 auto size4 = model->addOperand(&type9);
599 auto output4 = model->addOperand(&type12);
600 // Phase 2, operations
601 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
602 // Phase 3, inputs and outputs
603 model->identifyInputsAndOutputs(
604 {input4, begin4, size4},
605 {output4});
606 // Phase 4: set relaxed execution
607 model->relaxComputationFloat32toFloat16(true);
608 assert(model->isValid());
609 }
610
is_ignored_relaxed_5(int i)611 inline bool is_ignored_relaxed_5(int i) {
612 static std::set<int> ignore = {};
613 return ignore.find(i) != ignore.end();
614 }
615
CreateModel_float16_5(Model * model)616 void CreateModel_float16_5(Model *model) {
617 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
618 OperandType type12(Type::TENSOR_INT32, {1, 1, 3, 1});
619 OperandType type9(Type::TENSOR_INT32, {4});
620 // Phase 1, operands
621 auto input4 = model->addOperand(&type11);
622 auto begin4 = model->addOperand(&type9);
623 auto size4 = model->addOperand(&type9);
624 auto output4 = model->addOperand(&type12);
625 // Phase 2, operations
626 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
627 // Phase 3, inputs and outputs
628 model->identifyInputsAndOutputs(
629 {input4, begin4, size4},
630 {output4});
631 assert(model->isValid());
632 }
633
is_ignored_float16_5(int i)634 inline bool is_ignored_float16_5(int i) {
635 static std::set<int> ignore = {};
636 return ignore.find(i) != ignore.end();
637 }
638
CreateModel_dynamic_output_shape_5(Model * model)639 void CreateModel_dynamic_output_shape_5(Model *model) {
640 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
641 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
642 OperandType type9(Type::TENSOR_INT32, {4});
643 // Phase 1, operands
644 auto input4 = model->addOperand(&type11);
645 auto begin4 = model->addOperand(&type9);
646 auto size4 = model->addOperand(&type9);
647 auto output4 = model->addOperand(&type42);
648 // Phase 2, operations
649 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
650 // Phase 3, inputs and outputs
651 model->identifyInputsAndOutputs(
652 {input4, begin4, size4},
653 {output4});
654 assert(model->isValid());
655 }
656
is_ignored_dynamic_output_shape_5(int i)657 inline bool is_ignored_dynamic_output_shape_5(int i) {
658 static std::set<int> ignore = {};
659 return ignore.find(i) != ignore.end();
660 }
661
CreateModel_dynamic_output_shape_relaxed_5(Model * model)662 void CreateModel_dynamic_output_shape_relaxed_5(Model *model) {
663 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
664 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
665 OperandType type9(Type::TENSOR_INT32, {4});
666 // Phase 1, operands
667 auto input4 = model->addOperand(&type11);
668 auto begin4 = model->addOperand(&type9);
669 auto size4 = model->addOperand(&type9);
670 auto output4 = model->addOperand(&type42);
671 // Phase 2, operations
672 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
673 // Phase 3, inputs and outputs
674 model->identifyInputsAndOutputs(
675 {input4, begin4, size4},
676 {output4});
677 // Phase 4: set relaxed execution
678 model->relaxComputationFloat32toFloat16(true);
679 assert(model->isValid());
680 }
681
is_ignored_dynamic_output_shape_relaxed_5(int i)682 inline bool is_ignored_dynamic_output_shape_relaxed_5(int i) {
683 static std::set<int> ignore = {};
684 return ignore.find(i) != ignore.end();
685 }
686
CreateModel_dynamic_output_shape_float16_5(Model * model)687 void CreateModel_dynamic_output_shape_float16_5(Model *model) {
688 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
689 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
690 OperandType type9(Type::TENSOR_INT32, {4});
691 // Phase 1, operands
692 auto input4 = model->addOperand(&type11);
693 auto begin4 = model->addOperand(&type9);
694 auto size4 = model->addOperand(&type9);
695 auto output4 = model->addOperand(&type42);
696 // Phase 2, operations
697 model->addOperation(ANEURALNETWORKS_SLICE, {input4, begin4, size4}, {output4});
698 // Phase 3, inputs and outputs
699 model->identifyInputsAndOutputs(
700 {input4, begin4, size4},
701 {output4});
702 assert(model->isValid());
703 }
704
is_ignored_dynamic_output_shape_float16_5(int i)705 inline bool is_ignored_dynamic_output_shape_float16_5(int i) {
706 static std::set<int> ignore = {};
707 return ignore.find(i) != ignore.end();
708 }
709
CreateModel_6(Model * model)710 void CreateModel_6(Model *model) {
711 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
712 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
713 OperandType type9(Type::TENSOR_INT32, {4});
714 // Phase 1, operands
715 auto input5 = model->addOperand(&type11);
716 auto begin5 = model->addOperand(&type9);
717 auto size5 = model->addOperand(&type9);
718 auto output5 = model->addOperand(&type13);
719 // Phase 2, operations
720 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
721 // Phase 3, inputs and outputs
722 model->identifyInputsAndOutputs(
723 {input5, begin5, size5},
724 {output5});
725 assert(model->isValid());
726 }
727
is_ignored_6(int i)728 inline bool is_ignored_6(int i) {
729 static std::set<int> ignore = {};
730 return ignore.find(i) != ignore.end();
731 }
732
CreateModel_relaxed_6(Model * model)733 void CreateModel_relaxed_6(Model *model) {
734 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
735 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
736 OperandType type9(Type::TENSOR_INT32, {4});
737 // Phase 1, operands
738 auto input5 = model->addOperand(&type11);
739 auto begin5 = model->addOperand(&type9);
740 auto size5 = model->addOperand(&type9);
741 auto output5 = model->addOperand(&type13);
742 // Phase 2, operations
743 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
744 // Phase 3, inputs and outputs
745 model->identifyInputsAndOutputs(
746 {input5, begin5, size5},
747 {output5});
748 // Phase 4: set relaxed execution
749 model->relaxComputationFloat32toFloat16(true);
750 assert(model->isValid());
751 }
752
is_ignored_relaxed_6(int i)753 inline bool is_ignored_relaxed_6(int i) {
754 static std::set<int> ignore = {};
755 return ignore.find(i) != ignore.end();
756 }
757
CreateModel_float16_6(Model * model)758 void CreateModel_float16_6(Model *model) {
759 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
760 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
761 OperandType type9(Type::TENSOR_INT32, {4});
762 // Phase 1, operands
763 auto input5 = model->addOperand(&type11);
764 auto begin5 = model->addOperand(&type9);
765 auto size5 = model->addOperand(&type9);
766 auto output5 = model->addOperand(&type13);
767 // Phase 2, operations
768 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
769 // Phase 3, inputs and outputs
770 model->identifyInputsAndOutputs(
771 {input5, begin5, size5},
772 {output5});
773 assert(model->isValid());
774 }
775
is_ignored_float16_6(int i)776 inline bool is_ignored_float16_6(int i) {
777 static std::set<int> ignore = {};
778 return ignore.find(i) != ignore.end();
779 }
780
CreateModel_dynamic_output_shape_6(Model * model)781 void CreateModel_dynamic_output_shape_6(Model *model) {
782 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
783 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
784 OperandType type9(Type::TENSOR_INT32, {4});
785 // Phase 1, operands
786 auto input5 = model->addOperand(&type11);
787 auto begin5 = model->addOperand(&type9);
788 auto size5 = model->addOperand(&type9);
789 auto output5 = model->addOperand(&type42);
790 // Phase 2, operations
791 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
792 // Phase 3, inputs and outputs
793 model->identifyInputsAndOutputs(
794 {input5, begin5, size5},
795 {output5});
796 assert(model->isValid());
797 }
798
is_ignored_dynamic_output_shape_6(int i)799 inline bool is_ignored_dynamic_output_shape_6(int i) {
800 static std::set<int> ignore = {};
801 return ignore.find(i) != ignore.end();
802 }
803
CreateModel_dynamic_output_shape_relaxed_6(Model * model)804 void CreateModel_dynamic_output_shape_relaxed_6(Model *model) {
805 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
806 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
807 OperandType type9(Type::TENSOR_INT32, {4});
808 // Phase 1, operands
809 auto input5 = model->addOperand(&type11);
810 auto begin5 = model->addOperand(&type9);
811 auto size5 = model->addOperand(&type9);
812 auto output5 = model->addOperand(&type42);
813 // Phase 2, operations
814 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
815 // Phase 3, inputs and outputs
816 model->identifyInputsAndOutputs(
817 {input5, begin5, size5},
818 {output5});
819 // Phase 4: set relaxed execution
820 model->relaxComputationFloat32toFloat16(true);
821 assert(model->isValid());
822 }
823
is_ignored_dynamic_output_shape_relaxed_6(int i)824 inline bool is_ignored_dynamic_output_shape_relaxed_6(int i) {
825 static std::set<int> ignore = {};
826 return ignore.find(i) != ignore.end();
827 }
828
CreateModel_dynamic_output_shape_float16_6(Model * model)829 void CreateModel_dynamic_output_shape_float16_6(Model *model) {
830 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
831 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
832 OperandType type9(Type::TENSOR_INT32, {4});
833 // Phase 1, operands
834 auto input5 = model->addOperand(&type11);
835 auto begin5 = model->addOperand(&type9);
836 auto size5 = model->addOperand(&type9);
837 auto output5 = model->addOperand(&type42);
838 // Phase 2, operations
839 model->addOperation(ANEURALNETWORKS_SLICE, {input5, begin5, size5}, {output5});
840 // Phase 3, inputs and outputs
841 model->identifyInputsAndOutputs(
842 {input5, begin5, size5},
843 {output5});
844 assert(model->isValid());
845 }
846
is_ignored_dynamic_output_shape_float16_6(int i)847 inline bool is_ignored_dynamic_output_shape_float16_6(int i) {
848 static std::set<int> ignore = {};
849 return ignore.find(i) != ignore.end();
850 }
851
CreateModel_7(Model * model)852 void CreateModel_7(Model *model) {
853 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
854 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {2, 1, 3, 1}, 2.0f, 128);
855 OperandType type9(Type::TENSOR_INT32, {4});
856 // Phase 1, operands
857 auto input6 = model->addOperand(&type14);
858 auto begin6 = model->addOperand(&type9);
859 auto size6 = model->addOperand(&type9);
860 auto output6 = model->addOperand(&type15);
861 // Phase 2, operations
862 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
863 // Phase 3, inputs and outputs
864 model->identifyInputsAndOutputs(
865 {input6, begin6, size6},
866 {output6});
867 assert(model->isValid());
868 }
869
is_ignored_7(int i)870 inline bool is_ignored_7(int i) {
871 static std::set<int> ignore = {};
872 return ignore.find(i) != ignore.end();
873 }
874
CreateModel_relaxed_7(Model * model)875 void CreateModel_relaxed_7(Model *model) {
876 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
877 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {2, 1, 3, 1}, 2.0f, 128);
878 OperandType type9(Type::TENSOR_INT32, {4});
879 // Phase 1, operands
880 auto input6 = model->addOperand(&type14);
881 auto begin6 = model->addOperand(&type9);
882 auto size6 = model->addOperand(&type9);
883 auto output6 = model->addOperand(&type15);
884 // Phase 2, operations
885 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
886 // Phase 3, inputs and outputs
887 model->identifyInputsAndOutputs(
888 {input6, begin6, size6},
889 {output6});
890 // Phase 4: set relaxed execution
891 model->relaxComputationFloat32toFloat16(true);
892 assert(model->isValid());
893 }
894
is_ignored_relaxed_7(int i)895 inline bool is_ignored_relaxed_7(int i) {
896 static std::set<int> ignore = {};
897 return ignore.find(i) != ignore.end();
898 }
899
CreateModel_float16_7(Model * model)900 void CreateModel_float16_7(Model *model) {
901 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
902 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {2, 1, 3, 1}, 2.0f, 128);
903 OperandType type9(Type::TENSOR_INT32, {4});
904 // Phase 1, operands
905 auto input6 = model->addOperand(&type14);
906 auto begin6 = model->addOperand(&type9);
907 auto size6 = model->addOperand(&type9);
908 auto output6 = model->addOperand(&type15);
909 // Phase 2, operations
910 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
911 // Phase 3, inputs and outputs
912 model->identifyInputsAndOutputs(
913 {input6, begin6, size6},
914 {output6});
915 assert(model->isValid());
916 }
917
is_ignored_float16_7(int i)918 inline bool is_ignored_float16_7(int i) {
919 static std::set<int> ignore = {};
920 return ignore.find(i) != ignore.end();
921 }
922
CreateModel_dynamic_output_shape_7(Model * model)923 void CreateModel_dynamic_output_shape_7(Model *model) {
924 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
925 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
926 OperandType type9(Type::TENSOR_INT32, {4});
927 // Phase 1, operands
928 auto input6 = model->addOperand(&type14);
929 auto begin6 = model->addOperand(&type9);
930 auto size6 = model->addOperand(&type9);
931 auto output6 = model->addOperand(&type43);
932 // Phase 2, operations
933 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
934 // Phase 3, inputs and outputs
935 model->identifyInputsAndOutputs(
936 {input6, begin6, size6},
937 {output6});
938 assert(model->isValid());
939 }
940
is_ignored_dynamic_output_shape_7(int i)941 inline bool is_ignored_dynamic_output_shape_7(int i) {
942 static std::set<int> ignore = {};
943 return ignore.find(i) != ignore.end();
944 }
945
CreateModel_dynamic_output_shape_relaxed_7(Model * model)946 void CreateModel_dynamic_output_shape_relaxed_7(Model *model) {
947 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
948 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
949 OperandType type9(Type::TENSOR_INT32, {4});
950 // Phase 1, operands
951 auto input6 = model->addOperand(&type14);
952 auto begin6 = model->addOperand(&type9);
953 auto size6 = model->addOperand(&type9);
954 auto output6 = model->addOperand(&type43);
955 // Phase 2, operations
956 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
957 // Phase 3, inputs and outputs
958 model->identifyInputsAndOutputs(
959 {input6, begin6, size6},
960 {output6});
961 // Phase 4: set relaxed execution
962 model->relaxComputationFloat32toFloat16(true);
963 assert(model->isValid());
964 }
965
is_ignored_dynamic_output_shape_relaxed_7(int i)966 inline bool is_ignored_dynamic_output_shape_relaxed_7(int i) {
967 static std::set<int> ignore = {};
968 return ignore.find(i) != ignore.end();
969 }
970
CreateModel_dynamic_output_shape_float16_7(Model * model)971 void CreateModel_dynamic_output_shape_float16_7(Model *model) {
972 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {3, 2, 3, 1}, 2.0f, 128);
973 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
974 OperandType type9(Type::TENSOR_INT32, {4});
975 // Phase 1, operands
976 auto input6 = model->addOperand(&type14);
977 auto begin6 = model->addOperand(&type9);
978 auto size6 = model->addOperand(&type9);
979 auto output6 = model->addOperand(&type43);
980 // Phase 2, operations
981 model->addOperation(ANEURALNETWORKS_SLICE, {input6, begin6, size6}, {output6});
982 // Phase 3, inputs and outputs
983 model->identifyInputsAndOutputs(
984 {input6, begin6, size6},
985 {output6});
986 assert(model->isValid());
987 }
988
is_ignored_dynamic_output_shape_float16_7(int i)989 inline bool is_ignored_dynamic_output_shape_float16_7(int i) {
990 static std::set<int> ignore = {};
991 return ignore.find(i) != ignore.end();
992 }
993
CreateModel_8(Model * model)994 void CreateModel_8(Model *model) {
995 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
996 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
997 OperandType type9(Type::TENSOR_INT32, {4});
998 // Phase 1, operands
999 auto input7 = model->addOperand(&type11);
1000 auto begin7 = model->addOperand(&type9);
1001 auto size7 = model->addOperand(&type9);
1002 auto output7 = model->addOperand(&type13);
1003 // Phase 2, operations
1004 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1005 // Phase 3, inputs and outputs
1006 model->identifyInputsAndOutputs(
1007 {input7, begin7, size7},
1008 {output7});
1009 assert(model->isValid());
1010 }
1011
is_ignored_8(int i)1012 inline bool is_ignored_8(int i) {
1013 static std::set<int> ignore = {};
1014 return ignore.find(i) != ignore.end();
1015 }
1016
CreateModel_relaxed_8(Model * model)1017 void CreateModel_relaxed_8(Model *model) {
1018 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
1019 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
1020 OperandType type9(Type::TENSOR_INT32, {4});
1021 // Phase 1, operands
1022 auto input7 = model->addOperand(&type11);
1023 auto begin7 = model->addOperand(&type9);
1024 auto size7 = model->addOperand(&type9);
1025 auto output7 = model->addOperand(&type13);
1026 // Phase 2, operations
1027 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1028 // Phase 3, inputs and outputs
1029 model->identifyInputsAndOutputs(
1030 {input7, begin7, size7},
1031 {output7});
1032 // Phase 4: set relaxed execution
1033 model->relaxComputationFloat32toFloat16(true);
1034 assert(model->isValid());
1035 }
1036
is_ignored_relaxed_8(int i)1037 inline bool is_ignored_relaxed_8(int i) {
1038 static std::set<int> ignore = {};
1039 return ignore.find(i) != ignore.end();
1040 }
1041
CreateModel_float16_8(Model * model)1042 void CreateModel_float16_8(Model *model) {
1043 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
1044 OperandType type13(Type::TENSOR_INT32, {2, 1, 3, 1});
1045 OperandType type9(Type::TENSOR_INT32, {4});
1046 // Phase 1, operands
1047 auto input7 = model->addOperand(&type11);
1048 auto begin7 = model->addOperand(&type9);
1049 auto size7 = model->addOperand(&type9);
1050 auto output7 = model->addOperand(&type13);
1051 // Phase 2, operations
1052 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1053 // Phase 3, inputs and outputs
1054 model->identifyInputsAndOutputs(
1055 {input7, begin7, size7},
1056 {output7});
1057 assert(model->isValid());
1058 }
1059
is_ignored_float16_8(int i)1060 inline bool is_ignored_float16_8(int i) {
1061 static std::set<int> ignore = {};
1062 return ignore.find(i) != ignore.end();
1063 }
1064
CreateModel_dynamic_output_shape_8(Model * model)1065 void CreateModel_dynamic_output_shape_8(Model *model) {
1066 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
1067 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
1068 OperandType type9(Type::TENSOR_INT32, {4});
1069 // Phase 1, operands
1070 auto input7 = model->addOperand(&type11);
1071 auto begin7 = model->addOperand(&type9);
1072 auto size7 = model->addOperand(&type9);
1073 auto output7 = model->addOperand(&type42);
1074 // Phase 2, operations
1075 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1076 // Phase 3, inputs and outputs
1077 model->identifyInputsAndOutputs(
1078 {input7, begin7, size7},
1079 {output7});
1080 assert(model->isValid());
1081 }
1082
is_ignored_dynamic_output_shape_8(int i)1083 inline bool is_ignored_dynamic_output_shape_8(int i) {
1084 static std::set<int> ignore = {};
1085 return ignore.find(i) != ignore.end();
1086 }
1087
CreateModel_dynamic_output_shape_relaxed_8(Model * model)1088 void CreateModel_dynamic_output_shape_relaxed_8(Model *model) {
1089 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
1090 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
1091 OperandType type9(Type::TENSOR_INT32, {4});
1092 // Phase 1, operands
1093 auto input7 = model->addOperand(&type11);
1094 auto begin7 = model->addOperand(&type9);
1095 auto size7 = model->addOperand(&type9);
1096 auto output7 = model->addOperand(&type42);
1097 // Phase 2, operations
1098 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1099 // Phase 3, inputs and outputs
1100 model->identifyInputsAndOutputs(
1101 {input7, begin7, size7},
1102 {output7});
1103 // Phase 4: set relaxed execution
1104 model->relaxComputationFloat32toFloat16(true);
1105 assert(model->isValid());
1106 }
1107
is_ignored_dynamic_output_shape_relaxed_8(int i)1108 inline bool is_ignored_dynamic_output_shape_relaxed_8(int i) {
1109 static std::set<int> ignore = {};
1110 return ignore.find(i) != ignore.end();
1111 }
1112
CreateModel_dynamic_output_shape_float16_8(Model * model)1113 void CreateModel_dynamic_output_shape_float16_8(Model *model) {
1114 OperandType type11(Type::TENSOR_INT32, {3, 2, 3, 1});
1115 OperandType type42(Type::TENSOR_INT32, {0, 0, 0, 0});
1116 OperandType type9(Type::TENSOR_INT32, {4});
1117 // Phase 1, operands
1118 auto input7 = model->addOperand(&type11);
1119 auto begin7 = model->addOperand(&type9);
1120 auto size7 = model->addOperand(&type9);
1121 auto output7 = model->addOperand(&type42);
1122 // Phase 2, operations
1123 model->addOperation(ANEURALNETWORKS_SLICE, {input7, begin7, size7}, {output7});
1124 // Phase 3, inputs and outputs
1125 model->identifyInputsAndOutputs(
1126 {input7, begin7, size7},
1127 {output7});
1128 assert(model->isValid());
1129 }
1130
is_ignored_dynamic_output_shape_float16_8(int i)1131 inline bool is_ignored_dynamic_output_shape_float16_8(int i) {
1132 static std::set<int> ignore = {};
1133 return ignore.find(i) != ignore.end();
1134 }
1135
CreateModel_zero_sized(Model * model)1136 void CreateModel_zero_sized(Model *model) {
1137 OperandType type16(Type::TENSOR_FLOAT32, {1, 8});
1138 OperandType type17(Type::TENSOR_FLOAT32, {0});
1139 OperandType type18(Type::TENSOR_INT32, {0});
1140 OperandType type19(Type::TENSOR_FLOAT32, {0, 4});
1141 OperandType type20(Type::TENSOR_INT32, {1});
1142 OperandType type21(Type::FLOAT32, {});
1143 OperandType type22(Type::INT32, {});
1144 OperandType type23(Type::BOOL, {});
1145 OperandType type24(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
1146 OperandType type25(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
1147 OperandType type26(Type::TENSOR_FLOAT32, {0, 1, 1, 1});
1148 OperandType type27(Type::TENSOR_INT32, {4});
1149 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
1150 // Phase 1, operands
1151 auto scores = model->addOperand(&type5);
1152 auto roi = model->addOperand(&type16);
1153 auto param = model->addOperand(&type20);
1154 auto param1 = model->addOperand(&type21);
1155 auto param2 = model->addOperand(&type22);
1156 auto param3 = model->addOperand(&type22);
1157 auto param4 = model->addOperand(&type21);
1158 auto param5 = model->addOperand(&type21);
1159 auto param6 = model->addOperand(&type21);
1160 auto scoresOut = model->addOperand(&type17);
1161 auto roiOut = model->addOperand(&type19);
1162 auto classesOut = model->addOperand(&type18);
1163 auto batchSplitOut = model->addOperand(&type18);
1164 auto in = model->addOperand(&type24);
1165 auto param7 = model->addOperand(&type22);
1166 auto param8 = model->addOperand(&type22);
1167 auto param9 = model->addOperand(&type21);
1168 auto param10 = model->addOperand(&type21);
1169 auto param11 = model->addOperand(&type22);
1170 auto param12 = model->addOperand(&type22);
1171 auto layout = model->addOperand(&type23);
1172 auto featureMap = model->addOperand(&type25);
1173 auto param13 = model->addOperand(&type27);
1174 auto param14 = model->addOperand(&type27);
1175 auto out = model->addOperand(&type26);
1176 // Phase 2, operations
1177 static float scores_init[] = {0.9f, 0.1f};
1178 model->setOperandValue(scores, scores_init, sizeof(float) * 2);
1179 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1180 model->setOperandValue(roi, roi_init, sizeof(float) * 8);
1181 static int32_t param_init[] = {0};
1182 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1183 static float param1_init[] = {0.3f};
1184 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1185 static int32_t param2_init[] = {-1};
1186 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1187 static int32_t param3_init[] = {0};
1188 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1189 static float param4_init[] = {0.4f};
1190 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1191 static float param5_init[] = {1.0f};
1192 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1193 static float param6_init[] = {0.3f};
1194 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1195 static int32_t param7_init[] = {2};
1196 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1197 static int32_t param8_init[] = {2};
1198 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1199 static float param9_init[] = {2.0f};
1200 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1201 static float param10_init[] = {2.0f};
1202 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1203 static int32_t param11_init[] = {4};
1204 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1205 static int32_t param12_init[] = {4};
1206 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1207 static bool8 layout_init[] = {false};
1208 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1209 static int32_t param13_init[] = {0, 1, 1, 0};
1210 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1211 static int32_t param14_init[] = {-1, 1, -1, 1};
1212 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1213 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1214 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1215 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1216 // Phase 3, inputs and outputs
1217 model->identifyInputsAndOutputs(
1218 {in},
1219 {scoresOut, classesOut, out});
1220 assert(model->isValid());
1221 }
1222
is_ignored_zero_sized(int i)1223 inline bool is_ignored_zero_sized(int i) {
1224 static std::set<int> ignore = {};
1225 return ignore.find(i) != ignore.end();
1226 }
1227
CreateModel_zero_sized_relaxed(Model * model)1228 void CreateModel_zero_sized_relaxed(Model *model) {
1229 OperandType type16(Type::TENSOR_FLOAT32, {1, 8});
1230 OperandType type17(Type::TENSOR_FLOAT32, {0});
1231 OperandType type18(Type::TENSOR_INT32, {0});
1232 OperandType type19(Type::TENSOR_FLOAT32, {0, 4});
1233 OperandType type20(Type::TENSOR_INT32, {1});
1234 OperandType type21(Type::FLOAT32, {});
1235 OperandType type22(Type::INT32, {});
1236 OperandType type23(Type::BOOL, {});
1237 OperandType type24(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
1238 OperandType type25(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
1239 OperandType type26(Type::TENSOR_FLOAT32, {0, 1, 1, 1});
1240 OperandType type27(Type::TENSOR_INT32, {4});
1241 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
1242 // Phase 1, operands
1243 auto scores = model->addOperand(&type5);
1244 auto roi = model->addOperand(&type16);
1245 auto param = model->addOperand(&type20);
1246 auto param1 = model->addOperand(&type21);
1247 auto param2 = model->addOperand(&type22);
1248 auto param3 = model->addOperand(&type22);
1249 auto param4 = model->addOperand(&type21);
1250 auto param5 = model->addOperand(&type21);
1251 auto param6 = model->addOperand(&type21);
1252 auto scoresOut = model->addOperand(&type17);
1253 auto roiOut = model->addOperand(&type19);
1254 auto classesOut = model->addOperand(&type18);
1255 auto batchSplitOut = model->addOperand(&type18);
1256 auto in = model->addOperand(&type24);
1257 auto param7 = model->addOperand(&type22);
1258 auto param8 = model->addOperand(&type22);
1259 auto param9 = model->addOperand(&type21);
1260 auto param10 = model->addOperand(&type21);
1261 auto param11 = model->addOperand(&type22);
1262 auto param12 = model->addOperand(&type22);
1263 auto layout = model->addOperand(&type23);
1264 auto featureMap = model->addOperand(&type25);
1265 auto param13 = model->addOperand(&type27);
1266 auto param14 = model->addOperand(&type27);
1267 auto out = model->addOperand(&type26);
1268 // Phase 2, operations
1269 static float scores_init[] = {0.9f, 0.1f};
1270 model->setOperandValue(scores, scores_init, sizeof(float) * 2);
1271 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1272 model->setOperandValue(roi, roi_init, sizeof(float) * 8);
1273 static int32_t param_init[] = {0};
1274 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1275 static float param1_init[] = {0.3f};
1276 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1277 static int32_t param2_init[] = {-1};
1278 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1279 static int32_t param3_init[] = {0};
1280 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1281 static float param4_init[] = {0.4f};
1282 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1283 static float param5_init[] = {1.0f};
1284 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1285 static float param6_init[] = {0.3f};
1286 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1287 static int32_t param7_init[] = {2};
1288 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1289 static int32_t param8_init[] = {2};
1290 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1291 static float param9_init[] = {2.0f};
1292 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1293 static float param10_init[] = {2.0f};
1294 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1295 static int32_t param11_init[] = {4};
1296 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1297 static int32_t param12_init[] = {4};
1298 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1299 static bool8 layout_init[] = {false};
1300 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1301 static int32_t param13_init[] = {0, 1, 1, 0};
1302 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1303 static int32_t param14_init[] = {-1, 1, -1, 1};
1304 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1305 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1306 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1307 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1308 // Phase 3, inputs and outputs
1309 model->identifyInputsAndOutputs(
1310 {in},
1311 {scoresOut, classesOut, out});
1312 // Phase 4: set relaxed execution
1313 model->relaxComputationFloat32toFloat16(true);
1314 assert(model->isValid());
1315 }
1316
is_ignored_zero_sized_relaxed(int i)1317 inline bool is_ignored_zero_sized_relaxed(int i) {
1318 static std::set<int> ignore = {};
1319 return ignore.find(i) != ignore.end();
1320 }
1321
CreateModel_zero_sized_quant8(Model * model)1322 void CreateModel_zero_sized_quant8(Model *model) {
1323 OperandType type18(Type::TENSOR_INT32, {0});
1324 OperandType type20(Type::TENSOR_INT32, {1});
1325 OperandType type21(Type::FLOAT32, {});
1326 OperandType type22(Type::INT32, {});
1327 OperandType type23(Type::BOOL, {});
1328 OperandType type27(Type::TENSOR_INT32, {4});
1329 OperandType type44(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128);
1330 OperandType type45(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128);
1331 OperandType type46(Type::TENSOR_QUANT8_ASYMM, {0, 1, 1, 1}, 0.1f, 128);
1332 OperandType type47(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0);
1333 OperandType type48(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0);
1334 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128);
1335 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128);
1336 // Phase 1, operands
1337 auto scores = model->addOperand(&type49);
1338 auto roi = model->addOperand(&type47);
1339 auto param = model->addOperand(&type20);
1340 auto param1 = model->addOperand(&type21);
1341 auto param2 = model->addOperand(&type22);
1342 auto param3 = model->addOperand(&type22);
1343 auto param4 = model->addOperand(&type21);
1344 auto param5 = model->addOperand(&type21);
1345 auto param6 = model->addOperand(&type21);
1346 auto scoresOut = model->addOperand(&type50);
1347 auto roiOut = model->addOperand(&type48);
1348 auto classesOut = model->addOperand(&type18);
1349 auto batchSplitOut = model->addOperand(&type18);
1350 auto in = model->addOperand(&type45);
1351 auto param7 = model->addOperand(&type22);
1352 auto param8 = model->addOperand(&type22);
1353 auto param9 = model->addOperand(&type21);
1354 auto param10 = model->addOperand(&type21);
1355 auto param11 = model->addOperand(&type22);
1356 auto param12 = model->addOperand(&type22);
1357 auto layout = model->addOperand(&type23);
1358 auto featureMap = model->addOperand(&type44);
1359 auto param13 = model->addOperand(&type27);
1360 auto param14 = model->addOperand(&type27);
1361 auto out = model->addOperand(&type46);
1362 // Phase 2, operations
1363 static uint8_t scores_init[] = {137, 129};
1364 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2);
1365 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80};
1366 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8);
1367 static int32_t param_init[] = {0};
1368 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1369 static float param1_init[] = {0.3f};
1370 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1371 static int32_t param2_init[] = {-1};
1372 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1373 static int32_t param3_init[] = {0};
1374 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1375 static float param4_init[] = {0.4f};
1376 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1377 static float param5_init[] = {1.0f};
1378 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1379 static float param6_init[] = {0.3f};
1380 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1381 static int32_t param7_init[] = {2};
1382 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1383 static int32_t param8_init[] = {2};
1384 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1385 static float param9_init[] = {2.0f};
1386 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1387 static float param10_init[] = {2.0f};
1388 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1389 static int32_t param11_init[] = {4};
1390 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1391 static int32_t param12_init[] = {4};
1392 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1393 static bool8 layout_init[] = {false};
1394 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1395 static int32_t param13_init[] = {0, 1, 1, 0};
1396 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1397 static int32_t param14_init[] = {-1, 1, -1, 1};
1398 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1399 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1400 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1401 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1402 // Phase 3, inputs and outputs
1403 model->identifyInputsAndOutputs(
1404 {in},
1405 {scoresOut, classesOut, out});
1406 assert(model->isValid());
1407 }
1408
is_ignored_zero_sized_quant8(int i)1409 inline bool is_ignored_zero_sized_quant8(int i) {
1410 static std::set<int> ignore = {};
1411 return ignore.find(i) != ignore.end();
1412 }
1413
CreateModel_zero_sized_float16(Model * model)1414 void CreateModel_zero_sized_float16(Model *model) {
1415 OperandType type18(Type::TENSOR_INT32, {0});
1416 OperandType type20(Type::TENSOR_INT32, {1});
1417 OperandType type22(Type::INT32, {});
1418 OperandType type23(Type::BOOL, {});
1419 OperandType type27(Type::TENSOR_INT32, {4});
1420 OperandType type32(Type::TENSOR_FLOAT16, {1, 2});
1421 OperandType type51(Type::TENSOR_FLOAT16, {0, 2, 2, 1});
1422 OperandType type52(Type::TENSOR_FLOAT16, {1, 1, 1, 1});
1423 OperandType type53(Type::TENSOR_FLOAT16, {0, 1, 1, 1});
1424 OperandType type54(Type::FLOAT16, {});
1425 OperandType type55(Type::TENSOR_FLOAT16, {1, 8});
1426 OperandType type56(Type::TENSOR_FLOAT16, {0, 4});
1427 OperandType type57(Type::TENSOR_FLOAT16, {0});
1428 // Phase 1, operands
1429 auto scores = model->addOperand(&type32);
1430 auto roi = model->addOperand(&type55);
1431 auto param = model->addOperand(&type20);
1432 auto param1 = model->addOperand(&type54);
1433 auto param2 = model->addOperand(&type22);
1434 auto param3 = model->addOperand(&type22);
1435 auto param4 = model->addOperand(&type54);
1436 auto param5 = model->addOperand(&type54);
1437 auto param6 = model->addOperand(&type54);
1438 auto scoresOut = model->addOperand(&type57);
1439 auto roiOut = model->addOperand(&type56);
1440 auto classesOut = model->addOperand(&type18);
1441 auto batchSplitOut = model->addOperand(&type18);
1442 auto in = model->addOperand(&type52);
1443 auto param7 = model->addOperand(&type22);
1444 auto param8 = model->addOperand(&type22);
1445 auto param9 = model->addOperand(&type54);
1446 auto param10 = model->addOperand(&type54);
1447 auto param11 = model->addOperand(&type22);
1448 auto param12 = model->addOperand(&type22);
1449 auto layout = model->addOperand(&type23);
1450 auto featureMap = model->addOperand(&type51);
1451 auto param13 = model->addOperand(&type27);
1452 auto param14 = model->addOperand(&type27);
1453 auto out = model->addOperand(&type53);
1454 // Phase 2, operations
1455 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f};
1456 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2);
1457 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1458 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8);
1459 static int32_t param_init[] = {0};
1460 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1461 static _Float16 param1_init[] = {0.30000001192092896f};
1462 model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
1463 static int32_t param2_init[] = {-1};
1464 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1465 static int32_t param3_init[] = {0};
1466 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1467 static _Float16 param4_init[] = {0.4000000059604645f};
1468 model->setOperandValue(param4, param4_init, sizeof(_Float16) * 1);
1469 static _Float16 param5_init[] = {1.0f};
1470 model->setOperandValue(param5, param5_init, sizeof(_Float16) * 1);
1471 static _Float16 param6_init[] = {0.30000001192092896f};
1472 model->setOperandValue(param6, param6_init, sizeof(_Float16) * 1);
1473 static int32_t param7_init[] = {2};
1474 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1475 static int32_t param8_init[] = {2};
1476 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1477 static _Float16 param9_init[] = {2.0f};
1478 model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
1479 static _Float16 param10_init[] = {2.0f};
1480 model->setOperandValue(param10, param10_init, sizeof(_Float16) * 1);
1481 static int32_t param11_init[] = {4};
1482 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1483 static int32_t param12_init[] = {4};
1484 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1485 static bool8 layout_init[] = {false};
1486 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1487 static int32_t param13_init[] = {0, 1, 1, 0};
1488 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1489 static int32_t param14_init[] = {-1, 1, -1, 1};
1490 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1491 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1492 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1493 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1494 // Phase 3, inputs and outputs
1495 model->identifyInputsAndOutputs(
1496 {in},
1497 {scoresOut, classesOut, out});
1498 assert(model->isValid());
1499 }
1500
is_ignored_zero_sized_float16(int i)1501 inline bool is_ignored_zero_sized_float16(int i) {
1502 static std::set<int> ignore = {};
1503 return ignore.find(i) != ignore.end();
1504 }
1505
CreateModel_zero_sized_dynamic_output_shape(Model * model)1506 void CreateModel_zero_sized_dynamic_output_shape(Model *model) {
1507 OperandType type16(Type::TENSOR_FLOAT32, {1, 8});
1508 OperandType type17(Type::TENSOR_FLOAT32, {0});
1509 OperandType type18(Type::TENSOR_INT32, {0});
1510 OperandType type19(Type::TENSOR_FLOAT32, {0, 4});
1511 OperandType type20(Type::TENSOR_INT32, {1});
1512 OperandType type21(Type::FLOAT32, {});
1513 OperandType type22(Type::INT32, {});
1514 OperandType type23(Type::BOOL, {});
1515 OperandType type24(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
1516 OperandType type25(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
1517 OperandType type27(Type::TENSOR_INT32, {4});
1518 OperandType type40(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1519 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
1520 // Phase 1, operands
1521 auto scores = model->addOperand(&type5);
1522 auto roi = model->addOperand(&type16);
1523 auto param = model->addOperand(&type20);
1524 auto param1 = model->addOperand(&type21);
1525 auto param2 = model->addOperand(&type22);
1526 auto param3 = model->addOperand(&type22);
1527 auto param4 = model->addOperand(&type21);
1528 auto param5 = model->addOperand(&type21);
1529 auto param6 = model->addOperand(&type21);
1530 auto scoresOut = model->addOperand(&type17);
1531 auto roiOut = model->addOperand(&type19);
1532 auto classesOut = model->addOperand(&type18);
1533 auto batchSplitOut = model->addOperand(&type18);
1534 auto in = model->addOperand(&type24);
1535 auto param7 = model->addOperand(&type22);
1536 auto param8 = model->addOperand(&type22);
1537 auto param9 = model->addOperand(&type21);
1538 auto param10 = model->addOperand(&type21);
1539 auto param11 = model->addOperand(&type22);
1540 auto param12 = model->addOperand(&type22);
1541 auto layout = model->addOperand(&type23);
1542 auto featureMap = model->addOperand(&type25);
1543 auto param13 = model->addOperand(&type27);
1544 auto param14 = model->addOperand(&type27);
1545 auto out = model->addOperand(&type40);
1546 // Phase 2, operations
1547 static float scores_init[] = {0.9f, 0.1f};
1548 model->setOperandValue(scores, scores_init, sizeof(float) * 2);
1549 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1550 model->setOperandValue(roi, roi_init, sizeof(float) * 8);
1551 static int32_t param_init[] = {0};
1552 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1553 static float param1_init[] = {0.3f};
1554 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1555 static int32_t param2_init[] = {-1};
1556 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1557 static int32_t param3_init[] = {0};
1558 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1559 static float param4_init[] = {0.4f};
1560 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1561 static float param5_init[] = {1.0f};
1562 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1563 static float param6_init[] = {0.3f};
1564 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1565 static int32_t param7_init[] = {2};
1566 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1567 static int32_t param8_init[] = {2};
1568 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1569 static float param9_init[] = {2.0f};
1570 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1571 static float param10_init[] = {2.0f};
1572 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1573 static int32_t param11_init[] = {4};
1574 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1575 static int32_t param12_init[] = {4};
1576 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1577 static bool8 layout_init[] = {false};
1578 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1579 static int32_t param13_init[] = {0, 1, 1, 0};
1580 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1581 static int32_t param14_init[] = {-1, 1, -1, 1};
1582 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1583 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1584 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1585 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1586 // Phase 3, inputs and outputs
1587 model->identifyInputsAndOutputs(
1588 {in},
1589 {scoresOut, classesOut, out});
1590 assert(model->isValid());
1591 }
1592
is_ignored_zero_sized_dynamic_output_shape(int i)1593 inline bool is_ignored_zero_sized_dynamic_output_shape(int i) {
1594 static std::set<int> ignore = {};
1595 return ignore.find(i) != ignore.end();
1596 }
1597
CreateModel_zero_sized_dynamic_output_shape_relaxed(Model * model)1598 void CreateModel_zero_sized_dynamic_output_shape_relaxed(Model *model) {
1599 OperandType type16(Type::TENSOR_FLOAT32, {1, 8});
1600 OperandType type17(Type::TENSOR_FLOAT32, {0});
1601 OperandType type18(Type::TENSOR_INT32, {0});
1602 OperandType type19(Type::TENSOR_FLOAT32, {0, 4});
1603 OperandType type20(Type::TENSOR_INT32, {1});
1604 OperandType type21(Type::FLOAT32, {});
1605 OperandType type22(Type::INT32, {});
1606 OperandType type23(Type::BOOL, {});
1607 OperandType type24(Type::TENSOR_FLOAT32, {1, 1, 1, 1});
1608 OperandType type25(Type::TENSOR_FLOAT32, {0, 2, 2, 1});
1609 OperandType type27(Type::TENSOR_INT32, {4});
1610 OperandType type40(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1611 OperandType type5(Type::TENSOR_FLOAT32, {1, 2});
1612 // Phase 1, operands
1613 auto scores = model->addOperand(&type5);
1614 auto roi = model->addOperand(&type16);
1615 auto param = model->addOperand(&type20);
1616 auto param1 = model->addOperand(&type21);
1617 auto param2 = model->addOperand(&type22);
1618 auto param3 = model->addOperand(&type22);
1619 auto param4 = model->addOperand(&type21);
1620 auto param5 = model->addOperand(&type21);
1621 auto param6 = model->addOperand(&type21);
1622 auto scoresOut = model->addOperand(&type17);
1623 auto roiOut = model->addOperand(&type19);
1624 auto classesOut = model->addOperand(&type18);
1625 auto batchSplitOut = model->addOperand(&type18);
1626 auto in = model->addOperand(&type24);
1627 auto param7 = model->addOperand(&type22);
1628 auto param8 = model->addOperand(&type22);
1629 auto param9 = model->addOperand(&type21);
1630 auto param10 = model->addOperand(&type21);
1631 auto param11 = model->addOperand(&type22);
1632 auto param12 = model->addOperand(&type22);
1633 auto layout = model->addOperand(&type23);
1634 auto featureMap = model->addOperand(&type25);
1635 auto param13 = model->addOperand(&type27);
1636 auto param14 = model->addOperand(&type27);
1637 auto out = model->addOperand(&type40);
1638 // Phase 2, operations
1639 static float scores_init[] = {0.9f, 0.1f};
1640 model->setOperandValue(scores, scores_init, sizeof(float) * 2);
1641 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1642 model->setOperandValue(roi, roi_init, sizeof(float) * 8);
1643 static int32_t param_init[] = {0};
1644 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1645 static float param1_init[] = {0.3f};
1646 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1647 static int32_t param2_init[] = {-1};
1648 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1649 static int32_t param3_init[] = {0};
1650 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1651 static float param4_init[] = {0.4f};
1652 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1653 static float param5_init[] = {1.0f};
1654 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1655 static float param6_init[] = {0.3f};
1656 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1657 static int32_t param7_init[] = {2};
1658 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1659 static int32_t param8_init[] = {2};
1660 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1661 static float param9_init[] = {2.0f};
1662 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1663 static float param10_init[] = {2.0f};
1664 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1665 static int32_t param11_init[] = {4};
1666 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1667 static int32_t param12_init[] = {4};
1668 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1669 static bool8 layout_init[] = {false};
1670 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1671 static int32_t param13_init[] = {0, 1, 1, 0};
1672 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1673 static int32_t param14_init[] = {-1, 1, -1, 1};
1674 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1675 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1676 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1677 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1678 // Phase 3, inputs and outputs
1679 model->identifyInputsAndOutputs(
1680 {in},
1681 {scoresOut, classesOut, out});
1682 // Phase 4: set relaxed execution
1683 model->relaxComputationFloat32toFloat16(true);
1684 assert(model->isValid());
1685 }
1686
is_ignored_zero_sized_dynamic_output_shape_relaxed(int i)1687 inline bool is_ignored_zero_sized_dynamic_output_shape_relaxed(int i) {
1688 static std::set<int> ignore = {};
1689 return ignore.find(i) != ignore.end();
1690 }
1691
CreateModel_zero_sized_dynamic_output_shape_quant8(Model * model)1692 void CreateModel_zero_sized_dynamic_output_shape_quant8(Model *model) {
1693 OperandType type18(Type::TENSOR_INT32, {0});
1694 OperandType type20(Type::TENSOR_INT32, {1});
1695 OperandType type21(Type::FLOAT32, {});
1696 OperandType type22(Type::INT32, {});
1697 OperandType type23(Type::BOOL, {});
1698 OperandType type27(Type::TENSOR_INT32, {4});
1699 OperandType type44(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128);
1700 OperandType type45(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128);
1701 OperandType type47(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0);
1702 OperandType type48(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0);
1703 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128);
1704 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128);
1705 OperandType type58(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128);
1706 // Phase 1, operands
1707 auto scores = model->addOperand(&type49);
1708 auto roi = model->addOperand(&type47);
1709 auto param = model->addOperand(&type20);
1710 auto param1 = model->addOperand(&type21);
1711 auto param2 = model->addOperand(&type22);
1712 auto param3 = model->addOperand(&type22);
1713 auto param4 = model->addOperand(&type21);
1714 auto param5 = model->addOperand(&type21);
1715 auto param6 = model->addOperand(&type21);
1716 auto scoresOut = model->addOperand(&type50);
1717 auto roiOut = model->addOperand(&type48);
1718 auto classesOut = model->addOperand(&type18);
1719 auto batchSplitOut = model->addOperand(&type18);
1720 auto in = model->addOperand(&type45);
1721 auto param7 = model->addOperand(&type22);
1722 auto param8 = model->addOperand(&type22);
1723 auto param9 = model->addOperand(&type21);
1724 auto param10 = model->addOperand(&type21);
1725 auto param11 = model->addOperand(&type22);
1726 auto param12 = model->addOperand(&type22);
1727 auto layout = model->addOperand(&type23);
1728 auto featureMap = model->addOperand(&type44);
1729 auto param13 = model->addOperand(&type27);
1730 auto param14 = model->addOperand(&type27);
1731 auto out = model->addOperand(&type58);
1732 // Phase 2, operations
1733 static uint8_t scores_init[] = {137, 129};
1734 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2);
1735 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80};
1736 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8);
1737 static int32_t param_init[] = {0};
1738 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1739 static float param1_init[] = {0.3f};
1740 model->setOperandValue(param1, param1_init, sizeof(float) * 1);
1741 static int32_t param2_init[] = {-1};
1742 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1743 static int32_t param3_init[] = {0};
1744 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1745 static float param4_init[] = {0.4f};
1746 model->setOperandValue(param4, param4_init, sizeof(float) * 1);
1747 static float param5_init[] = {1.0f};
1748 model->setOperandValue(param5, param5_init, sizeof(float) * 1);
1749 static float param6_init[] = {0.3f};
1750 model->setOperandValue(param6, param6_init, sizeof(float) * 1);
1751 static int32_t param7_init[] = {2};
1752 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1753 static int32_t param8_init[] = {2};
1754 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1755 static float param9_init[] = {2.0f};
1756 model->setOperandValue(param9, param9_init, sizeof(float) * 1);
1757 static float param10_init[] = {2.0f};
1758 model->setOperandValue(param10, param10_init, sizeof(float) * 1);
1759 static int32_t param11_init[] = {4};
1760 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1761 static int32_t param12_init[] = {4};
1762 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1763 static bool8 layout_init[] = {false};
1764 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1765 static int32_t param13_init[] = {0, 1, 1, 0};
1766 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1767 static int32_t param14_init[] = {-1, 1, -1, 1};
1768 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1769 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1770 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1771 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1772 // Phase 3, inputs and outputs
1773 model->identifyInputsAndOutputs(
1774 {in},
1775 {scoresOut, classesOut, out});
1776 assert(model->isValid());
1777 }
1778
is_ignored_zero_sized_dynamic_output_shape_quant8(int i)1779 inline bool is_ignored_zero_sized_dynamic_output_shape_quant8(int i) {
1780 static std::set<int> ignore = {};
1781 return ignore.find(i) != ignore.end();
1782 }
1783
CreateModel_zero_sized_dynamic_output_shape_float16(Model * model)1784 void CreateModel_zero_sized_dynamic_output_shape_float16(Model *model) {
1785 OperandType type18(Type::TENSOR_INT32, {0});
1786 OperandType type20(Type::TENSOR_INT32, {1});
1787 OperandType type22(Type::INT32, {});
1788 OperandType type23(Type::BOOL, {});
1789 OperandType type27(Type::TENSOR_INT32, {4});
1790 OperandType type30(Type::TENSOR_FLOAT16, {0});
1791 OperandType type32(Type::TENSOR_FLOAT16, {1, 2});
1792 OperandType type41(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1793 OperandType type51(Type::TENSOR_FLOAT16, {0, 2, 2, 1});
1794 OperandType type52(Type::TENSOR_FLOAT16, {1, 1, 1, 1});
1795 OperandType type54(Type::FLOAT16, {});
1796 OperandType type55(Type::TENSOR_FLOAT16, {1, 8});
1797 OperandType type56(Type::TENSOR_FLOAT16, {0, 4});
1798 // Phase 1, operands
1799 auto scores = model->addOperand(&type32);
1800 auto roi = model->addOperand(&type55);
1801 auto param = model->addOperand(&type20);
1802 auto param1 = model->addOperand(&type54);
1803 auto param2 = model->addOperand(&type22);
1804 auto param3 = model->addOperand(&type22);
1805 auto param4 = model->addOperand(&type54);
1806 auto param5 = model->addOperand(&type54);
1807 auto param6 = model->addOperand(&type54);
1808 auto scoresOut = model->addOperand(&type30);
1809 auto roiOut = model->addOperand(&type56);
1810 auto classesOut = model->addOperand(&type18);
1811 auto batchSplitOut = model->addOperand(&type18);
1812 auto in = model->addOperand(&type52);
1813 auto param7 = model->addOperand(&type22);
1814 auto param8 = model->addOperand(&type22);
1815 auto param9 = model->addOperand(&type54);
1816 auto param10 = model->addOperand(&type54);
1817 auto param11 = model->addOperand(&type22);
1818 auto param12 = model->addOperand(&type22);
1819 auto layout = model->addOperand(&type23);
1820 auto featureMap = model->addOperand(&type51);
1821 auto param13 = model->addOperand(&type27);
1822 auto param14 = model->addOperand(&type27);
1823 auto out = model->addOperand(&type41);
1824 // Phase 2, operations
1825 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f};
1826 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2);
1827 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f};
1828 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8);
1829 static int32_t param_init[] = {0};
1830 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1831 static _Float16 param1_init[] = {0.30000001192092896f};
1832 model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
1833 static int32_t param2_init[] = {-1};
1834 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1835 static int32_t param3_init[] = {0};
1836 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1837 static _Float16 param4_init[] = {0.4000000059604645f};
1838 model->setOperandValue(param4, param4_init, sizeof(_Float16) * 1);
1839 static _Float16 param5_init[] = {1.0f};
1840 model->setOperandValue(param5, param5_init, sizeof(_Float16) * 1);
1841 static _Float16 param6_init[] = {0.30000001192092896f};
1842 model->setOperandValue(param6, param6_init, sizeof(_Float16) * 1);
1843 static int32_t param7_init[] = {2};
1844 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1845 static int32_t param8_init[] = {2};
1846 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1847 static _Float16 param9_init[] = {2.0f};
1848 model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
1849 static _Float16 param10_init[] = {2.0f};
1850 model->setOperandValue(param10, param10_init, sizeof(_Float16) * 1);
1851 static int32_t param11_init[] = {4};
1852 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1853 static int32_t param12_init[] = {4};
1854 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1855 static bool8 layout_init[] = {false};
1856 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1857 static int32_t param13_init[] = {0, 1, 1, 0};
1858 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 4);
1859 static int32_t param14_init[] = {-1, 1, -1, 1};
1860 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 4);
1861 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param, param1, param2, param3, param4, param5, param6}, {scoresOut, roiOut, classesOut, batchSplitOut});
1862 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param7, param8, param9, param10, param11, param12, layout}, {featureMap});
1863 model->addOperation(ANEURALNETWORKS_SLICE, {featureMap, param13, param14}, {out});
1864 // Phase 3, inputs and outputs
1865 model->identifyInputsAndOutputs(
1866 {in},
1867 {scoresOut, classesOut, out});
1868 assert(model->isValid());
1869 }
1870
is_ignored_zero_sized_dynamic_output_shape_float16(int i)1871 inline bool is_ignored_zero_sized_dynamic_output_shape_float16(int i) {
1872 static std::set<int> ignore = {};
1873 return ignore.find(i) != ignore.end();
1874 }
1875
1876