1 // clang-format off
2 // Generated file (from: roi_align.mod.py). Do not edit
3 // Create the model
createTestModel_nhwc()4 Model createTestModel_nhwc() {
5     const std::vector<Operand> operands = {
6         {
7             .type = OperandType::TENSOR_FLOAT32,
8             .dimensions = {1, 4, 4, 1},
9             .numberOfConsumers = 1,
10             .scale = 0.0f,
11             .zeroPoint = 0,
12             .lifetime = OperandLifeTime::MODEL_INPUT,
13             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14         },
15         {
16             .type = OperandType::TENSOR_FLOAT32,
17             .dimensions = {4, 4},
18             .numberOfConsumers = 1,
19             .scale = 0.0f,
20             .zeroPoint = 0,
21             .lifetime = OperandLifeTime::MODEL_INPUT,
22             .location = {.poolIndex = 0, .offset = 0, .length = 0},
23         },
24         {
25             .type = OperandType::TENSOR_INT32,
26             .dimensions = {4},
27             .numberOfConsumers = 1,
28             .scale = 0.0f,
29             .zeroPoint = 0,
30             .lifetime = OperandLifeTime::CONSTANT_COPY,
31             .location = {.poolIndex = 0, .offset = 0, .length = 16},
32         },
33         {
34             .type = OperandType::INT32,
35             .dimensions = {},
36             .numberOfConsumers = 1,
37             .scale = 0.0f,
38             .zeroPoint = 0,
39             .lifetime = OperandLifeTime::CONSTANT_COPY,
40             .location = {.poolIndex = 0, .offset = 16, .length = 4},
41         },
42         {
43             .type = OperandType::INT32,
44             .dimensions = {},
45             .numberOfConsumers = 1,
46             .scale = 0.0f,
47             .zeroPoint = 0,
48             .lifetime = OperandLifeTime::CONSTANT_COPY,
49             .location = {.poolIndex = 0, .offset = 20, .length = 4},
50         },
51         {
52             .type = OperandType::FLOAT32,
53             .dimensions = {},
54             .numberOfConsumers = 1,
55             .scale = 0.0f,
56             .zeroPoint = 0,
57             .lifetime = OperandLifeTime::CONSTANT_COPY,
58             .location = {.poolIndex = 0, .offset = 24, .length = 4},
59         },
60         {
61             .type = OperandType::FLOAT32,
62             .dimensions = {},
63             .numberOfConsumers = 1,
64             .scale = 0.0f,
65             .zeroPoint = 0,
66             .lifetime = OperandLifeTime::CONSTANT_COPY,
67             .location = {.poolIndex = 0, .offset = 28, .length = 4},
68         },
69         {
70             .type = OperandType::INT32,
71             .dimensions = {},
72             .numberOfConsumers = 1,
73             .scale = 0.0f,
74             .zeroPoint = 0,
75             .lifetime = OperandLifeTime::CONSTANT_COPY,
76             .location = {.poolIndex = 0, .offset = 32, .length = 4},
77         },
78         {
79             .type = OperandType::INT32,
80             .dimensions = {},
81             .numberOfConsumers = 1,
82             .scale = 0.0f,
83             .zeroPoint = 0,
84             .lifetime = OperandLifeTime::CONSTANT_COPY,
85             .location = {.poolIndex = 0, .offset = 36, .length = 4},
86         },
87         {
88             .type = OperandType::BOOL,
89             .dimensions = {},
90             .numberOfConsumers = 1,
91             .scale = 0.0f,
92             .zeroPoint = 0,
93             .lifetime = OperandLifeTime::CONSTANT_COPY,
94             .location = {.poolIndex = 0, .offset = 40, .length = 1},
95         },
96         {
97             .type = OperandType::TENSOR_FLOAT32,
98             .dimensions = {4, 2, 2, 1},
99             .numberOfConsumers = 0,
100             .scale = 0.0f,
101             .zeroPoint = 0,
102             .lifetime = OperandLifeTime::MODEL_OUTPUT,
103             .location = {.poolIndex = 0, .offset = 0, .length = 0},
104         }
105     };
106 
107     const std::vector<Operation> operations = {
108         {
109             .type = OperationType::ROI_ALIGN,
110             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
111             .outputs = {10},
112         }
113     };
114 
115     const std::vector<uint32_t> inputIndexes = {0, 1};
116     const std::vector<uint32_t> outputIndexes = {10};
117     std::vector<uint8_t> operandValues = {
118       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
119     };
120     const std::vector<hidl_memory> pools = {};
121 
122     return {
123         .operands = operands,
124         .operations = operations,
125         .inputIndexes = inputIndexes,
126         .outputIndexes = outputIndexes,
127         .operandValues = operandValues,
128         .pools = pools,
129     };
130 }
131 
is_ignored_nhwc(int i)132 inline bool is_ignored_nhwc(int i) {
133   static std::set<int> ignore = {};
134   return ignore.find(i) != ignore.end();
135 }
136 
137 // Create the model
createTestModel_nhwc_relaxed()138 Model createTestModel_nhwc_relaxed() {
139     const std::vector<Operand> operands = {
140         {
141             .type = OperandType::TENSOR_FLOAT32,
142             .dimensions = {1, 4, 4, 1},
143             .numberOfConsumers = 1,
144             .scale = 0.0f,
145             .zeroPoint = 0,
146             .lifetime = OperandLifeTime::MODEL_INPUT,
147             .location = {.poolIndex = 0, .offset = 0, .length = 0},
148         },
149         {
150             .type = OperandType::TENSOR_FLOAT32,
151             .dimensions = {4, 4},
152             .numberOfConsumers = 1,
153             .scale = 0.0f,
154             .zeroPoint = 0,
155             .lifetime = OperandLifeTime::MODEL_INPUT,
156             .location = {.poolIndex = 0, .offset = 0, .length = 0},
157         },
158         {
159             .type = OperandType::TENSOR_INT32,
160             .dimensions = {4},
161             .numberOfConsumers = 1,
162             .scale = 0.0f,
163             .zeroPoint = 0,
164             .lifetime = OperandLifeTime::CONSTANT_COPY,
165             .location = {.poolIndex = 0, .offset = 0, .length = 16},
166         },
167         {
168             .type = OperandType::INT32,
169             .dimensions = {},
170             .numberOfConsumers = 1,
171             .scale = 0.0f,
172             .zeroPoint = 0,
173             .lifetime = OperandLifeTime::CONSTANT_COPY,
174             .location = {.poolIndex = 0, .offset = 16, .length = 4},
175         },
176         {
177             .type = OperandType::INT32,
178             .dimensions = {},
179             .numberOfConsumers = 1,
180             .scale = 0.0f,
181             .zeroPoint = 0,
182             .lifetime = OperandLifeTime::CONSTANT_COPY,
183             .location = {.poolIndex = 0, .offset = 20, .length = 4},
184         },
185         {
186             .type = OperandType::FLOAT32,
187             .dimensions = {},
188             .numberOfConsumers = 1,
189             .scale = 0.0f,
190             .zeroPoint = 0,
191             .lifetime = OperandLifeTime::CONSTANT_COPY,
192             .location = {.poolIndex = 0, .offset = 24, .length = 4},
193         },
194         {
195             .type = OperandType::FLOAT32,
196             .dimensions = {},
197             .numberOfConsumers = 1,
198             .scale = 0.0f,
199             .zeroPoint = 0,
200             .lifetime = OperandLifeTime::CONSTANT_COPY,
201             .location = {.poolIndex = 0, .offset = 28, .length = 4},
202         },
203         {
204             .type = OperandType::INT32,
205             .dimensions = {},
206             .numberOfConsumers = 1,
207             .scale = 0.0f,
208             .zeroPoint = 0,
209             .lifetime = OperandLifeTime::CONSTANT_COPY,
210             .location = {.poolIndex = 0, .offset = 32, .length = 4},
211         },
212         {
213             .type = OperandType::INT32,
214             .dimensions = {},
215             .numberOfConsumers = 1,
216             .scale = 0.0f,
217             .zeroPoint = 0,
218             .lifetime = OperandLifeTime::CONSTANT_COPY,
219             .location = {.poolIndex = 0, .offset = 36, .length = 4},
220         },
221         {
222             .type = OperandType::BOOL,
223             .dimensions = {},
224             .numberOfConsumers = 1,
225             .scale = 0.0f,
226             .zeroPoint = 0,
227             .lifetime = OperandLifeTime::CONSTANT_COPY,
228             .location = {.poolIndex = 0, .offset = 40, .length = 1},
229         },
230         {
231             .type = OperandType::TENSOR_FLOAT32,
232             .dimensions = {4, 2, 2, 1},
233             .numberOfConsumers = 0,
234             .scale = 0.0f,
235             .zeroPoint = 0,
236             .lifetime = OperandLifeTime::MODEL_OUTPUT,
237             .location = {.poolIndex = 0, .offset = 0, .length = 0},
238         }
239     };
240 
241     const std::vector<Operation> operations = {
242         {
243             .type = OperationType::ROI_ALIGN,
244             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
245             .outputs = {10},
246         }
247     };
248 
249     const std::vector<uint32_t> inputIndexes = {0, 1};
250     const std::vector<uint32_t> outputIndexes = {10};
251     std::vector<uint8_t> operandValues = {
252       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
253     };
254     const std::vector<hidl_memory> pools = {};
255 
256     return {
257         .operands = operands,
258         .operations = operations,
259         .inputIndexes = inputIndexes,
260         .outputIndexes = outputIndexes,
261         .operandValues = operandValues,
262         .pools = pools,
263         .relaxComputationFloat32toFloat16 = true,
264     };
265 }
266 
is_ignored_nhwc_relaxed(int i)267 inline bool is_ignored_nhwc_relaxed(int i) {
268   static std::set<int> ignore = {};
269   return ignore.find(i) != ignore.end();
270 }
271 
272 // Create the model
createTestModel_nhwc_quant8()273 Model createTestModel_nhwc_quant8() {
274     const std::vector<Operand> operands = {
275         {
276             .type = OperandType::TENSOR_QUANT8_ASYMM,
277             .dimensions = {1, 4, 4, 1},
278             .numberOfConsumers = 1,
279             .scale = 0.25f,
280             .zeroPoint = 128,
281             .lifetime = OperandLifeTime::MODEL_INPUT,
282             .location = {.poolIndex = 0, .offset = 0, .length = 0},
283         },
284         {
285             .type = OperandType::TENSOR_QUANT16_ASYMM,
286             .dimensions = {4, 4},
287             .numberOfConsumers = 1,
288             .scale = 0.125f,
289             .zeroPoint = 0,
290             .lifetime = OperandLifeTime::MODEL_INPUT,
291             .location = {.poolIndex = 0, .offset = 0, .length = 0},
292         },
293         {
294             .type = OperandType::TENSOR_INT32,
295             .dimensions = {4},
296             .numberOfConsumers = 1,
297             .scale = 0.0f,
298             .zeroPoint = 0,
299             .lifetime = OperandLifeTime::CONSTANT_COPY,
300             .location = {.poolIndex = 0, .offset = 0, .length = 16},
301         },
302         {
303             .type = OperandType::INT32,
304             .dimensions = {},
305             .numberOfConsumers = 1,
306             .scale = 0.0f,
307             .zeroPoint = 0,
308             .lifetime = OperandLifeTime::CONSTANT_COPY,
309             .location = {.poolIndex = 0, .offset = 16, .length = 4},
310         },
311         {
312             .type = OperandType::INT32,
313             .dimensions = {},
314             .numberOfConsumers = 1,
315             .scale = 0.0f,
316             .zeroPoint = 0,
317             .lifetime = OperandLifeTime::CONSTANT_COPY,
318             .location = {.poolIndex = 0, .offset = 20, .length = 4},
319         },
320         {
321             .type = OperandType::FLOAT32,
322             .dimensions = {},
323             .numberOfConsumers = 1,
324             .scale = 0.0f,
325             .zeroPoint = 0,
326             .lifetime = OperandLifeTime::CONSTANT_COPY,
327             .location = {.poolIndex = 0, .offset = 24, .length = 4},
328         },
329         {
330             .type = OperandType::FLOAT32,
331             .dimensions = {},
332             .numberOfConsumers = 1,
333             .scale = 0.0f,
334             .zeroPoint = 0,
335             .lifetime = OperandLifeTime::CONSTANT_COPY,
336             .location = {.poolIndex = 0, .offset = 28, .length = 4},
337         },
338         {
339             .type = OperandType::INT32,
340             .dimensions = {},
341             .numberOfConsumers = 1,
342             .scale = 0.0f,
343             .zeroPoint = 0,
344             .lifetime = OperandLifeTime::CONSTANT_COPY,
345             .location = {.poolIndex = 0, .offset = 32, .length = 4},
346         },
347         {
348             .type = OperandType::INT32,
349             .dimensions = {},
350             .numberOfConsumers = 1,
351             .scale = 0.0f,
352             .zeroPoint = 0,
353             .lifetime = OperandLifeTime::CONSTANT_COPY,
354             .location = {.poolIndex = 0, .offset = 36, .length = 4},
355         },
356         {
357             .type = OperandType::BOOL,
358             .dimensions = {},
359             .numberOfConsumers = 1,
360             .scale = 0.0f,
361             .zeroPoint = 0,
362             .lifetime = OperandLifeTime::CONSTANT_COPY,
363             .location = {.poolIndex = 0, .offset = 40, .length = 1},
364         },
365         {
366             .type = OperandType::TENSOR_QUANT8_ASYMM,
367             .dimensions = {4, 2, 2, 1},
368             .numberOfConsumers = 0,
369             .scale = 0.0625f,
370             .zeroPoint = 128,
371             .lifetime = OperandLifeTime::MODEL_OUTPUT,
372             .location = {.poolIndex = 0, .offset = 0, .length = 0},
373         }
374     };
375 
376     const std::vector<Operation> operations = {
377         {
378             .type = OperationType::ROI_ALIGN,
379             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
380             .outputs = {10},
381         }
382     };
383 
384     const std::vector<uint32_t> inputIndexes = {0, 1};
385     const std::vector<uint32_t> outputIndexes = {10};
386     std::vector<uint8_t> operandValues = {
387       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
388     };
389     const std::vector<hidl_memory> pools = {};
390 
391     return {
392         .operands = operands,
393         .operations = operations,
394         .inputIndexes = inputIndexes,
395         .outputIndexes = outputIndexes,
396         .operandValues = operandValues,
397         .pools = pools,
398     };
399 }
400 
is_ignored_nhwc_quant8(int i)401 inline bool is_ignored_nhwc_quant8(int i) {
402   static std::set<int> ignore = {};
403   return ignore.find(i) != ignore.end();
404 }
405 
406 // Create the model
createTestModel_nhwc_float16()407 Model createTestModel_nhwc_float16() {
408     const std::vector<Operand> operands = {
409         {
410             .type = OperandType::TENSOR_FLOAT16,
411             .dimensions = {1, 4, 4, 1},
412             .numberOfConsumers = 1,
413             .scale = 0.0f,
414             .zeroPoint = 0,
415             .lifetime = OperandLifeTime::MODEL_INPUT,
416             .location = {.poolIndex = 0, .offset = 0, .length = 0},
417         },
418         {
419             .type = OperandType::TENSOR_FLOAT16,
420             .dimensions = {4, 4},
421             .numberOfConsumers = 1,
422             .scale = 0.0f,
423             .zeroPoint = 0,
424             .lifetime = OperandLifeTime::MODEL_INPUT,
425             .location = {.poolIndex = 0, .offset = 0, .length = 0},
426         },
427         {
428             .type = OperandType::TENSOR_INT32,
429             .dimensions = {4},
430             .numberOfConsumers = 1,
431             .scale = 0.0f,
432             .zeroPoint = 0,
433             .lifetime = OperandLifeTime::CONSTANT_COPY,
434             .location = {.poolIndex = 0, .offset = 0, .length = 16},
435         },
436         {
437             .type = OperandType::INT32,
438             .dimensions = {},
439             .numberOfConsumers = 1,
440             .scale = 0.0f,
441             .zeroPoint = 0,
442             .lifetime = OperandLifeTime::CONSTANT_COPY,
443             .location = {.poolIndex = 0, .offset = 16, .length = 4},
444         },
445         {
446             .type = OperandType::INT32,
447             .dimensions = {},
448             .numberOfConsumers = 1,
449             .scale = 0.0f,
450             .zeroPoint = 0,
451             .lifetime = OperandLifeTime::CONSTANT_COPY,
452             .location = {.poolIndex = 0, .offset = 20, .length = 4},
453         },
454         {
455             .type = OperandType::FLOAT16,
456             .dimensions = {},
457             .numberOfConsumers = 1,
458             .scale = 0.0f,
459             .zeroPoint = 0,
460             .lifetime = OperandLifeTime::CONSTANT_COPY,
461             .location = {.poolIndex = 0, .offset = 24, .length = 2},
462         },
463         {
464             .type = OperandType::FLOAT16,
465             .dimensions = {},
466             .numberOfConsumers = 1,
467             .scale = 0.0f,
468             .zeroPoint = 0,
469             .lifetime = OperandLifeTime::CONSTANT_COPY,
470             .location = {.poolIndex = 0, .offset = 26, .length = 2},
471         },
472         {
473             .type = OperandType::INT32,
474             .dimensions = {},
475             .numberOfConsumers = 1,
476             .scale = 0.0f,
477             .zeroPoint = 0,
478             .lifetime = OperandLifeTime::CONSTANT_COPY,
479             .location = {.poolIndex = 0, .offset = 28, .length = 4},
480         },
481         {
482             .type = OperandType::INT32,
483             .dimensions = {},
484             .numberOfConsumers = 1,
485             .scale = 0.0f,
486             .zeroPoint = 0,
487             .lifetime = OperandLifeTime::CONSTANT_COPY,
488             .location = {.poolIndex = 0, .offset = 32, .length = 4},
489         },
490         {
491             .type = OperandType::BOOL,
492             .dimensions = {},
493             .numberOfConsumers = 1,
494             .scale = 0.0f,
495             .zeroPoint = 0,
496             .lifetime = OperandLifeTime::CONSTANT_COPY,
497             .location = {.poolIndex = 0, .offset = 36, .length = 1},
498         },
499         {
500             .type = OperandType::TENSOR_FLOAT16,
501             .dimensions = {4, 2, 2, 1},
502             .numberOfConsumers = 0,
503             .scale = 0.0f,
504             .zeroPoint = 0,
505             .lifetime = OperandLifeTime::MODEL_OUTPUT,
506             .location = {.poolIndex = 0, .offset = 0, .length = 0},
507         }
508     };
509 
510     const std::vector<Operation> operations = {
511         {
512             .type = OperationType::ROI_ALIGN,
513             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
514             .outputs = {10},
515         }
516     };
517 
518     const std::vector<uint32_t> inputIndexes = {0, 1};
519     const std::vector<uint32_t> outputIndexes = {10};
520     std::vector<uint8_t> operandValues = {
521       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
522     };
523     const std::vector<hidl_memory> pools = {};
524 
525     return {
526         .operands = operands,
527         .operations = operations,
528         .inputIndexes = inputIndexes,
529         .outputIndexes = outputIndexes,
530         .operandValues = operandValues,
531         .pools = pools,
532     };
533 }
534 
is_ignored_nhwc_float16(int i)535 inline bool is_ignored_nhwc_float16(int i) {
536   static std::set<int> ignore = {};
537   return ignore.find(i) != ignore.end();
538 }
539 
540 // Create the model
createTestModel_nchw()541 Model createTestModel_nchw() {
542     const std::vector<Operand> operands = {
543         {
544             .type = OperandType::TENSOR_FLOAT32,
545             .dimensions = {1, 1, 4, 4},
546             .numberOfConsumers = 1,
547             .scale = 0.0f,
548             .zeroPoint = 0,
549             .lifetime = OperandLifeTime::MODEL_INPUT,
550             .location = {.poolIndex = 0, .offset = 0, .length = 0},
551         },
552         {
553             .type = OperandType::TENSOR_FLOAT32,
554             .dimensions = {4, 4},
555             .numberOfConsumers = 1,
556             .scale = 0.0f,
557             .zeroPoint = 0,
558             .lifetime = OperandLifeTime::MODEL_INPUT,
559             .location = {.poolIndex = 0, .offset = 0, .length = 0},
560         },
561         {
562             .type = OperandType::TENSOR_INT32,
563             .dimensions = {4},
564             .numberOfConsumers = 1,
565             .scale = 0.0f,
566             .zeroPoint = 0,
567             .lifetime = OperandLifeTime::CONSTANT_COPY,
568             .location = {.poolIndex = 0, .offset = 0, .length = 16},
569         },
570         {
571             .type = OperandType::INT32,
572             .dimensions = {},
573             .numberOfConsumers = 1,
574             .scale = 0.0f,
575             .zeroPoint = 0,
576             .lifetime = OperandLifeTime::CONSTANT_COPY,
577             .location = {.poolIndex = 0, .offset = 16, .length = 4},
578         },
579         {
580             .type = OperandType::INT32,
581             .dimensions = {},
582             .numberOfConsumers = 1,
583             .scale = 0.0f,
584             .zeroPoint = 0,
585             .lifetime = OperandLifeTime::CONSTANT_COPY,
586             .location = {.poolIndex = 0, .offset = 20, .length = 4},
587         },
588         {
589             .type = OperandType::FLOAT32,
590             .dimensions = {},
591             .numberOfConsumers = 1,
592             .scale = 0.0f,
593             .zeroPoint = 0,
594             .lifetime = OperandLifeTime::CONSTANT_COPY,
595             .location = {.poolIndex = 0, .offset = 24, .length = 4},
596         },
597         {
598             .type = OperandType::FLOAT32,
599             .dimensions = {},
600             .numberOfConsumers = 1,
601             .scale = 0.0f,
602             .zeroPoint = 0,
603             .lifetime = OperandLifeTime::CONSTANT_COPY,
604             .location = {.poolIndex = 0, .offset = 28, .length = 4},
605         },
606         {
607             .type = OperandType::INT32,
608             .dimensions = {},
609             .numberOfConsumers = 1,
610             .scale = 0.0f,
611             .zeroPoint = 0,
612             .lifetime = OperandLifeTime::CONSTANT_COPY,
613             .location = {.poolIndex = 0, .offset = 32, .length = 4},
614         },
615         {
616             .type = OperandType::INT32,
617             .dimensions = {},
618             .numberOfConsumers = 1,
619             .scale = 0.0f,
620             .zeroPoint = 0,
621             .lifetime = OperandLifeTime::CONSTANT_COPY,
622             .location = {.poolIndex = 0, .offset = 36, .length = 4},
623         },
624         {
625             .type = OperandType::BOOL,
626             .dimensions = {},
627             .numberOfConsumers = 1,
628             .scale = 0.0f,
629             .zeroPoint = 0,
630             .lifetime = OperandLifeTime::CONSTANT_COPY,
631             .location = {.poolIndex = 0, .offset = 40, .length = 1},
632         },
633         {
634             .type = OperandType::TENSOR_FLOAT32,
635             .dimensions = {4, 1, 2, 2},
636             .numberOfConsumers = 0,
637             .scale = 0.0f,
638             .zeroPoint = 0,
639             .lifetime = OperandLifeTime::MODEL_OUTPUT,
640             .location = {.poolIndex = 0, .offset = 0, .length = 0},
641         }
642     };
643 
644     const std::vector<Operation> operations = {
645         {
646             .type = OperationType::ROI_ALIGN,
647             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
648             .outputs = {10},
649         }
650     };
651 
652     const std::vector<uint32_t> inputIndexes = {0, 1};
653     const std::vector<uint32_t> outputIndexes = {10};
654     std::vector<uint8_t> operandValues = {
655       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
656     };
657     const std::vector<hidl_memory> pools = {};
658 
659     return {
660         .operands = operands,
661         .operations = operations,
662         .inputIndexes = inputIndexes,
663         .outputIndexes = outputIndexes,
664         .operandValues = operandValues,
665         .pools = pools,
666     };
667 }
668 
is_ignored_nchw(int i)669 inline bool is_ignored_nchw(int i) {
670   static std::set<int> ignore = {};
671   return ignore.find(i) != ignore.end();
672 }
673 
674 // Create the model
createTestModel_nchw_relaxed()675 Model createTestModel_nchw_relaxed() {
676     const std::vector<Operand> operands = {
677         {
678             .type = OperandType::TENSOR_FLOAT32,
679             .dimensions = {1, 1, 4, 4},
680             .numberOfConsumers = 1,
681             .scale = 0.0f,
682             .zeroPoint = 0,
683             .lifetime = OperandLifeTime::MODEL_INPUT,
684             .location = {.poolIndex = 0, .offset = 0, .length = 0},
685         },
686         {
687             .type = OperandType::TENSOR_FLOAT32,
688             .dimensions = {4, 4},
689             .numberOfConsumers = 1,
690             .scale = 0.0f,
691             .zeroPoint = 0,
692             .lifetime = OperandLifeTime::MODEL_INPUT,
693             .location = {.poolIndex = 0, .offset = 0, .length = 0},
694         },
695         {
696             .type = OperandType::TENSOR_INT32,
697             .dimensions = {4},
698             .numberOfConsumers = 1,
699             .scale = 0.0f,
700             .zeroPoint = 0,
701             .lifetime = OperandLifeTime::CONSTANT_COPY,
702             .location = {.poolIndex = 0, .offset = 0, .length = 16},
703         },
704         {
705             .type = OperandType::INT32,
706             .dimensions = {},
707             .numberOfConsumers = 1,
708             .scale = 0.0f,
709             .zeroPoint = 0,
710             .lifetime = OperandLifeTime::CONSTANT_COPY,
711             .location = {.poolIndex = 0, .offset = 16, .length = 4},
712         },
713         {
714             .type = OperandType::INT32,
715             .dimensions = {},
716             .numberOfConsumers = 1,
717             .scale = 0.0f,
718             .zeroPoint = 0,
719             .lifetime = OperandLifeTime::CONSTANT_COPY,
720             .location = {.poolIndex = 0, .offset = 20, .length = 4},
721         },
722         {
723             .type = OperandType::FLOAT32,
724             .dimensions = {},
725             .numberOfConsumers = 1,
726             .scale = 0.0f,
727             .zeroPoint = 0,
728             .lifetime = OperandLifeTime::CONSTANT_COPY,
729             .location = {.poolIndex = 0, .offset = 24, .length = 4},
730         },
731         {
732             .type = OperandType::FLOAT32,
733             .dimensions = {},
734             .numberOfConsumers = 1,
735             .scale = 0.0f,
736             .zeroPoint = 0,
737             .lifetime = OperandLifeTime::CONSTANT_COPY,
738             .location = {.poolIndex = 0, .offset = 28, .length = 4},
739         },
740         {
741             .type = OperandType::INT32,
742             .dimensions = {},
743             .numberOfConsumers = 1,
744             .scale = 0.0f,
745             .zeroPoint = 0,
746             .lifetime = OperandLifeTime::CONSTANT_COPY,
747             .location = {.poolIndex = 0, .offset = 32, .length = 4},
748         },
749         {
750             .type = OperandType::INT32,
751             .dimensions = {},
752             .numberOfConsumers = 1,
753             .scale = 0.0f,
754             .zeroPoint = 0,
755             .lifetime = OperandLifeTime::CONSTANT_COPY,
756             .location = {.poolIndex = 0, .offset = 36, .length = 4},
757         },
758         {
759             .type = OperandType::BOOL,
760             .dimensions = {},
761             .numberOfConsumers = 1,
762             .scale = 0.0f,
763             .zeroPoint = 0,
764             .lifetime = OperandLifeTime::CONSTANT_COPY,
765             .location = {.poolIndex = 0, .offset = 40, .length = 1},
766         },
767         {
768             .type = OperandType::TENSOR_FLOAT32,
769             .dimensions = {4, 1, 2, 2},
770             .numberOfConsumers = 0,
771             .scale = 0.0f,
772             .zeroPoint = 0,
773             .lifetime = OperandLifeTime::MODEL_OUTPUT,
774             .location = {.poolIndex = 0, .offset = 0, .length = 0},
775         }
776     };
777 
778     const std::vector<Operation> operations = {
779         {
780             .type = OperationType::ROI_ALIGN,
781             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
782             .outputs = {10},
783         }
784     };
785 
786     const std::vector<uint32_t> inputIndexes = {0, 1};
787     const std::vector<uint32_t> outputIndexes = {10};
788     std::vector<uint8_t> operandValues = {
789       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
790     };
791     const std::vector<hidl_memory> pools = {};
792 
793     return {
794         .operands = operands,
795         .operations = operations,
796         .inputIndexes = inputIndexes,
797         .outputIndexes = outputIndexes,
798         .operandValues = operandValues,
799         .pools = pools,
800         .relaxComputationFloat32toFloat16 = true,
801     };
802 }
803 
is_ignored_nchw_relaxed(int i)804 inline bool is_ignored_nchw_relaxed(int i) {
805   static std::set<int> ignore = {};
806   return ignore.find(i) != ignore.end();
807 }
808 
809 // Create the model
createTestModel_nchw_quant8()810 Model createTestModel_nchw_quant8() {
811     const std::vector<Operand> operands = {
812         {
813             .type = OperandType::TENSOR_QUANT8_ASYMM,
814             .dimensions = {1, 1, 4, 4},
815             .numberOfConsumers = 1,
816             .scale = 0.25f,
817             .zeroPoint = 128,
818             .lifetime = OperandLifeTime::MODEL_INPUT,
819             .location = {.poolIndex = 0, .offset = 0, .length = 0},
820         },
821         {
822             .type = OperandType::TENSOR_QUANT16_ASYMM,
823             .dimensions = {4, 4},
824             .numberOfConsumers = 1,
825             .scale = 0.125f,
826             .zeroPoint = 0,
827             .lifetime = OperandLifeTime::MODEL_INPUT,
828             .location = {.poolIndex = 0, .offset = 0, .length = 0},
829         },
830         {
831             .type = OperandType::TENSOR_INT32,
832             .dimensions = {4},
833             .numberOfConsumers = 1,
834             .scale = 0.0f,
835             .zeroPoint = 0,
836             .lifetime = OperandLifeTime::CONSTANT_COPY,
837             .location = {.poolIndex = 0, .offset = 0, .length = 16},
838         },
839         {
840             .type = OperandType::INT32,
841             .dimensions = {},
842             .numberOfConsumers = 1,
843             .scale = 0.0f,
844             .zeroPoint = 0,
845             .lifetime = OperandLifeTime::CONSTANT_COPY,
846             .location = {.poolIndex = 0, .offset = 16, .length = 4},
847         },
848         {
849             .type = OperandType::INT32,
850             .dimensions = {},
851             .numberOfConsumers = 1,
852             .scale = 0.0f,
853             .zeroPoint = 0,
854             .lifetime = OperandLifeTime::CONSTANT_COPY,
855             .location = {.poolIndex = 0, .offset = 20, .length = 4},
856         },
857         {
858             .type = OperandType::FLOAT32,
859             .dimensions = {},
860             .numberOfConsumers = 1,
861             .scale = 0.0f,
862             .zeroPoint = 0,
863             .lifetime = OperandLifeTime::CONSTANT_COPY,
864             .location = {.poolIndex = 0, .offset = 24, .length = 4},
865         },
866         {
867             .type = OperandType::FLOAT32,
868             .dimensions = {},
869             .numberOfConsumers = 1,
870             .scale = 0.0f,
871             .zeroPoint = 0,
872             .lifetime = OperandLifeTime::CONSTANT_COPY,
873             .location = {.poolIndex = 0, .offset = 28, .length = 4},
874         },
875         {
876             .type = OperandType::INT32,
877             .dimensions = {},
878             .numberOfConsumers = 1,
879             .scale = 0.0f,
880             .zeroPoint = 0,
881             .lifetime = OperandLifeTime::CONSTANT_COPY,
882             .location = {.poolIndex = 0, .offset = 32, .length = 4},
883         },
884         {
885             .type = OperandType::INT32,
886             .dimensions = {},
887             .numberOfConsumers = 1,
888             .scale = 0.0f,
889             .zeroPoint = 0,
890             .lifetime = OperandLifeTime::CONSTANT_COPY,
891             .location = {.poolIndex = 0, .offset = 36, .length = 4},
892         },
893         {
894             .type = OperandType::BOOL,
895             .dimensions = {},
896             .numberOfConsumers = 1,
897             .scale = 0.0f,
898             .zeroPoint = 0,
899             .lifetime = OperandLifeTime::CONSTANT_COPY,
900             .location = {.poolIndex = 0, .offset = 40, .length = 1},
901         },
902         {
903             .type = OperandType::TENSOR_QUANT8_ASYMM,
904             .dimensions = {4, 1, 2, 2},
905             .numberOfConsumers = 0,
906             .scale = 0.0625f,
907             .zeroPoint = 128,
908             .lifetime = OperandLifeTime::MODEL_OUTPUT,
909             .location = {.poolIndex = 0, .offset = 0, .length = 0},
910         }
911     };
912 
913     const std::vector<Operation> operations = {
914         {
915             .type = OperationType::ROI_ALIGN,
916             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
917             .outputs = {10},
918         }
919     };
920 
921     const std::vector<uint32_t> inputIndexes = {0, 1};
922     const std::vector<uint32_t> outputIndexes = {10};
923     std::vector<uint8_t> operandValues = {
924       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
925     };
926     const std::vector<hidl_memory> pools = {};
927 
928     return {
929         .operands = operands,
930         .operations = operations,
931         .inputIndexes = inputIndexes,
932         .outputIndexes = outputIndexes,
933         .operandValues = operandValues,
934         .pools = pools,
935     };
936 }
937 
is_ignored_nchw_quant8(int i)938 inline bool is_ignored_nchw_quant8(int i) {
939   static std::set<int> ignore = {};
940   return ignore.find(i) != ignore.end();
941 }
942 
943 // Create the model
createTestModel_nchw_float16()944 Model createTestModel_nchw_float16() {
945     const std::vector<Operand> operands = {
946         {
947             .type = OperandType::TENSOR_FLOAT16,
948             .dimensions = {1, 1, 4, 4},
949             .numberOfConsumers = 1,
950             .scale = 0.0f,
951             .zeroPoint = 0,
952             .lifetime = OperandLifeTime::MODEL_INPUT,
953             .location = {.poolIndex = 0, .offset = 0, .length = 0},
954         },
955         {
956             .type = OperandType::TENSOR_FLOAT16,
957             .dimensions = {4, 4},
958             .numberOfConsumers = 1,
959             .scale = 0.0f,
960             .zeroPoint = 0,
961             .lifetime = OperandLifeTime::MODEL_INPUT,
962             .location = {.poolIndex = 0, .offset = 0, .length = 0},
963         },
964         {
965             .type = OperandType::TENSOR_INT32,
966             .dimensions = {4},
967             .numberOfConsumers = 1,
968             .scale = 0.0f,
969             .zeroPoint = 0,
970             .lifetime = OperandLifeTime::CONSTANT_COPY,
971             .location = {.poolIndex = 0, .offset = 0, .length = 16},
972         },
973         {
974             .type = OperandType::INT32,
975             .dimensions = {},
976             .numberOfConsumers = 1,
977             .scale = 0.0f,
978             .zeroPoint = 0,
979             .lifetime = OperandLifeTime::CONSTANT_COPY,
980             .location = {.poolIndex = 0, .offset = 16, .length = 4},
981         },
982         {
983             .type = OperandType::INT32,
984             .dimensions = {},
985             .numberOfConsumers = 1,
986             .scale = 0.0f,
987             .zeroPoint = 0,
988             .lifetime = OperandLifeTime::CONSTANT_COPY,
989             .location = {.poolIndex = 0, .offset = 20, .length = 4},
990         },
991         {
992             .type = OperandType::FLOAT16,
993             .dimensions = {},
994             .numberOfConsumers = 1,
995             .scale = 0.0f,
996             .zeroPoint = 0,
997             .lifetime = OperandLifeTime::CONSTANT_COPY,
998             .location = {.poolIndex = 0, .offset = 24, .length = 2},
999         },
1000         {
1001             .type = OperandType::FLOAT16,
1002             .dimensions = {},
1003             .numberOfConsumers = 1,
1004             .scale = 0.0f,
1005             .zeroPoint = 0,
1006             .lifetime = OperandLifeTime::CONSTANT_COPY,
1007             .location = {.poolIndex = 0, .offset = 26, .length = 2},
1008         },
1009         {
1010             .type = OperandType::INT32,
1011             .dimensions = {},
1012             .numberOfConsumers = 1,
1013             .scale = 0.0f,
1014             .zeroPoint = 0,
1015             .lifetime = OperandLifeTime::CONSTANT_COPY,
1016             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1017         },
1018         {
1019             .type = OperandType::INT32,
1020             .dimensions = {},
1021             .numberOfConsumers = 1,
1022             .scale = 0.0f,
1023             .zeroPoint = 0,
1024             .lifetime = OperandLifeTime::CONSTANT_COPY,
1025             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1026         },
1027         {
1028             .type = OperandType::BOOL,
1029             .dimensions = {},
1030             .numberOfConsumers = 1,
1031             .scale = 0.0f,
1032             .zeroPoint = 0,
1033             .lifetime = OperandLifeTime::CONSTANT_COPY,
1034             .location = {.poolIndex = 0, .offset = 36, .length = 1},
1035         },
1036         {
1037             .type = OperandType::TENSOR_FLOAT16,
1038             .dimensions = {4, 1, 2, 2},
1039             .numberOfConsumers = 0,
1040             .scale = 0.0f,
1041             .zeroPoint = 0,
1042             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1043             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1044         }
1045     };
1046 
1047     const std::vector<Operation> operations = {
1048         {
1049             .type = OperationType::ROI_ALIGN,
1050             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1051             .outputs = {10},
1052         }
1053     };
1054 
1055     const std::vector<uint32_t> inputIndexes = {0, 1};
1056     const std::vector<uint32_t> outputIndexes = {10};
1057     std::vector<uint8_t> operandValues = {
1058       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
1059     };
1060     const std::vector<hidl_memory> pools = {};
1061 
1062     return {
1063         .operands = operands,
1064         .operations = operations,
1065         .inputIndexes = inputIndexes,
1066         .outputIndexes = outputIndexes,
1067         .operandValues = operandValues,
1068         .pools = pools,
1069     };
1070 }
1071 
is_ignored_nchw_float16(int i)1072 inline bool is_ignored_nchw_float16(int i) {
1073   static std::set<int> ignore = {};
1074   return ignore.find(i) != ignore.end();
1075 }
1076 
1077 // Create the model
createTestModel_dynamic_output_shape_nhwc()1078 Model createTestModel_dynamic_output_shape_nhwc() {
1079     const std::vector<Operand> operands = {
1080         {
1081             .type = OperandType::TENSOR_FLOAT32,
1082             .dimensions = {1, 4, 4, 1},
1083             .numberOfConsumers = 1,
1084             .scale = 0.0f,
1085             .zeroPoint = 0,
1086             .lifetime = OperandLifeTime::MODEL_INPUT,
1087             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1088         },
1089         {
1090             .type = OperandType::TENSOR_FLOAT32,
1091             .dimensions = {4, 4},
1092             .numberOfConsumers = 1,
1093             .scale = 0.0f,
1094             .zeroPoint = 0,
1095             .lifetime = OperandLifeTime::MODEL_INPUT,
1096             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1097         },
1098         {
1099             .type = OperandType::TENSOR_INT32,
1100             .dimensions = {4},
1101             .numberOfConsumers = 1,
1102             .scale = 0.0f,
1103             .zeroPoint = 0,
1104             .lifetime = OperandLifeTime::CONSTANT_COPY,
1105             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1106         },
1107         {
1108             .type = OperandType::INT32,
1109             .dimensions = {},
1110             .numberOfConsumers = 1,
1111             .scale = 0.0f,
1112             .zeroPoint = 0,
1113             .lifetime = OperandLifeTime::CONSTANT_COPY,
1114             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1115         },
1116         {
1117             .type = OperandType::INT32,
1118             .dimensions = {},
1119             .numberOfConsumers = 1,
1120             .scale = 0.0f,
1121             .zeroPoint = 0,
1122             .lifetime = OperandLifeTime::CONSTANT_COPY,
1123             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1124         },
1125         {
1126             .type = OperandType::FLOAT32,
1127             .dimensions = {},
1128             .numberOfConsumers = 1,
1129             .scale = 0.0f,
1130             .zeroPoint = 0,
1131             .lifetime = OperandLifeTime::CONSTANT_COPY,
1132             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1133         },
1134         {
1135             .type = OperandType::FLOAT32,
1136             .dimensions = {},
1137             .numberOfConsumers = 1,
1138             .scale = 0.0f,
1139             .zeroPoint = 0,
1140             .lifetime = OperandLifeTime::CONSTANT_COPY,
1141             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1142         },
1143         {
1144             .type = OperandType::INT32,
1145             .dimensions = {},
1146             .numberOfConsumers = 1,
1147             .scale = 0.0f,
1148             .zeroPoint = 0,
1149             .lifetime = OperandLifeTime::CONSTANT_COPY,
1150             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1151         },
1152         {
1153             .type = OperandType::INT32,
1154             .dimensions = {},
1155             .numberOfConsumers = 1,
1156             .scale = 0.0f,
1157             .zeroPoint = 0,
1158             .lifetime = OperandLifeTime::CONSTANT_COPY,
1159             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1160         },
1161         {
1162             .type = OperandType::BOOL,
1163             .dimensions = {},
1164             .numberOfConsumers = 1,
1165             .scale = 0.0f,
1166             .zeroPoint = 0,
1167             .lifetime = OperandLifeTime::CONSTANT_COPY,
1168             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1169         },
1170         {
1171             .type = OperandType::TENSOR_FLOAT32,
1172             .dimensions = {0, 0, 0, 0},
1173             .numberOfConsumers = 0,
1174             .scale = 0.0f,
1175             .zeroPoint = 0,
1176             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1177             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1178         }
1179     };
1180 
1181     const std::vector<Operation> operations = {
1182         {
1183             .type = OperationType::ROI_ALIGN,
1184             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1185             .outputs = {10},
1186         }
1187     };
1188 
1189     const std::vector<uint32_t> inputIndexes = {0, 1};
1190     const std::vector<uint32_t> outputIndexes = {10};
1191     std::vector<uint8_t> operandValues = {
1192       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
1193     };
1194     const std::vector<hidl_memory> pools = {};
1195 
1196     return {
1197         .operands = operands,
1198         .operations = operations,
1199         .inputIndexes = inputIndexes,
1200         .outputIndexes = outputIndexes,
1201         .operandValues = operandValues,
1202         .pools = pools,
1203     };
1204 }
1205 
is_ignored_dynamic_output_shape_nhwc(int i)1206 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
1207   static std::set<int> ignore = {};
1208   return ignore.find(i) != ignore.end();
1209 }
1210 
1211 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed()1212 Model createTestModel_dynamic_output_shape_nhwc_relaxed() {
1213     const std::vector<Operand> operands = {
1214         {
1215             .type = OperandType::TENSOR_FLOAT32,
1216             .dimensions = {1, 4, 4, 1},
1217             .numberOfConsumers = 1,
1218             .scale = 0.0f,
1219             .zeroPoint = 0,
1220             .lifetime = OperandLifeTime::MODEL_INPUT,
1221             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1222         },
1223         {
1224             .type = OperandType::TENSOR_FLOAT32,
1225             .dimensions = {4, 4},
1226             .numberOfConsumers = 1,
1227             .scale = 0.0f,
1228             .zeroPoint = 0,
1229             .lifetime = OperandLifeTime::MODEL_INPUT,
1230             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1231         },
1232         {
1233             .type = OperandType::TENSOR_INT32,
1234             .dimensions = {4},
1235             .numberOfConsumers = 1,
1236             .scale = 0.0f,
1237             .zeroPoint = 0,
1238             .lifetime = OperandLifeTime::CONSTANT_COPY,
1239             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1240         },
1241         {
1242             .type = OperandType::INT32,
1243             .dimensions = {},
1244             .numberOfConsumers = 1,
1245             .scale = 0.0f,
1246             .zeroPoint = 0,
1247             .lifetime = OperandLifeTime::CONSTANT_COPY,
1248             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1249         },
1250         {
1251             .type = OperandType::INT32,
1252             .dimensions = {},
1253             .numberOfConsumers = 1,
1254             .scale = 0.0f,
1255             .zeroPoint = 0,
1256             .lifetime = OperandLifeTime::CONSTANT_COPY,
1257             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1258         },
1259         {
1260             .type = OperandType::FLOAT32,
1261             .dimensions = {},
1262             .numberOfConsumers = 1,
1263             .scale = 0.0f,
1264             .zeroPoint = 0,
1265             .lifetime = OperandLifeTime::CONSTANT_COPY,
1266             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1267         },
1268         {
1269             .type = OperandType::FLOAT32,
1270             .dimensions = {},
1271             .numberOfConsumers = 1,
1272             .scale = 0.0f,
1273             .zeroPoint = 0,
1274             .lifetime = OperandLifeTime::CONSTANT_COPY,
1275             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1276         },
1277         {
1278             .type = OperandType::INT32,
1279             .dimensions = {},
1280             .numberOfConsumers = 1,
1281             .scale = 0.0f,
1282             .zeroPoint = 0,
1283             .lifetime = OperandLifeTime::CONSTANT_COPY,
1284             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1285         },
1286         {
1287             .type = OperandType::INT32,
1288             .dimensions = {},
1289             .numberOfConsumers = 1,
1290             .scale = 0.0f,
1291             .zeroPoint = 0,
1292             .lifetime = OperandLifeTime::CONSTANT_COPY,
1293             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1294         },
1295         {
1296             .type = OperandType::BOOL,
1297             .dimensions = {},
1298             .numberOfConsumers = 1,
1299             .scale = 0.0f,
1300             .zeroPoint = 0,
1301             .lifetime = OperandLifeTime::CONSTANT_COPY,
1302             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1303         },
1304         {
1305             .type = OperandType::TENSOR_FLOAT32,
1306             .dimensions = {0, 0, 0, 0},
1307             .numberOfConsumers = 0,
1308             .scale = 0.0f,
1309             .zeroPoint = 0,
1310             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1311             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1312         }
1313     };
1314 
1315     const std::vector<Operation> operations = {
1316         {
1317             .type = OperationType::ROI_ALIGN,
1318             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1319             .outputs = {10},
1320         }
1321     };
1322 
1323     const std::vector<uint32_t> inputIndexes = {0, 1};
1324     const std::vector<uint32_t> outputIndexes = {10};
1325     std::vector<uint8_t> operandValues = {
1326       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
1327     };
1328     const std::vector<hidl_memory> pools = {};
1329 
1330     return {
1331         .operands = operands,
1332         .operations = operations,
1333         .inputIndexes = inputIndexes,
1334         .outputIndexes = outputIndexes,
1335         .operandValues = operandValues,
1336         .pools = pools,
1337         .relaxComputationFloat32toFloat16 = true,
1338     };
1339 }
1340 
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)1341 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
1342   static std::set<int> ignore = {};
1343   return ignore.find(i) != ignore.end();
1344 }
1345 
1346 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8()1347 Model createTestModel_dynamic_output_shape_nhwc_quant8() {
1348     const std::vector<Operand> operands = {
1349         {
1350             .type = OperandType::TENSOR_QUANT8_ASYMM,
1351             .dimensions = {1, 4, 4, 1},
1352             .numberOfConsumers = 1,
1353             .scale = 0.25f,
1354             .zeroPoint = 128,
1355             .lifetime = OperandLifeTime::MODEL_INPUT,
1356             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1357         },
1358         {
1359             .type = OperandType::TENSOR_QUANT16_ASYMM,
1360             .dimensions = {4, 4},
1361             .numberOfConsumers = 1,
1362             .scale = 0.125f,
1363             .zeroPoint = 0,
1364             .lifetime = OperandLifeTime::MODEL_INPUT,
1365             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1366         },
1367         {
1368             .type = OperandType::TENSOR_INT32,
1369             .dimensions = {4},
1370             .numberOfConsumers = 1,
1371             .scale = 0.0f,
1372             .zeroPoint = 0,
1373             .lifetime = OperandLifeTime::CONSTANT_COPY,
1374             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1375         },
1376         {
1377             .type = OperandType::INT32,
1378             .dimensions = {},
1379             .numberOfConsumers = 1,
1380             .scale = 0.0f,
1381             .zeroPoint = 0,
1382             .lifetime = OperandLifeTime::CONSTANT_COPY,
1383             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1384         },
1385         {
1386             .type = OperandType::INT32,
1387             .dimensions = {},
1388             .numberOfConsumers = 1,
1389             .scale = 0.0f,
1390             .zeroPoint = 0,
1391             .lifetime = OperandLifeTime::CONSTANT_COPY,
1392             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1393         },
1394         {
1395             .type = OperandType::FLOAT32,
1396             .dimensions = {},
1397             .numberOfConsumers = 1,
1398             .scale = 0.0f,
1399             .zeroPoint = 0,
1400             .lifetime = OperandLifeTime::CONSTANT_COPY,
1401             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1402         },
1403         {
1404             .type = OperandType::FLOAT32,
1405             .dimensions = {},
1406             .numberOfConsumers = 1,
1407             .scale = 0.0f,
1408             .zeroPoint = 0,
1409             .lifetime = OperandLifeTime::CONSTANT_COPY,
1410             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1411         },
1412         {
1413             .type = OperandType::INT32,
1414             .dimensions = {},
1415             .numberOfConsumers = 1,
1416             .scale = 0.0f,
1417             .zeroPoint = 0,
1418             .lifetime = OperandLifeTime::CONSTANT_COPY,
1419             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1420         },
1421         {
1422             .type = OperandType::INT32,
1423             .dimensions = {},
1424             .numberOfConsumers = 1,
1425             .scale = 0.0f,
1426             .zeroPoint = 0,
1427             .lifetime = OperandLifeTime::CONSTANT_COPY,
1428             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1429         },
1430         {
1431             .type = OperandType::BOOL,
1432             .dimensions = {},
1433             .numberOfConsumers = 1,
1434             .scale = 0.0f,
1435             .zeroPoint = 0,
1436             .lifetime = OperandLifeTime::CONSTANT_COPY,
1437             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1438         },
1439         {
1440             .type = OperandType::TENSOR_QUANT8_ASYMM,
1441             .dimensions = {0, 0, 0, 0},
1442             .numberOfConsumers = 0,
1443             .scale = 0.0625f,
1444             .zeroPoint = 128,
1445             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1446             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1447         }
1448     };
1449 
1450     const std::vector<Operation> operations = {
1451         {
1452             .type = OperationType::ROI_ALIGN,
1453             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1454             .outputs = {10},
1455         }
1456     };
1457 
1458     const std::vector<uint32_t> inputIndexes = {0, 1};
1459     const std::vector<uint32_t> outputIndexes = {10};
1460     std::vector<uint8_t> operandValues = {
1461       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
1462     };
1463     const std::vector<hidl_memory> pools = {};
1464 
1465     return {
1466         .operands = operands,
1467         .operations = operations,
1468         .inputIndexes = inputIndexes,
1469         .outputIndexes = outputIndexes,
1470         .operandValues = operandValues,
1471         .pools = pools,
1472     };
1473 }
1474 
is_ignored_dynamic_output_shape_nhwc_quant8(int i)1475 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
1476   static std::set<int> ignore = {};
1477   return ignore.find(i) != ignore.end();
1478 }
1479 
1480 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16()1481 Model createTestModel_dynamic_output_shape_nhwc_float16() {
1482     const std::vector<Operand> operands = {
1483         {
1484             .type = OperandType::TENSOR_FLOAT16,
1485             .dimensions = {1, 4, 4, 1},
1486             .numberOfConsumers = 1,
1487             .scale = 0.0f,
1488             .zeroPoint = 0,
1489             .lifetime = OperandLifeTime::MODEL_INPUT,
1490             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1491         },
1492         {
1493             .type = OperandType::TENSOR_FLOAT16,
1494             .dimensions = {4, 4},
1495             .numberOfConsumers = 1,
1496             .scale = 0.0f,
1497             .zeroPoint = 0,
1498             .lifetime = OperandLifeTime::MODEL_INPUT,
1499             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1500         },
1501         {
1502             .type = OperandType::TENSOR_INT32,
1503             .dimensions = {4},
1504             .numberOfConsumers = 1,
1505             .scale = 0.0f,
1506             .zeroPoint = 0,
1507             .lifetime = OperandLifeTime::CONSTANT_COPY,
1508             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1509         },
1510         {
1511             .type = OperandType::INT32,
1512             .dimensions = {},
1513             .numberOfConsumers = 1,
1514             .scale = 0.0f,
1515             .zeroPoint = 0,
1516             .lifetime = OperandLifeTime::CONSTANT_COPY,
1517             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1518         },
1519         {
1520             .type = OperandType::INT32,
1521             .dimensions = {},
1522             .numberOfConsumers = 1,
1523             .scale = 0.0f,
1524             .zeroPoint = 0,
1525             .lifetime = OperandLifeTime::CONSTANT_COPY,
1526             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1527         },
1528         {
1529             .type = OperandType::FLOAT16,
1530             .dimensions = {},
1531             .numberOfConsumers = 1,
1532             .scale = 0.0f,
1533             .zeroPoint = 0,
1534             .lifetime = OperandLifeTime::CONSTANT_COPY,
1535             .location = {.poolIndex = 0, .offset = 24, .length = 2},
1536         },
1537         {
1538             .type = OperandType::FLOAT16,
1539             .dimensions = {},
1540             .numberOfConsumers = 1,
1541             .scale = 0.0f,
1542             .zeroPoint = 0,
1543             .lifetime = OperandLifeTime::CONSTANT_COPY,
1544             .location = {.poolIndex = 0, .offset = 26, .length = 2},
1545         },
1546         {
1547             .type = OperandType::INT32,
1548             .dimensions = {},
1549             .numberOfConsumers = 1,
1550             .scale = 0.0f,
1551             .zeroPoint = 0,
1552             .lifetime = OperandLifeTime::CONSTANT_COPY,
1553             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1554         },
1555         {
1556             .type = OperandType::INT32,
1557             .dimensions = {},
1558             .numberOfConsumers = 1,
1559             .scale = 0.0f,
1560             .zeroPoint = 0,
1561             .lifetime = OperandLifeTime::CONSTANT_COPY,
1562             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1563         },
1564         {
1565             .type = OperandType::BOOL,
1566             .dimensions = {},
1567             .numberOfConsumers = 1,
1568             .scale = 0.0f,
1569             .zeroPoint = 0,
1570             .lifetime = OperandLifeTime::CONSTANT_COPY,
1571             .location = {.poolIndex = 0, .offset = 36, .length = 1},
1572         },
1573         {
1574             .type = OperandType::TENSOR_FLOAT16,
1575             .dimensions = {0, 0, 0, 0},
1576             .numberOfConsumers = 0,
1577             .scale = 0.0f,
1578             .zeroPoint = 0,
1579             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1580             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1581         }
1582     };
1583 
1584     const std::vector<Operation> operations = {
1585         {
1586             .type = OperationType::ROI_ALIGN,
1587             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1588             .outputs = {10},
1589         }
1590     };
1591 
1592     const std::vector<uint32_t> inputIndexes = {0, 1};
1593     const std::vector<uint32_t> outputIndexes = {10};
1594     std::vector<uint8_t> operandValues = {
1595       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
1596     };
1597     const std::vector<hidl_memory> pools = {};
1598 
1599     return {
1600         .operands = operands,
1601         .operations = operations,
1602         .inputIndexes = inputIndexes,
1603         .outputIndexes = outputIndexes,
1604         .operandValues = operandValues,
1605         .pools = pools,
1606     };
1607 }
1608 
is_ignored_dynamic_output_shape_nhwc_float16(int i)1609 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
1610   static std::set<int> ignore = {};
1611   return ignore.find(i) != ignore.end();
1612 }
1613 
1614 // Create the model
createTestModel_dynamic_output_shape_nchw()1615 Model createTestModel_dynamic_output_shape_nchw() {
1616     const std::vector<Operand> operands = {
1617         {
1618             .type = OperandType::TENSOR_FLOAT32,
1619             .dimensions = {1, 1, 4, 4},
1620             .numberOfConsumers = 1,
1621             .scale = 0.0f,
1622             .zeroPoint = 0,
1623             .lifetime = OperandLifeTime::MODEL_INPUT,
1624             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1625         },
1626         {
1627             .type = OperandType::TENSOR_FLOAT32,
1628             .dimensions = {4, 4},
1629             .numberOfConsumers = 1,
1630             .scale = 0.0f,
1631             .zeroPoint = 0,
1632             .lifetime = OperandLifeTime::MODEL_INPUT,
1633             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1634         },
1635         {
1636             .type = OperandType::TENSOR_INT32,
1637             .dimensions = {4},
1638             .numberOfConsumers = 1,
1639             .scale = 0.0f,
1640             .zeroPoint = 0,
1641             .lifetime = OperandLifeTime::CONSTANT_COPY,
1642             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1643         },
1644         {
1645             .type = OperandType::INT32,
1646             .dimensions = {},
1647             .numberOfConsumers = 1,
1648             .scale = 0.0f,
1649             .zeroPoint = 0,
1650             .lifetime = OperandLifeTime::CONSTANT_COPY,
1651             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1652         },
1653         {
1654             .type = OperandType::INT32,
1655             .dimensions = {},
1656             .numberOfConsumers = 1,
1657             .scale = 0.0f,
1658             .zeroPoint = 0,
1659             .lifetime = OperandLifeTime::CONSTANT_COPY,
1660             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1661         },
1662         {
1663             .type = OperandType::FLOAT32,
1664             .dimensions = {},
1665             .numberOfConsumers = 1,
1666             .scale = 0.0f,
1667             .zeroPoint = 0,
1668             .lifetime = OperandLifeTime::CONSTANT_COPY,
1669             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1670         },
1671         {
1672             .type = OperandType::FLOAT32,
1673             .dimensions = {},
1674             .numberOfConsumers = 1,
1675             .scale = 0.0f,
1676             .zeroPoint = 0,
1677             .lifetime = OperandLifeTime::CONSTANT_COPY,
1678             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1679         },
1680         {
1681             .type = OperandType::INT32,
1682             .dimensions = {},
1683             .numberOfConsumers = 1,
1684             .scale = 0.0f,
1685             .zeroPoint = 0,
1686             .lifetime = OperandLifeTime::CONSTANT_COPY,
1687             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1688         },
1689         {
1690             .type = OperandType::INT32,
1691             .dimensions = {},
1692             .numberOfConsumers = 1,
1693             .scale = 0.0f,
1694             .zeroPoint = 0,
1695             .lifetime = OperandLifeTime::CONSTANT_COPY,
1696             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1697         },
1698         {
1699             .type = OperandType::BOOL,
1700             .dimensions = {},
1701             .numberOfConsumers = 1,
1702             .scale = 0.0f,
1703             .zeroPoint = 0,
1704             .lifetime = OperandLifeTime::CONSTANT_COPY,
1705             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1706         },
1707         {
1708             .type = OperandType::TENSOR_FLOAT32,
1709             .dimensions = {0, 0, 0, 0},
1710             .numberOfConsumers = 0,
1711             .scale = 0.0f,
1712             .zeroPoint = 0,
1713             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1714             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1715         }
1716     };
1717 
1718     const std::vector<Operation> operations = {
1719         {
1720             .type = OperationType::ROI_ALIGN,
1721             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1722             .outputs = {10},
1723         }
1724     };
1725 
1726     const std::vector<uint32_t> inputIndexes = {0, 1};
1727     const std::vector<uint32_t> outputIndexes = {10};
1728     std::vector<uint8_t> operandValues = {
1729       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
1730     };
1731     const std::vector<hidl_memory> pools = {};
1732 
1733     return {
1734         .operands = operands,
1735         .operations = operations,
1736         .inputIndexes = inputIndexes,
1737         .outputIndexes = outputIndexes,
1738         .operandValues = operandValues,
1739         .pools = pools,
1740     };
1741 }
1742 
is_ignored_dynamic_output_shape_nchw(int i)1743 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
1744   static std::set<int> ignore = {};
1745   return ignore.find(i) != ignore.end();
1746 }
1747 
1748 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed()1749 Model createTestModel_dynamic_output_shape_nchw_relaxed() {
1750     const std::vector<Operand> operands = {
1751         {
1752             .type = OperandType::TENSOR_FLOAT32,
1753             .dimensions = {1, 1, 4, 4},
1754             .numberOfConsumers = 1,
1755             .scale = 0.0f,
1756             .zeroPoint = 0,
1757             .lifetime = OperandLifeTime::MODEL_INPUT,
1758             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1759         },
1760         {
1761             .type = OperandType::TENSOR_FLOAT32,
1762             .dimensions = {4, 4},
1763             .numberOfConsumers = 1,
1764             .scale = 0.0f,
1765             .zeroPoint = 0,
1766             .lifetime = OperandLifeTime::MODEL_INPUT,
1767             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1768         },
1769         {
1770             .type = OperandType::TENSOR_INT32,
1771             .dimensions = {4},
1772             .numberOfConsumers = 1,
1773             .scale = 0.0f,
1774             .zeroPoint = 0,
1775             .lifetime = OperandLifeTime::CONSTANT_COPY,
1776             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1777         },
1778         {
1779             .type = OperandType::INT32,
1780             .dimensions = {},
1781             .numberOfConsumers = 1,
1782             .scale = 0.0f,
1783             .zeroPoint = 0,
1784             .lifetime = OperandLifeTime::CONSTANT_COPY,
1785             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1786         },
1787         {
1788             .type = OperandType::INT32,
1789             .dimensions = {},
1790             .numberOfConsumers = 1,
1791             .scale = 0.0f,
1792             .zeroPoint = 0,
1793             .lifetime = OperandLifeTime::CONSTANT_COPY,
1794             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1795         },
1796         {
1797             .type = OperandType::FLOAT32,
1798             .dimensions = {},
1799             .numberOfConsumers = 1,
1800             .scale = 0.0f,
1801             .zeroPoint = 0,
1802             .lifetime = OperandLifeTime::CONSTANT_COPY,
1803             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1804         },
1805         {
1806             .type = OperandType::FLOAT32,
1807             .dimensions = {},
1808             .numberOfConsumers = 1,
1809             .scale = 0.0f,
1810             .zeroPoint = 0,
1811             .lifetime = OperandLifeTime::CONSTANT_COPY,
1812             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1813         },
1814         {
1815             .type = OperandType::INT32,
1816             .dimensions = {},
1817             .numberOfConsumers = 1,
1818             .scale = 0.0f,
1819             .zeroPoint = 0,
1820             .lifetime = OperandLifeTime::CONSTANT_COPY,
1821             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1822         },
1823         {
1824             .type = OperandType::INT32,
1825             .dimensions = {},
1826             .numberOfConsumers = 1,
1827             .scale = 0.0f,
1828             .zeroPoint = 0,
1829             .lifetime = OperandLifeTime::CONSTANT_COPY,
1830             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1831         },
1832         {
1833             .type = OperandType::BOOL,
1834             .dimensions = {},
1835             .numberOfConsumers = 1,
1836             .scale = 0.0f,
1837             .zeroPoint = 0,
1838             .lifetime = OperandLifeTime::CONSTANT_COPY,
1839             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1840         },
1841         {
1842             .type = OperandType::TENSOR_FLOAT32,
1843             .dimensions = {0, 0, 0, 0},
1844             .numberOfConsumers = 0,
1845             .scale = 0.0f,
1846             .zeroPoint = 0,
1847             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1848             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1849         }
1850     };
1851 
1852     const std::vector<Operation> operations = {
1853         {
1854             .type = OperationType::ROI_ALIGN,
1855             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1856             .outputs = {10},
1857         }
1858     };
1859 
1860     const std::vector<uint32_t> inputIndexes = {0, 1};
1861     const std::vector<uint32_t> outputIndexes = {10};
1862     std::vector<uint8_t> operandValues = {
1863       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
1864     };
1865     const std::vector<hidl_memory> pools = {};
1866 
1867     return {
1868         .operands = operands,
1869         .operations = operations,
1870         .inputIndexes = inputIndexes,
1871         .outputIndexes = outputIndexes,
1872         .operandValues = operandValues,
1873         .pools = pools,
1874         .relaxComputationFloat32toFloat16 = true,
1875     };
1876 }
1877 
is_ignored_dynamic_output_shape_nchw_relaxed(int i)1878 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
1879   static std::set<int> ignore = {};
1880   return ignore.find(i) != ignore.end();
1881 }
1882 
1883 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8()1884 Model createTestModel_dynamic_output_shape_nchw_quant8() {
1885     const std::vector<Operand> operands = {
1886         {
1887             .type = OperandType::TENSOR_QUANT8_ASYMM,
1888             .dimensions = {1, 1, 4, 4},
1889             .numberOfConsumers = 1,
1890             .scale = 0.25f,
1891             .zeroPoint = 128,
1892             .lifetime = OperandLifeTime::MODEL_INPUT,
1893             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1894         },
1895         {
1896             .type = OperandType::TENSOR_QUANT16_ASYMM,
1897             .dimensions = {4, 4},
1898             .numberOfConsumers = 1,
1899             .scale = 0.125f,
1900             .zeroPoint = 0,
1901             .lifetime = OperandLifeTime::MODEL_INPUT,
1902             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1903         },
1904         {
1905             .type = OperandType::TENSOR_INT32,
1906             .dimensions = {4},
1907             .numberOfConsumers = 1,
1908             .scale = 0.0f,
1909             .zeroPoint = 0,
1910             .lifetime = OperandLifeTime::CONSTANT_COPY,
1911             .location = {.poolIndex = 0, .offset = 0, .length = 16},
1912         },
1913         {
1914             .type = OperandType::INT32,
1915             .dimensions = {},
1916             .numberOfConsumers = 1,
1917             .scale = 0.0f,
1918             .zeroPoint = 0,
1919             .lifetime = OperandLifeTime::CONSTANT_COPY,
1920             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1921         },
1922         {
1923             .type = OperandType::INT32,
1924             .dimensions = {},
1925             .numberOfConsumers = 1,
1926             .scale = 0.0f,
1927             .zeroPoint = 0,
1928             .lifetime = OperandLifeTime::CONSTANT_COPY,
1929             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1930         },
1931         {
1932             .type = OperandType::FLOAT32,
1933             .dimensions = {},
1934             .numberOfConsumers = 1,
1935             .scale = 0.0f,
1936             .zeroPoint = 0,
1937             .lifetime = OperandLifeTime::CONSTANT_COPY,
1938             .location = {.poolIndex = 0, .offset = 24, .length = 4},
1939         },
1940         {
1941             .type = OperandType::FLOAT32,
1942             .dimensions = {},
1943             .numberOfConsumers = 1,
1944             .scale = 0.0f,
1945             .zeroPoint = 0,
1946             .lifetime = OperandLifeTime::CONSTANT_COPY,
1947             .location = {.poolIndex = 0, .offset = 28, .length = 4},
1948         },
1949         {
1950             .type = OperandType::INT32,
1951             .dimensions = {},
1952             .numberOfConsumers = 1,
1953             .scale = 0.0f,
1954             .zeroPoint = 0,
1955             .lifetime = OperandLifeTime::CONSTANT_COPY,
1956             .location = {.poolIndex = 0, .offset = 32, .length = 4},
1957         },
1958         {
1959             .type = OperandType::INT32,
1960             .dimensions = {},
1961             .numberOfConsumers = 1,
1962             .scale = 0.0f,
1963             .zeroPoint = 0,
1964             .lifetime = OperandLifeTime::CONSTANT_COPY,
1965             .location = {.poolIndex = 0, .offset = 36, .length = 4},
1966         },
1967         {
1968             .type = OperandType::BOOL,
1969             .dimensions = {},
1970             .numberOfConsumers = 1,
1971             .scale = 0.0f,
1972             .zeroPoint = 0,
1973             .lifetime = OperandLifeTime::CONSTANT_COPY,
1974             .location = {.poolIndex = 0, .offset = 40, .length = 1},
1975         },
1976         {
1977             .type = OperandType::TENSOR_QUANT8_ASYMM,
1978             .dimensions = {0, 0, 0, 0},
1979             .numberOfConsumers = 0,
1980             .scale = 0.0625f,
1981             .zeroPoint = 128,
1982             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1983             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1984         }
1985     };
1986 
1987     const std::vector<Operation> operations = {
1988         {
1989             .type = OperationType::ROI_ALIGN,
1990             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
1991             .outputs = {10},
1992         }
1993     };
1994 
1995     const std::vector<uint32_t> inputIndexes = {0, 1};
1996     const std::vector<uint32_t> outputIndexes = {10};
1997     std::vector<uint8_t> operandValues = {
1998       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
1999     };
2000     const std::vector<hidl_memory> pools = {};
2001 
2002     return {
2003         .operands = operands,
2004         .operations = operations,
2005         .inputIndexes = inputIndexes,
2006         .outputIndexes = outputIndexes,
2007         .operandValues = operandValues,
2008         .pools = pools,
2009     };
2010 }
2011 
is_ignored_dynamic_output_shape_nchw_quant8(int i)2012 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
2013   static std::set<int> ignore = {};
2014   return ignore.find(i) != ignore.end();
2015 }
2016 
2017 // Create the model
createTestModel_dynamic_output_shape_nchw_float16()2018 Model createTestModel_dynamic_output_shape_nchw_float16() {
2019     const std::vector<Operand> operands = {
2020         {
2021             .type = OperandType::TENSOR_FLOAT16,
2022             .dimensions = {1, 1, 4, 4},
2023             .numberOfConsumers = 1,
2024             .scale = 0.0f,
2025             .zeroPoint = 0,
2026             .lifetime = OperandLifeTime::MODEL_INPUT,
2027             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2028         },
2029         {
2030             .type = OperandType::TENSOR_FLOAT16,
2031             .dimensions = {4, 4},
2032             .numberOfConsumers = 1,
2033             .scale = 0.0f,
2034             .zeroPoint = 0,
2035             .lifetime = OperandLifeTime::MODEL_INPUT,
2036             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2037         },
2038         {
2039             .type = OperandType::TENSOR_INT32,
2040             .dimensions = {4},
2041             .numberOfConsumers = 1,
2042             .scale = 0.0f,
2043             .zeroPoint = 0,
2044             .lifetime = OperandLifeTime::CONSTANT_COPY,
2045             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2046         },
2047         {
2048             .type = OperandType::INT32,
2049             .dimensions = {},
2050             .numberOfConsumers = 1,
2051             .scale = 0.0f,
2052             .zeroPoint = 0,
2053             .lifetime = OperandLifeTime::CONSTANT_COPY,
2054             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2055         },
2056         {
2057             .type = OperandType::INT32,
2058             .dimensions = {},
2059             .numberOfConsumers = 1,
2060             .scale = 0.0f,
2061             .zeroPoint = 0,
2062             .lifetime = OperandLifeTime::CONSTANT_COPY,
2063             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2064         },
2065         {
2066             .type = OperandType::FLOAT16,
2067             .dimensions = {},
2068             .numberOfConsumers = 1,
2069             .scale = 0.0f,
2070             .zeroPoint = 0,
2071             .lifetime = OperandLifeTime::CONSTANT_COPY,
2072             .location = {.poolIndex = 0, .offset = 24, .length = 2},
2073         },
2074         {
2075             .type = OperandType::FLOAT16,
2076             .dimensions = {},
2077             .numberOfConsumers = 1,
2078             .scale = 0.0f,
2079             .zeroPoint = 0,
2080             .lifetime = OperandLifeTime::CONSTANT_COPY,
2081             .location = {.poolIndex = 0, .offset = 26, .length = 2},
2082         },
2083         {
2084             .type = OperandType::INT32,
2085             .dimensions = {},
2086             .numberOfConsumers = 1,
2087             .scale = 0.0f,
2088             .zeroPoint = 0,
2089             .lifetime = OperandLifeTime::CONSTANT_COPY,
2090             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2091         },
2092         {
2093             .type = OperandType::INT32,
2094             .dimensions = {},
2095             .numberOfConsumers = 1,
2096             .scale = 0.0f,
2097             .zeroPoint = 0,
2098             .lifetime = OperandLifeTime::CONSTANT_COPY,
2099             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2100         },
2101         {
2102             .type = OperandType::BOOL,
2103             .dimensions = {},
2104             .numberOfConsumers = 1,
2105             .scale = 0.0f,
2106             .zeroPoint = 0,
2107             .lifetime = OperandLifeTime::CONSTANT_COPY,
2108             .location = {.poolIndex = 0, .offset = 36, .length = 1},
2109         },
2110         {
2111             .type = OperandType::TENSOR_FLOAT16,
2112             .dimensions = {0, 0, 0, 0},
2113             .numberOfConsumers = 0,
2114             .scale = 0.0f,
2115             .zeroPoint = 0,
2116             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2117             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2118         }
2119     };
2120 
2121     const std::vector<Operation> operations = {
2122         {
2123             .type = OperationType::ROI_ALIGN,
2124             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2125             .outputs = {10},
2126         }
2127     };
2128 
2129     const std::vector<uint32_t> inputIndexes = {0, 1};
2130     const std::vector<uint32_t> outputIndexes = {10};
2131     std::vector<uint8_t> operandValues = {
2132       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
2133     };
2134     const std::vector<hidl_memory> pools = {};
2135 
2136     return {
2137         .operands = operands,
2138         .operations = operations,
2139         .inputIndexes = inputIndexes,
2140         .outputIndexes = outputIndexes,
2141         .operandValues = operandValues,
2142         .pools = pools,
2143     };
2144 }
2145 
is_ignored_dynamic_output_shape_nchw_float16(int i)2146 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
2147   static std::set<int> ignore = {};
2148   return ignore.find(i) != ignore.end();
2149 }
2150 
2151 // Create the model
createTestModel_nhwc_2()2152 Model createTestModel_nhwc_2() {
2153     const std::vector<Operand> operands = {
2154         {
2155             .type = OperandType::TENSOR_FLOAT32,
2156             .dimensions = {4, 4, 8, 2},
2157             .numberOfConsumers = 1,
2158             .scale = 0.0f,
2159             .zeroPoint = 0,
2160             .lifetime = OperandLifeTime::MODEL_INPUT,
2161             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2162         },
2163         {
2164             .type = OperandType::TENSOR_FLOAT32,
2165             .dimensions = {4, 4},
2166             .numberOfConsumers = 1,
2167             .scale = 0.0f,
2168             .zeroPoint = 0,
2169             .lifetime = OperandLifeTime::MODEL_INPUT,
2170             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2171         },
2172         {
2173             .type = OperandType::TENSOR_INT32,
2174             .dimensions = {4},
2175             .numberOfConsumers = 1,
2176             .scale = 0.0f,
2177             .zeroPoint = 0,
2178             .lifetime = OperandLifeTime::CONSTANT_COPY,
2179             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2180         },
2181         {
2182             .type = OperandType::INT32,
2183             .dimensions = {},
2184             .numberOfConsumers = 1,
2185             .scale = 0.0f,
2186             .zeroPoint = 0,
2187             .lifetime = OperandLifeTime::CONSTANT_COPY,
2188             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2189         },
2190         {
2191             .type = OperandType::INT32,
2192             .dimensions = {},
2193             .numberOfConsumers = 1,
2194             .scale = 0.0f,
2195             .zeroPoint = 0,
2196             .lifetime = OperandLifeTime::CONSTANT_COPY,
2197             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2198         },
2199         {
2200             .type = OperandType::FLOAT32,
2201             .dimensions = {},
2202             .numberOfConsumers = 1,
2203             .scale = 0.0f,
2204             .zeroPoint = 0,
2205             .lifetime = OperandLifeTime::CONSTANT_COPY,
2206             .location = {.poolIndex = 0, .offset = 24, .length = 4},
2207         },
2208         {
2209             .type = OperandType::FLOAT32,
2210             .dimensions = {},
2211             .numberOfConsumers = 1,
2212             .scale = 0.0f,
2213             .zeroPoint = 0,
2214             .lifetime = OperandLifeTime::CONSTANT_COPY,
2215             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2216         },
2217         {
2218             .type = OperandType::INT32,
2219             .dimensions = {},
2220             .numberOfConsumers = 1,
2221             .scale = 0.0f,
2222             .zeroPoint = 0,
2223             .lifetime = OperandLifeTime::CONSTANT_COPY,
2224             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2225         },
2226         {
2227             .type = OperandType::INT32,
2228             .dimensions = {},
2229             .numberOfConsumers = 1,
2230             .scale = 0.0f,
2231             .zeroPoint = 0,
2232             .lifetime = OperandLifeTime::CONSTANT_COPY,
2233             .location = {.poolIndex = 0, .offset = 36, .length = 4},
2234         },
2235         {
2236             .type = OperandType::BOOL,
2237             .dimensions = {},
2238             .numberOfConsumers = 1,
2239             .scale = 0.0f,
2240             .zeroPoint = 0,
2241             .lifetime = OperandLifeTime::CONSTANT_COPY,
2242             .location = {.poolIndex = 0, .offset = 40, .length = 1},
2243         },
2244         {
2245             .type = OperandType::TENSOR_FLOAT32,
2246             .dimensions = {4, 2, 3, 2},
2247             .numberOfConsumers = 0,
2248             .scale = 0.0f,
2249             .zeroPoint = 0,
2250             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2251             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2252         }
2253     };
2254 
2255     const std::vector<Operation> operations = {
2256         {
2257             .type = OperationType::ROI_ALIGN,
2258             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2259             .outputs = {10},
2260         }
2261     };
2262 
2263     const std::vector<uint32_t> inputIndexes = {0, 1};
2264     const std::vector<uint32_t> outputIndexes = {10};
2265     std::vector<uint8_t> operandValues = {
2266       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
2267     };
2268     const std::vector<hidl_memory> pools = {};
2269 
2270     return {
2271         .operands = operands,
2272         .operations = operations,
2273         .inputIndexes = inputIndexes,
2274         .outputIndexes = outputIndexes,
2275         .operandValues = operandValues,
2276         .pools = pools,
2277     };
2278 }
2279 
is_ignored_nhwc_2(int i)2280 inline bool is_ignored_nhwc_2(int i) {
2281   static std::set<int> ignore = {};
2282   return ignore.find(i) != ignore.end();
2283 }
2284 
2285 // Create the model
createTestModel_nhwc_relaxed_2()2286 Model createTestModel_nhwc_relaxed_2() {
2287     const std::vector<Operand> operands = {
2288         {
2289             .type = OperandType::TENSOR_FLOAT32,
2290             .dimensions = {4, 4, 8, 2},
2291             .numberOfConsumers = 1,
2292             .scale = 0.0f,
2293             .zeroPoint = 0,
2294             .lifetime = OperandLifeTime::MODEL_INPUT,
2295             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2296         },
2297         {
2298             .type = OperandType::TENSOR_FLOAT32,
2299             .dimensions = {4, 4},
2300             .numberOfConsumers = 1,
2301             .scale = 0.0f,
2302             .zeroPoint = 0,
2303             .lifetime = OperandLifeTime::MODEL_INPUT,
2304             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2305         },
2306         {
2307             .type = OperandType::TENSOR_INT32,
2308             .dimensions = {4},
2309             .numberOfConsumers = 1,
2310             .scale = 0.0f,
2311             .zeroPoint = 0,
2312             .lifetime = OperandLifeTime::CONSTANT_COPY,
2313             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2314         },
2315         {
2316             .type = OperandType::INT32,
2317             .dimensions = {},
2318             .numberOfConsumers = 1,
2319             .scale = 0.0f,
2320             .zeroPoint = 0,
2321             .lifetime = OperandLifeTime::CONSTANT_COPY,
2322             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2323         },
2324         {
2325             .type = OperandType::INT32,
2326             .dimensions = {},
2327             .numberOfConsumers = 1,
2328             .scale = 0.0f,
2329             .zeroPoint = 0,
2330             .lifetime = OperandLifeTime::CONSTANT_COPY,
2331             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2332         },
2333         {
2334             .type = OperandType::FLOAT32,
2335             .dimensions = {},
2336             .numberOfConsumers = 1,
2337             .scale = 0.0f,
2338             .zeroPoint = 0,
2339             .lifetime = OperandLifeTime::CONSTANT_COPY,
2340             .location = {.poolIndex = 0, .offset = 24, .length = 4},
2341         },
2342         {
2343             .type = OperandType::FLOAT32,
2344             .dimensions = {},
2345             .numberOfConsumers = 1,
2346             .scale = 0.0f,
2347             .zeroPoint = 0,
2348             .lifetime = OperandLifeTime::CONSTANT_COPY,
2349             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2350         },
2351         {
2352             .type = OperandType::INT32,
2353             .dimensions = {},
2354             .numberOfConsumers = 1,
2355             .scale = 0.0f,
2356             .zeroPoint = 0,
2357             .lifetime = OperandLifeTime::CONSTANT_COPY,
2358             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2359         },
2360         {
2361             .type = OperandType::INT32,
2362             .dimensions = {},
2363             .numberOfConsumers = 1,
2364             .scale = 0.0f,
2365             .zeroPoint = 0,
2366             .lifetime = OperandLifeTime::CONSTANT_COPY,
2367             .location = {.poolIndex = 0, .offset = 36, .length = 4},
2368         },
2369         {
2370             .type = OperandType::BOOL,
2371             .dimensions = {},
2372             .numberOfConsumers = 1,
2373             .scale = 0.0f,
2374             .zeroPoint = 0,
2375             .lifetime = OperandLifeTime::CONSTANT_COPY,
2376             .location = {.poolIndex = 0, .offset = 40, .length = 1},
2377         },
2378         {
2379             .type = OperandType::TENSOR_FLOAT32,
2380             .dimensions = {4, 2, 3, 2},
2381             .numberOfConsumers = 0,
2382             .scale = 0.0f,
2383             .zeroPoint = 0,
2384             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2385             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2386         }
2387     };
2388 
2389     const std::vector<Operation> operations = {
2390         {
2391             .type = OperationType::ROI_ALIGN,
2392             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2393             .outputs = {10},
2394         }
2395     };
2396 
2397     const std::vector<uint32_t> inputIndexes = {0, 1};
2398     const std::vector<uint32_t> outputIndexes = {10};
2399     std::vector<uint8_t> operandValues = {
2400       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
2401     };
2402     const std::vector<hidl_memory> pools = {};
2403 
2404     return {
2405         .operands = operands,
2406         .operations = operations,
2407         .inputIndexes = inputIndexes,
2408         .outputIndexes = outputIndexes,
2409         .operandValues = operandValues,
2410         .pools = pools,
2411         .relaxComputationFloat32toFloat16 = true,
2412     };
2413 }
2414 
is_ignored_nhwc_relaxed_2(int i)2415 inline bool is_ignored_nhwc_relaxed_2(int i) {
2416   static std::set<int> ignore = {};
2417   return ignore.find(i) != ignore.end();
2418 }
2419 
2420 // Create the model
createTestModel_nhwc_quant8_2()2421 Model createTestModel_nhwc_quant8_2() {
2422     const std::vector<Operand> operands = {
2423         {
2424             .type = OperandType::TENSOR_QUANT8_ASYMM,
2425             .dimensions = {4, 4, 8, 2},
2426             .numberOfConsumers = 1,
2427             .scale = 0.04f,
2428             .zeroPoint = 0,
2429             .lifetime = OperandLifeTime::MODEL_INPUT,
2430             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2431         },
2432         {
2433             .type = OperandType::TENSOR_QUANT16_ASYMM,
2434             .dimensions = {4, 4},
2435             .numberOfConsumers = 1,
2436             .scale = 0.125f,
2437             .zeroPoint = 0,
2438             .lifetime = OperandLifeTime::MODEL_INPUT,
2439             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2440         },
2441         {
2442             .type = OperandType::TENSOR_INT32,
2443             .dimensions = {4},
2444             .numberOfConsumers = 1,
2445             .scale = 0.0f,
2446             .zeroPoint = 0,
2447             .lifetime = OperandLifeTime::CONSTANT_COPY,
2448             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2449         },
2450         {
2451             .type = OperandType::INT32,
2452             .dimensions = {},
2453             .numberOfConsumers = 1,
2454             .scale = 0.0f,
2455             .zeroPoint = 0,
2456             .lifetime = OperandLifeTime::CONSTANT_COPY,
2457             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2458         },
2459         {
2460             .type = OperandType::INT32,
2461             .dimensions = {},
2462             .numberOfConsumers = 1,
2463             .scale = 0.0f,
2464             .zeroPoint = 0,
2465             .lifetime = OperandLifeTime::CONSTANT_COPY,
2466             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2467         },
2468         {
2469             .type = OperandType::FLOAT32,
2470             .dimensions = {},
2471             .numberOfConsumers = 1,
2472             .scale = 0.0f,
2473             .zeroPoint = 0,
2474             .lifetime = OperandLifeTime::CONSTANT_COPY,
2475             .location = {.poolIndex = 0, .offset = 24, .length = 4},
2476         },
2477         {
2478             .type = OperandType::FLOAT32,
2479             .dimensions = {},
2480             .numberOfConsumers = 1,
2481             .scale = 0.0f,
2482             .zeroPoint = 0,
2483             .lifetime = OperandLifeTime::CONSTANT_COPY,
2484             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2485         },
2486         {
2487             .type = OperandType::INT32,
2488             .dimensions = {},
2489             .numberOfConsumers = 1,
2490             .scale = 0.0f,
2491             .zeroPoint = 0,
2492             .lifetime = OperandLifeTime::CONSTANT_COPY,
2493             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2494         },
2495         {
2496             .type = OperandType::INT32,
2497             .dimensions = {},
2498             .numberOfConsumers = 1,
2499             .scale = 0.0f,
2500             .zeroPoint = 0,
2501             .lifetime = OperandLifeTime::CONSTANT_COPY,
2502             .location = {.poolIndex = 0, .offset = 36, .length = 4},
2503         },
2504         {
2505             .type = OperandType::BOOL,
2506             .dimensions = {},
2507             .numberOfConsumers = 1,
2508             .scale = 0.0f,
2509             .zeroPoint = 0,
2510             .lifetime = OperandLifeTime::CONSTANT_COPY,
2511             .location = {.poolIndex = 0, .offset = 40, .length = 1},
2512         },
2513         {
2514             .type = OperandType::TENSOR_QUANT8_ASYMM,
2515             .dimensions = {4, 2, 3, 2},
2516             .numberOfConsumers = 0,
2517             .scale = 0.03125f,
2518             .zeroPoint = 10,
2519             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2520             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2521         }
2522     };
2523 
2524     const std::vector<Operation> operations = {
2525         {
2526             .type = OperationType::ROI_ALIGN,
2527             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2528             .outputs = {10},
2529         }
2530     };
2531 
2532     const std::vector<uint32_t> inputIndexes = {0, 1};
2533     const std::vector<uint32_t> outputIndexes = {10};
2534     std::vector<uint8_t> operandValues = {
2535       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
2536     };
2537     const std::vector<hidl_memory> pools = {};
2538 
2539     return {
2540         .operands = operands,
2541         .operations = operations,
2542         .inputIndexes = inputIndexes,
2543         .outputIndexes = outputIndexes,
2544         .operandValues = operandValues,
2545         .pools = pools,
2546     };
2547 }
2548 
is_ignored_nhwc_quant8_2(int i)2549 inline bool is_ignored_nhwc_quant8_2(int i) {
2550   static std::set<int> ignore = {};
2551   return ignore.find(i) != ignore.end();
2552 }
2553 
2554 // Create the model
createTestModel_nhwc_float16_2()2555 Model createTestModel_nhwc_float16_2() {
2556     const std::vector<Operand> operands = {
2557         {
2558             .type = OperandType::TENSOR_FLOAT16,
2559             .dimensions = {4, 4, 8, 2},
2560             .numberOfConsumers = 1,
2561             .scale = 0.0f,
2562             .zeroPoint = 0,
2563             .lifetime = OperandLifeTime::MODEL_INPUT,
2564             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2565         },
2566         {
2567             .type = OperandType::TENSOR_FLOAT16,
2568             .dimensions = {4, 4},
2569             .numberOfConsumers = 1,
2570             .scale = 0.0f,
2571             .zeroPoint = 0,
2572             .lifetime = OperandLifeTime::MODEL_INPUT,
2573             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2574         },
2575         {
2576             .type = OperandType::TENSOR_INT32,
2577             .dimensions = {4},
2578             .numberOfConsumers = 1,
2579             .scale = 0.0f,
2580             .zeroPoint = 0,
2581             .lifetime = OperandLifeTime::CONSTANT_COPY,
2582             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2583         },
2584         {
2585             .type = OperandType::INT32,
2586             .dimensions = {},
2587             .numberOfConsumers = 1,
2588             .scale = 0.0f,
2589             .zeroPoint = 0,
2590             .lifetime = OperandLifeTime::CONSTANT_COPY,
2591             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2592         },
2593         {
2594             .type = OperandType::INT32,
2595             .dimensions = {},
2596             .numberOfConsumers = 1,
2597             .scale = 0.0f,
2598             .zeroPoint = 0,
2599             .lifetime = OperandLifeTime::CONSTANT_COPY,
2600             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2601         },
2602         {
2603             .type = OperandType::FLOAT16,
2604             .dimensions = {},
2605             .numberOfConsumers = 1,
2606             .scale = 0.0f,
2607             .zeroPoint = 0,
2608             .lifetime = OperandLifeTime::CONSTANT_COPY,
2609             .location = {.poolIndex = 0, .offset = 24, .length = 2},
2610         },
2611         {
2612             .type = OperandType::FLOAT16,
2613             .dimensions = {},
2614             .numberOfConsumers = 1,
2615             .scale = 0.0f,
2616             .zeroPoint = 0,
2617             .lifetime = OperandLifeTime::CONSTANT_COPY,
2618             .location = {.poolIndex = 0, .offset = 26, .length = 2},
2619         },
2620         {
2621             .type = OperandType::INT32,
2622             .dimensions = {},
2623             .numberOfConsumers = 1,
2624             .scale = 0.0f,
2625             .zeroPoint = 0,
2626             .lifetime = OperandLifeTime::CONSTANT_COPY,
2627             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2628         },
2629         {
2630             .type = OperandType::INT32,
2631             .dimensions = {},
2632             .numberOfConsumers = 1,
2633             .scale = 0.0f,
2634             .zeroPoint = 0,
2635             .lifetime = OperandLifeTime::CONSTANT_COPY,
2636             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2637         },
2638         {
2639             .type = OperandType::BOOL,
2640             .dimensions = {},
2641             .numberOfConsumers = 1,
2642             .scale = 0.0f,
2643             .zeroPoint = 0,
2644             .lifetime = OperandLifeTime::CONSTANT_COPY,
2645             .location = {.poolIndex = 0, .offset = 36, .length = 1},
2646         },
2647         {
2648             .type = OperandType::TENSOR_FLOAT16,
2649             .dimensions = {4, 2, 3, 2},
2650             .numberOfConsumers = 0,
2651             .scale = 0.0f,
2652             .zeroPoint = 0,
2653             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2654             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2655         }
2656     };
2657 
2658     const std::vector<Operation> operations = {
2659         {
2660             .type = OperationType::ROI_ALIGN,
2661             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2662             .outputs = {10},
2663         }
2664     };
2665 
2666     const std::vector<uint32_t> inputIndexes = {0, 1};
2667     const std::vector<uint32_t> outputIndexes = {10};
2668     std::vector<uint8_t> operandValues = {
2669       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 4, 0, 0, 0, 4, 0, 0, 0, 0
2670     };
2671     const std::vector<hidl_memory> pools = {};
2672 
2673     return {
2674         .operands = operands,
2675         .operations = operations,
2676         .inputIndexes = inputIndexes,
2677         .outputIndexes = outputIndexes,
2678         .operandValues = operandValues,
2679         .pools = pools,
2680     };
2681 }
2682 
is_ignored_nhwc_float16_2(int i)2683 inline bool is_ignored_nhwc_float16_2(int i) {
2684   static std::set<int> ignore = {};
2685   return ignore.find(i) != ignore.end();
2686 }
2687 
2688 // Create the model
createTestModel_nchw_2()2689 Model createTestModel_nchw_2() {
2690     const std::vector<Operand> operands = {
2691         {
2692             .type = OperandType::TENSOR_FLOAT32,
2693             .dimensions = {4, 2, 4, 8},
2694             .numberOfConsumers = 1,
2695             .scale = 0.0f,
2696             .zeroPoint = 0,
2697             .lifetime = OperandLifeTime::MODEL_INPUT,
2698             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2699         },
2700         {
2701             .type = OperandType::TENSOR_FLOAT32,
2702             .dimensions = {4, 4},
2703             .numberOfConsumers = 1,
2704             .scale = 0.0f,
2705             .zeroPoint = 0,
2706             .lifetime = OperandLifeTime::MODEL_INPUT,
2707             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2708         },
2709         {
2710             .type = OperandType::TENSOR_INT32,
2711             .dimensions = {4},
2712             .numberOfConsumers = 1,
2713             .scale = 0.0f,
2714             .zeroPoint = 0,
2715             .lifetime = OperandLifeTime::CONSTANT_COPY,
2716             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2717         },
2718         {
2719             .type = OperandType::INT32,
2720             .dimensions = {},
2721             .numberOfConsumers = 1,
2722             .scale = 0.0f,
2723             .zeroPoint = 0,
2724             .lifetime = OperandLifeTime::CONSTANT_COPY,
2725             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2726         },
2727         {
2728             .type = OperandType::INT32,
2729             .dimensions = {},
2730             .numberOfConsumers = 1,
2731             .scale = 0.0f,
2732             .zeroPoint = 0,
2733             .lifetime = OperandLifeTime::CONSTANT_COPY,
2734             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2735         },
2736         {
2737             .type = OperandType::FLOAT32,
2738             .dimensions = {},
2739             .numberOfConsumers = 1,
2740             .scale = 0.0f,
2741             .zeroPoint = 0,
2742             .lifetime = OperandLifeTime::CONSTANT_COPY,
2743             .location = {.poolIndex = 0, .offset = 24, .length = 4},
2744         },
2745         {
2746             .type = OperandType::FLOAT32,
2747             .dimensions = {},
2748             .numberOfConsumers = 1,
2749             .scale = 0.0f,
2750             .zeroPoint = 0,
2751             .lifetime = OperandLifeTime::CONSTANT_COPY,
2752             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2753         },
2754         {
2755             .type = OperandType::INT32,
2756             .dimensions = {},
2757             .numberOfConsumers = 1,
2758             .scale = 0.0f,
2759             .zeroPoint = 0,
2760             .lifetime = OperandLifeTime::CONSTANT_COPY,
2761             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2762         },
2763         {
2764             .type = OperandType::INT32,
2765             .dimensions = {},
2766             .numberOfConsumers = 1,
2767             .scale = 0.0f,
2768             .zeroPoint = 0,
2769             .lifetime = OperandLifeTime::CONSTANT_COPY,
2770             .location = {.poolIndex = 0, .offset = 36, .length = 4},
2771         },
2772         {
2773             .type = OperandType::BOOL,
2774             .dimensions = {},
2775             .numberOfConsumers = 1,
2776             .scale = 0.0f,
2777             .zeroPoint = 0,
2778             .lifetime = OperandLifeTime::CONSTANT_COPY,
2779             .location = {.poolIndex = 0, .offset = 40, .length = 1},
2780         },
2781         {
2782             .type = OperandType::TENSOR_FLOAT32,
2783             .dimensions = {4, 2, 2, 3},
2784             .numberOfConsumers = 0,
2785             .scale = 0.0f,
2786             .zeroPoint = 0,
2787             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2788             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2789         }
2790     };
2791 
2792     const std::vector<Operation> operations = {
2793         {
2794             .type = OperationType::ROI_ALIGN,
2795             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2796             .outputs = {10},
2797         }
2798     };
2799 
2800     const std::vector<uint32_t> inputIndexes = {0, 1};
2801     const std::vector<uint32_t> outputIndexes = {10};
2802     std::vector<uint8_t> operandValues = {
2803       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
2804     };
2805     const std::vector<hidl_memory> pools = {};
2806 
2807     return {
2808         .operands = operands,
2809         .operations = operations,
2810         .inputIndexes = inputIndexes,
2811         .outputIndexes = outputIndexes,
2812         .operandValues = operandValues,
2813         .pools = pools,
2814     };
2815 }
2816 
is_ignored_nchw_2(int i)2817 inline bool is_ignored_nchw_2(int i) {
2818   static std::set<int> ignore = {};
2819   return ignore.find(i) != ignore.end();
2820 }
2821 
2822 // Create the model
createTestModel_nchw_relaxed_2()2823 Model createTestModel_nchw_relaxed_2() {
2824     const std::vector<Operand> operands = {
2825         {
2826             .type = OperandType::TENSOR_FLOAT32,
2827             .dimensions = {4, 2, 4, 8},
2828             .numberOfConsumers = 1,
2829             .scale = 0.0f,
2830             .zeroPoint = 0,
2831             .lifetime = OperandLifeTime::MODEL_INPUT,
2832             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2833         },
2834         {
2835             .type = OperandType::TENSOR_FLOAT32,
2836             .dimensions = {4, 4},
2837             .numberOfConsumers = 1,
2838             .scale = 0.0f,
2839             .zeroPoint = 0,
2840             .lifetime = OperandLifeTime::MODEL_INPUT,
2841             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2842         },
2843         {
2844             .type = OperandType::TENSOR_INT32,
2845             .dimensions = {4},
2846             .numberOfConsumers = 1,
2847             .scale = 0.0f,
2848             .zeroPoint = 0,
2849             .lifetime = OperandLifeTime::CONSTANT_COPY,
2850             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2851         },
2852         {
2853             .type = OperandType::INT32,
2854             .dimensions = {},
2855             .numberOfConsumers = 1,
2856             .scale = 0.0f,
2857             .zeroPoint = 0,
2858             .lifetime = OperandLifeTime::CONSTANT_COPY,
2859             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2860         },
2861         {
2862             .type = OperandType::INT32,
2863             .dimensions = {},
2864             .numberOfConsumers = 1,
2865             .scale = 0.0f,
2866             .zeroPoint = 0,
2867             .lifetime = OperandLifeTime::CONSTANT_COPY,
2868             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2869         },
2870         {
2871             .type = OperandType::FLOAT32,
2872             .dimensions = {},
2873             .numberOfConsumers = 1,
2874             .scale = 0.0f,
2875             .zeroPoint = 0,
2876             .lifetime = OperandLifeTime::CONSTANT_COPY,
2877             .location = {.poolIndex = 0, .offset = 24, .length = 4},
2878         },
2879         {
2880             .type = OperandType::FLOAT32,
2881             .dimensions = {},
2882             .numberOfConsumers = 1,
2883             .scale = 0.0f,
2884             .zeroPoint = 0,
2885             .lifetime = OperandLifeTime::CONSTANT_COPY,
2886             .location = {.poolIndex = 0, .offset = 28, .length = 4},
2887         },
2888         {
2889             .type = OperandType::INT32,
2890             .dimensions = {},
2891             .numberOfConsumers = 1,
2892             .scale = 0.0f,
2893             .zeroPoint = 0,
2894             .lifetime = OperandLifeTime::CONSTANT_COPY,
2895             .location = {.poolIndex = 0, .offset = 32, .length = 4},
2896         },
2897         {
2898             .type = OperandType::INT32,
2899             .dimensions = {},
2900             .numberOfConsumers = 1,
2901             .scale = 0.0f,
2902             .zeroPoint = 0,
2903             .lifetime = OperandLifeTime::CONSTANT_COPY,
2904             .location = {.poolIndex = 0, .offset = 36, .length = 4},
2905         },
2906         {
2907             .type = OperandType::BOOL,
2908             .dimensions = {},
2909             .numberOfConsumers = 1,
2910             .scale = 0.0f,
2911             .zeroPoint = 0,
2912             .lifetime = OperandLifeTime::CONSTANT_COPY,
2913             .location = {.poolIndex = 0, .offset = 40, .length = 1},
2914         },
2915         {
2916             .type = OperandType::TENSOR_FLOAT32,
2917             .dimensions = {4, 2, 2, 3},
2918             .numberOfConsumers = 0,
2919             .scale = 0.0f,
2920             .zeroPoint = 0,
2921             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2922             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2923         }
2924     };
2925 
2926     const std::vector<Operation> operations = {
2927         {
2928             .type = OperationType::ROI_ALIGN,
2929             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
2930             .outputs = {10},
2931         }
2932     };
2933 
2934     const std::vector<uint32_t> inputIndexes = {0, 1};
2935     const std::vector<uint32_t> outputIndexes = {10};
2936     std::vector<uint8_t> operandValues = {
2937       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
2938     };
2939     const std::vector<hidl_memory> pools = {};
2940 
2941     return {
2942         .operands = operands,
2943         .operations = operations,
2944         .inputIndexes = inputIndexes,
2945         .outputIndexes = outputIndexes,
2946         .operandValues = operandValues,
2947         .pools = pools,
2948         .relaxComputationFloat32toFloat16 = true,
2949     };
2950 }
2951 
is_ignored_nchw_relaxed_2(int i)2952 inline bool is_ignored_nchw_relaxed_2(int i) {
2953   static std::set<int> ignore = {};
2954   return ignore.find(i) != ignore.end();
2955 }
2956 
2957 // Create the model
createTestModel_nchw_quant8_2()2958 Model createTestModel_nchw_quant8_2() {
2959     const std::vector<Operand> operands = {
2960         {
2961             .type = OperandType::TENSOR_QUANT8_ASYMM,
2962             .dimensions = {4, 2, 4, 8},
2963             .numberOfConsumers = 1,
2964             .scale = 0.04f,
2965             .zeroPoint = 0,
2966             .lifetime = OperandLifeTime::MODEL_INPUT,
2967             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2968         },
2969         {
2970             .type = OperandType::TENSOR_QUANT16_ASYMM,
2971             .dimensions = {4, 4},
2972             .numberOfConsumers = 1,
2973             .scale = 0.125f,
2974             .zeroPoint = 0,
2975             .lifetime = OperandLifeTime::MODEL_INPUT,
2976             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2977         },
2978         {
2979             .type = OperandType::TENSOR_INT32,
2980             .dimensions = {4},
2981             .numberOfConsumers = 1,
2982             .scale = 0.0f,
2983             .zeroPoint = 0,
2984             .lifetime = OperandLifeTime::CONSTANT_COPY,
2985             .location = {.poolIndex = 0, .offset = 0, .length = 16},
2986         },
2987         {
2988             .type = OperandType::INT32,
2989             .dimensions = {},
2990             .numberOfConsumers = 1,
2991             .scale = 0.0f,
2992             .zeroPoint = 0,
2993             .lifetime = OperandLifeTime::CONSTANT_COPY,
2994             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2995         },
2996         {
2997             .type = OperandType::INT32,
2998             .dimensions = {},
2999             .numberOfConsumers = 1,
3000             .scale = 0.0f,
3001             .zeroPoint = 0,
3002             .lifetime = OperandLifeTime::CONSTANT_COPY,
3003             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3004         },
3005         {
3006             .type = OperandType::FLOAT32,
3007             .dimensions = {},
3008             .numberOfConsumers = 1,
3009             .scale = 0.0f,
3010             .zeroPoint = 0,
3011             .lifetime = OperandLifeTime::CONSTANT_COPY,
3012             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3013         },
3014         {
3015             .type = OperandType::FLOAT32,
3016             .dimensions = {},
3017             .numberOfConsumers = 1,
3018             .scale = 0.0f,
3019             .zeroPoint = 0,
3020             .lifetime = OperandLifeTime::CONSTANT_COPY,
3021             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3022         },
3023         {
3024             .type = OperandType::INT32,
3025             .dimensions = {},
3026             .numberOfConsumers = 1,
3027             .scale = 0.0f,
3028             .zeroPoint = 0,
3029             .lifetime = OperandLifeTime::CONSTANT_COPY,
3030             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3031         },
3032         {
3033             .type = OperandType::INT32,
3034             .dimensions = {},
3035             .numberOfConsumers = 1,
3036             .scale = 0.0f,
3037             .zeroPoint = 0,
3038             .lifetime = OperandLifeTime::CONSTANT_COPY,
3039             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3040         },
3041         {
3042             .type = OperandType::BOOL,
3043             .dimensions = {},
3044             .numberOfConsumers = 1,
3045             .scale = 0.0f,
3046             .zeroPoint = 0,
3047             .lifetime = OperandLifeTime::CONSTANT_COPY,
3048             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3049         },
3050         {
3051             .type = OperandType::TENSOR_QUANT8_ASYMM,
3052             .dimensions = {4, 2, 2, 3},
3053             .numberOfConsumers = 0,
3054             .scale = 0.03125f,
3055             .zeroPoint = 10,
3056             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3057             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3058         }
3059     };
3060 
3061     const std::vector<Operation> operations = {
3062         {
3063             .type = OperationType::ROI_ALIGN,
3064             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3065             .outputs = {10},
3066         }
3067     };
3068 
3069     const std::vector<uint32_t> inputIndexes = {0, 1};
3070     const std::vector<uint32_t> outputIndexes = {10};
3071     std::vector<uint8_t> operandValues = {
3072       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
3073     };
3074     const std::vector<hidl_memory> pools = {};
3075 
3076     return {
3077         .operands = operands,
3078         .operations = operations,
3079         .inputIndexes = inputIndexes,
3080         .outputIndexes = outputIndexes,
3081         .operandValues = operandValues,
3082         .pools = pools,
3083     };
3084 }
3085 
is_ignored_nchw_quant8_2(int i)3086 inline bool is_ignored_nchw_quant8_2(int i) {
3087   static std::set<int> ignore = {};
3088   return ignore.find(i) != ignore.end();
3089 }
3090 
3091 // Create the model
createTestModel_nchw_float16_2()3092 Model createTestModel_nchw_float16_2() {
3093     const std::vector<Operand> operands = {
3094         {
3095             .type = OperandType::TENSOR_FLOAT16,
3096             .dimensions = {4, 2, 4, 8},
3097             .numberOfConsumers = 1,
3098             .scale = 0.0f,
3099             .zeroPoint = 0,
3100             .lifetime = OperandLifeTime::MODEL_INPUT,
3101             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3102         },
3103         {
3104             .type = OperandType::TENSOR_FLOAT16,
3105             .dimensions = {4, 4},
3106             .numberOfConsumers = 1,
3107             .scale = 0.0f,
3108             .zeroPoint = 0,
3109             .lifetime = OperandLifeTime::MODEL_INPUT,
3110             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3111         },
3112         {
3113             .type = OperandType::TENSOR_INT32,
3114             .dimensions = {4},
3115             .numberOfConsumers = 1,
3116             .scale = 0.0f,
3117             .zeroPoint = 0,
3118             .lifetime = OperandLifeTime::CONSTANT_COPY,
3119             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3120         },
3121         {
3122             .type = OperandType::INT32,
3123             .dimensions = {},
3124             .numberOfConsumers = 1,
3125             .scale = 0.0f,
3126             .zeroPoint = 0,
3127             .lifetime = OperandLifeTime::CONSTANT_COPY,
3128             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3129         },
3130         {
3131             .type = OperandType::INT32,
3132             .dimensions = {},
3133             .numberOfConsumers = 1,
3134             .scale = 0.0f,
3135             .zeroPoint = 0,
3136             .lifetime = OperandLifeTime::CONSTANT_COPY,
3137             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3138         },
3139         {
3140             .type = OperandType::FLOAT16,
3141             .dimensions = {},
3142             .numberOfConsumers = 1,
3143             .scale = 0.0f,
3144             .zeroPoint = 0,
3145             .lifetime = OperandLifeTime::CONSTANT_COPY,
3146             .location = {.poolIndex = 0, .offset = 24, .length = 2},
3147         },
3148         {
3149             .type = OperandType::FLOAT16,
3150             .dimensions = {},
3151             .numberOfConsumers = 1,
3152             .scale = 0.0f,
3153             .zeroPoint = 0,
3154             .lifetime = OperandLifeTime::CONSTANT_COPY,
3155             .location = {.poolIndex = 0, .offset = 26, .length = 2},
3156         },
3157         {
3158             .type = OperandType::INT32,
3159             .dimensions = {},
3160             .numberOfConsumers = 1,
3161             .scale = 0.0f,
3162             .zeroPoint = 0,
3163             .lifetime = OperandLifeTime::CONSTANT_COPY,
3164             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3165         },
3166         {
3167             .type = OperandType::INT32,
3168             .dimensions = {},
3169             .numberOfConsumers = 1,
3170             .scale = 0.0f,
3171             .zeroPoint = 0,
3172             .lifetime = OperandLifeTime::CONSTANT_COPY,
3173             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3174         },
3175         {
3176             .type = OperandType::BOOL,
3177             .dimensions = {},
3178             .numberOfConsumers = 1,
3179             .scale = 0.0f,
3180             .zeroPoint = 0,
3181             .lifetime = OperandLifeTime::CONSTANT_COPY,
3182             .location = {.poolIndex = 0, .offset = 36, .length = 1},
3183         },
3184         {
3185             .type = OperandType::TENSOR_FLOAT16,
3186             .dimensions = {4, 2, 2, 3},
3187             .numberOfConsumers = 0,
3188             .scale = 0.0f,
3189             .zeroPoint = 0,
3190             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3191             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3192         }
3193     };
3194 
3195     const std::vector<Operation> operations = {
3196         {
3197             .type = OperationType::ROI_ALIGN,
3198             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3199             .outputs = {10},
3200         }
3201     };
3202 
3203     const std::vector<uint32_t> inputIndexes = {0, 1};
3204     const std::vector<uint32_t> outputIndexes = {10};
3205     std::vector<uint8_t> operandValues = {
3206       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 4, 0, 0, 0, 4, 0, 0, 0, 1
3207     };
3208     const std::vector<hidl_memory> pools = {};
3209 
3210     return {
3211         .operands = operands,
3212         .operations = operations,
3213         .inputIndexes = inputIndexes,
3214         .outputIndexes = outputIndexes,
3215         .operandValues = operandValues,
3216         .pools = pools,
3217     };
3218 }
3219 
is_ignored_nchw_float16_2(int i)3220 inline bool is_ignored_nchw_float16_2(int i) {
3221   static std::set<int> ignore = {};
3222   return ignore.find(i) != ignore.end();
3223 }
3224 
3225 // Create the model
createTestModel_dynamic_output_shape_nhwc_2()3226 Model createTestModel_dynamic_output_shape_nhwc_2() {
3227     const std::vector<Operand> operands = {
3228         {
3229             .type = OperandType::TENSOR_FLOAT32,
3230             .dimensions = {4, 4, 8, 2},
3231             .numberOfConsumers = 1,
3232             .scale = 0.0f,
3233             .zeroPoint = 0,
3234             .lifetime = OperandLifeTime::MODEL_INPUT,
3235             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3236         },
3237         {
3238             .type = OperandType::TENSOR_FLOAT32,
3239             .dimensions = {4, 4},
3240             .numberOfConsumers = 1,
3241             .scale = 0.0f,
3242             .zeroPoint = 0,
3243             .lifetime = OperandLifeTime::MODEL_INPUT,
3244             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3245         },
3246         {
3247             .type = OperandType::TENSOR_INT32,
3248             .dimensions = {4},
3249             .numberOfConsumers = 1,
3250             .scale = 0.0f,
3251             .zeroPoint = 0,
3252             .lifetime = OperandLifeTime::CONSTANT_COPY,
3253             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3254         },
3255         {
3256             .type = OperandType::INT32,
3257             .dimensions = {},
3258             .numberOfConsumers = 1,
3259             .scale = 0.0f,
3260             .zeroPoint = 0,
3261             .lifetime = OperandLifeTime::CONSTANT_COPY,
3262             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3263         },
3264         {
3265             .type = OperandType::INT32,
3266             .dimensions = {},
3267             .numberOfConsumers = 1,
3268             .scale = 0.0f,
3269             .zeroPoint = 0,
3270             .lifetime = OperandLifeTime::CONSTANT_COPY,
3271             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3272         },
3273         {
3274             .type = OperandType::FLOAT32,
3275             .dimensions = {},
3276             .numberOfConsumers = 1,
3277             .scale = 0.0f,
3278             .zeroPoint = 0,
3279             .lifetime = OperandLifeTime::CONSTANT_COPY,
3280             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3281         },
3282         {
3283             .type = OperandType::FLOAT32,
3284             .dimensions = {},
3285             .numberOfConsumers = 1,
3286             .scale = 0.0f,
3287             .zeroPoint = 0,
3288             .lifetime = OperandLifeTime::CONSTANT_COPY,
3289             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3290         },
3291         {
3292             .type = OperandType::INT32,
3293             .dimensions = {},
3294             .numberOfConsumers = 1,
3295             .scale = 0.0f,
3296             .zeroPoint = 0,
3297             .lifetime = OperandLifeTime::CONSTANT_COPY,
3298             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3299         },
3300         {
3301             .type = OperandType::INT32,
3302             .dimensions = {},
3303             .numberOfConsumers = 1,
3304             .scale = 0.0f,
3305             .zeroPoint = 0,
3306             .lifetime = OperandLifeTime::CONSTANT_COPY,
3307             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3308         },
3309         {
3310             .type = OperandType::BOOL,
3311             .dimensions = {},
3312             .numberOfConsumers = 1,
3313             .scale = 0.0f,
3314             .zeroPoint = 0,
3315             .lifetime = OperandLifeTime::CONSTANT_COPY,
3316             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3317         },
3318         {
3319             .type = OperandType::TENSOR_FLOAT32,
3320             .dimensions = {0, 0, 0, 0},
3321             .numberOfConsumers = 0,
3322             .scale = 0.0f,
3323             .zeroPoint = 0,
3324             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3325             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3326         }
3327     };
3328 
3329     const std::vector<Operation> operations = {
3330         {
3331             .type = OperationType::ROI_ALIGN,
3332             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3333             .outputs = {10},
3334         }
3335     };
3336 
3337     const std::vector<uint32_t> inputIndexes = {0, 1};
3338     const std::vector<uint32_t> outputIndexes = {10};
3339     std::vector<uint8_t> operandValues = {
3340       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
3341     };
3342     const std::vector<hidl_memory> pools = {};
3343 
3344     return {
3345         .operands = operands,
3346         .operations = operations,
3347         .inputIndexes = inputIndexes,
3348         .outputIndexes = outputIndexes,
3349         .operandValues = operandValues,
3350         .pools = pools,
3351     };
3352 }
3353 
is_ignored_dynamic_output_shape_nhwc_2(int i)3354 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
3355   static std::set<int> ignore = {};
3356   return ignore.find(i) != ignore.end();
3357 }
3358 
3359 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed_2()3360 Model createTestModel_dynamic_output_shape_nhwc_relaxed_2() {
3361     const std::vector<Operand> operands = {
3362         {
3363             .type = OperandType::TENSOR_FLOAT32,
3364             .dimensions = {4, 4, 8, 2},
3365             .numberOfConsumers = 1,
3366             .scale = 0.0f,
3367             .zeroPoint = 0,
3368             .lifetime = OperandLifeTime::MODEL_INPUT,
3369             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3370         },
3371         {
3372             .type = OperandType::TENSOR_FLOAT32,
3373             .dimensions = {4, 4},
3374             .numberOfConsumers = 1,
3375             .scale = 0.0f,
3376             .zeroPoint = 0,
3377             .lifetime = OperandLifeTime::MODEL_INPUT,
3378             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3379         },
3380         {
3381             .type = OperandType::TENSOR_INT32,
3382             .dimensions = {4},
3383             .numberOfConsumers = 1,
3384             .scale = 0.0f,
3385             .zeroPoint = 0,
3386             .lifetime = OperandLifeTime::CONSTANT_COPY,
3387             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3388         },
3389         {
3390             .type = OperandType::INT32,
3391             .dimensions = {},
3392             .numberOfConsumers = 1,
3393             .scale = 0.0f,
3394             .zeroPoint = 0,
3395             .lifetime = OperandLifeTime::CONSTANT_COPY,
3396             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3397         },
3398         {
3399             .type = OperandType::INT32,
3400             .dimensions = {},
3401             .numberOfConsumers = 1,
3402             .scale = 0.0f,
3403             .zeroPoint = 0,
3404             .lifetime = OperandLifeTime::CONSTANT_COPY,
3405             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3406         },
3407         {
3408             .type = OperandType::FLOAT32,
3409             .dimensions = {},
3410             .numberOfConsumers = 1,
3411             .scale = 0.0f,
3412             .zeroPoint = 0,
3413             .lifetime = OperandLifeTime::CONSTANT_COPY,
3414             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3415         },
3416         {
3417             .type = OperandType::FLOAT32,
3418             .dimensions = {},
3419             .numberOfConsumers = 1,
3420             .scale = 0.0f,
3421             .zeroPoint = 0,
3422             .lifetime = OperandLifeTime::CONSTANT_COPY,
3423             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3424         },
3425         {
3426             .type = OperandType::INT32,
3427             .dimensions = {},
3428             .numberOfConsumers = 1,
3429             .scale = 0.0f,
3430             .zeroPoint = 0,
3431             .lifetime = OperandLifeTime::CONSTANT_COPY,
3432             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3433         },
3434         {
3435             .type = OperandType::INT32,
3436             .dimensions = {},
3437             .numberOfConsumers = 1,
3438             .scale = 0.0f,
3439             .zeroPoint = 0,
3440             .lifetime = OperandLifeTime::CONSTANT_COPY,
3441             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3442         },
3443         {
3444             .type = OperandType::BOOL,
3445             .dimensions = {},
3446             .numberOfConsumers = 1,
3447             .scale = 0.0f,
3448             .zeroPoint = 0,
3449             .lifetime = OperandLifeTime::CONSTANT_COPY,
3450             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3451         },
3452         {
3453             .type = OperandType::TENSOR_FLOAT32,
3454             .dimensions = {0, 0, 0, 0},
3455             .numberOfConsumers = 0,
3456             .scale = 0.0f,
3457             .zeroPoint = 0,
3458             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3459             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3460         }
3461     };
3462 
3463     const std::vector<Operation> operations = {
3464         {
3465             .type = OperationType::ROI_ALIGN,
3466             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3467             .outputs = {10},
3468         }
3469     };
3470 
3471     const std::vector<uint32_t> inputIndexes = {0, 1};
3472     const std::vector<uint32_t> outputIndexes = {10};
3473     std::vector<uint8_t> operandValues = {
3474       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
3475     };
3476     const std::vector<hidl_memory> pools = {};
3477 
3478     return {
3479         .operands = operands,
3480         .operations = operations,
3481         .inputIndexes = inputIndexes,
3482         .outputIndexes = outputIndexes,
3483         .operandValues = operandValues,
3484         .pools = pools,
3485         .relaxComputationFloat32toFloat16 = true,
3486     };
3487 }
3488 
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)3489 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
3490   static std::set<int> ignore = {};
3491   return ignore.find(i) != ignore.end();
3492 }
3493 
3494 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8_2()3495 Model createTestModel_dynamic_output_shape_nhwc_quant8_2() {
3496     const std::vector<Operand> operands = {
3497         {
3498             .type = OperandType::TENSOR_QUANT8_ASYMM,
3499             .dimensions = {4, 4, 8, 2},
3500             .numberOfConsumers = 1,
3501             .scale = 0.04f,
3502             .zeroPoint = 0,
3503             .lifetime = OperandLifeTime::MODEL_INPUT,
3504             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3505         },
3506         {
3507             .type = OperandType::TENSOR_QUANT16_ASYMM,
3508             .dimensions = {4, 4},
3509             .numberOfConsumers = 1,
3510             .scale = 0.125f,
3511             .zeroPoint = 0,
3512             .lifetime = OperandLifeTime::MODEL_INPUT,
3513             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3514         },
3515         {
3516             .type = OperandType::TENSOR_INT32,
3517             .dimensions = {4},
3518             .numberOfConsumers = 1,
3519             .scale = 0.0f,
3520             .zeroPoint = 0,
3521             .lifetime = OperandLifeTime::CONSTANT_COPY,
3522             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3523         },
3524         {
3525             .type = OperandType::INT32,
3526             .dimensions = {},
3527             .numberOfConsumers = 1,
3528             .scale = 0.0f,
3529             .zeroPoint = 0,
3530             .lifetime = OperandLifeTime::CONSTANT_COPY,
3531             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3532         },
3533         {
3534             .type = OperandType::INT32,
3535             .dimensions = {},
3536             .numberOfConsumers = 1,
3537             .scale = 0.0f,
3538             .zeroPoint = 0,
3539             .lifetime = OperandLifeTime::CONSTANT_COPY,
3540             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3541         },
3542         {
3543             .type = OperandType::FLOAT32,
3544             .dimensions = {},
3545             .numberOfConsumers = 1,
3546             .scale = 0.0f,
3547             .zeroPoint = 0,
3548             .lifetime = OperandLifeTime::CONSTANT_COPY,
3549             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3550         },
3551         {
3552             .type = OperandType::FLOAT32,
3553             .dimensions = {},
3554             .numberOfConsumers = 1,
3555             .scale = 0.0f,
3556             .zeroPoint = 0,
3557             .lifetime = OperandLifeTime::CONSTANT_COPY,
3558             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3559         },
3560         {
3561             .type = OperandType::INT32,
3562             .dimensions = {},
3563             .numberOfConsumers = 1,
3564             .scale = 0.0f,
3565             .zeroPoint = 0,
3566             .lifetime = OperandLifeTime::CONSTANT_COPY,
3567             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3568         },
3569         {
3570             .type = OperandType::INT32,
3571             .dimensions = {},
3572             .numberOfConsumers = 1,
3573             .scale = 0.0f,
3574             .zeroPoint = 0,
3575             .lifetime = OperandLifeTime::CONSTANT_COPY,
3576             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3577         },
3578         {
3579             .type = OperandType::BOOL,
3580             .dimensions = {},
3581             .numberOfConsumers = 1,
3582             .scale = 0.0f,
3583             .zeroPoint = 0,
3584             .lifetime = OperandLifeTime::CONSTANT_COPY,
3585             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3586         },
3587         {
3588             .type = OperandType::TENSOR_QUANT8_ASYMM,
3589             .dimensions = {0, 0, 0, 0},
3590             .numberOfConsumers = 0,
3591             .scale = 0.03125f,
3592             .zeroPoint = 10,
3593             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3594             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3595         }
3596     };
3597 
3598     const std::vector<Operation> operations = {
3599         {
3600             .type = OperationType::ROI_ALIGN,
3601             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3602             .outputs = {10},
3603         }
3604     };
3605 
3606     const std::vector<uint32_t> inputIndexes = {0, 1};
3607     const std::vector<uint32_t> outputIndexes = {10};
3608     std::vector<uint8_t> operandValues = {
3609       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
3610     };
3611     const std::vector<hidl_memory> pools = {};
3612 
3613     return {
3614         .operands = operands,
3615         .operations = operations,
3616         .inputIndexes = inputIndexes,
3617         .outputIndexes = outputIndexes,
3618         .operandValues = operandValues,
3619         .pools = pools,
3620     };
3621 }
3622 
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)3623 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
3624   static std::set<int> ignore = {};
3625   return ignore.find(i) != ignore.end();
3626 }
3627 
3628 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16_2()3629 Model createTestModel_dynamic_output_shape_nhwc_float16_2() {
3630     const std::vector<Operand> operands = {
3631         {
3632             .type = OperandType::TENSOR_FLOAT16,
3633             .dimensions = {4, 4, 8, 2},
3634             .numberOfConsumers = 1,
3635             .scale = 0.0f,
3636             .zeroPoint = 0,
3637             .lifetime = OperandLifeTime::MODEL_INPUT,
3638             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3639         },
3640         {
3641             .type = OperandType::TENSOR_FLOAT16,
3642             .dimensions = {4, 4},
3643             .numberOfConsumers = 1,
3644             .scale = 0.0f,
3645             .zeroPoint = 0,
3646             .lifetime = OperandLifeTime::MODEL_INPUT,
3647             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3648         },
3649         {
3650             .type = OperandType::TENSOR_INT32,
3651             .dimensions = {4},
3652             .numberOfConsumers = 1,
3653             .scale = 0.0f,
3654             .zeroPoint = 0,
3655             .lifetime = OperandLifeTime::CONSTANT_COPY,
3656             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3657         },
3658         {
3659             .type = OperandType::INT32,
3660             .dimensions = {},
3661             .numberOfConsumers = 1,
3662             .scale = 0.0f,
3663             .zeroPoint = 0,
3664             .lifetime = OperandLifeTime::CONSTANT_COPY,
3665             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3666         },
3667         {
3668             .type = OperandType::INT32,
3669             .dimensions = {},
3670             .numberOfConsumers = 1,
3671             .scale = 0.0f,
3672             .zeroPoint = 0,
3673             .lifetime = OperandLifeTime::CONSTANT_COPY,
3674             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3675         },
3676         {
3677             .type = OperandType::FLOAT16,
3678             .dimensions = {},
3679             .numberOfConsumers = 1,
3680             .scale = 0.0f,
3681             .zeroPoint = 0,
3682             .lifetime = OperandLifeTime::CONSTANT_COPY,
3683             .location = {.poolIndex = 0, .offset = 24, .length = 2},
3684         },
3685         {
3686             .type = OperandType::FLOAT16,
3687             .dimensions = {},
3688             .numberOfConsumers = 1,
3689             .scale = 0.0f,
3690             .zeroPoint = 0,
3691             .lifetime = OperandLifeTime::CONSTANT_COPY,
3692             .location = {.poolIndex = 0, .offset = 26, .length = 2},
3693         },
3694         {
3695             .type = OperandType::INT32,
3696             .dimensions = {},
3697             .numberOfConsumers = 1,
3698             .scale = 0.0f,
3699             .zeroPoint = 0,
3700             .lifetime = OperandLifeTime::CONSTANT_COPY,
3701             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3702         },
3703         {
3704             .type = OperandType::INT32,
3705             .dimensions = {},
3706             .numberOfConsumers = 1,
3707             .scale = 0.0f,
3708             .zeroPoint = 0,
3709             .lifetime = OperandLifeTime::CONSTANT_COPY,
3710             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3711         },
3712         {
3713             .type = OperandType::BOOL,
3714             .dimensions = {},
3715             .numberOfConsumers = 1,
3716             .scale = 0.0f,
3717             .zeroPoint = 0,
3718             .lifetime = OperandLifeTime::CONSTANT_COPY,
3719             .location = {.poolIndex = 0, .offset = 36, .length = 1},
3720         },
3721         {
3722             .type = OperandType::TENSOR_FLOAT16,
3723             .dimensions = {0, 0, 0, 0},
3724             .numberOfConsumers = 0,
3725             .scale = 0.0f,
3726             .zeroPoint = 0,
3727             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3728             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3729         }
3730     };
3731 
3732     const std::vector<Operation> operations = {
3733         {
3734             .type = OperationType::ROI_ALIGN,
3735             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3736             .outputs = {10},
3737         }
3738     };
3739 
3740     const std::vector<uint32_t> inputIndexes = {0, 1};
3741     const std::vector<uint32_t> outputIndexes = {10};
3742     std::vector<uint8_t> operandValues = {
3743       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 4, 0, 0, 0, 4, 0, 0, 0, 0
3744     };
3745     const std::vector<hidl_memory> pools = {};
3746 
3747     return {
3748         .operands = operands,
3749         .operations = operations,
3750         .inputIndexes = inputIndexes,
3751         .outputIndexes = outputIndexes,
3752         .operandValues = operandValues,
3753         .pools = pools,
3754     };
3755 }
3756 
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)3757 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
3758   static std::set<int> ignore = {};
3759   return ignore.find(i) != ignore.end();
3760 }
3761 
3762 // Create the model
createTestModel_dynamic_output_shape_nchw_2()3763 Model createTestModel_dynamic_output_shape_nchw_2() {
3764     const std::vector<Operand> operands = {
3765         {
3766             .type = OperandType::TENSOR_FLOAT32,
3767             .dimensions = {4, 2, 4, 8},
3768             .numberOfConsumers = 1,
3769             .scale = 0.0f,
3770             .zeroPoint = 0,
3771             .lifetime = OperandLifeTime::MODEL_INPUT,
3772             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3773         },
3774         {
3775             .type = OperandType::TENSOR_FLOAT32,
3776             .dimensions = {4, 4},
3777             .numberOfConsumers = 1,
3778             .scale = 0.0f,
3779             .zeroPoint = 0,
3780             .lifetime = OperandLifeTime::MODEL_INPUT,
3781             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3782         },
3783         {
3784             .type = OperandType::TENSOR_INT32,
3785             .dimensions = {4},
3786             .numberOfConsumers = 1,
3787             .scale = 0.0f,
3788             .zeroPoint = 0,
3789             .lifetime = OperandLifeTime::CONSTANT_COPY,
3790             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3791         },
3792         {
3793             .type = OperandType::INT32,
3794             .dimensions = {},
3795             .numberOfConsumers = 1,
3796             .scale = 0.0f,
3797             .zeroPoint = 0,
3798             .lifetime = OperandLifeTime::CONSTANT_COPY,
3799             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3800         },
3801         {
3802             .type = OperandType::INT32,
3803             .dimensions = {},
3804             .numberOfConsumers = 1,
3805             .scale = 0.0f,
3806             .zeroPoint = 0,
3807             .lifetime = OperandLifeTime::CONSTANT_COPY,
3808             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3809         },
3810         {
3811             .type = OperandType::FLOAT32,
3812             .dimensions = {},
3813             .numberOfConsumers = 1,
3814             .scale = 0.0f,
3815             .zeroPoint = 0,
3816             .lifetime = OperandLifeTime::CONSTANT_COPY,
3817             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3818         },
3819         {
3820             .type = OperandType::FLOAT32,
3821             .dimensions = {},
3822             .numberOfConsumers = 1,
3823             .scale = 0.0f,
3824             .zeroPoint = 0,
3825             .lifetime = OperandLifeTime::CONSTANT_COPY,
3826             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3827         },
3828         {
3829             .type = OperandType::INT32,
3830             .dimensions = {},
3831             .numberOfConsumers = 1,
3832             .scale = 0.0f,
3833             .zeroPoint = 0,
3834             .lifetime = OperandLifeTime::CONSTANT_COPY,
3835             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3836         },
3837         {
3838             .type = OperandType::INT32,
3839             .dimensions = {},
3840             .numberOfConsumers = 1,
3841             .scale = 0.0f,
3842             .zeroPoint = 0,
3843             .lifetime = OperandLifeTime::CONSTANT_COPY,
3844             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3845         },
3846         {
3847             .type = OperandType::BOOL,
3848             .dimensions = {},
3849             .numberOfConsumers = 1,
3850             .scale = 0.0f,
3851             .zeroPoint = 0,
3852             .lifetime = OperandLifeTime::CONSTANT_COPY,
3853             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3854         },
3855         {
3856             .type = OperandType::TENSOR_FLOAT32,
3857             .dimensions = {0, 0, 0, 0},
3858             .numberOfConsumers = 0,
3859             .scale = 0.0f,
3860             .zeroPoint = 0,
3861             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3862             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3863         }
3864     };
3865 
3866     const std::vector<Operation> operations = {
3867         {
3868             .type = OperationType::ROI_ALIGN,
3869             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3870             .outputs = {10},
3871         }
3872     };
3873 
3874     const std::vector<uint32_t> inputIndexes = {0, 1};
3875     const std::vector<uint32_t> outputIndexes = {10};
3876     std::vector<uint8_t> operandValues = {
3877       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
3878     };
3879     const std::vector<hidl_memory> pools = {};
3880 
3881     return {
3882         .operands = operands,
3883         .operations = operations,
3884         .inputIndexes = inputIndexes,
3885         .outputIndexes = outputIndexes,
3886         .operandValues = operandValues,
3887         .pools = pools,
3888     };
3889 }
3890 
is_ignored_dynamic_output_shape_nchw_2(int i)3891 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
3892   static std::set<int> ignore = {};
3893   return ignore.find(i) != ignore.end();
3894 }
3895 
3896 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed_2()3897 Model createTestModel_dynamic_output_shape_nchw_relaxed_2() {
3898     const std::vector<Operand> operands = {
3899         {
3900             .type = OperandType::TENSOR_FLOAT32,
3901             .dimensions = {4, 2, 4, 8},
3902             .numberOfConsumers = 1,
3903             .scale = 0.0f,
3904             .zeroPoint = 0,
3905             .lifetime = OperandLifeTime::MODEL_INPUT,
3906             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3907         },
3908         {
3909             .type = OperandType::TENSOR_FLOAT32,
3910             .dimensions = {4, 4},
3911             .numberOfConsumers = 1,
3912             .scale = 0.0f,
3913             .zeroPoint = 0,
3914             .lifetime = OperandLifeTime::MODEL_INPUT,
3915             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3916         },
3917         {
3918             .type = OperandType::TENSOR_INT32,
3919             .dimensions = {4},
3920             .numberOfConsumers = 1,
3921             .scale = 0.0f,
3922             .zeroPoint = 0,
3923             .lifetime = OperandLifeTime::CONSTANT_COPY,
3924             .location = {.poolIndex = 0, .offset = 0, .length = 16},
3925         },
3926         {
3927             .type = OperandType::INT32,
3928             .dimensions = {},
3929             .numberOfConsumers = 1,
3930             .scale = 0.0f,
3931             .zeroPoint = 0,
3932             .lifetime = OperandLifeTime::CONSTANT_COPY,
3933             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3934         },
3935         {
3936             .type = OperandType::INT32,
3937             .dimensions = {},
3938             .numberOfConsumers = 1,
3939             .scale = 0.0f,
3940             .zeroPoint = 0,
3941             .lifetime = OperandLifeTime::CONSTANT_COPY,
3942             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3943         },
3944         {
3945             .type = OperandType::FLOAT32,
3946             .dimensions = {},
3947             .numberOfConsumers = 1,
3948             .scale = 0.0f,
3949             .zeroPoint = 0,
3950             .lifetime = OperandLifeTime::CONSTANT_COPY,
3951             .location = {.poolIndex = 0, .offset = 24, .length = 4},
3952         },
3953         {
3954             .type = OperandType::FLOAT32,
3955             .dimensions = {},
3956             .numberOfConsumers = 1,
3957             .scale = 0.0f,
3958             .zeroPoint = 0,
3959             .lifetime = OperandLifeTime::CONSTANT_COPY,
3960             .location = {.poolIndex = 0, .offset = 28, .length = 4},
3961         },
3962         {
3963             .type = OperandType::INT32,
3964             .dimensions = {},
3965             .numberOfConsumers = 1,
3966             .scale = 0.0f,
3967             .zeroPoint = 0,
3968             .lifetime = OperandLifeTime::CONSTANT_COPY,
3969             .location = {.poolIndex = 0, .offset = 32, .length = 4},
3970         },
3971         {
3972             .type = OperandType::INT32,
3973             .dimensions = {},
3974             .numberOfConsumers = 1,
3975             .scale = 0.0f,
3976             .zeroPoint = 0,
3977             .lifetime = OperandLifeTime::CONSTANT_COPY,
3978             .location = {.poolIndex = 0, .offset = 36, .length = 4},
3979         },
3980         {
3981             .type = OperandType::BOOL,
3982             .dimensions = {},
3983             .numberOfConsumers = 1,
3984             .scale = 0.0f,
3985             .zeroPoint = 0,
3986             .lifetime = OperandLifeTime::CONSTANT_COPY,
3987             .location = {.poolIndex = 0, .offset = 40, .length = 1},
3988         },
3989         {
3990             .type = OperandType::TENSOR_FLOAT32,
3991             .dimensions = {0, 0, 0, 0},
3992             .numberOfConsumers = 0,
3993             .scale = 0.0f,
3994             .zeroPoint = 0,
3995             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3996             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3997         }
3998     };
3999 
4000     const std::vector<Operation> operations = {
4001         {
4002             .type = OperationType::ROI_ALIGN,
4003             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4004             .outputs = {10},
4005         }
4006     };
4007 
4008     const std::vector<uint32_t> inputIndexes = {0, 1};
4009     const std::vector<uint32_t> outputIndexes = {10};
4010     std::vector<uint8_t> operandValues = {
4011       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
4012     };
4013     const std::vector<hidl_memory> pools = {};
4014 
4015     return {
4016         .operands = operands,
4017         .operations = operations,
4018         .inputIndexes = inputIndexes,
4019         .outputIndexes = outputIndexes,
4020         .operandValues = operandValues,
4021         .pools = pools,
4022         .relaxComputationFloat32toFloat16 = true,
4023     };
4024 }
4025 
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)4026 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
4027   static std::set<int> ignore = {};
4028   return ignore.find(i) != ignore.end();
4029 }
4030 
4031 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8_2()4032 Model createTestModel_dynamic_output_shape_nchw_quant8_2() {
4033     const std::vector<Operand> operands = {
4034         {
4035             .type = OperandType::TENSOR_QUANT8_ASYMM,
4036             .dimensions = {4, 2, 4, 8},
4037             .numberOfConsumers = 1,
4038             .scale = 0.04f,
4039             .zeroPoint = 0,
4040             .lifetime = OperandLifeTime::MODEL_INPUT,
4041             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4042         },
4043         {
4044             .type = OperandType::TENSOR_QUANT16_ASYMM,
4045             .dimensions = {4, 4},
4046             .numberOfConsumers = 1,
4047             .scale = 0.125f,
4048             .zeroPoint = 0,
4049             .lifetime = OperandLifeTime::MODEL_INPUT,
4050             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4051         },
4052         {
4053             .type = OperandType::TENSOR_INT32,
4054             .dimensions = {4},
4055             .numberOfConsumers = 1,
4056             .scale = 0.0f,
4057             .zeroPoint = 0,
4058             .lifetime = OperandLifeTime::CONSTANT_COPY,
4059             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4060         },
4061         {
4062             .type = OperandType::INT32,
4063             .dimensions = {},
4064             .numberOfConsumers = 1,
4065             .scale = 0.0f,
4066             .zeroPoint = 0,
4067             .lifetime = OperandLifeTime::CONSTANT_COPY,
4068             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4069         },
4070         {
4071             .type = OperandType::INT32,
4072             .dimensions = {},
4073             .numberOfConsumers = 1,
4074             .scale = 0.0f,
4075             .zeroPoint = 0,
4076             .lifetime = OperandLifeTime::CONSTANT_COPY,
4077             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4078         },
4079         {
4080             .type = OperandType::FLOAT32,
4081             .dimensions = {},
4082             .numberOfConsumers = 1,
4083             .scale = 0.0f,
4084             .zeroPoint = 0,
4085             .lifetime = OperandLifeTime::CONSTANT_COPY,
4086             .location = {.poolIndex = 0, .offset = 24, .length = 4},
4087         },
4088         {
4089             .type = OperandType::FLOAT32,
4090             .dimensions = {},
4091             .numberOfConsumers = 1,
4092             .scale = 0.0f,
4093             .zeroPoint = 0,
4094             .lifetime = OperandLifeTime::CONSTANT_COPY,
4095             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4096         },
4097         {
4098             .type = OperandType::INT32,
4099             .dimensions = {},
4100             .numberOfConsumers = 1,
4101             .scale = 0.0f,
4102             .zeroPoint = 0,
4103             .lifetime = OperandLifeTime::CONSTANT_COPY,
4104             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4105         },
4106         {
4107             .type = OperandType::INT32,
4108             .dimensions = {},
4109             .numberOfConsumers = 1,
4110             .scale = 0.0f,
4111             .zeroPoint = 0,
4112             .lifetime = OperandLifeTime::CONSTANT_COPY,
4113             .location = {.poolIndex = 0, .offset = 36, .length = 4},
4114         },
4115         {
4116             .type = OperandType::BOOL,
4117             .dimensions = {},
4118             .numberOfConsumers = 1,
4119             .scale = 0.0f,
4120             .zeroPoint = 0,
4121             .lifetime = OperandLifeTime::CONSTANT_COPY,
4122             .location = {.poolIndex = 0, .offset = 40, .length = 1},
4123         },
4124         {
4125             .type = OperandType::TENSOR_QUANT8_ASYMM,
4126             .dimensions = {0, 0, 0, 0},
4127             .numberOfConsumers = 0,
4128             .scale = 0.03125f,
4129             .zeroPoint = 10,
4130             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4131             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4132         }
4133     };
4134 
4135     const std::vector<Operation> operations = {
4136         {
4137             .type = OperationType::ROI_ALIGN,
4138             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4139             .outputs = {10},
4140         }
4141     };
4142 
4143     const std::vector<uint32_t> inputIndexes = {0, 1};
4144     const std::vector<uint32_t> outputIndexes = {10};
4145     std::vector<uint8_t> operandValues = {
4146       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
4147     };
4148     const std::vector<hidl_memory> pools = {};
4149 
4150     return {
4151         .operands = operands,
4152         .operations = operations,
4153         .inputIndexes = inputIndexes,
4154         .outputIndexes = outputIndexes,
4155         .operandValues = operandValues,
4156         .pools = pools,
4157     };
4158 }
4159 
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)4160 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
4161   static std::set<int> ignore = {};
4162   return ignore.find(i) != ignore.end();
4163 }
4164 
4165 // Create the model
createTestModel_dynamic_output_shape_nchw_float16_2()4166 Model createTestModel_dynamic_output_shape_nchw_float16_2() {
4167     const std::vector<Operand> operands = {
4168         {
4169             .type = OperandType::TENSOR_FLOAT16,
4170             .dimensions = {4, 2, 4, 8},
4171             .numberOfConsumers = 1,
4172             .scale = 0.0f,
4173             .zeroPoint = 0,
4174             .lifetime = OperandLifeTime::MODEL_INPUT,
4175             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4176         },
4177         {
4178             .type = OperandType::TENSOR_FLOAT16,
4179             .dimensions = {4, 4},
4180             .numberOfConsumers = 1,
4181             .scale = 0.0f,
4182             .zeroPoint = 0,
4183             .lifetime = OperandLifeTime::MODEL_INPUT,
4184             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4185         },
4186         {
4187             .type = OperandType::TENSOR_INT32,
4188             .dimensions = {4},
4189             .numberOfConsumers = 1,
4190             .scale = 0.0f,
4191             .zeroPoint = 0,
4192             .lifetime = OperandLifeTime::CONSTANT_COPY,
4193             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4194         },
4195         {
4196             .type = OperandType::INT32,
4197             .dimensions = {},
4198             .numberOfConsumers = 1,
4199             .scale = 0.0f,
4200             .zeroPoint = 0,
4201             .lifetime = OperandLifeTime::CONSTANT_COPY,
4202             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4203         },
4204         {
4205             .type = OperandType::INT32,
4206             .dimensions = {},
4207             .numberOfConsumers = 1,
4208             .scale = 0.0f,
4209             .zeroPoint = 0,
4210             .lifetime = OperandLifeTime::CONSTANT_COPY,
4211             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4212         },
4213         {
4214             .type = OperandType::FLOAT16,
4215             .dimensions = {},
4216             .numberOfConsumers = 1,
4217             .scale = 0.0f,
4218             .zeroPoint = 0,
4219             .lifetime = OperandLifeTime::CONSTANT_COPY,
4220             .location = {.poolIndex = 0, .offset = 24, .length = 2},
4221         },
4222         {
4223             .type = OperandType::FLOAT16,
4224             .dimensions = {},
4225             .numberOfConsumers = 1,
4226             .scale = 0.0f,
4227             .zeroPoint = 0,
4228             .lifetime = OperandLifeTime::CONSTANT_COPY,
4229             .location = {.poolIndex = 0, .offset = 26, .length = 2},
4230         },
4231         {
4232             .type = OperandType::INT32,
4233             .dimensions = {},
4234             .numberOfConsumers = 1,
4235             .scale = 0.0f,
4236             .zeroPoint = 0,
4237             .lifetime = OperandLifeTime::CONSTANT_COPY,
4238             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4239         },
4240         {
4241             .type = OperandType::INT32,
4242             .dimensions = {},
4243             .numberOfConsumers = 1,
4244             .scale = 0.0f,
4245             .zeroPoint = 0,
4246             .lifetime = OperandLifeTime::CONSTANT_COPY,
4247             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4248         },
4249         {
4250             .type = OperandType::BOOL,
4251             .dimensions = {},
4252             .numberOfConsumers = 1,
4253             .scale = 0.0f,
4254             .zeroPoint = 0,
4255             .lifetime = OperandLifeTime::CONSTANT_COPY,
4256             .location = {.poolIndex = 0, .offset = 36, .length = 1},
4257         },
4258         {
4259             .type = OperandType::TENSOR_FLOAT16,
4260             .dimensions = {0, 0, 0, 0},
4261             .numberOfConsumers = 0,
4262             .scale = 0.0f,
4263             .zeroPoint = 0,
4264             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4265             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4266         }
4267     };
4268 
4269     const std::vector<Operation> operations = {
4270         {
4271             .type = OperationType::ROI_ALIGN,
4272             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4273             .outputs = {10},
4274         }
4275     };
4276 
4277     const std::vector<uint32_t> inputIndexes = {0, 1};
4278     const std::vector<uint32_t> outputIndexes = {10};
4279     std::vector<uint8_t> operandValues = {
4280       0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 4, 0, 0, 0, 4, 0, 0, 0, 1
4281     };
4282     const std::vector<hidl_memory> pools = {};
4283 
4284     return {
4285         .operands = operands,
4286         .operations = operations,
4287         .inputIndexes = inputIndexes,
4288         .outputIndexes = outputIndexes,
4289         .operandValues = operandValues,
4290         .pools = pools,
4291     };
4292 }
4293 
is_ignored_dynamic_output_shape_nchw_float16_2(int i)4294 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
4295   static std::set<int> ignore = {};
4296   return ignore.find(i) != ignore.end();
4297 }
4298 
4299 // Create the model
createTestModel_nhwc_3()4300 Model createTestModel_nhwc_3() {
4301     const std::vector<Operand> operands = {
4302         {
4303             .type = OperandType::TENSOR_FLOAT32,
4304             .dimensions = {2, 4, 8, 2},
4305             .numberOfConsumers = 1,
4306             .scale = 0.0f,
4307             .zeroPoint = 0,
4308             .lifetime = OperandLifeTime::MODEL_INPUT,
4309             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4310         },
4311         {
4312             .type = OperandType::TENSOR_FLOAT32,
4313             .dimensions = {4, 4},
4314             .numberOfConsumers = 1,
4315             .scale = 0.0f,
4316             .zeroPoint = 0,
4317             .lifetime = OperandLifeTime::MODEL_INPUT,
4318             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4319         },
4320         {
4321             .type = OperandType::TENSOR_INT32,
4322             .dimensions = {4},
4323             .numberOfConsumers = 1,
4324             .scale = 0.0f,
4325             .zeroPoint = 0,
4326             .lifetime = OperandLifeTime::CONSTANT_COPY,
4327             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4328         },
4329         {
4330             .type = OperandType::INT32,
4331             .dimensions = {},
4332             .numberOfConsumers = 1,
4333             .scale = 0.0f,
4334             .zeroPoint = 0,
4335             .lifetime = OperandLifeTime::CONSTANT_COPY,
4336             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4337         },
4338         {
4339             .type = OperandType::INT32,
4340             .dimensions = {},
4341             .numberOfConsumers = 1,
4342             .scale = 0.0f,
4343             .zeroPoint = 0,
4344             .lifetime = OperandLifeTime::CONSTANT_COPY,
4345             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4346         },
4347         {
4348             .type = OperandType::FLOAT32,
4349             .dimensions = {},
4350             .numberOfConsumers = 1,
4351             .scale = 0.0f,
4352             .zeroPoint = 0,
4353             .lifetime = OperandLifeTime::CONSTANT_COPY,
4354             .location = {.poolIndex = 0, .offset = 24, .length = 4},
4355         },
4356         {
4357             .type = OperandType::FLOAT32,
4358             .dimensions = {},
4359             .numberOfConsumers = 1,
4360             .scale = 0.0f,
4361             .zeroPoint = 0,
4362             .lifetime = OperandLifeTime::CONSTANT_COPY,
4363             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4364         },
4365         {
4366             .type = OperandType::INT32,
4367             .dimensions = {},
4368             .numberOfConsumers = 1,
4369             .scale = 0.0f,
4370             .zeroPoint = 0,
4371             .lifetime = OperandLifeTime::CONSTANT_COPY,
4372             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4373         },
4374         {
4375             .type = OperandType::INT32,
4376             .dimensions = {},
4377             .numberOfConsumers = 1,
4378             .scale = 0.0f,
4379             .zeroPoint = 0,
4380             .lifetime = OperandLifeTime::CONSTANT_COPY,
4381             .location = {.poolIndex = 0, .offset = 36, .length = 4},
4382         },
4383         {
4384             .type = OperandType::BOOL,
4385             .dimensions = {},
4386             .numberOfConsumers = 1,
4387             .scale = 0.0f,
4388             .zeroPoint = 0,
4389             .lifetime = OperandLifeTime::CONSTANT_COPY,
4390             .location = {.poolIndex = 0, .offset = 40, .length = 1},
4391         },
4392         {
4393             .type = OperandType::TENSOR_FLOAT32,
4394             .dimensions = {4, 2, 3, 2},
4395             .numberOfConsumers = 0,
4396             .scale = 0.0f,
4397             .zeroPoint = 0,
4398             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4399             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4400         }
4401     };
4402 
4403     const std::vector<Operation> operations = {
4404         {
4405             .type = OperationType::ROI_ALIGN,
4406             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4407             .outputs = {10},
4408         }
4409     };
4410 
4411     const std::vector<uint32_t> inputIndexes = {0, 1};
4412     const std::vector<uint32_t> outputIndexes = {10};
4413     std::vector<uint8_t> operandValues = {
4414       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
4415     };
4416     const std::vector<hidl_memory> pools = {};
4417 
4418     return {
4419         .operands = operands,
4420         .operations = operations,
4421         .inputIndexes = inputIndexes,
4422         .outputIndexes = outputIndexes,
4423         .operandValues = operandValues,
4424         .pools = pools,
4425     };
4426 }
4427 
is_ignored_nhwc_3(int i)4428 inline bool is_ignored_nhwc_3(int i) {
4429   static std::set<int> ignore = {};
4430   return ignore.find(i) != ignore.end();
4431 }
4432 
4433 // Create the model
createTestModel_nhwc_relaxed_3()4434 Model createTestModel_nhwc_relaxed_3() {
4435     const std::vector<Operand> operands = {
4436         {
4437             .type = OperandType::TENSOR_FLOAT32,
4438             .dimensions = {2, 4, 8, 2},
4439             .numberOfConsumers = 1,
4440             .scale = 0.0f,
4441             .zeroPoint = 0,
4442             .lifetime = OperandLifeTime::MODEL_INPUT,
4443             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4444         },
4445         {
4446             .type = OperandType::TENSOR_FLOAT32,
4447             .dimensions = {4, 4},
4448             .numberOfConsumers = 1,
4449             .scale = 0.0f,
4450             .zeroPoint = 0,
4451             .lifetime = OperandLifeTime::MODEL_INPUT,
4452             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4453         },
4454         {
4455             .type = OperandType::TENSOR_INT32,
4456             .dimensions = {4},
4457             .numberOfConsumers = 1,
4458             .scale = 0.0f,
4459             .zeroPoint = 0,
4460             .lifetime = OperandLifeTime::CONSTANT_COPY,
4461             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4462         },
4463         {
4464             .type = OperandType::INT32,
4465             .dimensions = {},
4466             .numberOfConsumers = 1,
4467             .scale = 0.0f,
4468             .zeroPoint = 0,
4469             .lifetime = OperandLifeTime::CONSTANT_COPY,
4470             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4471         },
4472         {
4473             .type = OperandType::INT32,
4474             .dimensions = {},
4475             .numberOfConsumers = 1,
4476             .scale = 0.0f,
4477             .zeroPoint = 0,
4478             .lifetime = OperandLifeTime::CONSTANT_COPY,
4479             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4480         },
4481         {
4482             .type = OperandType::FLOAT32,
4483             .dimensions = {},
4484             .numberOfConsumers = 1,
4485             .scale = 0.0f,
4486             .zeroPoint = 0,
4487             .lifetime = OperandLifeTime::CONSTANT_COPY,
4488             .location = {.poolIndex = 0, .offset = 24, .length = 4},
4489         },
4490         {
4491             .type = OperandType::FLOAT32,
4492             .dimensions = {},
4493             .numberOfConsumers = 1,
4494             .scale = 0.0f,
4495             .zeroPoint = 0,
4496             .lifetime = OperandLifeTime::CONSTANT_COPY,
4497             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4498         },
4499         {
4500             .type = OperandType::INT32,
4501             .dimensions = {},
4502             .numberOfConsumers = 1,
4503             .scale = 0.0f,
4504             .zeroPoint = 0,
4505             .lifetime = OperandLifeTime::CONSTANT_COPY,
4506             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4507         },
4508         {
4509             .type = OperandType::INT32,
4510             .dimensions = {},
4511             .numberOfConsumers = 1,
4512             .scale = 0.0f,
4513             .zeroPoint = 0,
4514             .lifetime = OperandLifeTime::CONSTANT_COPY,
4515             .location = {.poolIndex = 0, .offset = 36, .length = 4},
4516         },
4517         {
4518             .type = OperandType::BOOL,
4519             .dimensions = {},
4520             .numberOfConsumers = 1,
4521             .scale = 0.0f,
4522             .zeroPoint = 0,
4523             .lifetime = OperandLifeTime::CONSTANT_COPY,
4524             .location = {.poolIndex = 0, .offset = 40, .length = 1},
4525         },
4526         {
4527             .type = OperandType::TENSOR_FLOAT32,
4528             .dimensions = {4, 2, 3, 2},
4529             .numberOfConsumers = 0,
4530             .scale = 0.0f,
4531             .zeroPoint = 0,
4532             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4533             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4534         }
4535     };
4536 
4537     const std::vector<Operation> operations = {
4538         {
4539             .type = OperationType::ROI_ALIGN,
4540             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4541             .outputs = {10},
4542         }
4543     };
4544 
4545     const std::vector<uint32_t> inputIndexes = {0, 1};
4546     const std::vector<uint32_t> outputIndexes = {10};
4547     std::vector<uint8_t> operandValues = {
4548       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
4549     };
4550     const std::vector<hidl_memory> pools = {};
4551 
4552     return {
4553         .operands = operands,
4554         .operations = operations,
4555         .inputIndexes = inputIndexes,
4556         .outputIndexes = outputIndexes,
4557         .operandValues = operandValues,
4558         .pools = pools,
4559         .relaxComputationFloat32toFloat16 = true,
4560     };
4561 }
4562 
is_ignored_nhwc_relaxed_3(int i)4563 inline bool is_ignored_nhwc_relaxed_3(int i) {
4564   static std::set<int> ignore = {};
4565   return ignore.find(i) != ignore.end();
4566 }
4567 
4568 // Create the model
createTestModel_nhwc_quant8_3()4569 Model createTestModel_nhwc_quant8_3() {
4570     const std::vector<Operand> operands = {
4571         {
4572             .type = OperandType::TENSOR_QUANT8_ASYMM,
4573             .dimensions = {2, 4, 8, 2},
4574             .numberOfConsumers = 1,
4575             .scale = 0.04f,
4576             .zeroPoint = 0,
4577             .lifetime = OperandLifeTime::MODEL_INPUT,
4578             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4579         },
4580         {
4581             .type = OperandType::TENSOR_QUANT16_ASYMM,
4582             .dimensions = {4, 4},
4583             .numberOfConsumers = 1,
4584             .scale = 0.125f,
4585             .zeroPoint = 0,
4586             .lifetime = OperandLifeTime::MODEL_INPUT,
4587             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4588         },
4589         {
4590             .type = OperandType::TENSOR_INT32,
4591             .dimensions = {4},
4592             .numberOfConsumers = 1,
4593             .scale = 0.0f,
4594             .zeroPoint = 0,
4595             .lifetime = OperandLifeTime::CONSTANT_COPY,
4596             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4597         },
4598         {
4599             .type = OperandType::INT32,
4600             .dimensions = {},
4601             .numberOfConsumers = 1,
4602             .scale = 0.0f,
4603             .zeroPoint = 0,
4604             .lifetime = OperandLifeTime::CONSTANT_COPY,
4605             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4606         },
4607         {
4608             .type = OperandType::INT32,
4609             .dimensions = {},
4610             .numberOfConsumers = 1,
4611             .scale = 0.0f,
4612             .zeroPoint = 0,
4613             .lifetime = OperandLifeTime::CONSTANT_COPY,
4614             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4615         },
4616         {
4617             .type = OperandType::FLOAT32,
4618             .dimensions = {},
4619             .numberOfConsumers = 1,
4620             .scale = 0.0f,
4621             .zeroPoint = 0,
4622             .lifetime = OperandLifeTime::CONSTANT_COPY,
4623             .location = {.poolIndex = 0, .offset = 24, .length = 4},
4624         },
4625         {
4626             .type = OperandType::FLOAT32,
4627             .dimensions = {},
4628             .numberOfConsumers = 1,
4629             .scale = 0.0f,
4630             .zeroPoint = 0,
4631             .lifetime = OperandLifeTime::CONSTANT_COPY,
4632             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4633         },
4634         {
4635             .type = OperandType::INT32,
4636             .dimensions = {},
4637             .numberOfConsumers = 1,
4638             .scale = 0.0f,
4639             .zeroPoint = 0,
4640             .lifetime = OperandLifeTime::CONSTANT_COPY,
4641             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4642         },
4643         {
4644             .type = OperandType::INT32,
4645             .dimensions = {},
4646             .numberOfConsumers = 1,
4647             .scale = 0.0f,
4648             .zeroPoint = 0,
4649             .lifetime = OperandLifeTime::CONSTANT_COPY,
4650             .location = {.poolIndex = 0, .offset = 36, .length = 4},
4651         },
4652         {
4653             .type = OperandType::BOOL,
4654             .dimensions = {},
4655             .numberOfConsumers = 1,
4656             .scale = 0.0f,
4657             .zeroPoint = 0,
4658             .lifetime = OperandLifeTime::CONSTANT_COPY,
4659             .location = {.poolIndex = 0, .offset = 40, .length = 1},
4660         },
4661         {
4662             .type = OperandType::TENSOR_QUANT8_ASYMM,
4663             .dimensions = {4, 2, 3, 2},
4664             .numberOfConsumers = 0,
4665             .scale = 0.03125f,
4666             .zeroPoint = 10,
4667             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4668             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4669         }
4670     };
4671 
4672     const std::vector<Operation> operations = {
4673         {
4674             .type = OperationType::ROI_ALIGN,
4675             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4676             .outputs = {10},
4677         }
4678     };
4679 
4680     const std::vector<uint32_t> inputIndexes = {0, 1};
4681     const std::vector<uint32_t> outputIndexes = {10};
4682     std::vector<uint8_t> operandValues = {
4683       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
4684     };
4685     const std::vector<hidl_memory> pools = {};
4686 
4687     return {
4688         .operands = operands,
4689         .operations = operations,
4690         .inputIndexes = inputIndexes,
4691         .outputIndexes = outputIndexes,
4692         .operandValues = operandValues,
4693         .pools = pools,
4694     };
4695 }
4696 
is_ignored_nhwc_quant8_3(int i)4697 inline bool is_ignored_nhwc_quant8_3(int i) {
4698   static std::set<int> ignore = {};
4699   return ignore.find(i) != ignore.end();
4700 }
4701 
4702 // Create the model
createTestModel_nhwc_float16_3()4703 Model createTestModel_nhwc_float16_3() {
4704     const std::vector<Operand> operands = {
4705         {
4706             .type = OperandType::TENSOR_FLOAT16,
4707             .dimensions = {2, 4, 8, 2},
4708             .numberOfConsumers = 1,
4709             .scale = 0.0f,
4710             .zeroPoint = 0,
4711             .lifetime = OperandLifeTime::MODEL_INPUT,
4712             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4713         },
4714         {
4715             .type = OperandType::TENSOR_FLOAT16,
4716             .dimensions = {4, 4},
4717             .numberOfConsumers = 1,
4718             .scale = 0.0f,
4719             .zeroPoint = 0,
4720             .lifetime = OperandLifeTime::MODEL_INPUT,
4721             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4722         },
4723         {
4724             .type = OperandType::TENSOR_INT32,
4725             .dimensions = {4},
4726             .numberOfConsumers = 1,
4727             .scale = 0.0f,
4728             .zeroPoint = 0,
4729             .lifetime = OperandLifeTime::CONSTANT_COPY,
4730             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4731         },
4732         {
4733             .type = OperandType::INT32,
4734             .dimensions = {},
4735             .numberOfConsumers = 1,
4736             .scale = 0.0f,
4737             .zeroPoint = 0,
4738             .lifetime = OperandLifeTime::CONSTANT_COPY,
4739             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4740         },
4741         {
4742             .type = OperandType::INT32,
4743             .dimensions = {},
4744             .numberOfConsumers = 1,
4745             .scale = 0.0f,
4746             .zeroPoint = 0,
4747             .lifetime = OperandLifeTime::CONSTANT_COPY,
4748             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4749         },
4750         {
4751             .type = OperandType::FLOAT16,
4752             .dimensions = {},
4753             .numberOfConsumers = 1,
4754             .scale = 0.0f,
4755             .zeroPoint = 0,
4756             .lifetime = OperandLifeTime::CONSTANT_COPY,
4757             .location = {.poolIndex = 0, .offset = 24, .length = 2},
4758         },
4759         {
4760             .type = OperandType::FLOAT16,
4761             .dimensions = {},
4762             .numberOfConsumers = 1,
4763             .scale = 0.0f,
4764             .zeroPoint = 0,
4765             .lifetime = OperandLifeTime::CONSTANT_COPY,
4766             .location = {.poolIndex = 0, .offset = 26, .length = 2},
4767         },
4768         {
4769             .type = OperandType::INT32,
4770             .dimensions = {},
4771             .numberOfConsumers = 1,
4772             .scale = 0.0f,
4773             .zeroPoint = 0,
4774             .lifetime = OperandLifeTime::CONSTANT_COPY,
4775             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4776         },
4777         {
4778             .type = OperandType::INT32,
4779             .dimensions = {},
4780             .numberOfConsumers = 1,
4781             .scale = 0.0f,
4782             .zeroPoint = 0,
4783             .lifetime = OperandLifeTime::CONSTANT_COPY,
4784             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4785         },
4786         {
4787             .type = OperandType::BOOL,
4788             .dimensions = {},
4789             .numberOfConsumers = 1,
4790             .scale = 0.0f,
4791             .zeroPoint = 0,
4792             .lifetime = OperandLifeTime::CONSTANT_COPY,
4793             .location = {.poolIndex = 0, .offset = 36, .length = 1},
4794         },
4795         {
4796             .type = OperandType::TENSOR_FLOAT16,
4797             .dimensions = {4, 2, 3, 2},
4798             .numberOfConsumers = 0,
4799             .scale = 0.0f,
4800             .zeroPoint = 0,
4801             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4802             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4803         }
4804     };
4805 
4806     const std::vector<Operation> operations = {
4807         {
4808             .type = OperationType::ROI_ALIGN,
4809             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4810             .outputs = {10},
4811         }
4812     };
4813 
4814     const std::vector<uint32_t> inputIndexes = {0, 1};
4815     const std::vector<uint32_t> outputIndexes = {10};
4816     std::vector<uint8_t> operandValues = {
4817       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0
4818     };
4819     const std::vector<hidl_memory> pools = {};
4820 
4821     return {
4822         .operands = operands,
4823         .operations = operations,
4824         .inputIndexes = inputIndexes,
4825         .outputIndexes = outputIndexes,
4826         .operandValues = operandValues,
4827         .pools = pools,
4828     };
4829 }
4830 
is_ignored_nhwc_float16_3(int i)4831 inline bool is_ignored_nhwc_float16_3(int i) {
4832   static std::set<int> ignore = {};
4833   return ignore.find(i) != ignore.end();
4834 }
4835 
4836 // Create the model
createTestModel_nchw_3()4837 Model createTestModel_nchw_3() {
4838     const std::vector<Operand> operands = {
4839         {
4840             .type = OperandType::TENSOR_FLOAT32,
4841             .dimensions = {2, 2, 4, 8},
4842             .numberOfConsumers = 1,
4843             .scale = 0.0f,
4844             .zeroPoint = 0,
4845             .lifetime = OperandLifeTime::MODEL_INPUT,
4846             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4847         },
4848         {
4849             .type = OperandType::TENSOR_FLOAT32,
4850             .dimensions = {4, 4},
4851             .numberOfConsumers = 1,
4852             .scale = 0.0f,
4853             .zeroPoint = 0,
4854             .lifetime = OperandLifeTime::MODEL_INPUT,
4855             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4856         },
4857         {
4858             .type = OperandType::TENSOR_INT32,
4859             .dimensions = {4},
4860             .numberOfConsumers = 1,
4861             .scale = 0.0f,
4862             .zeroPoint = 0,
4863             .lifetime = OperandLifeTime::CONSTANT_COPY,
4864             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4865         },
4866         {
4867             .type = OperandType::INT32,
4868             .dimensions = {},
4869             .numberOfConsumers = 1,
4870             .scale = 0.0f,
4871             .zeroPoint = 0,
4872             .lifetime = OperandLifeTime::CONSTANT_COPY,
4873             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4874         },
4875         {
4876             .type = OperandType::INT32,
4877             .dimensions = {},
4878             .numberOfConsumers = 1,
4879             .scale = 0.0f,
4880             .zeroPoint = 0,
4881             .lifetime = OperandLifeTime::CONSTANT_COPY,
4882             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4883         },
4884         {
4885             .type = OperandType::FLOAT32,
4886             .dimensions = {},
4887             .numberOfConsumers = 1,
4888             .scale = 0.0f,
4889             .zeroPoint = 0,
4890             .lifetime = OperandLifeTime::CONSTANT_COPY,
4891             .location = {.poolIndex = 0, .offset = 24, .length = 4},
4892         },
4893         {
4894             .type = OperandType::FLOAT32,
4895             .dimensions = {},
4896             .numberOfConsumers = 1,
4897             .scale = 0.0f,
4898             .zeroPoint = 0,
4899             .lifetime = OperandLifeTime::CONSTANT_COPY,
4900             .location = {.poolIndex = 0, .offset = 28, .length = 4},
4901         },
4902         {
4903             .type = OperandType::INT32,
4904             .dimensions = {},
4905             .numberOfConsumers = 1,
4906             .scale = 0.0f,
4907             .zeroPoint = 0,
4908             .lifetime = OperandLifeTime::CONSTANT_COPY,
4909             .location = {.poolIndex = 0, .offset = 32, .length = 4},
4910         },
4911         {
4912             .type = OperandType::INT32,
4913             .dimensions = {},
4914             .numberOfConsumers = 1,
4915             .scale = 0.0f,
4916             .zeroPoint = 0,
4917             .lifetime = OperandLifeTime::CONSTANT_COPY,
4918             .location = {.poolIndex = 0, .offset = 36, .length = 4},
4919         },
4920         {
4921             .type = OperandType::BOOL,
4922             .dimensions = {},
4923             .numberOfConsumers = 1,
4924             .scale = 0.0f,
4925             .zeroPoint = 0,
4926             .lifetime = OperandLifeTime::CONSTANT_COPY,
4927             .location = {.poolIndex = 0, .offset = 40, .length = 1},
4928         },
4929         {
4930             .type = OperandType::TENSOR_FLOAT32,
4931             .dimensions = {4, 2, 2, 3},
4932             .numberOfConsumers = 0,
4933             .scale = 0.0f,
4934             .zeroPoint = 0,
4935             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4936             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4937         }
4938     };
4939 
4940     const std::vector<Operation> operations = {
4941         {
4942             .type = OperationType::ROI_ALIGN,
4943             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
4944             .outputs = {10},
4945         }
4946     };
4947 
4948     const std::vector<uint32_t> inputIndexes = {0, 1};
4949     const std::vector<uint32_t> outputIndexes = {10};
4950     std::vector<uint8_t> operandValues = {
4951       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
4952     };
4953     const std::vector<hidl_memory> pools = {};
4954 
4955     return {
4956         .operands = operands,
4957         .operations = operations,
4958         .inputIndexes = inputIndexes,
4959         .outputIndexes = outputIndexes,
4960         .operandValues = operandValues,
4961         .pools = pools,
4962     };
4963 }
4964 
is_ignored_nchw_3(int i)4965 inline bool is_ignored_nchw_3(int i) {
4966   static std::set<int> ignore = {};
4967   return ignore.find(i) != ignore.end();
4968 }
4969 
4970 // Create the model
createTestModel_nchw_relaxed_3()4971 Model createTestModel_nchw_relaxed_3() {
4972     const std::vector<Operand> operands = {
4973         {
4974             .type = OperandType::TENSOR_FLOAT32,
4975             .dimensions = {2, 2, 4, 8},
4976             .numberOfConsumers = 1,
4977             .scale = 0.0f,
4978             .zeroPoint = 0,
4979             .lifetime = OperandLifeTime::MODEL_INPUT,
4980             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4981         },
4982         {
4983             .type = OperandType::TENSOR_FLOAT32,
4984             .dimensions = {4, 4},
4985             .numberOfConsumers = 1,
4986             .scale = 0.0f,
4987             .zeroPoint = 0,
4988             .lifetime = OperandLifeTime::MODEL_INPUT,
4989             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4990         },
4991         {
4992             .type = OperandType::TENSOR_INT32,
4993             .dimensions = {4},
4994             .numberOfConsumers = 1,
4995             .scale = 0.0f,
4996             .zeroPoint = 0,
4997             .lifetime = OperandLifeTime::CONSTANT_COPY,
4998             .location = {.poolIndex = 0, .offset = 0, .length = 16},
4999         },
5000         {
5001             .type = OperandType::INT32,
5002             .dimensions = {},
5003             .numberOfConsumers = 1,
5004             .scale = 0.0f,
5005             .zeroPoint = 0,
5006             .lifetime = OperandLifeTime::CONSTANT_COPY,
5007             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5008         },
5009         {
5010             .type = OperandType::INT32,
5011             .dimensions = {},
5012             .numberOfConsumers = 1,
5013             .scale = 0.0f,
5014             .zeroPoint = 0,
5015             .lifetime = OperandLifeTime::CONSTANT_COPY,
5016             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5017         },
5018         {
5019             .type = OperandType::FLOAT32,
5020             .dimensions = {},
5021             .numberOfConsumers = 1,
5022             .scale = 0.0f,
5023             .zeroPoint = 0,
5024             .lifetime = OperandLifeTime::CONSTANT_COPY,
5025             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5026         },
5027         {
5028             .type = OperandType::FLOAT32,
5029             .dimensions = {},
5030             .numberOfConsumers = 1,
5031             .scale = 0.0f,
5032             .zeroPoint = 0,
5033             .lifetime = OperandLifeTime::CONSTANT_COPY,
5034             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5035         },
5036         {
5037             .type = OperandType::INT32,
5038             .dimensions = {},
5039             .numberOfConsumers = 1,
5040             .scale = 0.0f,
5041             .zeroPoint = 0,
5042             .lifetime = OperandLifeTime::CONSTANT_COPY,
5043             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5044         },
5045         {
5046             .type = OperandType::INT32,
5047             .dimensions = {},
5048             .numberOfConsumers = 1,
5049             .scale = 0.0f,
5050             .zeroPoint = 0,
5051             .lifetime = OperandLifeTime::CONSTANT_COPY,
5052             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5053         },
5054         {
5055             .type = OperandType::BOOL,
5056             .dimensions = {},
5057             .numberOfConsumers = 1,
5058             .scale = 0.0f,
5059             .zeroPoint = 0,
5060             .lifetime = OperandLifeTime::CONSTANT_COPY,
5061             .location = {.poolIndex = 0, .offset = 40, .length = 1},
5062         },
5063         {
5064             .type = OperandType::TENSOR_FLOAT32,
5065             .dimensions = {4, 2, 2, 3},
5066             .numberOfConsumers = 0,
5067             .scale = 0.0f,
5068             .zeroPoint = 0,
5069             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5070             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5071         }
5072     };
5073 
5074     const std::vector<Operation> operations = {
5075         {
5076             .type = OperationType::ROI_ALIGN,
5077             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5078             .outputs = {10},
5079         }
5080     };
5081 
5082     const std::vector<uint32_t> inputIndexes = {0, 1};
5083     const std::vector<uint32_t> outputIndexes = {10};
5084     std::vector<uint8_t> operandValues = {
5085       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
5086     };
5087     const std::vector<hidl_memory> pools = {};
5088 
5089     return {
5090         .operands = operands,
5091         .operations = operations,
5092         .inputIndexes = inputIndexes,
5093         .outputIndexes = outputIndexes,
5094         .operandValues = operandValues,
5095         .pools = pools,
5096         .relaxComputationFloat32toFloat16 = true,
5097     };
5098 }
5099 
is_ignored_nchw_relaxed_3(int i)5100 inline bool is_ignored_nchw_relaxed_3(int i) {
5101   static std::set<int> ignore = {};
5102   return ignore.find(i) != ignore.end();
5103 }
5104 
5105 // Create the model
createTestModel_nchw_quant8_3()5106 Model createTestModel_nchw_quant8_3() {
5107     const std::vector<Operand> operands = {
5108         {
5109             .type = OperandType::TENSOR_QUANT8_ASYMM,
5110             .dimensions = {2, 2, 4, 8},
5111             .numberOfConsumers = 1,
5112             .scale = 0.04f,
5113             .zeroPoint = 0,
5114             .lifetime = OperandLifeTime::MODEL_INPUT,
5115             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5116         },
5117         {
5118             .type = OperandType::TENSOR_QUANT16_ASYMM,
5119             .dimensions = {4, 4},
5120             .numberOfConsumers = 1,
5121             .scale = 0.125f,
5122             .zeroPoint = 0,
5123             .lifetime = OperandLifeTime::MODEL_INPUT,
5124             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5125         },
5126         {
5127             .type = OperandType::TENSOR_INT32,
5128             .dimensions = {4},
5129             .numberOfConsumers = 1,
5130             .scale = 0.0f,
5131             .zeroPoint = 0,
5132             .lifetime = OperandLifeTime::CONSTANT_COPY,
5133             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5134         },
5135         {
5136             .type = OperandType::INT32,
5137             .dimensions = {},
5138             .numberOfConsumers = 1,
5139             .scale = 0.0f,
5140             .zeroPoint = 0,
5141             .lifetime = OperandLifeTime::CONSTANT_COPY,
5142             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5143         },
5144         {
5145             .type = OperandType::INT32,
5146             .dimensions = {},
5147             .numberOfConsumers = 1,
5148             .scale = 0.0f,
5149             .zeroPoint = 0,
5150             .lifetime = OperandLifeTime::CONSTANT_COPY,
5151             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5152         },
5153         {
5154             .type = OperandType::FLOAT32,
5155             .dimensions = {},
5156             .numberOfConsumers = 1,
5157             .scale = 0.0f,
5158             .zeroPoint = 0,
5159             .lifetime = OperandLifeTime::CONSTANT_COPY,
5160             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5161         },
5162         {
5163             .type = OperandType::FLOAT32,
5164             .dimensions = {},
5165             .numberOfConsumers = 1,
5166             .scale = 0.0f,
5167             .zeroPoint = 0,
5168             .lifetime = OperandLifeTime::CONSTANT_COPY,
5169             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5170         },
5171         {
5172             .type = OperandType::INT32,
5173             .dimensions = {},
5174             .numberOfConsumers = 1,
5175             .scale = 0.0f,
5176             .zeroPoint = 0,
5177             .lifetime = OperandLifeTime::CONSTANT_COPY,
5178             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5179         },
5180         {
5181             .type = OperandType::INT32,
5182             .dimensions = {},
5183             .numberOfConsumers = 1,
5184             .scale = 0.0f,
5185             .zeroPoint = 0,
5186             .lifetime = OperandLifeTime::CONSTANT_COPY,
5187             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5188         },
5189         {
5190             .type = OperandType::BOOL,
5191             .dimensions = {},
5192             .numberOfConsumers = 1,
5193             .scale = 0.0f,
5194             .zeroPoint = 0,
5195             .lifetime = OperandLifeTime::CONSTANT_COPY,
5196             .location = {.poolIndex = 0, .offset = 40, .length = 1},
5197         },
5198         {
5199             .type = OperandType::TENSOR_QUANT8_ASYMM,
5200             .dimensions = {4, 2, 2, 3},
5201             .numberOfConsumers = 0,
5202             .scale = 0.03125f,
5203             .zeroPoint = 10,
5204             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5205             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5206         }
5207     };
5208 
5209     const std::vector<Operation> operations = {
5210         {
5211             .type = OperationType::ROI_ALIGN,
5212             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5213             .outputs = {10},
5214         }
5215     };
5216 
5217     const std::vector<uint32_t> inputIndexes = {0, 1};
5218     const std::vector<uint32_t> outputIndexes = {10};
5219     std::vector<uint8_t> operandValues = {
5220       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
5221     };
5222     const std::vector<hidl_memory> pools = {};
5223 
5224     return {
5225         .operands = operands,
5226         .operations = operations,
5227         .inputIndexes = inputIndexes,
5228         .outputIndexes = outputIndexes,
5229         .operandValues = operandValues,
5230         .pools = pools,
5231     };
5232 }
5233 
is_ignored_nchw_quant8_3(int i)5234 inline bool is_ignored_nchw_quant8_3(int i) {
5235   static std::set<int> ignore = {};
5236   return ignore.find(i) != ignore.end();
5237 }
5238 
5239 // Create the model
createTestModel_nchw_float16_3()5240 Model createTestModel_nchw_float16_3() {
5241     const std::vector<Operand> operands = {
5242         {
5243             .type = OperandType::TENSOR_FLOAT16,
5244             .dimensions = {2, 2, 4, 8},
5245             .numberOfConsumers = 1,
5246             .scale = 0.0f,
5247             .zeroPoint = 0,
5248             .lifetime = OperandLifeTime::MODEL_INPUT,
5249             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5250         },
5251         {
5252             .type = OperandType::TENSOR_FLOAT16,
5253             .dimensions = {4, 4},
5254             .numberOfConsumers = 1,
5255             .scale = 0.0f,
5256             .zeroPoint = 0,
5257             .lifetime = OperandLifeTime::MODEL_INPUT,
5258             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5259         },
5260         {
5261             .type = OperandType::TENSOR_INT32,
5262             .dimensions = {4},
5263             .numberOfConsumers = 1,
5264             .scale = 0.0f,
5265             .zeroPoint = 0,
5266             .lifetime = OperandLifeTime::CONSTANT_COPY,
5267             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5268         },
5269         {
5270             .type = OperandType::INT32,
5271             .dimensions = {},
5272             .numberOfConsumers = 1,
5273             .scale = 0.0f,
5274             .zeroPoint = 0,
5275             .lifetime = OperandLifeTime::CONSTANT_COPY,
5276             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5277         },
5278         {
5279             .type = OperandType::INT32,
5280             .dimensions = {},
5281             .numberOfConsumers = 1,
5282             .scale = 0.0f,
5283             .zeroPoint = 0,
5284             .lifetime = OperandLifeTime::CONSTANT_COPY,
5285             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5286         },
5287         {
5288             .type = OperandType::FLOAT16,
5289             .dimensions = {},
5290             .numberOfConsumers = 1,
5291             .scale = 0.0f,
5292             .zeroPoint = 0,
5293             .lifetime = OperandLifeTime::CONSTANT_COPY,
5294             .location = {.poolIndex = 0, .offset = 24, .length = 2},
5295         },
5296         {
5297             .type = OperandType::FLOAT16,
5298             .dimensions = {},
5299             .numberOfConsumers = 1,
5300             .scale = 0.0f,
5301             .zeroPoint = 0,
5302             .lifetime = OperandLifeTime::CONSTANT_COPY,
5303             .location = {.poolIndex = 0, .offset = 26, .length = 2},
5304         },
5305         {
5306             .type = OperandType::INT32,
5307             .dimensions = {},
5308             .numberOfConsumers = 1,
5309             .scale = 0.0f,
5310             .zeroPoint = 0,
5311             .lifetime = OperandLifeTime::CONSTANT_COPY,
5312             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5313         },
5314         {
5315             .type = OperandType::INT32,
5316             .dimensions = {},
5317             .numberOfConsumers = 1,
5318             .scale = 0.0f,
5319             .zeroPoint = 0,
5320             .lifetime = OperandLifeTime::CONSTANT_COPY,
5321             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5322         },
5323         {
5324             .type = OperandType::BOOL,
5325             .dimensions = {},
5326             .numberOfConsumers = 1,
5327             .scale = 0.0f,
5328             .zeroPoint = 0,
5329             .lifetime = OperandLifeTime::CONSTANT_COPY,
5330             .location = {.poolIndex = 0, .offset = 36, .length = 1},
5331         },
5332         {
5333             .type = OperandType::TENSOR_FLOAT16,
5334             .dimensions = {4, 2, 2, 3},
5335             .numberOfConsumers = 0,
5336             .scale = 0.0f,
5337             .zeroPoint = 0,
5338             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5339             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5340         }
5341     };
5342 
5343     const std::vector<Operation> operations = {
5344         {
5345             .type = OperationType::ROI_ALIGN,
5346             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5347             .outputs = {10},
5348         }
5349     };
5350 
5351     const std::vector<uint32_t> inputIndexes = {0, 1};
5352     const std::vector<uint32_t> outputIndexes = {10};
5353     std::vector<uint8_t> operandValues = {
5354       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 1
5355     };
5356     const std::vector<hidl_memory> pools = {};
5357 
5358     return {
5359         .operands = operands,
5360         .operations = operations,
5361         .inputIndexes = inputIndexes,
5362         .outputIndexes = outputIndexes,
5363         .operandValues = operandValues,
5364         .pools = pools,
5365     };
5366 }
5367 
is_ignored_nchw_float16_3(int i)5368 inline bool is_ignored_nchw_float16_3(int i) {
5369   static std::set<int> ignore = {};
5370   return ignore.find(i) != ignore.end();
5371 }
5372 
5373 // Create the model
createTestModel_dynamic_output_shape_nhwc_3()5374 Model createTestModel_dynamic_output_shape_nhwc_3() {
5375     const std::vector<Operand> operands = {
5376         {
5377             .type = OperandType::TENSOR_FLOAT32,
5378             .dimensions = {2, 4, 8, 2},
5379             .numberOfConsumers = 1,
5380             .scale = 0.0f,
5381             .zeroPoint = 0,
5382             .lifetime = OperandLifeTime::MODEL_INPUT,
5383             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5384         },
5385         {
5386             .type = OperandType::TENSOR_FLOAT32,
5387             .dimensions = {4, 4},
5388             .numberOfConsumers = 1,
5389             .scale = 0.0f,
5390             .zeroPoint = 0,
5391             .lifetime = OperandLifeTime::MODEL_INPUT,
5392             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5393         },
5394         {
5395             .type = OperandType::TENSOR_INT32,
5396             .dimensions = {4},
5397             .numberOfConsumers = 1,
5398             .scale = 0.0f,
5399             .zeroPoint = 0,
5400             .lifetime = OperandLifeTime::CONSTANT_COPY,
5401             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5402         },
5403         {
5404             .type = OperandType::INT32,
5405             .dimensions = {},
5406             .numberOfConsumers = 1,
5407             .scale = 0.0f,
5408             .zeroPoint = 0,
5409             .lifetime = OperandLifeTime::CONSTANT_COPY,
5410             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5411         },
5412         {
5413             .type = OperandType::INT32,
5414             .dimensions = {},
5415             .numberOfConsumers = 1,
5416             .scale = 0.0f,
5417             .zeroPoint = 0,
5418             .lifetime = OperandLifeTime::CONSTANT_COPY,
5419             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5420         },
5421         {
5422             .type = OperandType::FLOAT32,
5423             .dimensions = {},
5424             .numberOfConsumers = 1,
5425             .scale = 0.0f,
5426             .zeroPoint = 0,
5427             .lifetime = OperandLifeTime::CONSTANT_COPY,
5428             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5429         },
5430         {
5431             .type = OperandType::FLOAT32,
5432             .dimensions = {},
5433             .numberOfConsumers = 1,
5434             .scale = 0.0f,
5435             .zeroPoint = 0,
5436             .lifetime = OperandLifeTime::CONSTANT_COPY,
5437             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5438         },
5439         {
5440             .type = OperandType::INT32,
5441             .dimensions = {},
5442             .numberOfConsumers = 1,
5443             .scale = 0.0f,
5444             .zeroPoint = 0,
5445             .lifetime = OperandLifeTime::CONSTANT_COPY,
5446             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5447         },
5448         {
5449             .type = OperandType::INT32,
5450             .dimensions = {},
5451             .numberOfConsumers = 1,
5452             .scale = 0.0f,
5453             .zeroPoint = 0,
5454             .lifetime = OperandLifeTime::CONSTANT_COPY,
5455             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5456         },
5457         {
5458             .type = OperandType::BOOL,
5459             .dimensions = {},
5460             .numberOfConsumers = 1,
5461             .scale = 0.0f,
5462             .zeroPoint = 0,
5463             .lifetime = OperandLifeTime::CONSTANT_COPY,
5464             .location = {.poolIndex = 0, .offset = 40, .length = 1},
5465         },
5466         {
5467             .type = OperandType::TENSOR_FLOAT32,
5468             .dimensions = {0, 0, 0, 0},
5469             .numberOfConsumers = 0,
5470             .scale = 0.0f,
5471             .zeroPoint = 0,
5472             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5473             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5474         }
5475     };
5476 
5477     const std::vector<Operation> operations = {
5478         {
5479             .type = OperationType::ROI_ALIGN,
5480             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5481             .outputs = {10},
5482         }
5483     };
5484 
5485     const std::vector<uint32_t> inputIndexes = {0, 1};
5486     const std::vector<uint32_t> outputIndexes = {10};
5487     std::vector<uint8_t> operandValues = {
5488       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
5489     };
5490     const std::vector<hidl_memory> pools = {};
5491 
5492     return {
5493         .operands = operands,
5494         .operations = operations,
5495         .inputIndexes = inputIndexes,
5496         .outputIndexes = outputIndexes,
5497         .operandValues = operandValues,
5498         .pools = pools,
5499     };
5500 }
5501 
is_ignored_dynamic_output_shape_nhwc_3(int i)5502 inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) {
5503   static std::set<int> ignore = {};
5504   return ignore.find(i) != ignore.end();
5505 }
5506 
5507 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed_3()5508 Model createTestModel_dynamic_output_shape_nhwc_relaxed_3() {
5509     const std::vector<Operand> operands = {
5510         {
5511             .type = OperandType::TENSOR_FLOAT32,
5512             .dimensions = {2, 4, 8, 2},
5513             .numberOfConsumers = 1,
5514             .scale = 0.0f,
5515             .zeroPoint = 0,
5516             .lifetime = OperandLifeTime::MODEL_INPUT,
5517             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5518         },
5519         {
5520             .type = OperandType::TENSOR_FLOAT32,
5521             .dimensions = {4, 4},
5522             .numberOfConsumers = 1,
5523             .scale = 0.0f,
5524             .zeroPoint = 0,
5525             .lifetime = OperandLifeTime::MODEL_INPUT,
5526             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5527         },
5528         {
5529             .type = OperandType::TENSOR_INT32,
5530             .dimensions = {4},
5531             .numberOfConsumers = 1,
5532             .scale = 0.0f,
5533             .zeroPoint = 0,
5534             .lifetime = OperandLifeTime::CONSTANT_COPY,
5535             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5536         },
5537         {
5538             .type = OperandType::INT32,
5539             .dimensions = {},
5540             .numberOfConsumers = 1,
5541             .scale = 0.0f,
5542             .zeroPoint = 0,
5543             .lifetime = OperandLifeTime::CONSTANT_COPY,
5544             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5545         },
5546         {
5547             .type = OperandType::INT32,
5548             .dimensions = {},
5549             .numberOfConsumers = 1,
5550             .scale = 0.0f,
5551             .zeroPoint = 0,
5552             .lifetime = OperandLifeTime::CONSTANT_COPY,
5553             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5554         },
5555         {
5556             .type = OperandType::FLOAT32,
5557             .dimensions = {},
5558             .numberOfConsumers = 1,
5559             .scale = 0.0f,
5560             .zeroPoint = 0,
5561             .lifetime = OperandLifeTime::CONSTANT_COPY,
5562             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5563         },
5564         {
5565             .type = OperandType::FLOAT32,
5566             .dimensions = {},
5567             .numberOfConsumers = 1,
5568             .scale = 0.0f,
5569             .zeroPoint = 0,
5570             .lifetime = OperandLifeTime::CONSTANT_COPY,
5571             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5572         },
5573         {
5574             .type = OperandType::INT32,
5575             .dimensions = {},
5576             .numberOfConsumers = 1,
5577             .scale = 0.0f,
5578             .zeroPoint = 0,
5579             .lifetime = OperandLifeTime::CONSTANT_COPY,
5580             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5581         },
5582         {
5583             .type = OperandType::INT32,
5584             .dimensions = {},
5585             .numberOfConsumers = 1,
5586             .scale = 0.0f,
5587             .zeroPoint = 0,
5588             .lifetime = OperandLifeTime::CONSTANT_COPY,
5589             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5590         },
5591         {
5592             .type = OperandType::BOOL,
5593             .dimensions = {},
5594             .numberOfConsumers = 1,
5595             .scale = 0.0f,
5596             .zeroPoint = 0,
5597             .lifetime = OperandLifeTime::CONSTANT_COPY,
5598             .location = {.poolIndex = 0, .offset = 40, .length = 1},
5599         },
5600         {
5601             .type = OperandType::TENSOR_FLOAT32,
5602             .dimensions = {0, 0, 0, 0},
5603             .numberOfConsumers = 0,
5604             .scale = 0.0f,
5605             .zeroPoint = 0,
5606             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5607             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5608         }
5609     };
5610 
5611     const std::vector<Operation> operations = {
5612         {
5613             .type = OperationType::ROI_ALIGN,
5614             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5615             .outputs = {10},
5616         }
5617     };
5618 
5619     const std::vector<uint32_t> inputIndexes = {0, 1};
5620     const std::vector<uint32_t> outputIndexes = {10};
5621     std::vector<uint8_t> operandValues = {
5622       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
5623     };
5624     const std::vector<hidl_memory> pools = {};
5625 
5626     return {
5627         .operands = operands,
5628         .operations = operations,
5629         .inputIndexes = inputIndexes,
5630         .outputIndexes = outputIndexes,
5631         .operandValues = operandValues,
5632         .pools = pools,
5633         .relaxComputationFloat32toFloat16 = true,
5634     };
5635 }
5636 
is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i)5637 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) {
5638   static std::set<int> ignore = {};
5639   return ignore.find(i) != ignore.end();
5640 }
5641 
5642 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8_3()5643 Model createTestModel_dynamic_output_shape_nhwc_quant8_3() {
5644     const std::vector<Operand> operands = {
5645         {
5646             .type = OperandType::TENSOR_QUANT8_ASYMM,
5647             .dimensions = {2, 4, 8, 2},
5648             .numberOfConsumers = 1,
5649             .scale = 0.04f,
5650             .zeroPoint = 0,
5651             .lifetime = OperandLifeTime::MODEL_INPUT,
5652             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5653         },
5654         {
5655             .type = OperandType::TENSOR_QUANT16_ASYMM,
5656             .dimensions = {4, 4},
5657             .numberOfConsumers = 1,
5658             .scale = 0.125f,
5659             .zeroPoint = 0,
5660             .lifetime = OperandLifeTime::MODEL_INPUT,
5661             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5662         },
5663         {
5664             .type = OperandType::TENSOR_INT32,
5665             .dimensions = {4},
5666             .numberOfConsumers = 1,
5667             .scale = 0.0f,
5668             .zeroPoint = 0,
5669             .lifetime = OperandLifeTime::CONSTANT_COPY,
5670             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5671         },
5672         {
5673             .type = OperandType::INT32,
5674             .dimensions = {},
5675             .numberOfConsumers = 1,
5676             .scale = 0.0f,
5677             .zeroPoint = 0,
5678             .lifetime = OperandLifeTime::CONSTANT_COPY,
5679             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5680         },
5681         {
5682             .type = OperandType::INT32,
5683             .dimensions = {},
5684             .numberOfConsumers = 1,
5685             .scale = 0.0f,
5686             .zeroPoint = 0,
5687             .lifetime = OperandLifeTime::CONSTANT_COPY,
5688             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5689         },
5690         {
5691             .type = OperandType::FLOAT32,
5692             .dimensions = {},
5693             .numberOfConsumers = 1,
5694             .scale = 0.0f,
5695             .zeroPoint = 0,
5696             .lifetime = OperandLifeTime::CONSTANT_COPY,
5697             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5698         },
5699         {
5700             .type = OperandType::FLOAT32,
5701             .dimensions = {},
5702             .numberOfConsumers = 1,
5703             .scale = 0.0f,
5704             .zeroPoint = 0,
5705             .lifetime = OperandLifeTime::CONSTANT_COPY,
5706             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5707         },
5708         {
5709             .type = OperandType::INT32,
5710             .dimensions = {},
5711             .numberOfConsumers = 1,
5712             .scale = 0.0f,
5713             .zeroPoint = 0,
5714             .lifetime = OperandLifeTime::CONSTANT_COPY,
5715             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5716         },
5717         {
5718             .type = OperandType::INT32,
5719             .dimensions = {},
5720             .numberOfConsumers = 1,
5721             .scale = 0.0f,
5722             .zeroPoint = 0,
5723             .lifetime = OperandLifeTime::CONSTANT_COPY,
5724             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5725         },
5726         {
5727             .type = OperandType::BOOL,
5728             .dimensions = {},
5729             .numberOfConsumers = 1,
5730             .scale = 0.0f,
5731             .zeroPoint = 0,
5732             .lifetime = OperandLifeTime::CONSTANT_COPY,
5733             .location = {.poolIndex = 0, .offset = 40, .length = 1},
5734         },
5735         {
5736             .type = OperandType::TENSOR_QUANT8_ASYMM,
5737             .dimensions = {0, 0, 0, 0},
5738             .numberOfConsumers = 0,
5739             .scale = 0.03125f,
5740             .zeroPoint = 10,
5741             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5742             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5743         }
5744     };
5745 
5746     const std::vector<Operation> operations = {
5747         {
5748             .type = OperationType::ROI_ALIGN,
5749             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5750             .outputs = {10},
5751         }
5752     };
5753 
5754     const std::vector<uint32_t> inputIndexes = {0, 1};
5755     const std::vector<uint32_t> outputIndexes = {10};
5756     std::vector<uint8_t> operandValues = {
5757       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0
5758     };
5759     const std::vector<hidl_memory> pools = {};
5760 
5761     return {
5762         .operands = operands,
5763         .operations = operations,
5764         .inputIndexes = inputIndexes,
5765         .outputIndexes = outputIndexes,
5766         .operandValues = operandValues,
5767         .pools = pools,
5768     };
5769 }
5770 
is_ignored_dynamic_output_shape_nhwc_quant8_3(int i)5771 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) {
5772   static std::set<int> ignore = {};
5773   return ignore.find(i) != ignore.end();
5774 }
5775 
5776 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16_3()5777 Model createTestModel_dynamic_output_shape_nhwc_float16_3() {
5778     const std::vector<Operand> operands = {
5779         {
5780             .type = OperandType::TENSOR_FLOAT16,
5781             .dimensions = {2, 4, 8, 2},
5782             .numberOfConsumers = 1,
5783             .scale = 0.0f,
5784             .zeroPoint = 0,
5785             .lifetime = OperandLifeTime::MODEL_INPUT,
5786             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5787         },
5788         {
5789             .type = OperandType::TENSOR_FLOAT16,
5790             .dimensions = {4, 4},
5791             .numberOfConsumers = 1,
5792             .scale = 0.0f,
5793             .zeroPoint = 0,
5794             .lifetime = OperandLifeTime::MODEL_INPUT,
5795             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5796         },
5797         {
5798             .type = OperandType::TENSOR_INT32,
5799             .dimensions = {4},
5800             .numberOfConsumers = 1,
5801             .scale = 0.0f,
5802             .zeroPoint = 0,
5803             .lifetime = OperandLifeTime::CONSTANT_COPY,
5804             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5805         },
5806         {
5807             .type = OperandType::INT32,
5808             .dimensions = {},
5809             .numberOfConsumers = 1,
5810             .scale = 0.0f,
5811             .zeroPoint = 0,
5812             .lifetime = OperandLifeTime::CONSTANT_COPY,
5813             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5814         },
5815         {
5816             .type = OperandType::INT32,
5817             .dimensions = {},
5818             .numberOfConsumers = 1,
5819             .scale = 0.0f,
5820             .zeroPoint = 0,
5821             .lifetime = OperandLifeTime::CONSTANT_COPY,
5822             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5823         },
5824         {
5825             .type = OperandType::FLOAT16,
5826             .dimensions = {},
5827             .numberOfConsumers = 1,
5828             .scale = 0.0f,
5829             .zeroPoint = 0,
5830             .lifetime = OperandLifeTime::CONSTANT_COPY,
5831             .location = {.poolIndex = 0, .offset = 24, .length = 2},
5832         },
5833         {
5834             .type = OperandType::FLOAT16,
5835             .dimensions = {},
5836             .numberOfConsumers = 1,
5837             .scale = 0.0f,
5838             .zeroPoint = 0,
5839             .lifetime = OperandLifeTime::CONSTANT_COPY,
5840             .location = {.poolIndex = 0, .offset = 26, .length = 2},
5841         },
5842         {
5843             .type = OperandType::INT32,
5844             .dimensions = {},
5845             .numberOfConsumers = 1,
5846             .scale = 0.0f,
5847             .zeroPoint = 0,
5848             .lifetime = OperandLifeTime::CONSTANT_COPY,
5849             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5850         },
5851         {
5852             .type = OperandType::INT32,
5853             .dimensions = {},
5854             .numberOfConsumers = 1,
5855             .scale = 0.0f,
5856             .zeroPoint = 0,
5857             .lifetime = OperandLifeTime::CONSTANT_COPY,
5858             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5859         },
5860         {
5861             .type = OperandType::BOOL,
5862             .dimensions = {},
5863             .numberOfConsumers = 1,
5864             .scale = 0.0f,
5865             .zeroPoint = 0,
5866             .lifetime = OperandLifeTime::CONSTANT_COPY,
5867             .location = {.poolIndex = 0, .offset = 36, .length = 1},
5868         },
5869         {
5870             .type = OperandType::TENSOR_FLOAT16,
5871             .dimensions = {0, 0, 0, 0},
5872             .numberOfConsumers = 0,
5873             .scale = 0.0f,
5874             .zeroPoint = 0,
5875             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5876             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5877         }
5878     };
5879 
5880     const std::vector<Operation> operations = {
5881         {
5882             .type = OperationType::ROI_ALIGN,
5883             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
5884             .outputs = {10},
5885         }
5886     };
5887 
5888     const std::vector<uint32_t> inputIndexes = {0, 1};
5889     const std::vector<uint32_t> outputIndexes = {10};
5890     std::vector<uint8_t> operandValues = {
5891       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0
5892     };
5893     const std::vector<hidl_memory> pools = {};
5894 
5895     return {
5896         .operands = operands,
5897         .operations = operations,
5898         .inputIndexes = inputIndexes,
5899         .outputIndexes = outputIndexes,
5900         .operandValues = operandValues,
5901         .pools = pools,
5902     };
5903 }
5904 
is_ignored_dynamic_output_shape_nhwc_float16_3(int i)5905 inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) {
5906   static std::set<int> ignore = {};
5907   return ignore.find(i) != ignore.end();
5908 }
5909 
5910 // Create the model
createTestModel_dynamic_output_shape_nchw_3()5911 Model createTestModel_dynamic_output_shape_nchw_3() {
5912     const std::vector<Operand> operands = {
5913         {
5914             .type = OperandType::TENSOR_FLOAT32,
5915             .dimensions = {2, 2, 4, 8},
5916             .numberOfConsumers = 1,
5917             .scale = 0.0f,
5918             .zeroPoint = 0,
5919             .lifetime = OperandLifeTime::MODEL_INPUT,
5920             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5921         },
5922         {
5923             .type = OperandType::TENSOR_FLOAT32,
5924             .dimensions = {4, 4},
5925             .numberOfConsumers = 1,
5926             .scale = 0.0f,
5927             .zeroPoint = 0,
5928             .lifetime = OperandLifeTime::MODEL_INPUT,
5929             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5930         },
5931         {
5932             .type = OperandType::TENSOR_INT32,
5933             .dimensions = {4},
5934             .numberOfConsumers = 1,
5935             .scale = 0.0f,
5936             .zeroPoint = 0,
5937             .lifetime = OperandLifeTime::CONSTANT_COPY,
5938             .location = {.poolIndex = 0, .offset = 0, .length = 16},
5939         },
5940         {
5941             .type = OperandType::INT32,
5942             .dimensions = {},
5943             .numberOfConsumers = 1,
5944             .scale = 0.0f,
5945             .zeroPoint = 0,
5946             .lifetime = OperandLifeTime::CONSTANT_COPY,
5947             .location = {.poolIndex = 0, .offset = 16, .length = 4},
5948         },
5949         {
5950             .type = OperandType::INT32,
5951             .dimensions = {},
5952             .numberOfConsumers = 1,
5953             .scale = 0.0f,
5954             .zeroPoint = 0,
5955             .lifetime = OperandLifeTime::CONSTANT_COPY,
5956             .location = {.poolIndex = 0, .offset = 20, .length = 4},
5957         },
5958         {
5959             .type = OperandType::FLOAT32,
5960             .dimensions = {},
5961             .numberOfConsumers = 1,
5962             .scale = 0.0f,
5963             .zeroPoint = 0,
5964             .lifetime = OperandLifeTime::CONSTANT_COPY,
5965             .location = {.poolIndex = 0, .offset = 24, .length = 4},
5966         },
5967         {
5968             .type = OperandType::FLOAT32,
5969             .dimensions = {},
5970             .numberOfConsumers = 1,
5971             .scale = 0.0f,
5972             .zeroPoint = 0,
5973             .lifetime = OperandLifeTime::CONSTANT_COPY,
5974             .location = {.poolIndex = 0, .offset = 28, .length = 4},
5975         },
5976         {
5977             .type = OperandType::INT32,
5978             .dimensions = {},
5979             .numberOfConsumers = 1,
5980             .scale = 0.0f,
5981             .zeroPoint = 0,
5982             .lifetime = OperandLifeTime::CONSTANT_COPY,
5983             .location = {.poolIndex = 0, .offset = 32, .length = 4},
5984         },
5985         {
5986             .type = OperandType::INT32,
5987             .dimensions = {},
5988             .numberOfConsumers = 1,
5989             .scale = 0.0f,
5990             .zeroPoint = 0,
5991             .lifetime = OperandLifeTime::CONSTANT_COPY,
5992             .location = {.poolIndex = 0, .offset = 36, .length = 4},
5993         },
5994         {
5995             .type = OperandType::BOOL,
5996             .dimensions = {},
5997             .numberOfConsumers = 1,
5998             .scale = 0.0f,
5999             .zeroPoint = 0,
6000             .lifetime = OperandLifeTime::CONSTANT_COPY,
6001             .location = {.poolIndex = 0, .offset = 40, .length = 1},
6002         },
6003         {
6004             .type = OperandType::TENSOR_FLOAT32,
6005             .dimensions = {0, 0, 0, 0},
6006             .numberOfConsumers = 0,
6007             .scale = 0.0f,
6008             .zeroPoint = 0,
6009             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6010             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6011         }
6012     };
6013 
6014     const std::vector<Operation> operations = {
6015         {
6016             .type = OperationType::ROI_ALIGN,
6017             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6018             .outputs = {10},
6019         }
6020     };
6021 
6022     const std::vector<uint32_t> inputIndexes = {0, 1};
6023     const std::vector<uint32_t> outputIndexes = {10};
6024     std::vector<uint8_t> operandValues = {
6025       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
6026     };
6027     const std::vector<hidl_memory> pools = {};
6028 
6029     return {
6030         .operands = operands,
6031         .operations = operations,
6032         .inputIndexes = inputIndexes,
6033         .outputIndexes = outputIndexes,
6034         .operandValues = operandValues,
6035         .pools = pools,
6036     };
6037 }
6038 
is_ignored_dynamic_output_shape_nchw_3(int i)6039 inline bool is_ignored_dynamic_output_shape_nchw_3(int i) {
6040   static std::set<int> ignore = {};
6041   return ignore.find(i) != ignore.end();
6042 }
6043 
6044 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed_3()6045 Model createTestModel_dynamic_output_shape_nchw_relaxed_3() {
6046     const std::vector<Operand> operands = {
6047         {
6048             .type = OperandType::TENSOR_FLOAT32,
6049             .dimensions = {2, 2, 4, 8},
6050             .numberOfConsumers = 1,
6051             .scale = 0.0f,
6052             .zeroPoint = 0,
6053             .lifetime = OperandLifeTime::MODEL_INPUT,
6054             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6055         },
6056         {
6057             .type = OperandType::TENSOR_FLOAT32,
6058             .dimensions = {4, 4},
6059             .numberOfConsumers = 1,
6060             .scale = 0.0f,
6061             .zeroPoint = 0,
6062             .lifetime = OperandLifeTime::MODEL_INPUT,
6063             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6064         },
6065         {
6066             .type = OperandType::TENSOR_INT32,
6067             .dimensions = {4},
6068             .numberOfConsumers = 1,
6069             .scale = 0.0f,
6070             .zeroPoint = 0,
6071             .lifetime = OperandLifeTime::CONSTANT_COPY,
6072             .location = {.poolIndex = 0, .offset = 0, .length = 16},
6073         },
6074         {
6075             .type = OperandType::INT32,
6076             .dimensions = {},
6077             .numberOfConsumers = 1,
6078             .scale = 0.0f,
6079             .zeroPoint = 0,
6080             .lifetime = OperandLifeTime::CONSTANT_COPY,
6081             .location = {.poolIndex = 0, .offset = 16, .length = 4},
6082         },
6083         {
6084             .type = OperandType::INT32,
6085             .dimensions = {},
6086             .numberOfConsumers = 1,
6087             .scale = 0.0f,
6088             .zeroPoint = 0,
6089             .lifetime = OperandLifeTime::CONSTANT_COPY,
6090             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6091         },
6092         {
6093             .type = OperandType::FLOAT32,
6094             .dimensions = {},
6095             .numberOfConsumers = 1,
6096             .scale = 0.0f,
6097             .zeroPoint = 0,
6098             .lifetime = OperandLifeTime::CONSTANT_COPY,
6099             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6100         },
6101         {
6102             .type = OperandType::FLOAT32,
6103             .dimensions = {},
6104             .numberOfConsumers = 1,
6105             .scale = 0.0f,
6106             .zeroPoint = 0,
6107             .lifetime = OperandLifeTime::CONSTANT_COPY,
6108             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6109         },
6110         {
6111             .type = OperandType::INT32,
6112             .dimensions = {},
6113             .numberOfConsumers = 1,
6114             .scale = 0.0f,
6115             .zeroPoint = 0,
6116             .lifetime = OperandLifeTime::CONSTANT_COPY,
6117             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6118         },
6119         {
6120             .type = OperandType::INT32,
6121             .dimensions = {},
6122             .numberOfConsumers = 1,
6123             .scale = 0.0f,
6124             .zeroPoint = 0,
6125             .lifetime = OperandLifeTime::CONSTANT_COPY,
6126             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6127         },
6128         {
6129             .type = OperandType::BOOL,
6130             .dimensions = {},
6131             .numberOfConsumers = 1,
6132             .scale = 0.0f,
6133             .zeroPoint = 0,
6134             .lifetime = OperandLifeTime::CONSTANT_COPY,
6135             .location = {.poolIndex = 0, .offset = 40, .length = 1},
6136         },
6137         {
6138             .type = OperandType::TENSOR_FLOAT32,
6139             .dimensions = {0, 0, 0, 0},
6140             .numberOfConsumers = 0,
6141             .scale = 0.0f,
6142             .zeroPoint = 0,
6143             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6144             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6145         }
6146     };
6147 
6148     const std::vector<Operation> operations = {
6149         {
6150             .type = OperationType::ROI_ALIGN,
6151             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6152             .outputs = {10},
6153         }
6154     };
6155 
6156     const std::vector<uint32_t> inputIndexes = {0, 1};
6157     const std::vector<uint32_t> outputIndexes = {10};
6158     std::vector<uint8_t> operandValues = {
6159       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
6160     };
6161     const std::vector<hidl_memory> pools = {};
6162 
6163     return {
6164         .operands = operands,
6165         .operations = operations,
6166         .inputIndexes = inputIndexes,
6167         .outputIndexes = outputIndexes,
6168         .operandValues = operandValues,
6169         .pools = pools,
6170         .relaxComputationFloat32toFloat16 = true,
6171     };
6172 }
6173 
is_ignored_dynamic_output_shape_nchw_relaxed_3(int i)6174 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) {
6175   static std::set<int> ignore = {};
6176   return ignore.find(i) != ignore.end();
6177 }
6178 
6179 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8_3()6180 Model createTestModel_dynamic_output_shape_nchw_quant8_3() {
6181     const std::vector<Operand> operands = {
6182         {
6183             .type = OperandType::TENSOR_QUANT8_ASYMM,
6184             .dimensions = {2, 2, 4, 8},
6185             .numberOfConsumers = 1,
6186             .scale = 0.04f,
6187             .zeroPoint = 0,
6188             .lifetime = OperandLifeTime::MODEL_INPUT,
6189             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6190         },
6191         {
6192             .type = OperandType::TENSOR_QUANT16_ASYMM,
6193             .dimensions = {4, 4},
6194             .numberOfConsumers = 1,
6195             .scale = 0.125f,
6196             .zeroPoint = 0,
6197             .lifetime = OperandLifeTime::MODEL_INPUT,
6198             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6199         },
6200         {
6201             .type = OperandType::TENSOR_INT32,
6202             .dimensions = {4},
6203             .numberOfConsumers = 1,
6204             .scale = 0.0f,
6205             .zeroPoint = 0,
6206             .lifetime = OperandLifeTime::CONSTANT_COPY,
6207             .location = {.poolIndex = 0, .offset = 0, .length = 16},
6208         },
6209         {
6210             .type = OperandType::INT32,
6211             .dimensions = {},
6212             .numberOfConsumers = 1,
6213             .scale = 0.0f,
6214             .zeroPoint = 0,
6215             .lifetime = OperandLifeTime::CONSTANT_COPY,
6216             .location = {.poolIndex = 0, .offset = 16, .length = 4},
6217         },
6218         {
6219             .type = OperandType::INT32,
6220             .dimensions = {},
6221             .numberOfConsumers = 1,
6222             .scale = 0.0f,
6223             .zeroPoint = 0,
6224             .lifetime = OperandLifeTime::CONSTANT_COPY,
6225             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6226         },
6227         {
6228             .type = OperandType::FLOAT32,
6229             .dimensions = {},
6230             .numberOfConsumers = 1,
6231             .scale = 0.0f,
6232             .zeroPoint = 0,
6233             .lifetime = OperandLifeTime::CONSTANT_COPY,
6234             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6235         },
6236         {
6237             .type = OperandType::FLOAT32,
6238             .dimensions = {},
6239             .numberOfConsumers = 1,
6240             .scale = 0.0f,
6241             .zeroPoint = 0,
6242             .lifetime = OperandLifeTime::CONSTANT_COPY,
6243             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6244         },
6245         {
6246             .type = OperandType::INT32,
6247             .dimensions = {},
6248             .numberOfConsumers = 1,
6249             .scale = 0.0f,
6250             .zeroPoint = 0,
6251             .lifetime = OperandLifeTime::CONSTANT_COPY,
6252             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6253         },
6254         {
6255             .type = OperandType::INT32,
6256             .dimensions = {},
6257             .numberOfConsumers = 1,
6258             .scale = 0.0f,
6259             .zeroPoint = 0,
6260             .lifetime = OperandLifeTime::CONSTANT_COPY,
6261             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6262         },
6263         {
6264             .type = OperandType::BOOL,
6265             .dimensions = {},
6266             .numberOfConsumers = 1,
6267             .scale = 0.0f,
6268             .zeroPoint = 0,
6269             .lifetime = OperandLifeTime::CONSTANT_COPY,
6270             .location = {.poolIndex = 0, .offset = 40, .length = 1},
6271         },
6272         {
6273             .type = OperandType::TENSOR_QUANT8_ASYMM,
6274             .dimensions = {0, 0, 0, 0},
6275             .numberOfConsumers = 0,
6276             .scale = 0.03125f,
6277             .zeroPoint = 10,
6278             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6279             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6280         }
6281     };
6282 
6283     const std::vector<Operation> operations = {
6284         {
6285             .type = OperationType::ROI_ALIGN,
6286             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6287             .outputs = {10},
6288         }
6289     };
6290 
6291     const std::vector<uint32_t> inputIndexes = {0, 1};
6292     const std::vector<uint32_t> outputIndexes = {10};
6293     std::vector<uint8_t> operandValues = {
6294       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 128, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 1
6295     };
6296     const std::vector<hidl_memory> pools = {};
6297 
6298     return {
6299         .operands = operands,
6300         .operations = operations,
6301         .inputIndexes = inputIndexes,
6302         .outputIndexes = outputIndexes,
6303         .operandValues = operandValues,
6304         .pools = pools,
6305     };
6306 }
6307 
is_ignored_dynamic_output_shape_nchw_quant8_3(int i)6308 inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) {
6309   static std::set<int> ignore = {};
6310   return ignore.find(i) != ignore.end();
6311 }
6312 
6313 // Create the model
createTestModel_dynamic_output_shape_nchw_float16_3()6314 Model createTestModel_dynamic_output_shape_nchw_float16_3() {
6315     const std::vector<Operand> operands = {
6316         {
6317             .type = OperandType::TENSOR_FLOAT16,
6318             .dimensions = {2, 2, 4, 8},
6319             .numberOfConsumers = 1,
6320             .scale = 0.0f,
6321             .zeroPoint = 0,
6322             .lifetime = OperandLifeTime::MODEL_INPUT,
6323             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6324         },
6325         {
6326             .type = OperandType::TENSOR_FLOAT16,
6327             .dimensions = {4, 4},
6328             .numberOfConsumers = 1,
6329             .scale = 0.0f,
6330             .zeroPoint = 0,
6331             .lifetime = OperandLifeTime::MODEL_INPUT,
6332             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6333         },
6334         {
6335             .type = OperandType::TENSOR_INT32,
6336             .dimensions = {4},
6337             .numberOfConsumers = 1,
6338             .scale = 0.0f,
6339             .zeroPoint = 0,
6340             .lifetime = OperandLifeTime::CONSTANT_COPY,
6341             .location = {.poolIndex = 0, .offset = 0, .length = 16},
6342         },
6343         {
6344             .type = OperandType::INT32,
6345             .dimensions = {},
6346             .numberOfConsumers = 1,
6347             .scale = 0.0f,
6348             .zeroPoint = 0,
6349             .lifetime = OperandLifeTime::CONSTANT_COPY,
6350             .location = {.poolIndex = 0, .offset = 16, .length = 4},
6351         },
6352         {
6353             .type = OperandType::INT32,
6354             .dimensions = {},
6355             .numberOfConsumers = 1,
6356             .scale = 0.0f,
6357             .zeroPoint = 0,
6358             .lifetime = OperandLifeTime::CONSTANT_COPY,
6359             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6360         },
6361         {
6362             .type = OperandType::FLOAT16,
6363             .dimensions = {},
6364             .numberOfConsumers = 1,
6365             .scale = 0.0f,
6366             .zeroPoint = 0,
6367             .lifetime = OperandLifeTime::CONSTANT_COPY,
6368             .location = {.poolIndex = 0, .offset = 24, .length = 2},
6369         },
6370         {
6371             .type = OperandType::FLOAT16,
6372             .dimensions = {},
6373             .numberOfConsumers = 1,
6374             .scale = 0.0f,
6375             .zeroPoint = 0,
6376             .lifetime = OperandLifeTime::CONSTANT_COPY,
6377             .location = {.poolIndex = 0, .offset = 26, .length = 2},
6378         },
6379         {
6380             .type = OperandType::INT32,
6381             .dimensions = {},
6382             .numberOfConsumers = 1,
6383             .scale = 0.0f,
6384             .zeroPoint = 0,
6385             .lifetime = OperandLifeTime::CONSTANT_COPY,
6386             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6387         },
6388         {
6389             .type = OperandType::INT32,
6390             .dimensions = {},
6391             .numberOfConsumers = 1,
6392             .scale = 0.0f,
6393             .zeroPoint = 0,
6394             .lifetime = OperandLifeTime::CONSTANT_COPY,
6395             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6396         },
6397         {
6398             .type = OperandType::BOOL,
6399             .dimensions = {},
6400             .numberOfConsumers = 1,
6401             .scale = 0.0f,
6402             .zeroPoint = 0,
6403             .lifetime = OperandLifeTime::CONSTANT_COPY,
6404             .location = {.poolIndex = 0, .offset = 36, .length = 1},
6405         },
6406         {
6407             .type = OperandType::TENSOR_FLOAT16,
6408             .dimensions = {0, 0, 0, 0},
6409             .numberOfConsumers = 0,
6410             .scale = 0.0f,
6411             .zeroPoint = 0,
6412             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6413             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6414         }
6415     };
6416 
6417     const std::vector<Operation> operations = {
6418         {
6419             .type = OperationType::ROI_ALIGN,
6420             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6421             .outputs = {10},
6422         }
6423     };
6424 
6425     const std::vector<uint32_t> inputIndexes = {0, 1};
6426     const std::vector<uint32_t> outputIndexes = {10};
6427     std::vector<uint8_t> operandValues = {
6428       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 68, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 1
6429     };
6430     const std::vector<hidl_memory> pools = {};
6431 
6432     return {
6433         .operands = operands,
6434         .operations = operations,
6435         .inputIndexes = inputIndexes,
6436         .outputIndexes = outputIndexes,
6437         .operandValues = operandValues,
6438         .pools = pools,
6439     };
6440 }
6441 
is_ignored_dynamic_output_shape_nchw_float16_3(int i)6442 inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) {
6443   static std::set<int> ignore = {};
6444   return ignore.find(i) != ignore.end();
6445 }
6446 
6447 // Create the model
createTestModel_nhwc_4()6448 Model createTestModel_nhwc_4() {
6449     const std::vector<Operand> operands = {
6450         {
6451             .type = OperandType::TENSOR_FLOAT32,
6452             .dimensions = {4, 4, 4, 1},
6453             .numberOfConsumers = 1,
6454             .scale = 0.0f,
6455             .zeroPoint = 0,
6456             .lifetime = OperandLifeTime::MODEL_INPUT,
6457             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6458         },
6459         {
6460             .type = OperandType::TENSOR_FLOAT32,
6461             .dimensions = {5, 4},
6462             .numberOfConsumers = 1,
6463             .scale = 0.0f,
6464             .zeroPoint = 0,
6465             .lifetime = OperandLifeTime::MODEL_INPUT,
6466             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6467         },
6468         {
6469             .type = OperandType::TENSOR_INT32,
6470             .dimensions = {5},
6471             .numberOfConsumers = 1,
6472             .scale = 0.0f,
6473             .zeroPoint = 0,
6474             .lifetime = OperandLifeTime::CONSTANT_COPY,
6475             .location = {.poolIndex = 0, .offset = 0, .length = 20},
6476         },
6477         {
6478             .type = OperandType::INT32,
6479             .dimensions = {},
6480             .numberOfConsumers = 1,
6481             .scale = 0.0f,
6482             .zeroPoint = 0,
6483             .lifetime = OperandLifeTime::CONSTANT_COPY,
6484             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6485         },
6486         {
6487             .type = OperandType::INT32,
6488             .dimensions = {},
6489             .numberOfConsumers = 1,
6490             .scale = 0.0f,
6491             .zeroPoint = 0,
6492             .lifetime = OperandLifeTime::CONSTANT_COPY,
6493             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6494         },
6495         {
6496             .type = OperandType::FLOAT32,
6497             .dimensions = {},
6498             .numberOfConsumers = 1,
6499             .scale = 0.0f,
6500             .zeroPoint = 0,
6501             .lifetime = OperandLifeTime::CONSTANT_COPY,
6502             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6503         },
6504         {
6505             .type = OperandType::FLOAT32,
6506             .dimensions = {},
6507             .numberOfConsumers = 1,
6508             .scale = 0.0f,
6509             .zeroPoint = 0,
6510             .lifetime = OperandLifeTime::CONSTANT_COPY,
6511             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6512         },
6513         {
6514             .type = OperandType::INT32,
6515             .dimensions = {},
6516             .numberOfConsumers = 1,
6517             .scale = 0.0f,
6518             .zeroPoint = 0,
6519             .lifetime = OperandLifeTime::CONSTANT_COPY,
6520             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6521         },
6522         {
6523             .type = OperandType::INT32,
6524             .dimensions = {},
6525             .numberOfConsumers = 1,
6526             .scale = 0.0f,
6527             .zeroPoint = 0,
6528             .lifetime = OperandLifeTime::CONSTANT_COPY,
6529             .location = {.poolIndex = 0, .offset = 40, .length = 4},
6530         },
6531         {
6532             .type = OperandType::BOOL,
6533             .dimensions = {},
6534             .numberOfConsumers = 1,
6535             .scale = 0.0f,
6536             .zeroPoint = 0,
6537             .lifetime = OperandLifeTime::CONSTANT_COPY,
6538             .location = {.poolIndex = 0, .offset = 44, .length = 1},
6539         },
6540         {
6541             .type = OperandType::TENSOR_FLOAT32,
6542             .dimensions = {5, 2, 2, 1},
6543             .numberOfConsumers = 0,
6544             .scale = 0.0f,
6545             .zeroPoint = 0,
6546             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6547             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6548         }
6549     };
6550 
6551     const std::vector<Operation> operations = {
6552         {
6553             .type = OperationType::ROI_ALIGN,
6554             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6555             .outputs = {10},
6556         }
6557     };
6558 
6559     const std::vector<uint32_t> inputIndexes = {0, 1};
6560     const std::vector<uint32_t> outputIndexes = {10};
6561     std::vector<uint8_t> operandValues = {
6562       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
6563     };
6564     const std::vector<hidl_memory> pools = {};
6565 
6566     return {
6567         .operands = operands,
6568         .operations = operations,
6569         .inputIndexes = inputIndexes,
6570         .outputIndexes = outputIndexes,
6571         .operandValues = operandValues,
6572         .pools = pools,
6573     };
6574 }
6575 
is_ignored_nhwc_4(int i)6576 inline bool is_ignored_nhwc_4(int i) {
6577   static std::set<int> ignore = {};
6578   return ignore.find(i) != ignore.end();
6579 }
6580 
6581 // Create the model
createTestModel_nhwc_relaxed_4()6582 Model createTestModel_nhwc_relaxed_4() {
6583     const std::vector<Operand> operands = {
6584         {
6585             .type = OperandType::TENSOR_FLOAT32,
6586             .dimensions = {4, 4, 4, 1},
6587             .numberOfConsumers = 1,
6588             .scale = 0.0f,
6589             .zeroPoint = 0,
6590             .lifetime = OperandLifeTime::MODEL_INPUT,
6591             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6592         },
6593         {
6594             .type = OperandType::TENSOR_FLOAT32,
6595             .dimensions = {5, 4},
6596             .numberOfConsumers = 1,
6597             .scale = 0.0f,
6598             .zeroPoint = 0,
6599             .lifetime = OperandLifeTime::MODEL_INPUT,
6600             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6601         },
6602         {
6603             .type = OperandType::TENSOR_INT32,
6604             .dimensions = {5},
6605             .numberOfConsumers = 1,
6606             .scale = 0.0f,
6607             .zeroPoint = 0,
6608             .lifetime = OperandLifeTime::CONSTANT_COPY,
6609             .location = {.poolIndex = 0, .offset = 0, .length = 20},
6610         },
6611         {
6612             .type = OperandType::INT32,
6613             .dimensions = {},
6614             .numberOfConsumers = 1,
6615             .scale = 0.0f,
6616             .zeroPoint = 0,
6617             .lifetime = OperandLifeTime::CONSTANT_COPY,
6618             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6619         },
6620         {
6621             .type = OperandType::INT32,
6622             .dimensions = {},
6623             .numberOfConsumers = 1,
6624             .scale = 0.0f,
6625             .zeroPoint = 0,
6626             .lifetime = OperandLifeTime::CONSTANT_COPY,
6627             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6628         },
6629         {
6630             .type = OperandType::FLOAT32,
6631             .dimensions = {},
6632             .numberOfConsumers = 1,
6633             .scale = 0.0f,
6634             .zeroPoint = 0,
6635             .lifetime = OperandLifeTime::CONSTANT_COPY,
6636             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6637         },
6638         {
6639             .type = OperandType::FLOAT32,
6640             .dimensions = {},
6641             .numberOfConsumers = 1,
6642             .scale = 0.0f,
6643             .zeroPoint = 0,
6644             .lifetime = OperandLifeTime::CONSTANT_COPY,
6645             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6646         },
6647         {
6648             .type = OperandType::INT32,
6649             .dimensions = {},
6650             .numberOfConsumers = 1,
6651             .scale = 0.0f,
6652             .zeroPoint = 0,
6653             .lifetime = OperandLifeTime::CONSTANT_COPY,
6654             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6655         },
6656         {
6657             .type = OperandType::INT32,
6658             .dimensions = {},
6659             .numberOfConsumers = 1,
6660             .scale = 0.0f,
6661             .zeroPoint = 0,
6662             .lifetime = OperandLifeTime::CONSTANT_COPY,
6663             .location = {.poolIndex = 0, .offset = 40, .length = 4},
6664         },
6665         {
6666             .type = OperandType::BOOL,
6667             .dimensions = {},
6668             .numberOfConsumers = 1,
6669             .scale = 0.0f,
6670             .zeroPoint = 0,
6671             .lifetime = OperandLifeTime::CONSTANT_COPY,
6672             .location = {.poolIndex = 0, .offset = 44, .length = 1},
6673         },
6674         {
6675             .type = OperandType::TENSOR_FLOAT32,
6676             .dimensions = {5, 2, 2, 1},
6677             .numberOfConsumers = 0,
6678             .scale = 0.0f,
6679             .zeroPoint = 0,
6680             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6681             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6682         }
6683     };
6684 
6685     const std::vector<Operation> operations = {
6686         {
6687             .type = OperationType::ROI_ALIGN,
6688             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6689             .outputs = {10},
6690         }
6691     };
6692 
6693     const std::vector<uint32_t> inputIndexes = {0, 1};
6694     const std::vector<uint32_t> outputIndexes = {10};
6695     std::vector<uint8_t> operandValues = {
6696       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
6697     };
6698     const std::vector<hidl_memory> pools = {};
6699 
6700     return {
6701         .operands = operands,
6702         .operations = operations,
6703         .inputIndexes = inputIndexes,
6704         .outputIndexes = outputIndexes,
6705         .operandValues = operandValues,
6706         .pools = pools,
6707         .relaxComputationFloat32toFloat16 = true,
6708     };
6709 }
6710 
is_ignored_nhwc_relaxed_4(int i)6711 inline bool is_ignored_nhwc_relaxed_4(int i) {
6712   static std::set<int> ignore = {};
6713   return ignore.find(i) != ignore.end();
6714 }
6715 
6716 // Create the model
createTestModel_nhwc_quant8_4()6717 Model createTestModel_nhwc_quant8_4() {
6718     const std::vector<Operand> operands = {
6719         {
6720             .type = OperandType::TENSOR_QUANT8_ASYMM,
6721             .dimensions = {4, 4, 4, 1},
6722             .numberOfConsumers = 1,
6723             .scale = 0.25f,
6724             .zeroPoint = 128,
6725             .lifetime = OperandLifeTime::MODEL_INPUT,
6726             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6727         },
6728         {
6729             .type = OperandType::TENSOR_QUANT16_ASYMM,
6730             .dimensions = {5, 4},
6731             .numberOfConsumers = 1,
6732             .scale = 0.125f,
6733             .zeroPoint = 0,
6734             .lifetime = OperandLifeTime::MODEL_INPUT,
6735             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6736         },
6737         {
6738             .type = OperandType::TENSOR_INT32,
6739             .dimensions = {5},
6740             .numberOfConsumers = 1,
6741             .scale = 0.0f,
6742             .zeroPoint = 0,
6743             .lifetime = OperandLifeTime::CONSTANT_COPY,
6744             .location = {.poolIndex = 0, .offset = 0, .length = 20},
6745         },
6746         {
6747             .type = OperandType::INT32,
6748             .dimensions = {},
6749             .numberOfConsumers = 1,
6750             .scale = 0.0f,
6751             .zeroPoint = 0,
6752             .lifetime = OperandLifeTime::CONSTANT_COPY,
6753             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6754         },
6755         {
6756             .type = OperandType::INT32,
6757             .dimensions = {},
6758             .numberOfConsumers = 1,
6759             .scale = 0.0f,
6760             .zeroPoint = 0,
6761             .lifetime = OperandLifeTime::CONSTANT_COPY,
6762             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6763         },
6764         {
6765             .type = OperandType::FLOAT32,
6766             .dimensions = {},
6767             .numberOfConsumers = 1,
6768             .scale = 0.0f,
6769             .zeroPoint = 0,
6770             .lifetime = OperandLifeTime::CONSTANT_COPY,
6771             .location = {.poolIndex = 0, .offset = 28, .length = 4},
6772         },
6773         {
6774             .type = OperandType::FLOAT32,
6775             .dimensions = {},
6776             .numberOfConsumers = 1,
6777             .scale = 0.0f,
6778             .zeroPoint = 0,
6779             .lifetime = OperandLifeTime::CONSTANT_COPY,
6780             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6781         },
6782         {
6783             .type = OperandType::INT32,
6784             .dimensions = {},
6785             .numberOfConsumers = 1,
6786             .scale = 0.0f,
6787             .zeroPoint = 0,
6788             .lifetime = OperandLifeTime::CONSTANT_COPY,
6789             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6790         },
6791         {
6792             .type = OperandType::INT32,
6793             .dimensions = {},
6794             .numberOfConsumers = 1,
6795             .scale = 0.0f,
6796             .zeroPoint = 0,
6797             .lifetime = OperandLifeTime::CONSTANT_COPY,
6798             .location = {.poolIndex = 0, .offset = 40, .length = 4},
6799         },
6800         {
6801             .type = OperandType::BOOL,
6802             .dimensions = {},
6803             .numberOfConsumers = 1,
6804             .scale = 0.0f,
6805             .zeroPoint = 0,
6806             .lifetime = OperandLifeTime::CONSTANT_COPY,
6807             .location = {.poolIndex = 0, .offset = 44, .length = 1},
6808         },
6809         {
6810             .type = OperandType::TENSOR_QUANT8_ASYMM,
6811             .dimensions = {5, 2, 2, 1},
6812             .numberOfConsumers = 0,
6813             .scale = 0.0625f,
6814             .zeroPoint = 128,
6815             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6816             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6817         }
6818     };
6819 
6820     const std::vector<Operation> operations = {
6821         {
6822             .type = OperationType::ROI_ALIGN,
6823             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6824             .outputs = {10},
6825         }
6826     };
6827 
6828     const std::vector<uint32_t> inputIndexes = {0, 1};
6829     const std::vector<uint32_t> outputIndexes = {10};
6830     std::vector<uint8_t> operandValues = {
6831       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
6832     };
6833     const std::vector<hidl_memory> pools = {};
6834 
6835     return {
6836         .operands = operands,
6837         .operations = operations,
6838         .inputIndexes = inputIndexes,
6839         .outputIndexes = outputIndexes,
6840         .operandValues = operandValues,
6841         .pools = pools,
6842     };
6843 }
6844 
is_ignored_nhwc_quant8_4(int i)6845 inline bool is_ignored_nhwc_quant8_4(int i) {
6846   static std::set<int> ignore = {};
6847   return ignore.find(i) != ignore.end();
6848 }
6849 
6850 // Create the model
createTestModel_nhwc_float16_4()6851 Model createTestModel_nhwc_float16_4() {
6852     const std::vector<Operand> operands = {
6853         {
6854             .type = OperandType::TENSOR_FLOAT16,
6855             .dimensions = {4, 4, 4, 1},
6856             .numberOfConsumers = 1,
6857             .scale = 0.0f,
6858             .zeroPoint = 0,
6859             .lifetime = OperandLifeTime::MODEL_INPUT,
6860             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6861         },
6862         {
6863             .type = OperandType::TENSOR_FLOAT16,
6864             .dimensions = {5, 4},
6865             .numberOfConsumers = 1,
6866             .scale = 0.0f,
6867             .zeroPoint = 0,
6868             .lifetime = OperandLifeTime::MODEL_INPUT,
6869             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6870         },
6871         {
6872             .type = OperandType::TENSOR_INT32,
6873             .dimensions = {5},
6874             .numberOfConsumers = 1,
6875             .scale = 0.0f,
6876             .zeroPoint = 0,
6877             .lifetime = OperandLifeTime::CONSTANT_COPY,
6878             .location = {.poolIndex = 0, .offset = 0, .length = 20},
6879         },
6880         {
6881             .type = OperandType::INT32,
6882             .dimensions = {},
6883             .numberOfConsumers = 1,
6884             .scale = 0.0f,
6885             .zeroPoint = 0,
6886             .lifetime = OperandLifeTime::CONSTANT_COPY,
6887             .location = {.poolIndex = 0, .offset = 20, .length = 4},
6888         },
6889         {
6890             .type = OperandType::INT32,
6891             .dimensions = {},
6892             .numberOfConsumers = 1,
6893             .scale = 0.0f,
6894             .zeroPoint = 0,
6895             .lifetime = OperandLifeTime::CONSTANT_COPY,
6896             .location = {.poolIndex = 0, .offset = 24, .length = 4},
6897         },
6898         {
6899             .type = OperandType::FLOAT16,
6900             .dimensions = {},
6901             .numberOfConsumers = 1,
6902             .scale = 0.0f,
6903             .zeroPoint = 0,
6904             .lifetime = OperandLifeTime::CONSTANT_COPY,
6905             .location = {.poolIndex = 0, .offset = 28, .length = 2},
6906         },
6907         {
6908             .type = OperandType::FLOAT16,
6909             .dimensions = {},
6910             .numberOfConsumers = 1,
6911             .scale = 0.0f,
6912             .zeroPoint = 0,
6913             .lifetime = OperandLifeTime::CONSTANT_COPY,
6914             .location = {.poolIndex = 0, .offset = 30, .length = 2},
6915         },
6916         {
6917             .type = OperandType::INT32,
6918             .dimensions = {},
6919             .numberOfConsumers = 1,
6920             .scale = 0.0f,
6921             .zeroPoint = 0,
6922             .lifetime = OperandLifeTime::CONSTANT_COPY,
6923             .location = {.poolIndex = 0, .offset = 32, .length = 4},
6924         },
6925         {
6926             .type = OperandType::INT32,
6927             .dimensions = {},
6928             .numberOfConsumers = 1,
6929             .scale = 0.0f,
6930             .zeroPoint = 0,
6931             .lifetime = OperandLifeTime::CONSTANT_COPY,
6932             .location = {.poolIndex = 0, .offset = 36, .length = 4},
6933         },
6934         {
6935             .type = OperandType::BOOL,
6936             .dimensions = {},
6937             .numberOfConsumers = 1,
6938             .scale = 0.0f,
6939             .zeroPoint = 0,
6940             .lifetime = OperandLifeTime::CONSTANT_COPY,
6941             .location = {.poolIndex = 0, .offset = 40, .length = 1},
6942         },
6943         {
6944             .type = OperandType::TENSOR_FLOAT16,
6945             .dimensions = {5, 2, 2, 1},
6946             .numberOfConsumers = 0,
6947             .scale = 0.0f,
6948             .zeroPoint = 0,
6949             .lifetime = OperandLifeTime::MODEL_OUTPUT,
6950             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6951         }
6952     };
6953 
6954     const std::vector<Operation> operations = {
6955         {
6956             .type = OperationType::ROI_ALIGN,
6957             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
6958             .outputs = {10},
6959         }
6960     };
6961 
6962     const std::vector<uint32_t> inputIndexes = {0, 1};
6963     const std::vector<uint32_t> outputIndexes = {10};
6964     std::vector<uint8_t> operandValues = {
6965       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 60, 0, 0, 0, 0, 4, 0, 0, 0, 0
6966     };
6967     const std::vector<hidl_memory> pools = {};
6968 
6969     return {
6970         .operands = operands,
6971         .operations = operations,
6972         .inputIndexes = inputIndexes,
6973         .outputIndexes = outputIndexes,
6974         .operandValues = operandValues,
6975         .pools = pools,
6976     };
6977 }
6978 
is_ignored_nhwc_float16_4(int i)6979 inline bool is_ignored_nhwc_float16_4(int i) {
6980   static std::set<int> ignore = {};
6981   return ignore.find(i) != ignore.end();
6982 }
6983 
6984 // Create the model
createTestModel_nchw_4()6985 Model createTestModel_nchw_4() {
6986     const std::vector<Operand> operands = {
6987         {
6988             .type = OperandType::TENSOR_FLOAT32,
6989             .dimensions = {4, 1, 4, 4},
6990             .numberOfConsumers = 1,
6991             .scale = 0.0f,
6992             .zeroPoint = 0,
6993             .lifetime = OperandLifeTime::MODEL_INPUT,
6994             .location = {.poolIndex = 0, .offset = 0, .length = 0},
6995         },
6996         {
6997             .type = OperandType::TENSOR_FLOAT32,
6998             .dimensions = {5, 4},
6999             .numberOfConsumers = 1,
7000             .scale = 0.0f,
7001             .zeroPoint = 0,
7002             .lifetime = OperandLifeTime::MODEL_INPUT,
7003             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7004         },
7005         {
7006             .type = OperandType::TENSOR_INT32,
7007             .dimensions = {5},
7008             .numberOfConsumers = 1,
7009             .scale = 0.0f,
7010             .zeroPoint = 0,
7011             .lifetime = OperandLifeTime::CONSTANT_COPY,
7012             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7013         },
7014         {
7015             .type = OperandType::INT32,
7016             .dimensions = {},
7017             .numberOfConsumers = 1,
7018             .scale = 0.0f,
7019             .zeroPoint = 0,
7020             .lifetime = OperandLifeTime::CONSTANT_COPY,
7021             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7022         },
7023         {
7024             .type = OperandType::INT32,
7025             .dimensions = {},
7026             .numberOfConsumers = 1,
7027             .scale = 0.0f,
7028             .zeroPoint = 0,
7029             .lifetime = OperandLifeTime::CONSTANT_COPY,
7030             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7031         },
7032         {
7033             .type = OperandType::FLOAT32,
7034             .dimensions = {},
7035             .numberOfConsumers = 1,
7036             .scale = 0.0f,
7037             .zeroPoint = 0,
7038             .lifetime = OperandLifeTime::CONSTANT_COPY,
7039             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7040         },
7041         {
7042             .type = OperandType::FLOAT32,
7043             .dimensions = {},
7044             .numberOfConsumers = 1,
7045             .scale = 0.0f,
7046             .zeroPoint = 0,
7047             .lifetime = OperandLifeTime::CONSTANT_COPY,
7048             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7049         },
7050         {
7051             .type = OperandType::INT32,
7052             .dimensions = {},
7053             .numberOfConsumers = 1,
7054             .scale = 0.0f,
7055             .zeroPoint = 0,
7056             .lifetime = OperandLifeTime::CONSTANT_COPY,
7057             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7058         },
7059         {
7060             .type = OperandType::INT32,
7061             .dimensions = {},
7062             .numberOfConsumers = 1,
7063             .scale = 0.0f,
7064             .zeroPoint = 0,
7065             .lifetime = OperandLifeTime::CONSTANT_COPY,
7066             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7067         },
7068         {
7069             .type = OperandType::BOOL,
7070             .dimensions = {},
7071             .numberOfConsumers = 1,
7072             .scale = 0.0f,
7073             .zeroPoint = 0,
7074             .lifetime = OperandLifeTime::CONSTANT_COPY,
7075             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7076         },
7077         {
7078             .type = OperandType::TENSOR_FLOAT32,
7079             .dimensions = {5, 1, 2, 2},
7080             .numberOfConsumers = 0,
7081             .scale = 0.0f,
7082             .zeroPoint = 0,
7083             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7084             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7085         }
7086     };
7087 
7088     const std::vector<Operation> operations = {
7089         {
7090             .type = OperationType::ROI_ALIGN,
7091             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7092             .outputs = {10},
7093         }
7094     };
7095 
7096     const std::vector<uint32_t> inputIndexes = {0, 1};
7097     const std::vector<uint32_t> outputIndexes = {10};
7098     std::vector<uint8_t> operandValues = {
7099       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
7100     };
7101     const std::vector<hidl_memory> pools = {};
7102 
7103     return {
7104         .operands = operands,
7105         .operations = operations,
7106         .inputIndexes = inputIndexes,
7107         .outputIndexes = outputIndexes,
7108         .operandValues = operandValues,
7109         .pools = pools,
7110     };
7111 }
7112 
is_ignored_nchw_4(int i)7113 inline bool is_ignored_nchw_4(int i) {
7114   static std::set<int> ignore = {};
7115   return ignore.find(i) != ignore.end();
7116 }
7117 
7118 // Create the model
createTestModel_nchw_relaxed_4()7119 Model createTestModel_nchw_relaxed_4() {
7120     const std::vector<Operand> operands = {
7121         {
7122             .type = OperandType::TENSOR_FLOAT32,
7123             .dimensions = {4, 1, 4, 4},
7124             .numberOfConsumers = 1,
7125             .scale = 0.0f,
7126             .zeroPoint = 0,
7127             .lifetime = OperandLifeTime::MODEL_INPUT,
7128             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7129         },
7130         {
7131             .type = OperandType::TENSOR_FLOAT32,
7132             .dimensions = {5, 4},
7133             .numberOfConsumers = 1,
7134             .scale = 0.0f,
7135             .zeroPoint = 0,
7136             .lifetime = OperandLifeTime::MODEL_INPUT,
7137             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7138         },
7139         {
7140             .type = OperandType::TENSOR_INT32,
7141             .dimensions = {5},
7142             .numberOfConsumers = 1,
7143             .scale = 0.0f,
7144             .zeroPoint = 0,
7145             .lifetime = OperandLifeTime::CONSTANT_COPY,
7146             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7147         },
7148         {
7149             .type = OperandType::INT32,
7150             .dimensions = {},
7151             .numberOfConsumers = 1,
7152             .scale = 0.0f,
7153             .zeroPoint = 0,
7154             .lifetime = OperandLifeTime::CONSTANT_COPY,
7155             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7156         },
7157         {
7158             .type = OperandType::INT32,
7159             .dimensions = {},
7160             .numberOfConsumers = 1,
7161             .scale = 0.0f,
7162             .zeroPoint = 0,
7163             .lifetime = OperandLifeTime::CONSTANT_COPY,
7164             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7165         },
7166         {
7167             .type = OperandType::FLOAT32,
7168             .dimensions = {},
7169             .numberOfConsumers = 1,
7170             .scale = 0.0f,
7171             .zeroPoint = 0,
7172             .lifetime = OperandLifeTime::CONSTANT_COPY,
7173             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7174         },
7175         {
7176             .type = OperandType::FLOAT32,
7177             .dimensions = {},
7178             .numberOfConsumers = 1,
7179             .scale = 0.0f,
7180             .zeroPoint = 0,
7181             .lifetime = OperandLifeTime::CONSTANT_COPY,
7182             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7183         },
7184         {
7185             .type = OperandType::INT32,
7186             .dimensions = {},
7187             .numberOfConsumers = 1,
7188             .scale = 0.0f,
7189             .zeroPoint = 0,
7190             .lifetime = OperandLifeTime::CONSTANT_COPY,
7191             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7192         },
7193         {
7194             .type = OperandType::INT32,
7195             .dimensions = {},
7196             .numberOfConsumers = 1,
7197             .scale = 0.0f,
7198             .zeroPoint = 0,
7199             .lifetime = OperandLifeTime::CONSTANT_COPY,
7200             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7201         },
7202         {
7203             .type = OperandType::BOOL,
7204             .dimensions = {},
7205             .numberOfConsumers = 1,
7206             .scale = 0.0f,
7207             .zeroPoint = 0,
7208             .lifetime = OperandLifeTime::CONSTANT_COPY,
7209             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7210         },
7211         {
7212             .type = OperandType::TENSOR_FLOAT32,
7213             .dimensions = {5, 1, 2, 2},
7214             .numberOfConsumers = 0,
7215             .scale = 0.0f,
7216             .zeroPoint = 0,
7217             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7218             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7219         }
7220     };
7221 
7222     const std::vector<Operation> operations = {
7223         {
7224             .type = OperationType::ROI_ALIGN,
7225             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7226             .outputs = {10},
7227         }
7228     };
7229 
7230     const std::vector<uint32_t> inputIndexes = {0, 1};
7231     const std::vector<uint32_t> outputIndexes = {10};
7232     std::vector<uint8_t> operandValues = {
7233       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
7234     };
7235     const std::vector<hidl_memory> pools = {};
7236 
7237     return {
7238         .operands = operands,
7239         .operations = operations,
7240         .inputIndexes = inputIndexes,
7241         .outputIndexes = outputIndexes,
7242         .operandValues = operandValues,
7243         .pools = pools,
7244         .relaxComputationFloat32toFloat16 = true,
7245     };
7246 }
7247 
is_ignored_nchw_relaxed_4(int i)7248 inline bool is_ignored_nchw_relaxed_4(int i) {
7249   static std::set<int> ignore = {};
7250   return ignore.find(i) != ignore.end();
7251 }
7252 
7253 // Create the model
createTestModel_nchw_quant8_4()7254 Model createTestModel_nchw_quant8_4() {
7255     const std::vector<Operand> operands = {
7256         {
7257             .type = OperandType::TENSOR_QUANT8_ASYMM,
7258             .dimensions = {4, 1, 4, 4},
7259             .numberOfConsumers = 1,
7260             .scale = 0.25f,
7261             .zeroPoint = 128,
7262             .lifetime = OperandLifeTime::MODEL_INPUT,
7263             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7264         },
7265         {
7266             .type = OperandType::TENSOR_QUANT16_ASYMM,
7267             .dimensions = {5, 4},
7268             .numberOfConsumers = 1,
7269             .scale = 0.125f,
7270             .zeroPoint = 0,
7271             .lifetime = OperandLifeTime::MODEL_INPUT,
7272             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7273         },
7274         {
7275             .type = OperandType::TENSOR_INT32,
7276             .dimensions = {5},
7277             .numberOfConsumers = 1,
7278             .scale = 0.0f,
7279             .zeroPoint = 0,
7280             .lifetime = OperandLifeTime::CONSTANT_COPY,
7281             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7282         },
7283         {
7284             .type = OperandType::INT32,
7285             .dimensions = {},
7286             .numberOfConsumers = 1,
7287             .scale = 0.0f,
7288             .zeroPoint = 0,
7289             .lifetime = OperandLifeTime::CONSTANT_COPY,
7290             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7291         },
7292         {
7293             .type = OperandType::INT32,
7294             .dimensions = {},
7295             .numberOfConsumers = 1,
7296             .scale = 0.0f,
7297             .zeroPoint = 0,
7298             .lifetime = OperandLifeTime::CONSTANT_COPY,
7299             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7300         },
7301         {
7302             .type = OperandType::FLOAT32,
7303             .dimensions = {},
7304             .numberOfConsumers = 1,
7305             .scale = 0.0f,
7306             .zeroPoint = 0,
7307             .lifetime = OperandLifeTime::CONSTANT_COPY,
7308             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7309         },
7310         {
7311             .type = OperandType::FLOAT32,
7312             .dimensions = {},
7313             .numberOfConsumers = 1,
7314             .scale = 0.0f,
7315             .zeroPoint = 0,
7316             .lifetime = OperandLifeTime::CONSTANT_COPY,
7317             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7318         },
7319         {
7320             .type = OperandType::INT32,
7321             .dimensions = {},
7322             .numberOfConsumers = 1,
7323             .scale = 0.0f,
7324             .zeroPoint = 0,
7325             .lifetime = OperandLifeTime::CONSTANT_COPY,
7326             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7327         },
7328         {
7329             .type = OperandType::INT32,
7330             .dimensions = {},
7331             .numberOfConsumers = 1,
7332             .scale = 0.0f,
7333             .zeroPoint = 0,
7334             .lifetime = OperandLifeTime::CONSTANT_COPY,
7335             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7336         },
7337         {
7338             .type = OperandType::BOOL,
7339             .dimensions = {},
7340             .numberOfConsumers = 1,
7341             .scale = 0.0f,
7342             .zeroPoint = 0,
7343             .lifetime = OperandLifeTime::CONSTANT_COPY,
7344             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7345         },
7346         {
7347             .type = OperandType::TENSOR_QUANT8_ASYMM,
7348             .dimensions = {5, 1, 2, 2},
7349             .numberOfConsumers = 0,
7350             .scale = 0.0625f,
7351             .zeroPoint = 128,
7352             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7353             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7354         }
7355     };
7356 
7357     const std::vector<Operation> operations = {
7358         {
7359             .type = OperationType::ROI_ALIGN,
7360             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7361             .outputs = {10},
7362         }
7363     };
7364 
7365     const std::vector<uint32_t> inputIndexes = {0, 1};
7366     const std::vector<uint32_t> outputIndexes = {10};
7367     std::vector<uint8_t> operandValues = {
7368       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
7369     };
7370     const std::vector<hidl_memory> pools = {};
7371 
7372     return {
7373         .operands = operands,
7374         .operations = operations,
7375         .inputIndexes = inputIndexes,
7376         .outputIndexes = outputIndexes,
7377         .operandValues = operandValues,
7378         .pools = pools,
7379     };
7380 }
7381 
is_ignored_nchw_quant8_4(int i)7382 inline bool is_ignored_nchw_quant8_4(int i) {
7383   static std::set<int> ignore = {};
7384   return ignore.find(i) != ignore.end();
7385 }
7386 
7387 // Create the model
createTestModel_nchw_float16_4()7388 Model createTestModel_nchw_float16_4() {
7389     const std::vector<Operand> operands = {
7390         {
7391             .type = OperandType::TENSOR_FLOAT16,
7392             .dimensions = {4, 1, 4, 4},
7393             .numberOfConsumers = 1,
7394             .scale = 0.0f,
7395             .zeroPoint = 0,
7396             .lifetime = OperandLifeTime::MODEL_INPUT,
7397             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7398         },
7399         {
7400             .type = OperandType::TENSOR_FLOAT16,
7401             .dimensions = {5, 4},
7402             .numberOfConsumers = 1,
7403             .scale = 0.0f,
7404             .zeroPoint = 0,
7405             .lifetime = OperandLifeTime::MODEL_INPUT,
7406             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7407         },
7408         {
7409             .type = OperandType::TENSOR_INT32,
7410             .dimensions = {5},
7411             .numberOfConsumers = 1,
7412             .scale = 0.0f,
7413             .zeroPoint = 0,
7414             .lifetime = OperandLifeTime::CONSTANT_COPY,
7415             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7416         },
7417         {
7418             .type = OperandType::INT32,
7419             .dimensions = {},
7420             .numberOfConsumers = 1,
7421             .scale = 0.0f,
7422             .zeroPoint = 0,
7423             .lifetime = OperandLifeTime::CONSTANT_COPY,
7424             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7425         },
7426         {
7427             .type = OperandType::INT32,
7428             .dimensions = {},
7429             .numberOfConsumers = 1,
7430             .scale = 0.0f,
7431             .zeroPoint = 0,
7432             .lifetime = OperandLifeTime::CONSTANT_COPY,
7433             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7434         },
7435         {
7436             .type = OperandType::FLOAT16,
7437             .dimensions = {},
7438             .numberOfConsumers = 1,
7439             .scale = 0.0f,
7440             .zeroPoint = 0,
7441             .lifetime = OperandLifeTime::CONSTANT_COPY,
7442             .location = {.poolIndex = 0, .offset = 28, .length = 2},
7443         },
7444         {
7445             .type = OperandType::FLOAT16,
7446             .dimensions = {},
7447             .numberOfConsumers = 1,
7448             .scale = 0.0f,
7449             .zeroPoint = 0,
7450             .lifetime = OperandLifeTime::CONSTANT_COPY,
7451             .location = {.poolIndex = 0, .offset = 30, .length = 2},
7452         },
7453         {
7454             .type = OperandType::INT32,
7455             .dimensions = {},
7456             .numberOfConsumers = 1,
7457             .scale = 0.0f,
7458             .zeroPoint = 0,
7459             .lifetime = OperandLifeTime::CONSTANT_COPY,
7460             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7461         },
7462         {
7463             .type = OperandType::INT32,
7464             .dimensions = {},
7465             .numberOfConsumers = 1,
7466             .scale = 0.0f,
7467             .zeroPoint = 0,
7468             .lifetime = OperandLifeTime::CONSTANT_COPY,
7469             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7470         },
7471         {
7472             .type = OperandType::BOOL,
7473             .dimensions = {},
7474             .numberOfConsumers = 1,
7475             .scale = 0.0f,
7476             .zeroPoint = 0,
7477             .lifetime = OperandLifeTime::CONSTANT_COPY,
7478             .location = {.poolIndex = 0, .offset = 40, .length = 1},
7479         },
7480         {
7481             .type = OperandType::TENSOR_FLOAT16,
7482             .dimensions = {5, 1, 2, 2},
7483             .numberOfConsumers = 0,
7484             .scale = 0.0f,
7485             .zeroPoint = 0,
7486             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7487             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7488         }
7489     };
7490 
7491     const std::vector<Operation> operations = {
7492         {
7493             .type = OperationType::ROI_ALIGN,
7494             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7495             .outputs = {10},
7496         }
7497     };
7498 
7499     const std::vector<uint32_t> inputIndexes = {0, 1};
7500     const std::vector<uint32_t> outputIndexes = {10};
7501     std::vector<uint8_t> operandValues = {
7502       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 60, 0, 0, 0, 0, 4, 0, 0, 0, 1
7503     };
7504     const std::vector<hidl_memory> pools = {};
7505 
7506     return {
7507         .operands = operands,
7508         .operations = operations,
7509         .inputIndexes = inputIndexes,
7510         .outputIndexes = outputIndexes,
7511         .operandValues = operandValues,
7512         .pools = pools,
7513     };
7514 }
7515 
is_ignored_nchw_float16_4(int i)7516 inline bool is_ignored_nchw_float16_4(int i) {
7517   static std::set<int> ignore = {};
7518   return ignore.find(i) != ignore.end();
7519 }
7520 
7521 // Create the model
createTestModel_dynamic_output_shape_nhwc_4()7522 Model createTestModel_dynamic_output_shape_nhwc_4() {
7523     const std::vector<Operand> operands = {
7524         {
7525             .type = OperandType::TENSOR_FLOAT32,
7526             .dimensions = {4, 4, 4, 1},
7527             .numberOfConsumers = 1,
7528             .scale = 0.0f,
7529             .zeroPoint = 0,
7530             .lifetime = OperandLifeTime::MODEL_INPUT,
7531             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7532         },
7533         {
7534             .type = OperandType::TENSOR_FLOAT32,
7535             .dimensions = {5, 4},
7536             .numberOfConsumers = 1,
7537             .scale = 0.0f,
7538             .zeroPoint = 0,
7539             .lifetime = OperandLifeTime::MODEL_INPUT,
7540             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7541         },
7542         {
7543             .type = OperandType::TENSOR_INT32,
7544             .dimensions = {5},
7545             .numberOfConsumers = 1,
7546             .scale = 0.0f,
7547             .zeroPoint = 0,
7548             .lifetime = OperandLifeTime::CONSTANT_COPY,
7549             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7550         },
7551         {
7552             .type = OperandType::INT32,
7553             .dimensions = {},
7554             .numberOfConsumers = 1,
7555             .scale = 0.0f,
7556             .zeroPoint = 0,
7557             .lifetime = OperandLifeTime::CONSTANT_COPY,
7558             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7559         },
7560         {
7561             .type = OperandType::INT32,
7562             .dimensions = {},
7563             .numberOfConsumers = 1,
7564             .scale = 0.0f,
7565             .zeroPoint = 0,
7566             .lifetime = OperandLifeTime::CONSTANT_COPY,
7567             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7568         },
7569         {
7570             .type = OperandType::FLOAT32,
7571             .dimensions = {},
7572             .numberOfConsumers = 1,
7573             .scale = 0.0f,
7574             .zeroPoint = 0,
7575             .lifetime = OperandLifeTime::CONSTANT_COPY,
7576             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7577         },
7578         {
7579             .type = OperandType::FLOAT32,
7580             .dimensions = {},
7581             .numberOfConsumers = 1,
7582             .scale = 0.0f,
7583             .zeroPoint = 0,
7584             .lifetime = OperandLifeTime::CONSTANT_COPY,
7585             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7586         },
7587         {
7588             .type = OperandType::INT32,
7589             .dimensions = {},
7590             .numberOfConsumers = 1,
7591             .scale = 0.0f,
7592             .zeroPoint = 0,
7593             .lifetime = OperandLifeTime::CONSTANT_COPY,
7594             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7595         },
7596         {
7597             .type = OperandType::INT32,
7598             .dimensions = {},
7599             .numberOfConsumers = 1,
7600             .scale = 0.0f,
7601             .zeroPoint = 0,
7602             .lifetime = OperandLifeTime::CONSTANT_COPY,
7603             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7604         },
7605         {
7606             .type = OperandType::BOOL,
7607             .dimensions = {},
7608             .numberOfConsumers = 1,
7609             .scale = 0.0f,
7610             .zeroPoint = 0,
7611             .lifetime = OperandLifeTime::CONSTANT_COPY,
7612             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7613         },
7614         {
7615             .type = OperandType::TENSOR_FLOAT32,
7616             .dimensions = {0, 0, 0, 0},
7617             .numberOfConsumers = 0,
7618             .scale = 0.0f,
7619             .zeroPoint = 0,
7620             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7621             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7622         }
7623     };
7624 
7625     const std::vector<Operation> operations = {
7626         {
7627             .type = OperationType::ROI_ALIGN,
7628             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7629             .outputs = {10},
7630         }
7631     };
7632 
7633     const std::vector<uint32_t> inputIndexes = {0, 1};
7634     const std::vector<uint32_t> outputIndexes = {10};
7635     std::vector<uint8_t> operandValues = {
7636       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
7637     };
7638     const std::vector<hidl_memory> pools = {};
7639 
7640     return {
7641         .operands = operands,
7642         .operations = operations,
7643         .inputIndexes = inputIndexes,
7644         .outputIndexes = outputIndexes,
7645         .operandValues = operandValues,
7646         .pools = pools,
7647     };
7648 }
7649 
is_ignored_dynamic_output_shape_nhwc_4(int i)7650 inline bool is_ignored_dynamic_output_shape_nhwc_4(int i) {
7651   static std::set<int> ignore = {};
7652   return ignore.find(i) != ignore.end();
7653 }
7654 
7655 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed_4()7656 Model createTestModel_dynamic_output_shape_nhwc_relaxed_4() {
7657     const std::vector<Operand> operands = {
7658         {
7659             .type = OperandType::TENSOR_FLOAT32,
7660             .dimensions = {4, 4, 4, 1},
7661             .numberOfConsumers = 1,
7662             .scale = 0.0f,
7663             .zeroPoint = 0,
7664             .lifetime = OperandLifeTime::MODEL_INPUT,
7665             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7666         },
7667         {
7668             .type = OperandType::TENSOR_FLOAT32,
7669             .dimensions = {5, 4},
7670             .numberOfConsumers = 1,
7671             .scale = 0.0f,
7672             .zeroPoint = 0,
7673             .lifetime = OperandLifeTime::MODEL_INPUT,
7674             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7675         },
7676         {
7677             .type = OperandType::TENSOR_INT32,
7678             .dimensions = {5},
7679             .numberOfConsumers = 1,
7680             .scale = 0.0f,
7681             .zeroPoint = 0,
7682             .lifetime = OperandLifeTime::CONSTANT_COPY,
7683             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7684         },
7685         {
7686             .type = OperandType::INT32,
7687             .dimensions = {},
7688             .numberOfConsumers = 1,
7689             .scale = 0.0f,
7690             .zeroPoint = 0,
7691             .lifetime = OperandLifeTime::CONSTANT_COPY,
7692             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7693         },
7694         {
7695             .type = OperandType::INT32,
7696             .dimensions = {},
7697             .numberOfConsumers = 1,
7698             .scale = 0.0f,
7699             .zeroPoint = 0,
7700             .lifetime = OperandLifeTime::CONSTANT_COPY,
7701             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7702         },
7703         {
7704             .type = OperandType::FLOAT32,
7705             .dimensions = {},
7706             .numberOfConsumers = 1,
7707             .scale = 0.0f,
7708             .zeroPoint = 0,
7709             .lifetime = OperandLifeTime::CONSTANT_COPY,
7710             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7711         },
7712         {
7713             .type = OperandType::FLOAT32,
7714             .dimensions = {},
7715             .numberOfConsumers = 1,
7716             .scale = 0.0f,
7717             .zeroPoint = 0,
7718             .lifetime = OperandLifeTime::CONSTANT_COPY,
7719             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7720         },
7721         {
7722             .type = OperandType::INT32,
7723             .dimensions = {},
7724             .numberOfConsumers = 1,
7725             .scale = 0.0f,
7726             .zeroPoint = 0,
7727             .lifetime = OperandLifeTime::CONSTANT_COPY,
7728             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7729         },
7730         {
7731             .type = OperandType::INT32,
7732             .dimensions = {},
7733             .numberOfConsumers = 1,
7734             .scale = 0.0f,
7735             .zeroPoint = 0,
7736             .lifetime = OperandLifeTime::CONSTANT_COPY,
7737             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7738         },
7739         {
7740             .type = OperandType::BOOL,
7741             .dimensions = {},
7742             .numberOfConsumers = 1,
7743             .scale = 0.0f,
7744             .zeroPoint = 0,
7745             .lifetime = OperandLifeTime::CONSTANT_COPY,
7746             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7747         },
7748         {
7749             .type = OperandType::TENSOR_FLOAT32,
7750             .dimensions = {0, 0, 0, 0},
7751             .numberOfConsumers = 0,
7752             .scale = 0.0f,
7753             .zeroPoint = 0,
7754             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7755             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7756         }
7757     };
7758 
7759     const std::vector<Operation> operations = {
7760         {
7761             .type = OperationType::ROI_ALIGN,
7762             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7763             .outputs = {10},
7764         }
7765     };
7766 
7767     const std::vector<uint32_t> inputIndexes = {0, 1};
7768     const std::vector<uint32_t> outputIndexes = {10};
7769     std::vector<uint8_t> operandValues = {
7770       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
7771     };
7772     const std::vector<hidl_memory> pools = {};
7773 
7774     return {
7775         .operands = operands,
7776         .operations = operations,
7777         .inputIndexes = inputIndexes,
7778         .outputIndexes = outputIndexes,
7779         .operandValues = operandValues,
7780         .pools = pools,
7781         .relaxComputationFloat32toFloat16 = true,
7782     };
7783 }
7784 
is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i)7785 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i) {
7786   static std::set<int> ignore = {};
7787   return ignore.find(i) != ignore.end();
7788 }
7789 
7790 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8_4()7791 Model createTestModel_dynamic_output_shape_nhwc_quant8_4() {
7792     const std::vector<Operand> operands = {
7793         {
7794             .type = OperandType::TENSOR_QUANT8_ASYMM,
7795             .dimensions = {4, 4, 4, 1},
7796             .numberOfConsumers = 1,
7797             .scale = 0.25f,
7798             .zeroPoint = 128,
7799             .lifetime = OperandLifeTime::MODEL_INPUT,
7800             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7801         },
7802         {
7803             .type = OperandType::TENSOR_QUANT16_ASYMM,
7804             .dimensions = {5, 4},
7805             .numberOfConsumers = 1,
7806             .scale = 0.125f,
7807             .zeroPoint = 0,
7808             .lifetime = OperandLifeTime::MODEL_INPUT,
7809             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7810         },
7811         {
7812             .type = OperandType::TENSOR_INT32,
7813             .dimensions = {5},
7814             .numberOfConsumers = 1,
7815             .scale = 0.0f,
7816             .zeroPoint = 0,
7817             .lifetime = OperandLifeTime::CONSTANT_COPY,
7818             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7819         },
7820         {
7821             .type = OperandType::INT32,
7822             .dimensions = {},
7823             .numberOfConsumers = 1,
7824             .scale = 0.0f,
7825             .zeroPoint = 0,
7826             .lifetime = OperandLifeTime::CONSTANT_COPY,
7827             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7828         },
7829         {
7830             .type = OperandType::INT32,
7831             .dimensions = {},
7832             .numberOfConsumers = 1,
7833             .scale = 0.0f,
7834             .zeroPoint = 0,
7835             .lifetime = OperandLifeTime::CONSTANT_COPY,
7836             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7837         },
7838         {
7839             .type = OperandType::FLOAT32,
7840             .dimensions = {},
7841             .numberOfConsumers = 1,
7842             .scale = 0.0f,
7843             .zeroPoint = 0,
7844             .lifetime = OperandLifeTime::CONSTANT_COPY,
7845             .location = {.poolIndex = 0, .offset = 28, .length = 4},
7846         },
7847         {
7848             .type = OperandType::FLOAT32,
7849             .dimensions = {},
7850             .numberOfConsumers = 1,
7851             .scale = 0.0f,
7852             .zeroPoint = 0,
7853             .lifetime = OperandLifeTime::CONSTANT_COPY,
7854             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7855         },
7856         {
7857             .type = OperandType::INT32,
7858             .dimensions = {},
7859             .numberOfConsumers = 1,
7860             .scale = 0.0f,
7861             .zeroPoint = 0,
7862             .lifetime = OperandLifeTime::CONSTANT_COPY,
7863             .location = {.poolIndex = 0, .offset = 36, .length = 4},
7864         },
7865         {
7866             .type = OperandType::INT32,
7867             .dimensions = {},
7868             .numberOfConsumers = 1,
7869             .scale = 0.0f,
7870             .zeroPoint = 0,
7871             .lifetime = OperandLifeTime::CONSTANT_COPY,
7872             .location = {.poolIndex = 0, .offset = 40, .length = 4},
7873         },
7874         {
7875             .type = OperandType::BOOL,
7876             .dimensions = {},
7877             .numberOfConsumers = 1,
7878             .scale = 0.0f,
7879             .zeroPoint = 0,
7880             .lifetime = OperandLifeTime::CONSTANT_COPY,
7881             .location = {.poolIndex = 0, .offset = 44, .length = 1},
7882         },
7883         {
7884             .type = OperandType::TENSOR_QUANT8_ASYMM,
7885             .dimensions = {0, 0, 0, 0},
7886             .numberOfConsumers = 0,
7887             .scale = 0.0625f,
7888             .zeroPoint = 128,
7889             .lifetime = OperandLifeTime::MODEL_OUTPUT,
7890             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7891         }
7892     };
7893 
7894     const std::vector<Operation> operations = {
7895         {
7896             .type = OperationType::ROI_ALIGN,
7897             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
7898             .outputs = {10},
7899         }
7900     };
7901 
7902     const std::vector<uint32_t> inputIndexes = {0, 1};
7903     const std::vector<uint32_t> outputIndexes = {10};
7904     std::vector<uint8_t> operandValues = {
7905       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 0
7906     };
7907     const std::vector<hidl_memory> pools = {};
7908 
7909     return {
7910         .operands = operands,
7911         .operations = operations,
7912         .inputIndexes = inputIndexes,
7913         .outputIndexes = outputIndexes,
7914         .operandValues = operandValues,
7915         .pools = pools,
7916     };
7917 }
7918 
is_ignored_dynamic_output_shape_nhwc_quant8_4(int i)7919 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_4(int i) {
7920   static std::set<int> ignore = {};
7921   return ignore.find(i) != ignore.end();
7922 }
7923 
7924 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16_4()7925 Model createTestModel_dynamic_output_shape_nhwc_float16_4() {
7926     const std::vector<Operand> operands = {
7927         {
7928             .type = OperandType::TENSOR_FLOAT16,
7929             .dimensions = {4, 4, 4, 1},
7930             .numberOfConsumers = 1,
7931             .scale = 0.0f,
7932             .zeroPoint = 0,
7933             .lifetime = OperandLifeTime::MODEL_INPUT,
7934             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7935         },
7936         {
7937             .type = OperandType::TENSOR_FLOAT16,
7938             .dimensions = {5, 4},
7939             .numberOfConsumers = 1,
7940             .scale = 0.0f,
7941             .zeroPoint = 0,
7942             .lifetime = OperandLifeTime::MODEL_INPUT,
7943             .location = {.poolIndex = 0, .offset = 0, .length = 0},
7944         },
7945         {
7946             .type = OperandType::TENSOR_INT32,
7947             .dimensions = {5},
7948             .numberOfConsumers = 1,
7949             .scale = 0.0f,
7950             .zeroPoint = 0,
7951             .lifetime = OperandLifeTime::CONSTANT_COPY,
7952             .location = {.poolIndex = 0, .offset = 0, .length = 20},
7953         },
7954         {
7955             .type = OperandType::INT32,
7956             .dimensions = {},
7957             .numberOfConsumers = 1,
7958             .scale = 0.0f,
7959             .zeroPoint = 0,
7960             .lifetime = OperandLifeTime::CONSTANT_COPY,
7961             .location = {.poolIndex = 0, .offset = 20, .length = 4},
7962         },
7963         {
7964             .type = OperandType::INT32,
7965             .dimensions = {},
7966             .numberOfConsumers = 1,
7967             .scale = 0.0f,
7968             .zeroPoint = 0,
7969             .lifetime = OperandLifeTime::CONSTANT_COPY,
7970             .location = {.poolIndex = 0, .offset = 24, .length = 4},
7971         },
7972         {
7973             .type = OperandType::FLOAT16,
7974             .dimensions = {},
7975             .numberOfConsumers = 1,
7976             .scale = 0.0f,
7977             .zeroPoint = 0,
7978             .lifetime = OperandLifeTime::CONSTANT_COPY,
7979             .location = {.poolIndex = 0, .offset = 28, .length = 2},
7980         },
7981         {
7982             .type = OperandType::FLOAT16,
7983             .dimensions = {},
7984             .numberOfConsumers = 1,
7985             .scale = 0.0f,
7986             .zeroPoint = 0,
7987             .lifetime = OperandLifeTime::CONSTANT_COPY,
7988             .location = {.poolIndex = 0, .offset = 30, .length = 2},
7989         },
7990         {
7991             .type = OperandType::INT32,
7992             .dimensions = {},
7993             .numberOfConsumers = 1,
7994             .scale = 0.0f,
7995             .zeroPoint = 0,
7996             .lifetime = OperandLifeTime::CONSTANT_COPY,
7997             .location = {.poolIndex = 0, .offset = 32, .length = 4},
7998         },
7999         {
8000             .type = OperandType::INT32,
8001             .dimensions = {},
8002             .numberOfConsumers = 1,
8003             .scale = 0.0f,
8004             .zeroPoint = 0,
8005             .lifetime = OperandLifeTime::CONSTANT_COPY,
8006             .location = {.poolIndex = 0, .offset = 36, .length = 4},
8007         },
8008         {
8009             .type = OperandType::BOOL,
8010             .dimensions = {},
8011             .numberOfConsumers = 1,
8012             .scale = 0.0f,
8013             .zeroPoint = 0,
8014             .lifetime = OperandLifeTime::CONSTANT_COPY,
8015             .location = {.poolIndex = 0, .offset = 40, .length = 1},
8016         },
8017         {
8018             .type = OperandType::TENSOR_FLOAT16,
8019             .dimensions = {0, 0, 0, 0},
8020             .numberOfConsumers = 0,
8021             .scale = 0.0f,
8022             .zeroPoint = 0,
8023             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8024             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8025         }
8026     };
8027 
8028     const std::vector<Operation> operations = {
8029         {
8030             .type = OperationType::ROI_ALIGN,
8031             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
8032             .outputs = {10},
8033         }
8034     };
8035 
8036     const std::vector<uint32_t> inputIndexes = {0, 1};
8037     const std::vector<uint32_t> outputIndexes = {10};
8038     std::vector<uint8_t> operandValues = {
8039       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 60, 0, 0, 0, 0, 4, 0, 0, 0, 0
8040     };
8041     const std::vector<hidl_memory> pools = {};
8042 
8043     return {
8044         .operands = operands,
8045         .operations = operations,
8046         .inputIndexes = inputIndexes,
8047         .outputIndexes = outputIndexes,
8048         .operandValues = operandValues,
8049         .pools = pools,
8050     };
8051 }
8052 
is_ignored_dynamic_output_shape_nhwc_float16_4(int i)8053 inline bool is_ignored_dynamic_output_shape_nhwc_float16_4(int i) {
8054   static std::set<int> ignore = {};
8055   return ignore.find(i) != ignore.end();
8056 }
8057 
8058 // Create the model
createTestModel_dynamic_output_shape_nchw_4()8059 Model createTestModel_dynamic_output_shape_nchw_4() {
8060     const std::vector<Operand> operands = {
8061         {
8062             .type = OperandType::TENSOR_FLOAT32,
8063             .dimensions = {4, 1, 4, 4},
8064             .numberOfConsumers = 1,
8065             .scale = 0.0f,
8066             .zeroPoint = 0,
8067             .lifetime = OperandLifeTime::MODEL_INPUT,
8068             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8069         },
8070         {
8071             .type = OperandType::TENSOR_FLOAT32,
8072             .dimensions = {5, 4},
8073             .numberOfConsumers = 1,
8074             .scale = 0.0f,
8075             .zeroPoint = 0,
8076             .lifetime = OperandLifeTime::MODEL_INPUT,
8077             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8078         },
8079         {
8080             .type = OperandType::TENSOR_INT32,
8081             .dimensions = {5},
8082             .numberOfConsumers = 1,
8083             .scale = 0.0f,
8084             .zeroPoint = 0,
8085             .lifetime = OperandLifeTime::CONSTANT_COPY,
8086             .location = {.poolIndex = 0, .offset = 0, .length = 20},
8087         },
8088         {
8089             .type = OperandType::INT32,
8090             .dimensions = {},
8091             .numberOfConsumers = 1,
8092             .scale = 0.0f,
8093             .zeroPoint = 0,
8094             .lifetime = OperandLifeTime::CONSTANT_COPY,
8095             .location = {.poolIndex = 0, .offset = 20, .length = 4},
8096         },
8097         {
8098             .type = OperandType::INT32,
8099             .dimensions = {},
8100             .numberOfConsumers = 1,
8101             .scale = 0.0f,
8102             .zeroPoint = 0,
8103             .lifetime = OperandLifeTime::CONSTANT_COPY,
8104             .location = {.poolIndex = 0, .offset = 24, .length = 4},
8105         },
8106         {
8107             .type = OperandType::FLOAT32,
8108             .dimensions = {},
8109             .numberOfConsumers = 1,
8110             .scale = 0.0f,
8111             .zeroPoint = 0,
8112             .lifetime = OperandLifeTime::CONSTANT_COPY,
8113             .location = {.poolIndex = 0, .offset = 28, .length = 4},
8114         },
8115         {
8116             .type = OperandType::FLOAT32,
8117             .dimensions = {},
8118             .numberOfConsumers = 1,
8119             .scale = 0.0f,
8120             .zeroPoint = 0,
8121             .lifetime = OperandLifeTime::CONSTANT_COPY,
8122             .location = {.poolIndex = 0, .offset = 32, .length = 4},
8123         },
8124         {
8125             .type = OperandType::INT32,
8126             .dimensions = {},
8127             .numberOfConsumers = 1,
8128             .scale = 0.0f,
8129             .zeroPoint = 0,
8130             .lifetime = OperandLifeTime::CONSTANT_COPY,
8131             .location = {.poolIndex = 0, .offset = 36, .length = 4},
8132         },
8133         {
8134             .type = OperandType::INT32,
8135             .dimensions = {},
8136             .numberOfConsumers = 1,
8137             .scale = 0.0f,
8138             .zeroPoint = 0,
8139             .lifetime = OperandLifeTime::CONSTANT_COPY,
8140             .location = {.poolIndex = 0, .offset = 40, .length = 4},
8141         },
8142         {
8143             .type = OperandType::BOOL,
8144             .dimensions = {},
8145             .numberOfConsumers = 1,
8146             .scale = 0.0f,
8147             .zeroPoint = 0,
8148             .lifetime = OperandLifeTime::CONSTANT_COPY,
8149             .location = {.poolIndex = 0, .offset = 44, .length = 1},
8150         },
8151         {
8152             .type = OperandType::TENSOR_FLOAT32,
8153             .dimensions = {0, 0, 0, 0},
8154             .numberOfConsumers = 0,
8155             .scale = 0.0f,
8156             .zeroPoint = 0,
8157             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8158             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8159         }
8160     };
8161 
8162     const std::vector<Operation> operations = {
8163         {
8164             .type = OperationType::ROI_ALIGN,
8165             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
8166             .outputs = {10},
8167         }
8168     };
8169 
8170     const std::vector<uint32_t> inputIndexes = {0, 1};
8171     const std::vector<uint32_t> outputIndexes = {10};
8172     std::vector<uint8_t> operandValues = {
8173       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
8174     };
8175     const std::vector<hidl_memory> pools = {};
8176 
8177     return {
8178         .operands = operands,
8179         .operations = operations,
8180         .inputIndexes = inputIndexes,
8181         .outputIndexes = outputIndexes,
8182         .operandValues = operandValues,
8183         .pools = pools,
8184     };
8185 }
8186 
is_ignored_dynamic_output_shape_nchw_4(int i)8187 inline bool is_ignored_dynamic_output_shape_nchw_4(int i) {
8188   static std::set<int> ignore = {};
8189   return ignore.find(i) != ignore.end();
8190 }
8191 
8192 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed_4()8193 Model createTestModel_dynamic_output_shape_nchw_relaxed_4() {
8194     const std::vector<Operand> operands = {
8195         {
8196             .type = OperandType::TENSOR_FLOAT32,
8197             .dimensions = {4, 1, 4, 4},
8198             .numberOfConsumers = 1,
8199             .scale = 0.0f,
8200             .zeroPoint = 0,
8201             .lifetime = OperandLifeTime::MODEL_INPUT,
8202             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8203         },
8204         {
8205             .type = OperandType::TENSOR_FLOAT32,
8206             .dimensions = {5, 4},
8207             .numberOfConsumers = 1,
8208             .scale = 0.0f,
8209             .zeroPoint = 0,
8210             .lifetime = OperandLifeTime::MODEL_INPUT,
8211             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8212         },
8213         {
8214             .type = OperandType::TENSOR_INT32,
8215             .dimensions = {5},
8216             .numberOfConsumers = 1,
8217             .scale = 0.0f,
8218             .zeroPoint = 0,
8219             .lifetime = OperandLifeTime::CONSTANT_COPY,
8220             .location = {.poolIndex = 0, .offset = 0, .length = 20},
8221         },
8222         {
8223             .type = OperandType::INT32,
8224             .dimensions = {},
8225             .numberOfConsumers = 1,
8226             .scale = 0.0f,
8227             .zeroPoint = 0,
8228             .lifetime = OperandLifeTime::CONSTANT_COPY,
8229             .location = {.poolIndex = 0, .offset = 20, .length = 4},
8230         },
8231         {
8232             .type = OperandType::INT32,
8233             .dimensions = {},
8234             .numberOfConsumers = 1,
8235             .scale = 0.0f,
8236             .zeroPoint = 0,
8237             .lifetime = OperandLifeTime::CONSTANT_COPY,
8238             .location = {.poolIndex = 0, .offset = 24, .length = 4},
8239         },
8240         {
8241             .type = OperandType::FLOAT32,
8242             .dimensions = {},
8243             .numberOfConsumers = 1,
8244             .scale = 0.0f,
8245             .zeroPoint = 0,
8246             .lifetime = OperandLifeTime::CONSTANT_COPY,
8247             .location = {.poolIndex = 0, .offset = 28, .length = 4},
8248         },
8249         {
8250             .type = OperandType::FLOAT32,
8251             .dimensions = {},
8252             .numberOfConsumers = 1,
8253             .scale = 0.0f,
8254             .zeroPoint = 0,
8255             .lifetime = OperandLifeTime::CONSTANT_COPY,
8256             .location = {.poolIndex = 0, .offset = 32, .length = 4},
8257         },
8258         {
8259             .type = OperandType::INT32,
8260             .dimensions = {},
8261             .numberOfConsumers = 1,
8262             .scale = 0.0f,
8263             .zeroPoint = 0,
8264             .lifetime = OperandLifeTime::CONSTANT_COPY,
8265             .location = {.poolIndex = 0, .offset = 36, .length = 4},
8266         },
8267         {
8268             .type = OperandType::INT32,
8269             .dimensions = {},
8270             .numberOfConsumers = 1,
8271             .scale = 0.0f,
8272             .zeroPoint = 0,
8273             .lifetime = OperandLifeTime::CONSTANT_COPY,
8274             .location = {.poolIndex = 0, .offset = 40, .length = 4},
8275         },
8276         {
8277             .type = OperandType::BOOL,
8278             .dimensions = {},
8279             .numberOfConsumers = 1,
8280             .scale = 0.0f,
8281             .zeroPoint = 0,
8282             .lifetime = OperandLifeTime::CONSTANT_COPY,
8283             .location = {.poolIndex = 0, .offset = 44, .length = 1},
8284         },
8285         {
8286             .type = OperandType::TENSOR_FLOAT32,
8287             .dimensions = {0, 0, 0, 0},
8288             .numberOfConsumers = 0,
8289             .scale = 0.0f,
8290             .zeroPoint = 0,
8291             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8292             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8293         }
8294     };
8295 
8296     const std::vector<Operation> operations = {
8297         {
8298             .type = OperationType::ROI_ALIGN,
8299             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
8300             .outputs = {10},
8301         }
8302     };
8303 
8304     const std::vector<uint32_t> inputIndexes = {0, 1};
8305     const std::vector<uint32_t> outputIndexes = {10};
8306     std::vector<uint8_t> operandValues = {
8307       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
8308     };
8309     const std::vector<hidl_memory> pools = {};
8310 
8311     return {
8312         .operands = operands,
8313         .operations = operations,
8314         .inputIndexes = inputIndexes,
8315         .outputIndexes = outputIndexes,
8316         .operandValues = operandValues,
8317         .pools = pools,
8318         .relaxComputationFloat32toFloat16 = true,
8319     };
8320 }
8321 
is_ignored_dynamic_output_shape_nchw_relaxed_4(int i)8322 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_4(int i) {
8323   static std::set<int> ignore = {};
8324   return ignore.find(i) != ignore.end();
8325 }
8326 
8327 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8_4()8328 Model createTestModel_dynamic_output_shape_nchw_quant8_4() {
8329     const std::vector<Operand> operands = {
8330         {
8331             .type = OperandType::TENSOR_QUANT8_ASYMM,
8332             .dimensions = {4, 1, 4, 4},
8333             .numberOfConsumers = 1,
8334             .scale = 0.25f,
8335             .zeroPoint = 128,
8336             .lifetime = OperandLifeTime::MODEL_INPUT,
8337             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8338         },
8339         {
8340             .type = OperandType::TENSOR_QUANT16_ASYMM,
8341             .dimensions = {5, 4},
8342             .numberOfConsumers = 1,
8343             .scale = 0.125f,
8344             .zeroPoint = 0,
8345             .lifetime = OperandLifeTime::MODEL_INPUT,
8346             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8347         },
8348         {
8349             .type = OperandType::TENSOR_INT32,
8350             .dimensions = {5},
8351             .numberOfConsumers = 1,
8352             .scale = 0.0f,
8353             .zeroPoint = 0,
8354             .lifetime = OperandLifeTime::CONSTANT_COPY,
8355             .location = {.poolIndex = 0, .offset = 0, .length = 20},
8356         },
8357         {
8358             .type = OperandType::INT32,
8359             .dimensions = {},
8360             .numberOfConsumers = 1,
8361             .scale = 0.0f,
8362             .zeroPoint = 0,
8363             .lifetime = OperandLifeTime::CONSTANT_COPY,
8364             .location = {.poolIndex = 0, .offset = 20, .length = 4},
8365         },
8366         {
8367             .type = OperandType::INT32,
8368             .dimensions = {},
8369             .numberOfConsumers = 1,
8370             .scale = 0.0f,
8371             .zeroPoint = 0,
8372             .lifetime = OperandLifeTime::CONSTANT_COPY,
8373             .location = {.poolIndex = 0, .offset = 24, .length = 4},
8374         },
8375         {
8376             .type = OperandType::FLOAT32,
8377             .dimensions = {},
8378             .numberOfConsumers = 1,
8379             .scale = 0.0f,
8380             .zeroPoint = 0,
8381             .lifetime = OperandLifeTime::CONSTANT_COPY,
8382             .location = {.poolIndex = 0, .offset = 28, .length = 4},
8383         },
8384         {
8385             .type = OperandType::FLOAT32,
8386             .dimensions = {},
8387             .numberOfConsumers = 1,
8388             .scale = 0.0f,
8389             .zeroPoint = 0,
8390             .lifetime = OperandLifeTime::CONSTANT_COPY,
8391             .location = {.poolIndex = 0, .offset = 32, .length = 4},
8392         },
8393         {
8394             .type = OperandType::INT32,
8395             .dimensions = {},
8396             .numberOfConsumers = 1,
8397             .scale = 0.0f,
8398             .zeroPoint = 0,
8399             .lifetime = OperandLifeTime::CONSTANT_COPY,
8400             .location = {.poolIndex = 0, .offset = 36, .length = 4},
8401         },
8402         {
8403             .type = OperandType::INT32,
8404             .dimensions = {},
8405             .numberOfConsumers = 1,
8406             .scale = 0.0f,
8407             .zeroPoint = 0,
8408             .lifetime = OperandLifeTime::CONSTANT_COPY,
8409             .location = {.poolIndex = 0, .offset = 40, .length = 4},
8410         },
8411         {
8412             .type = OperandType::BOOL,
8413             .dimensions = {},
8414             .numberOfConsumers = 1,
8415             .scale = 0.0f,
8416             .zeroPoint = 0,
8417             .lifetime = OperandLifeTime::CONSTANT_COPY,
8418             .location = {.poolIndex = 0, .offset = 44, .length = 1},
8419         },
8420         {
8421             .type = OperandType::TENSOR_QUANT8_ASYMM,
8422             .dimensions = {0, 0, 0, 0},
8423             .numberOfConsumers = 0,
8424             .scale = 0.0625f,
8425             .zeroPoint = 128,
8426             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8427             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8428         }
8429     };
8430 
8431     const std::vector<Operation> operations = {
8432         {
8433             .type = OperationType::ROI_ALIGN,
8434             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
8435             .outputs = {10},
8436         }
8437     };
8438 
8439     const std::vector<uint32_t> inputIndexes = {0, 1};
8440     const std::vector<uint32_t> outputIndexes = {10};
8441     std::vector<uint8_t> operandValues = {
8442       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 0, 4, 0, 0, 0, 1
8443     };
8444     const std::vector<hidl_memory> pools = {};
8445 
8446     return {
8447         .operands = operands,
8448         .operations = operations,
8449         .inputIndexes = inputIndexes,
8450         .outputIndexes = outputIndexes,
8451         .operandValues = operandValues,
8452         .pools = pools,
8453     };
8454 }
8455 
is_ignored_dynamic_output_shape_nchw_quant8_4(int i)8456 inline bool is_ignored_dynamic_output_shape_nchw_quant8_4(int i) {
8457   static std::set<int> ignore = {};
8458   return ignore.find(i) != ignore.end();
8459 }
8460 
8461 // Create the model
createTestModel_dynamic_output_shape_nchw_float16_4()8462 Model createTestModel_dynamic_output_shape_nchw_float16_4() {
8463     const std::vector<Operand> operands = {
8464         {
8465             .type = OperandType::TENSOR_FLOAT16,
8466             .dimensions = {4, 1, 4, 4},
8467             .numberOfConsumers = 1,
8468             .scale = 0.0f,
8469             .zeroPoint = 0,
8470             .lifetime = OperandLifeTime::MODEL_INPUT,
8471             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8472         },
8473         {
8474             .type = OperandType::TENSOR_FLOAT16,
8475             .dimensions = {5, 4},
8476             .numberOfConsumers = 1,
8477             .scale = 0.0f,
8478             .zeroPoint = 0,
8479             .lifetime = OperandLifeTime::MODEL_INPUT,
8480             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8481         },
8482         {
8483             .type = OperandType::TENSOR_INT32,
8484             .dimensions = {5},
8485             .numberOfConsumers = 1,
8486             .scale = 0.0f,
8487             .zeroPoint = 0,
8488             .lifetime = OperandLifeTime::CONSTANT_COPY,
8489             .location = {.poolIndex = 0, .offset = 0, .length = 20},
8490         },
8491         {
8492             .type = OperandType::INT32,
8493             .dimensions = {},
8494             .numberOfConsumers = 1,
8495             .scale = 0.0f,
8496             .zeroPoint = 0,
8497             .lifetime = OperandLifeTime::CONSTANT_COPY,
8498             .location = {.poolIndex = 0, .offset = 20, .length = 4},
8499         },
8500         {
8501             .type = OperandType::INT32,
8502             .dimensions = {},
8503             .numberOfConsumers = 1,
8504             .scale = 0.0f,
8505             .zeroPoint = 0,
8506             .lifetime = OperandLifeTime::CONSTANT_COPY,
8507             .location = {.poolIndex = 0, .offset = 24, .length = 4},
8508         },
8509         {
8510             .type = OperandType::FLOAT16,
8511             .dimensions = {},
8512             .numberOfConsumers = 1,
8513             .scale = 0.0f,
8514             .zeroPoint = 0,
8515             .lifetime = OperandLifeTime::CONSTANT_COPY,
8516             .location = {.poolIndex = 0, .offset = 28, .length = 2},
8517         },
8518         {
8519             .type = OperandType::FLOAT16,
8520             .dimensions = {},
8521             .numberOfConsumers = 1,
8522             .scale = 0.0f,
8523             .zeroPoint = 0,
8524             .lifetime = OperandLifeTime::CONSTANT_COPY,
8525             .location = {.poolIndex = 0, .offset = 30, .length = 2},
8526         },
8527         {
8528             .type = OperandType::INT32,
8529             .dimensions = {},
8530             .numberOfConsumers = 1,
8531             .scale = 0.0f,
8532             .zeroPoint = 0,
8533             .lifetime = OperandLifeTime::CONSTANT_COPY,
8534             .location = {.poolIndex = 0, .offset = 32, .length = 4},
8535         },
8536         {
8537             .type = OperandType::INT32,
8538             .dimensions = {},
8539             .numberOfConsumers = 1,
8540             .scale = 0.0f,
8541             .zeroPoint = 0,
8542             .lifetime = OperandLifeTime::CONSTANT_COPY,
8543             .location = {.poolIndex = 0, .offset = 36, .length = 4},
8544         },
8545         {
8546             .type = OperandType::BOOL,
8547             .dimensions = {},
8548             .numberOfConsumers = 1,
8549             .scale = 0.0f,
8550             .zeroPoint = 0,
8551             .lifetime = OperandLifeTime::CONSTANT_COPY,
8552             .location = {.poolIndex = 0, .offset = 40, .length = 1},
8553         },
8554         {
8555             .type = OperandType::TENSOR_FLOAT16,
8556             .dimensions = {0, 0, 0, 0},
8557             .numberOfConsumers = 0,
8558             .scale = 0.0f,
8559             .zeroPoint = 0,
8560             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8561             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8562         }
8563     };
8564 
8565     const std::vector<Operation> operations = {
8566         {
8567             .type = OperationType::ROI_ALIGN,
8568             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
8569             .outputs = {10},
8570         }
8571     };
8572 
8573     const std::vector<uint32_t> inputIndexes = {0, 1};
8574     const std::vector<uint32_t> outputIndexes = {10};
8575     std::vector<uint8_t> operandValues = {
8576       2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 60, 0, 0, 0, 0, 4, 0, 0, 0, 1
8577     };
8578     const std::vector<hidl_memory> pools = {};
8579 
8580     return {
8581         .operands = operands,
8582         .operations = operations,
8583         .inputIndexes = inputIndexes,
8584         .outputIndexes = outputIndexes,
8585         .operandValues = operandValues,
8586         .pools = pools,
8587     };
8588 }
8589 
is_ignored_dynamic_output_shape_nchw_float16_4(int i)8590 inline bool is_ignored_dynamic_output_shape_nchw_float16_4(int i) {
8591   static std::set<int> ignore = {};
8592   return ignore.find(i) != ignore.end();
8593 }
8594 
8595 // Create the model
createTestModel_zero_sized_nhwc()8596 Model createTestModel_zero_sized_nhwc() {
8597     const std::vector<Operand> operands = {
8598         {
8599             .type = OperandType::TENSOR_FLOAT32,
8600             .dimensions = {1, 2},
8601             .numberOfConsumers = 1,
8602             .scale = 0.0f,
8603             .zeroPoint = 0,
8604             .lifetime = OperandLifeTime::CONSTANT_COPY,
8605             .location = {.poolIndex = 0, .offset = 0, .length = 8},
8606         },
8607         {
8608             .type = OperandType::TENSOR_FLOAT32,
8609             .dimensions = {1, 8},
8610             .numberOfConsumers = 1,
8611             .scale = 0.0f,
8612             .zeroPoint = 0,
8613             .lifetime = OperandLifeTime::CONSTANT_COPY,
8614             .location = {.poolIndex = 0, .offset = 8, .length = 32},
8615         },
8616         {
8617             .type = OperandType::TENSOR_INT32,
8618             .dimensions = {1},
8619             .numberOfConsumers = 1,
8620             .scale = 0.0f,
8621             .zeroPoint = 0,
8622             .lifetime = OperandLifeTime::CONSTANT_COPY,
8623             .location = {.poolIndex = 0, .offset = 40, .length = 4},
8624         },
8625         {
8626             .type = OperandType::FLOAT32,
8627             .dimensions = {},
8628             .numberOfConsumers = 1,
8629             .scale = 0.0f,
8630             .zeroPoint = 0,
8631             .lifetime = OperandLifeTime::CONSTANT_COPY,
8632             .location = {.poolIndex = 0, .offset = 44, .length = 4},
8633         },
8634         {
8635             .type = OperandType::INT32,
8636             .dimensions = {},
8637             .numberOfConsumers = 1,
8638             .scale = 0.0f,
8639             .zeroPoint = 0,
8640             .lifetime = OperandLifeTime::CONSTANT_COPY,
8641             .location = {.poolIndex = 0, .offset = 48, .length = 4},
8642         },
8643         {
8644             .type = OperandType::INT32,
8645             .dimensions = {},
8646             .numberOfConsumers = 1,
8647             .scale = 0.0f,
8648             .zeroPoint = 0,
8649             .lifetime = OperandLifeTime::CONSTANT_COPY,
8650             .location = {.poolIndex = 0, .offset = 52, .length = 4},
8651         },
8652         {
8653             .type = OperandType::FLOAT32,
8654             .dimensions = {},
8655             .numberOfConsumers = 1,
8656             .scale = 0.0f,
8657             .zeroPoint = 0,
8658             .lifetime = OperandLifeTime::CONSTANT_COPY,
8659             .location = {.poolIndex = 0, .offset = 56, .length = 4},
8660         },
8661         {
8662             .type = OperandType::FLOAT32,
8663             .dimensions = {},
8664             .numberOfConsumers = 1,
8665             .scale = 0.0f,
8666             .zeroPoint = 0,
8667             .lifetime = OperandLifeTime::CONSTANT_COPY,
8668             .location = {.poolIndex = 0, .offset = 60, .length = 4},
8669         },
8670         {
8671             .type = OperandType::FLOAT32,
8672             .dimensions = {},
8673             .numberOfConsumers = 1,
8674             .scale = 0.0f,
8675             .zeroPoint = 0,
8676             .lifetime = OperandLifeTime::CONSTANT_COPY,
8677             .location = {.poolIndex = 0, .offset = 64, .length = 4},
8678         },
8679         {
8680             .type = OperandType::TENSOR_FLOAT32,
8681             .dimensions = {0},
8682             .numberOfConsumers = 0,
8683             .scale = 0.0f,
8684             .zeroPoint = 0,
8685             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8686             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8687         },
8688         {
8689             .type = OperandType::TENSOR_FLOAT32,
8690             .dimensions = {0, 4},
8691             .numberOfConsumers = 1,
8692             .scale = 0.0f,
8693             .zeroPoint = 0,
8694             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
8695             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8696         },
8697         {
8698             .type = OperandType::TENSOR_INT32,
8699             .dimensions = {0},
8700             .numberOfConsumers = 0,
8701             .scale = 0.0f,
8702             .zeroPoint = 0,
8703             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8704             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8705         },
8706         {
8707             .type = OperandType::TENSOR_INT32,
8708             .dimensions = {0},
8709             .numberOfConsumers = 1,
8710             .scale = 0.0f,
8711             .zeroPoint = 0,
8712             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
8713             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8714         },
8715         {
8716             .type = OperandType::TENSOR_FLOAT32,
8717             .dimensions = {1, 1, 1, 1},
8718             .numberOfConsumers = 1,
8719             .scale = 0.0f,
8720             .zeroPoint = 0,
8721             .lifetime = OperandLifeTime::MODEL_INPUT,
8722             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8723         },
8724         {
8725             .type = OperandType::INT32,
8726             .dimensions = {},
8727             .numberOfConsumers = 1,
8728             .scale = 0.0f,
8729             .zeroPoint = 0,
8730             .lifetime = OperandLifeTime::CONSTANT_COPY,
8731             .location = {.poolIndex = 0, .offset = 68, .length = 4},
8732         },
8733         {
8734             .type = OperandType::INT32,
8735             .dimensions = {},
8736             .numberOfConsumers = 1,
8737             .scale = 0.0f,
8738             .zeroPoint = 0,
8739             .lifetime = OperandLifeTime::CONSTANT_COPY,
8740             .location = {.poolIndex = 0, .offset = 72, .length = 4},
8741         },
8742         {
8743             .type = OperandType::FLOAT32,
8744             .dimensions = {},
8745             .numberOfConsumers = 1,
8746             .scale = 0.0f,
8747             .zeroPoint = 0,
8748             .lifetime = OperandLifeTime::CONSTANT_COPY,
8749             .location = {.poolIndex = 0, .offset = 76, .length = 4},
8750         },
8751         {
8752             .type = OperandType::FLOAT32,
8753             .dimensions = {},
8754             .numberOfConsumers = 1,
8755             .scale = 0.0f,
8756             .zeroPoint = 0,
8757             .lifetime = OperandLifeTime::CONSTANT_COPY,
8758             .location = {.poolIndex = 0, .offset = 80, .length = 4},
8759         },
8760         {
8761             .type = OperandType::INT32,
8762             .dimensions = {},
8763             .numberOfConsumers = 1,
8764             .scale = 0.0f,
8765             .zeroPoint = 0,
8766             .lifetime = OperandLifeTime::CONSTANT_COPY,
8767             .location = {.poolIndex = 0, .offset = 84, .length = 4},
8768         },
8769         {
8770             .type = OperandType::INT32,
8771             .dimensions = {},
8772             .numberOfConsumers = 1,
8773             .scale = 0.0f,
8774             .zeroPoint = 0,
8775             .lifetime = OperandLifeTime::CONSTANT_COPY,
8776             .location = {.poolIndex = 0, .offset = 88, .length = 4},
8777         },
8778         {
8779             .type = OperandType::BOOL,
8780             .dimensions = {},
8781             .numberOfConsumers = 1,
8782             .scale = 0.0f,
8783             .zeroPoint = 0,
8784             .lifetime = OperandLifeTime::CONSTANT_COPY,
8785             .location = {.poolIndex = 0, .offset = 92, .length = 1},
8786         },
8787         {
8788             .type = OperandType::TENSOR_FLOAT32,
8789             .dimensions = {0, 2, 2, 1},
8790             .numberOfConsumers = 0,
8791             .scale = 0.0f,
8792             .zeroPoint = 0,
8793             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8794             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8795         }
8796     };
8797 
8798     const std::vector<Operation> operations = {
8799         {
8800             .type = OperationType::BOX_WITH_NMS_LIMIT,
8801             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
8802             .outputs = {9, 10, 11, 12},
8803         },
8804         {
8805             .type = OperationType::ROI_ALIGN,
8806             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
8807             .outputs = {21},
8808         }
8809     };
8810 
8811     const std::vector<uint32_t> inputIndexes = {13};
8812     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
8813     std::vector<uint8_t> operandValues = {
8814       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
8815     };
8816     const std::vector<hidl_memory> pools = {};
8817 
8818     return {
8819         .operands = operands,
8820         .operations = operations,
8821         .inputIndexes = inputIndexes,
8822         .outputIndexes = outputIndexes,
8823         .operandValues = operandValues,
8824         .pools = pools,
8825     };
8826 }
8827 
is_ignored_zero_sized_nhwc(int i)8828 inline bool is_ignored_zero_sized_nhwc(int i) {
8829   static std::set<int> ignore = {};
8830   return ignore.find(i) != ignore.end();
8831 }
8832 
8833 // Create the model
createTestModel_zero_sized_nhwc_relaxed()8834 Model createTestModel_zero_sized_nhwc_relaxed() {
8835     const std::vector<Operand> operands = {
8836         {
8837             .type = OperandType::TENSOR_FLOAT32,
8838             .dimensions = {1, 2},
8839             .numberOfConsumers = 1,
8840             .scale = 0.0f,
8841             .zeroPoint = 0,
8842             .lifetime = OperandLifeTime::CONSTANT_COPY,
8843             .location = {.poolIndex = 0, .offset = 0, .length = 8},
8844         },
8845         {
8846             .type = OperandType::TENSOR_FLOAT32,
8847             .dimensions = {1, 8},
8848             .numberOfConsumers = 1,
8849             .scale = 0.0f,
8850             .zeroPoint = 0,
8851             .lifetime = OperandLifeTime::CONSTANT_COPY,
8852             .location = {.poolIndex = 0, .offset = 8, .length = 32},
8853         },
8854         {
8855             .type = OperandType::TENSOR_INT32,
8856             .dimensions = {1},
8857             .numberOfConsumers = 1,
8858             .scale = 0.0f,
8859             .zeroPoint = 0,
8860             .lifetime = OperandLifeTime::CONSTANT_COPY,
8861             .location = {.poolIndex = 0, .offset = 40, .length = 4},
8862         },
8863         {
8864             .type = OperandType::FLOAT32,
8865             .dimensions = {},
8866             .numberOfConsumers = 1,
8867             .scale = 0.0f,
8868             .zeroPoint = 0,
8869             .lifetime = OperandLifeTime::CONSTANT_COPY,
8870             .location = {.poolIndex = 0, .offset = 44, .length = 4},
8871         },
8872         {
8873             .type = OperandType::INT32,
8874             .dimensions = {},
8875             .numberOfConsumers = 1,
8876             .scale = 0.0f,
8877             .zeroPoint = 0,
8878             .lifetime = OperandLifeTime::CONSTANT_COPY,
8879             .location = {.poolIndex = 0, .offset = 48, .length = 4},
8880         },
8881         {
8882             .type = OperandType::INT32,
8883             .dimensions = {},
8884             .numberOfConsumers = 1,
8885             .scale = 0.0f,
8886             .zeroPoint = 0,
8887             .lifetime = OperandLifeTime::CONSTANT_COPY,
8888             .location = {.poolIndex = 0, .offset = 52, .length = 4},
8889         },
8890         {
8891             .type = OperandType::FLOAT32,
8892             .dimensions = {},
8893             .numberOfConsumers = 1,
8894             .scale = 0.0f,
8895             .zeroPoint = 0,
8896             .lifetime = OperandLifeTime::CONSTANT_COPY,
8897             .location = {.poolIndex = 0, .offset = 56, .length = 4},
8898         },
8899         {
8900             .type = OperandType::FLOAT32,
8901             .dimensions = {},
8902             .numberOfConsumers = 1,
8903             .scale = 0.0f,
8904             .zeroPoint = 0,
8905             .lifetime = OperandLifeTime::CONSTANT_COPY,
8906             .location = {.poolIndex = 0, .offset = 60, .length = 4},
8907         },
8908         {
8909             .type = OperandType::FLOAT32,
8910             .dimensions = {},
8911             .numberOfConsumers = 1,
8912             .scale = 0.0f,
8913             .zeroPoint = 0,
8914             .lifetime = OperandLifeTime::CONSTANT_COPY,
8915             .location = {.poolIndex = 0, .offset = 64, .length = 4},
8916         },
8917         {
8918             .type = OperandType::TENSOR_FLOAT32,
8919             .dimensions = {0},
8920             .numberOfConsumers = 0,
8921             .scale = 0.0f,
8922             .zeroPoint = 0,
8923             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8924             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8925         },
8926         {
8927             .type = OperandType::TENSOR_FLOAT32,
8928             .dimensions = {0, 4},
8929             .numberOfConsumers = 1,
8930             .scale = 0.0f,
8931             .zeroPoint = 0,
8932             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
8933             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8934         },
8935         {
8936             .type = OperandType::TENSOR_INT32,
8937             .dimensions = {0},
8938             .numberOfConsumers = 0,
8939             .scale = 0.0f,
8940             .zeroPoint = 0,
8941             .lifetime = OperandLifeTime::MODEL_OUTPUT,
8942             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8943         },
8944         {
8945             .type = OperandType::TENSOR_INT32,
8946             .dimensions = {0},
8947             .numberOfConsumers = 1,
8948             .scale = 0.0f,
8949             .zeroPoint = 0,
8950             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
8951             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8952         },
8953         {
8954             .type = OperandType::TENSOR_FLOAT32,
8955             .dimensions = {1, 1, 1, 1},
8956             .numberOfConsumers = 1,
8957             .scale = 0.0f,
8958             .zeroPoint = 0,
8959             .lifetime = OperandLifeTime::MODEL_INPUT,
8960             .location = {.poolIndex = 0, .offset = 0, .length = 0},
8961         },
8962         {
8963             .type = OperandType::INT32,
8964             .dimensions = {},
8965             .numberOfConsumers = 1,
8966             .scale = 0.0f,
8967             .zeroPoint = 0,
8968             .lifetime = OperandLifeTime::CONSTANT_COPY,
8969             .location = {.poolIndex = 0, .offset = 68, .length = 4},
8970         },
8971         {
8972             .type = OperandType::INT32,
8973             .dimensions = {},
8974             .numberOfConsumers = 1,
8975             .scale = 0.0f,
8976             .zeroPoint = 0,
8977             .lifetime = OperandLifeTime::CONSTANT_COPY,
8978             .location = {.poolIndex = 0, .offset = 72, .length = 4},
8979         },
8980         {
8981             .type = OperandType::FLOAT32,
8982             .dimensions = {},
8983             .numberOfConsumers = 1,
8984             .scale = 0.0f,
8985             .zeroPoint = 0,
8986             .lifetime = OperandLifeTime::CONSTANT_COPY,
8987             .location = {.poolIndex = 0, .offset = 76, .length = 4},
8988         },
8989         {
8990             .type = OperandType::FLOAT32,
8991             .dimensions = {},
8992             .numberOfConsumers = 1,
8993             .scale = 0.0f,
8994             .zeroPoint = 0,
8995             .lifetime = OperandLifeTime::CONSTANT_COPY,
8996             .location = {.poolIndex = 0, .offset = 80, .length = 4},
8997         },
8998         {
8999             .type = OperandType::INT32,
9000             .dimensions = {},
9001             .numberOfConsumers = 1,
9002             .scale = 0.0f,
9003             .zeroPoint = 0,
9004             .lifetime = OperandLifeTime::CONSTANT_COPY,
9005             .location = {.poolIndex = 0, .offset = 84, .length = 4},
9006         },
9007         {
9008             .type = OperandType::INT32,
9009             .dimensions = {},
9010             .numberOfConsumers = 1,
9011             .scale = 0.0f,
9012             .zeroPoint = 0,
9013             .lifetime = OperandLifeTime::CONSTANT_COPY,
9014             .location = {.poolIndex = 0, .offset = 88, .length = 4},
9015         },
9016         {
9017             .type = OperandType::BOOL,
9018             .dimensions = {},
9019             .numberOfConsumers = 1,
9020             .scale = 0.0f,
9021             .zeroPoint = 0,
9022             .lifetime = OperandLifeTime::CONSTANT_COPY,
9023             .location = {.poolIndex = 0, .offset = 92, .length = 1},
9024         },
9025         {
9026             .type = OperandType::TENSOR_FLOAT32,
9027             .dimensions = {0, 2, 2, 1},
9028             .numberOfConsumers = 0,
9029             .scale = 0.0f,
9030             .zeroPoint = 0,
9031             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9032             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9033         }
9034     };
9035 
9036     const std::vector<Operation> operations = {
9037         {
9038             .type = OperationType::BOX_WITH_NMS_LIMIT,
9039             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
9040             .outputs = {9, 10, 11, 12},
9041         },
9042         {
9043             .type = OperationType::ROI_ALIGN,
9044             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
9045             .outputs = {21},
9046         }
9047     };
9048 
9049     const std::vector<uint32_t> inputIndexes = {13};
9050     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
9051     std::vector<uint8_t> operandValues = {
9052       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
9053     };
9054     const std::vector<hidl_memory> pools = {};
9055 
9056     return {
9057         .operands = operands,
9058         .operations = operations,
9059         .inputIndexes = inputIndexes,
9060         .outputIndexes = outputIndexes,
9061         .operandValues = operandValues,
9062         .pools = pools,
9063         .relaxComputationFloat32toFloat16 = true,
9064     };
9065 }
9066 
is_ignored_zero_sized_nhwc_relaxed(int i)9067 inline bool is_ignored_zero_sized_nhwc_relaxed(int i) {
9068   static std::set<int> ignore = {};
9069   return ignore.find(i) != ignore.end();
9070 }
9071 
9072 // Create the model
createTestModel_zero_sized_nhwc_quant8()9073 Model createTestModel_zero_sized_nhwc_quant8() {
9074     const std::vector<Operand> operands = {
9075         {
9076             .type = OperandType::TENSOR_QUANT8_ASYMM,
9077             .dimensions = {1, 2},
9078             .numberOfConsumers = 1,
9079             .scale = 0.1f,
9080             .zeroPoint = 128,
9081             .lifetime = OperandLifeTime::CONSTANT_COPY,
9082             .location = {.poolIndex = 0, .offset = 0, .length = 2},
9083         },
9084         {
9085             .type = OperandType::TENSOR_QUANT16_ASYMM,
9086             .dimensions = {1, 8},
9087             .numberOfConsumers = 1,
9088             .scale = 0.125f,
9089             .zeroPoint = 0,
9090             .lifetime = OperandLifeTime::CONSTANT_COPY,
9091             .location = {.poolIndex = 0, .offset = 2, .length = 16},
9092         },
9093         {
9094             .type = OperandType::TENSOR_INT32,
9095             .dimensions = {1},
9096             .numberOfConsumers = 1,
9097             .scale = 0.0f,
9098             .zeroPoint = 0,
9099             .lifetime = OperandLifeTime::CONSTANT_COPY,
9100             .location = {.poolIndex = 0, .offset = 18, .length = 4},
9101         },
9102         {
9103             .type = OperandType::FLOAT32,
9104             .dimensions = {},
9105             .numberOfConsumers = 1,
9106             .scale = 0.0f,
9107             .zeroPoint = 0,
9108             .lifetime = OperandLifeTime::CONSTANT_COPY,
9109             .location = {.poolIndex = 0, .offset = 22, .length = 4},
9110         },
9111         {
9112             .type = OperandType::INT32,
9113             .dimensions = {},
9114             .numberOfConsumers = 1,
9115             .scale = 0.0f,
9116             .zeroPoint = 0,
9117             .lifetime = OperandLifeTime::CONSTANT_COPY,
9118             .location = {.poolIndex = 0, .offset = 26, .length = 4},
9119         },
9120         {
9121             .type = OperandType::INT32,
9122             .dimensions = {},
9123             .numberOfConsumers = 1,
9124             .scale = 0.0f,
9125             .zeroPoint = 0,
9126             .lifetime = OperandLifeTime::CONSTANT_COPY,
9127             .location = {.poolIndex = 0, .offset = 30, .length = 4},
9128         },
9129         {
9130             .type = OperandType::FLOAT32,
9131             .dimensions = {},
9132             .numberOfConsumers = 1,
9133             .scale = 0.0f,
9134             .zeroPoint = 0,
9135             .lifetime = OperandLifeTime::CONSTANT_COPY,
9136             .location = {.poolIndex = 0, .offset = 34, .length = 4},
9137         },
9138         {
9139             .type = OperandType::FLOAT32,
9140             .dimensions = {},
9141             .numberOfConsumers = 1,
9142             .scale = 0.0f,
9143             .zeroPoint = 0,
9144             .lifetime = OperandLifeTime::CONSTANT_COPY,
9145             .location = {.poolIndex = 0, .offset = 38, .length = 4},
9146         },
9147         {
9148             .type = OperandType::FLOAT32,
9149             .dimensions = {},
9150             .numberOfConsumers = 1,
9151             .scale = 0.0f,
9152             .zeroPoint = 0,
9153             .lifetime = OperandLifeTime::CONSTANT_COPY,
9154             .location = {.poolIndex = 0, .offset = 42, .length = 4},
9155         },
9156         {
9157             .type = OperandType::TENSOR_QUANT8_ASYMM,
9158             .dimensions = {0},
9159             .numberOfConsumers = 0,
9160             .scale = 0.1f,
9161             .zeroPoint = 128,
9162             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9163             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9164         },
9165         {
9166             .type = OperandType::TENSOR_QUANT16_ASYMM,
9167             .dimensions = {0, 4},
9168             .numberOfConsumers = 1,
9169             .scale = 0.125f,
9170             .zeroPoint = 0,
9171             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9172             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9173         },
9174         {
9175             .type = OperandType::TENSOR_INT32,
9176             .dimensions = {0},
9177             .numberOfConsumers = 0,
9178             .scale = 0.0f,
9179             .zeroPoint = 0,
9180             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9181             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9182         },
9183         {
9184             .type = OperandType::TENSOR_INT32,
9185             .dimensions = {0},
9186             .numberOfConsumers = 1,
9187             .scale = 0.0f,
9188             .zeroPoint = 0,
9189             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9190             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9191         },
9192         {
9193             .type = OperandType::TENSOR_QUANT8_ASYMM,
9194             .dimensions = {1, 1, 1, 1},
9195             .numberOfConsumers = 1,
9196             .scale = 0.1f,
9197             .zeroPoint = 128,
9198             .lifetime = OperandLifeTime::MODEL_INPUT,
9199             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9200         },
9201         {
9202             .type = OperandType::INT32,
9203             .dimensions = {},
9204             .numberOfConsumers = 1,
9205             .scale = 0.0f,
9206             .zeroPoint = 0,
9207             .lifetime = OperandLifeTime::CONSTANT_COPY,
9208             .location = {.poolIndex = 0, .offset = 46, .length = 4},
9209         },
9210         {
9211             .type = OperandType::INT32,
9212             .dimensions = {},
9213             .numberOfConsumers = 1,
9214             .scale = 0.0f,
9215             .zeroPoint = 0,
9216             .lifetime = OperandLifeTime::CONSTANT_COPY,
9217             .location = {.poolIndex = 0, .offset = 50, .length = 4},
9218         },
9219         {
9220             .type = OperandType::FLOAT32,
9221             .dimensions = {},
9222             .numberOfConsumers = 1,
9223             .scale = 0.0f,
9224             .zeroPoint = 0,
9225             .lifetime = OperandLifeTime::CONSTANT_COPY,
9226             .location = {.poolIndex = 0, .offset = 54, .length = 4},
9227         },
9228         {
9229             .type = OperandType::FLOAT32,
9230             .dimensions = {},
9231             .numberOfConsumers = 1,
9232             .scale = 0.0f,
9233             .zeroPoint = 0,
9234             .lifetime = OperandLifeTime::CONSTANT_COPY,
9235             .location = {.poolIndex = 0, .offset = 58, .length = 4},
9236         },
9237         {
9238             .type = OperandType::INT32,
9239             .dimensions = {},
9240             .numberOfConsumers = 1,
9241             .scale = 0.0f,
9242             .zeroPoint = 0,
9243             .lifetime = OperandLifeTime::CONSTANT_COPY,
9244             .location = {.poolIndex = 0, .offset = 62, .length = 4},
9245         },
9246         {
9247             .type = OperandType::INT32,
9248             .dimensions = {},
9249             .numberOfConsumers = 1,
9250             .scale = 0.0f,
9251             .zeroPoint = 0,
9252             .lifetime = OperandLifeTime::CONSTANT_COPY,
9253             .location = {.poolIndex = 0, .offset = 66, .length = 4},
9254         },
9255         {
9256             .type = OperandType::BOOL,
9257             .dimensions = {},
9258             .numberOfConsumers = 1,
9259             .scale = 0.0f,
9260             .zeroPoint = 0,
9261             .lifetime = OperandLifeTime::CONSTANT_COPY,
9262             .location = {.poolIndex = 0, .offset = 70, .length = 1},
9263         },
9264         {
9265             .type = OperandType::TENSOR_QUANT8_ASYMM,
9266             .dimensions = {0, 2, 2, 1},
9267             .numberOfConsumers = 0,
9268             .scale = 0.1f,
9269             .zeroPoint = 128,
9270             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9271             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9272         }
9273     };
9274 
9275     const std::vector<Operation> operations = {
9276         {
9277             .type = OperationType::BOX_WITH_NMS_LIMIT,
9278             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
9279             .outputs = {9, 10, 11, 12},
9280         },
9281         {
9282             .type = OperationType::ROI_ALIGN,
9283             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
9284             .outputs = {21},
9285         }
9286     };
9287 
9288     const std::vector<uint32_t> inputIndexes = {13};
9289     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
9290     std::vector<uint8_t> operandValues = {
9291       137, 129, 8, 0, 8, 0, 80, 0, 80, 0, 0, 0, 0, 0, 80, 0, 80, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
9292     };
9293     const std::vector<hidl_memory> pools = {};
9294 
9295     return {
9296         .operands = operands,
9297         .operations = operations,
9298         .inputIndexes = inputIndexes,
9299         .outputIndexes = outputIndexes,
9300         .operandValues = operandValues,
9301         .pools = pools,
9302     };
9303 }
9304 
is_ignored_zero_sized_nhwc_quant8(int i)9305 inline bool is_ignored_zero_sized_nhwc_quant8(int i) {
9306   static std::set<int> ignore = {};
9307   return ignore.find(i) != ignore.end();
9308 }
9309 
9310 // Create the model
createTestModel_zero_sized_nhwc_float16()9311 Model createTestModel_zero_sized_nhwc_float16() {
9312     const std::vector<Operand> operands = {
9313         {
9314             .type = OperandType::TENSOR_FLOAT16,
9315             .dimensions = {1, 2},
9316             .numberOfConsumers = 1,
9317             .scale = 0.0f,
9318             .zeroPoint = 0,
9319             .lifetime = OperandLifeTime::CONSTANT_COPY,
9320             .location = {.poolIndex = 0, .offset = 0, .length = 4},
9321         },
9322         {
9323             .type = OperandType::TENSOR_FLOAT16,
9324             .dimensions = {1, 8},
9325             .numberOfConsumers = 1,
9326             .scale = 0.0f,
9327             .zeroPoint = 0,
9328             .lifetime = OperandLifeTime::CONSTANT_COPY,
9329             .location = {.poolIndex = 0, .offset = 4, .length = 16},
9330         },
9331         {
9332             .type = OperandType::TENSOR_INT32,
9333             .dimensions = {1},
9334             .numberOfConsumers = 1,
9335             .scale = 0.0f,
9336             .zeroPoint = 0,
9337             .lifetime = OperandLifeTime::CONSTANT_COPY,
9338             .location = {.poolIndex = 0, .offset = 20, .length = 4},
9339         },
9340         {
9341             .type = OperandType::FLOAT16,
9342             .dimensions = {},
9343             .numberOfConsumers = 1,
9344             .scale = 0.0f,
9345             .zeroPoint = 0,
9346             .lifetime = OperandLifeTime::CONSTANT_COPY,
9347             .location = {.poolIndex = 0, .offset = 24, .length = 2},
9348         },
9349         {
9350             .type = OperandType::INT32,
9351             .dimensions = {},
9352             .numberOfConsumers = 1,
9353             .scale = 0.0f,
9354             .zeroPoint = 0,
9355             .lifetime = OperandLifeTime::CONSTANT_COPY,
9356             .location = {.poolIndex = 0, .offset = 26, .length = 4},
9357         },
9358         {
9359             .type = OperandType::INT32,
9360             .dimensions = {},
9361             .numberOfConsumers = 1,
9362             .scale = 0.0f,
9363             .zeroPoint = 0,
9364             .lifetime = OperandLifeTime::CONSTANT_COPY,
9365             .location = {.poolIndex = 0, .offset = 30, .length = 4},
9366         },
9367         {
9368             .type = OperandType::FLOAT16,
9369             .dimensions = {},
9370             .numberOfConsumers = 1,
9371             .scale = 0.0f,
9372             .zeroPoint = 0,
9373             .lifetime = OperandLifeTime::CONSTANT_COPY,
9374             .location = {.poolIndex = 0, .offset = 34, .length = 2},
9375         },
9376         {
9377             .type = OperandType::FLOAT16,
9378             .dimensions = {},
9379             .numberOfConsumers = 1,
9380             .scale = 0.0f,
9381             .zeroPoint = 0,
9382             .lifetime = OperandLifeTime::CONSTANT_COPY,
9383             .location = {.poolIndex = 0, .offset = 36, .length = 2},
9384         },
9385         {
9386             .type = OperandType::FLOAT16,
9387             .dimensions = {},
9388             .numberOfConsumers = 1,
9389             .scale = 0.0f,
9390             .zeroPoint = 0,
9391             .lifetime = OperandLifeTime::CONSTANT_COPY,
9392             .location = {.poolIndex = 0, .offset = 38, .length = 2},
9393         },
9394         {
9395             .type = OperandType::TENSOR_FLOAT16,
9396             .dimensions = {0},
9397             .numberOfConsumers = 0,
9398             .scale = 0.0f,
9399             .zeroPoint = 0,
9400             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9401             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9402         },
9403         {
9404             .type = OperandType::TENSOR_FLOAT16,
9405             .dimensions = {0, 4},
9406             .numberOfConsumers = 1,
9407             .scale = 0.0f,
9408             .zeroPoint = 0,
9409             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9410             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9411         },
9412         {
9413             .type = OperandType::TENSOR_INT32,
9414             .dimensions = {0},
9415             .numberOfConsumers = 0,
9416             .scale = 0.0f,
9417             .zeroPoint = 0,
9418             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9419             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9420         },
9421         {
9422             .type = OperandType::TENSOR_INT32,
9423             .dimensions = {0},
9424             .numberOfConsumers = 1,
9425             .scale = 0.0f,
9426             .zeroPoint = 0,
9427             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9428             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9429         },
9430         {
9431             .type = OperandType::TENSOR_FLOAT16,
9432             .dimensions = {1, 1, 1, 1},
9433             .numberOfConsumers = 1,
9434             .scale = 0.0f,
9435             .zeroPoint = 0,
9436             .lifetime = OperandLifeTime::MODEL_INPUT,
9437             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9438         },
9439         {
9440             .type = OperandType::INT32,
9441             .dimensions = {},
9442             .numberOfConsumers = 1,
9443             .scale = 0.0f,
9444             .zeroPoint = 0,
9445             .lifetime = OperandLifeTime::CONSTANT_COPY,
9446             .location = {.poolIndex = 0, .offset = 40, .length = 4},
9447         },
9448         {
9449             .type = OperandType::INT32,
9450             .dimensions = {},
9451             .numberOfConsumers = 1,
9452             .scale = 0.0f,
9453             .zeroPoint = 0,
9454             .lifetime = OperandLifeTime::CONSTANT_COPY,
9455             .location = {.poolIndex = 0, .offset = 44, .length = 4},
9456         },
9457         {
9458             .type = OperandType::FLOAT16,
9459             .dimensions = {},
9460             .numberOfConsumers = 1,
9461             .scale = 0.0f,
9462             .zeroPoint = 0,
9463             .lifetime = OperandLifeTime::CONSTANT_COPY,
9464             .location = {.poolIndex = 0, .offset = 48, .length = 2},
9465         },
9466         {
9467             .type = OperandType::FLOAT16,
9468             .dimensions = {},
9469             .numberOfConsumers = 1,
9470             .scale = 0.0f,
9471             .zeroPoint = 0,
9472             .lifetime = OperandLifeTime::CONSTANT_COPY,
9473             .location = {.poolIndex = 0, .offset = 50, .length = 2},
9474         },
9475         {
9476             .type = OperandType::INT32,
9477             .dimensions = {},
9478             .numberOfConsumers = 1,
9479             .scale = 0.0f,
9480             .zeroPoint = 0,
9481             .lifetime = OperandLifeTime::CONSTANT_COPY,
9482             .location = {.poolIndex = 0, .offset = 52, .length = 4},
9483         },
9484         {
9485             .type = OperandType::INT32,
9486             .dimensions = {},
9487             .numberOfConsumers = 1,
9488             .scale = 0.0f,
9489             .zeroPoint = 0,
9490             .lifetime = OperandLifeTime::CONSTANT_COPY,
9491             .location = {.poolIndex = 0, .offset = 56, .length = 4},
9492         },
9493         {
9494             .type = OperandType::BOOL,
9495             .dimensions = {},
9496             .numberOfConsumers = 1,
9497             .scale = 0.0f,
9498             .zeroPoint = 0,
9499             .lifetime = OperandLifeTime::CONSTANT_COPY,
9500             .location = {.poolIndex = 0, .offset = 60, .length = 1},
9501         },
9502         {
9503             .type = OperandType::TENSOR_FLOAT16,
9504             .dimensions = {0, 2, 2, 1},
9505             .numberOfConsumers = 0,
9506             .scale = 0.0f,
9507             .zeroPoint = 0,
9508             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9509             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9510         }
9511     };
9512 
9513     const std::vector<Operation> operations = {
9514         {
9515             .type = OperationType::BOX_WITH_NMS_LIMIT,
9516             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
9517             .outputs = {9, 10, 11, 12},
9518         },
9519         {
9520             .type = OperationType::ROI_ALIGN,
9521             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
9522             .outputs = {21},
9523         }
9524     };
9525 
9526     const std::vector<uint32_t> inputIndexes = {13};
9527     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
9528     std::vector<uint8_t> operandValues = {
9529       51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
9530     };
9531     const std::vector<hidl_memory> pools = {};
9532 
9533     return {
9534         .operands = operands,
9535         .operations = operations,
9536         .inputIndexes = inputIndexes,
9537         .outputIndexes = outputIndexes,
9538         .operandValues = operandValues,
9539         .pools = pools,
9540     };
9541 }
9542 
is_ignored_zero_sized_nhwc_float16(int i)9543 inline bool is_ignored_zero_sized_nhwc_float16(int i) {
9544   static std::set<int> ignore = {};
9545   return ignore.find(i) != ignore.end();
9546 }
9547 
9548 // Create the model
createTestModel_zero_sized_nchw()9549 Model createTestModel_zero_sized_nchw() {
9550     const std::vector<Operand> operands = {
9551         {
9552             .type = OperandType::TENSOR_FLOAT32,
9553             .dimensions = {1, 2},
9554             .numberOfConsumers = 1,
9555             .scale = 0.0f,
9556             .zeroPoint = 0,
9557             .lifetime = OperandLifeTime::CONSTANT_COPY,
9558             .location = {.poolIndex = 0, .offset = 0, .length = 8},
9559         },
9560         {
9561             .type = OperandType::TENSOR_FLOAT32,
9562             .dimensions = {1, 8},
9563             .numberOfConsumers = 1,
9564             .scale = 0.0f,
9565             .zeroPoint = 0,
9566             .lifetime = OperandLifeTime::CONSTANT_COPY,
9567             .location = {.poolIndex = 0, .offset = 8, .length = 32},
9568         },
9569         {
9570             .type = OperandType::TENSOR_INT32,
9571             .dimensions = {1},
9572             .numberOfConsumers = 1,
9573             .scale = 0.0f,
9574             .zeroPoint = 0,
9575             .lifetime = OperandLifeTime::CONSTANT_COPY,
9576             .location = {.poolIndex = 0, .offset = 40, .length = 4},
9577         },
9578         {
9579             .type = OperandType::FLOAT32,
9580             .dimensions = {},
9581             .numberOfConsumers = 1,
9582             .scale = 0.0f,
9583             .zeroPoint = 0,
9584             .lifetime = OperandLifeTime::CONSTANT_COPY,
9585             .location = {.poolIndex = 0, .offset = 44, .length = 4},
9586         },
9587         {
9588             .type = OperandType::INT32,
9589             .dimensions = {},
9590             .numberOfConsumers = 1,
9591             .scale = 0.0f,
9592             .zeroPoint = 0,
9593             .lifetime = OperandLifeTime::CONSTANT_COPY,
9594             .location = {.poolIndex = 0, .offset = 48, .length = 4},
9595         },
9596         {
9597             .type = OperandType::INT32,
9598             .dimensions = {},
9599             .numberOfConsumers = 1,
9600             .scale = 0.0f,
9601             .zeroPoint = 0,
9602             .lifetime = OperandLifeTime::CONSTANT_COPY,
9603             .location = {.poolIndex = 0, .offset = 52, .length = 4},
9604         },
9605         {
9606             .type = OperandType::FLOAT32,
9607             .dimensions = {},
9608             .numberOfConsumers = 1,
9609             .scale = 0.0f,
9610             .zeroPoint = 0,
9611             .lifetime = OperandLifeTime::CONSTANT_COPY,
9612             .location = {.poolIndex = 0, .offset = 56, .length = 4},
9613         },
9614         {
9615             .type = OperandType::FLOAT32,
9616             .dimensions = {},
9617             .numberOfConsumers = 1,
9618             .scale = 0.0f,
9619             .zeroPoint = 0,
9620             .lifetime = OperandLifeTime::CONSTANT_COPY,
9621             .location = {.poolIndex = 0, .offset = 60, .length = 4},
9622         },
9623         {
9624             .type = OperandType::FLOAT32,
9625             .dimensions = {},
9626             .numberOfConsumers = 1,
9627             .scale = 0.0f,
9628             .zeroPoint = 0,
9629             .lifetime = OperandLifeTime::CONSTANT_COPY,
9630             .location = {.poolIndex = 0, .offset = 64, .length = 4},
9631         },
9632         {
9633             .type = OperandType::TENSOR_FLOAT32,
9634             .dimensions = {0},
9635             .numberOfConsumers = 0,
9636             .scale = 0.0f,
9637             .zeroPoint = 0,
9638             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9639             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9640         },
9641         {
9642             .type = OperandType::TENSOR_FLOAT32,
9643             .dimensions = {0, 4},
9644             .numberOfConsumers = 1,
9645             .scale = 0.0f,
9646             .zeroPoint = 0,
9647             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9648             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9649         },
9650         {
9651             .type = OperandType::TENSOR_INT32,
9652             .dimensions = {0},
9653             .numberOfConsumers = 0,
9654             .scale = 0.0f,
9655             .zeroPoint = 0,
9656             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9657             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9658         },
9659         {
9660             .type = OperandType::TENSOR_INT32,
9661             .dimensions = {0},
9662             .numberOfConsumers = 1,
9663             .scale = 0.0f,
9664             .zeroPoint = 0,
9665             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9666             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9667         },
9668         {
9669             .type = OperandType::TENSOR_FLOAT32,
9670             .dimensions = {1, 1, 1, 1},
9671             .numberOfConsumers = 1,
9672             .scale = 0.0f,
9673             .zeroPoint = 0,
9674             .lifetime = OperandLifeTime::MODEL_INPUT,
9675             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9676         },
9677         {
9678             .type = OperandType::INT32,
9679             .dimensions = {},
9680             .numberOfConsumers = 1,
9681             .scale = 0.0f,
9682             .zeroPoint = 0,
9683             .lifetime = OperandLifeTime::CONSTANT_COPY,
9684             .location = {.poolIndex = 0, .offset = 68, .length = 4},
9685         },
9686         {
9687             .type = OperandType::INT32,
9688             .dimensions = {},
9689             .numberOfConsumers = 1,
9690             .scale = 0.0f,
9691             .zeroPoint = 0,
9692             .lifetime = OperandLifeTime::CONSTANT_COPY,
9693             .location = {.poolIndex = 0, .offset = 72, .length = 4},
9694         },
9695         {
9696             .type = OperandType::FLOAT32,
9697             .dimensions = {},
9698             .numberOfConsumers = 1,
9699             .scale = 0.0f,
9700             .zeroPoint = 0,
9701             .lifetime = OperandLifeTime::CONSTANT_COPY,
9702             .location = {.poolIndex = 0, .offset = 76, .length = 4},
9703         },
9704         {
9705             .type = OperandType::FLOAT32,
9706             .dimensions = {},
9707             .numberOfConsumers = 1,
9708             .scale = 0.0f,
9709             .zeroPoint = 0,
9710             .lifetime = OperandLifeTime::CONSTANT_COPY,
9711             .location = {.poolIndex = 0, .offset = 80, .length = 4},
9712         },
9713         {
9714             .type = OperandType::INT32,
9715             .dimensions = {},
9716             .numberOfConsumers = 1,
9717             .scale = 0.0f,
9718             .zeroPoint = 0,
9719             .lifetime = OperandLifeTime::CONSTANT_COPY,
9720             .location = {.poolIndex = 0, .offset = 84, .length = 4},
9721         },
9722         {
9723             .type = OperandType::INT32,
9724             .dimensions = {},
9725             .numberOfConsumers = 1,
9726             .scale = 0.0f,
9727             .zeroPoint = 0,
9728             .lifetime = OperandLifeTime::CONSTANT_COPY,
9729             .location = {.poolIndex = 0, .offset = 88, .length = 4},
9730         },
9731         {
9732             .type = OperandType::BOOL,
9733             .dimensions = {},
9734             .numberOfConsumers = 1,
9735             .scale = 0.0f,
9736             .zeroPoint = 0,
9737             .lifetime = OperandLifeTime::CONSTANT_COPY,
9738             .location = {.poolIndex = 0, .offset = 92, .length = 1},
9739         },
9740         {
9741             .type = OperandType::TENSOR_FLOAT32,
9742             .dimensions = {0, 1, 2, 2},
9743             .numberOfConsumers = 0,
9744             .scale = 0.0f,
9745             .zeroPoint = 0,
9746             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9747             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9748         }
9749     };
9750 
9751     const std::vector<Operation> operations = {
9752         {
9753             .type = OperationType::BOX_WITH_NMS_LIMIT,
9754             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
9755             .outputs = {9, 10, 11, 12},
9756         },
9757         {
9758             .type = OperationType::ROI_ALIGN,
9759             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
9760             .outputs = {21},
9761         }
9762     };
9763 
9764     const std::vector<uint32_t> inputIndexes = {13};
9765     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
9766     std::vector<uint8_t> operandValues = {
9767       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
9768     };
9769     const std::vector<hidl_memory> pools = {};
9770 
9771     return {
9772         .operands = operands,
9773         .operations = operations,
9774         .inputIndexes = inputIndexes,
9775         .outputIndexes = outputIndexes,
9776         .operandValues = operandValues,
9777         .pools = pools,
9778     };
9779 }
9780 
is_ignored_zero_sized_nchw(int i)9781 inline bool is_ignored_zero_sized_nchw(int i) {
9782   static std::set<int> ignore = {};
9783   return ignore.find(i) != ignore.end();
9784 }
9785 
9786 // Create the model
createTestModel_zero_sized_nchw_relaxed()9787 Model createTestModel_zero_sized_nchw_relaxed() {
9788     const std::vector<Operand> operands = {
9789         {
9790             .type = OperandType::TENSOR_FLOAT32,
9791             .dimensions = {1, 2},
9792             .numberOfConsumers = 1,
9793             .scale = 0.0f,
9794             .zeroPoint = 0,
9795             .lifetime = OperandLifeTime::CONSTANT_COPY,
9796             .location = {.poolIndex = 0, .offset = 0, .length = 8},
9797         },
9798         {
9799             .type = OperandType::TENSOR_FLOAT32,
9800             .dimensions = {1, 8},
9801             .numberOfConsumers = 1,
9802             .scale = 0.0f,
9803             .zeroPoint = 0,
9804             .lifetime = OperandLifeTime::CONSTANT_COPY,
9805             .location = {.poolIndex = 0, .offset = 8, .length = 32},
9806         },
9807         {
9808             .type = OperandType::TENSOR_INT32,
9809             .dimensions = {1},
9810             .numberOfConsumers = 1,
9811             .scale = 0.0f,
9812             .zeroPoint = 0,
9813             .lifetime = OperandLifeTime::CONSTANT_COPY,
9814             .location = {.poolIndex = 0, .offset = 40, .length = 4},
9815         },
9816         {
9817             .type = OperandType::FLOAT32,
9818             .dimensions = {},
9819             .numberOfConsumers = 1,
9820             .scale = 0.0f,
9821             .zeroPoint = 0,
9822             .lifetime = OperandLifeTime::CONSTANT_COPY,
9823             .location = {.poolIndex = 0, .offset = 44, .length = 4},
9824         },
9825         {
9826             .type = OperandType::INT32,
9827             .dimensions = {},
9828             .numberOfConsumers = 1,
9829             .scale = 0.0f,
9830             .zeroPoint = 0,
9831             .lifetime = OperandLifeTime::CONSTANT_COPY,
9832             .location = {.poolIndex = 0, .offset = 48, .length = 4},
9833         },
9834         {
9835             .type = OperandType::INT32,
9836             .dimensions = {},
9837             .numberOfConsumers = 1,
9838             .scale = 0.0f,
9839             .zeroPoint = 0,
9840             .lifetime = OperandLifeTime::CONSTANT_COPY,
9841             .location = {.poolIndex = 0, .offset = 52, .length = 4},
9842         },
9843         {
9844             .type = OperandType::FLOAT32,
9845             .dimensions = {},
9846             .numberOfConsumers = 1,
9847             .scale = 0.0f,
9848             .zeroPoint = 0,
9849             .lifetime = OperandLifeTime::CONSTANT_COPY,
9850             .location = {.poolIndex = 0, .offset = 56, .length = 4},
9851         },
9852         {
9853             .type = OperandType::FLOAT32,
9854             .dimensions = {},
9855             .numberOfConsumers = 1,
9856             .scale = 0.0f,
9857             .zeroPoint = 0,
9858             .lifetime = OperandLifeTime::CONSTANT_COPY,
9859             .location = {.poolIndex = 0, .offset = 60, .length = 4},
9860         },
9861         {
9862             .type = OperandType::FLOAT32,
9863             .dimensions = {},
9864             .numberOfConsumers = 1,
9865             .scale = 0.0f,
9866             .zeroPoint = 0,
9867             .lifetime = OperandLifeTime::CONSTANT_COPY,
9868             .location = {.poolIndex = 0, .offset = 64, .length = 4},
9869         },
9870         {
9871             .type = OperandType::TENSOR_FLOAT32,
9872             .dimensions = {0},
9873             .numberOfConsumers = 0,
9874             .scale = 0.0f,
9875             .zeroPoint = 0,
9876             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9877             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9878         },
9879         {
9880             .type = OperandType::TENSOR_FLOAT32,
9881             .dimensions = {0, 4},
9882             .numberOfConsumers = 1,
9883             .scale = 0.0f,
9884             .zeroPoint = 0,
9885             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9886             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9887         },
9888         {
9889             .type = OperandType::TENSOR_INT32,
9890             .dimensions = {0},
9891             .numberOfConsumers = 0,
9892             .scale = 0.0f,
9893             .zeroPoint = 0,
9894             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9895             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9896         },
9897         {
9898             .type = OperandType::TENSOR_INT32,
9899             .dimensions = {0},
9900             .numberOfConsumers = 1,
9901             .scale = 0.0f,
9902             .zeroPoint = 0,
9903             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
9904             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9905         },
9906         {
9907             .type = OperandType::TENSOR_FLOAT32,
9908             .dimensions = {1, 1, 1, 1},
9909             .numberOfConsumers = 1,
9910             .scale = 0.0f,
9911             .zeroPoint = 0,
9912             .lifetime = OperandLifeTime::MODEL_INPUT,
9913             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9914         },
9915         {
9916             .type = OperandType::INT32,
9917             .dimensions = {},
9918             .numberOfConsumers = 1,
9919             .scale = 0.0f,
9920             .zeroPoint = 0,
9921             .lifetime = OperandLifeTime::CONSTANT_COPY,
9922             .location = {.poolIndex = 0, .offset = 68, .length = 4},
9923         },
9924         {
9925             .type = OperandType::INT32,
9926             .dimensions = {},
9927             .numberOfConsumers = 1,
9928             .scale = 0.0f,
9929             .zeroPoint = 0,
9930             .lifetime = OperandLifeTime::CONSTANT_COPY,
9931             .location = {.poolIndex = 0, .offset = 72, .length = 4},
9932         },
9933         {
9934             .type = OperandType::FLOAT32,
9935             .dimensions = {},
9936             .numberOfConsumers = 1,
9937             .scale = 0.0f,
9938             .zeroPoint = 0,
9939             .lifetime = OperandLifeTime::CONSTANT_COPY,
9940             .location = {.poolIndex = 0, .offset = 76, .length = 4},
9941         },
9942         {
9943             .type = OperandType::FLOAT32,
9944             .dimensions = {},
9945             .numberOfConsumers = 1,
9946             .scale = 0.0f,
9947             .zeroPoint = 0,
9948             .lifetime = OperandLifeTime::CONSTANT_COPY,
9949             .location = {.poolIndex = 0, .offset = 80, .length = 4},
9950         },
9951         {
9952             .type = OperandType::INT32,
9953             .dimensions = {},
9954             .numberOfConsumers = 1,
9955             .scale = 0.0f,
9956             .zeroPoint = 0,
9957             .lifetime = OperandLifeTime::CONSTANT_COPY,
9958             .location = {.poolIndex = 0, .offset = 84, .length = 4},
9959         },
9960         {
9961             .type = OperandType::INT32,
9962             .dimensions = {},
9963             .numberOfConsumers = 1,
9964             .scale = 0.0f,
9965             .zeroPoint = 0,
9966             .lifetime = OperandLifeTime::CONSTANT_COPY,
9967             .location = {.poolIndex = 0, .offset = 88, .length = 4},
9968         },
9969         {
9970             .type = OperandType::BOOL,
9971             .dimensions = {},
9972             .numberOfConsumers = 1,
9973             .scale = 0.0f,
9974             .zeroPoint = 0,
9975             .lifetime = OperandLifeTime::CONSTANT_COPY,
9976             .location = {.poolIndex = 0, .offset = 92, .length = 1},
9977         },
9978         {
9979             .type = OperandType::TENSOR_FLOAT32,
9980             .dimensions = {0, 1, 2, 2},
9981             .numberOfConsumers = 0,
9982             .scale = 0.0f,
9983             .zeroPoint = 0,
9984             .lifetime = OperandLifeTime::MODEL_OUTPUT,
9985             .location = {.poolIndex = 0, .offset = 0, .length = 0},
9986         }
9987     };
9988 
9989     const std::vector<Operation> operations = {
9990         {
9991             .type = OperationType::BOX_WITH_NMS_LIMIT,
9992             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
9993             .outputs = {9, 10, 11, 12},
9994         },
9995         {
9996             .type = OperationType::ROI_ALIGN,
9997             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
9998             .outputs = {21},
9999         }
10000     };
10001 
10002     const std::vector<uint32_t> inputIndexes = {13};
10003     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
10004     std::vector<uint8_t> operandValues = {
10005       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
10006     };
10007     const std::vector<hidl_memory> pools = {};
10008 
10009     return {
10010         .operands = operands,
10011         .operations = operations,
10012         .inputIndexes = inputIndexes,
10013         .outputIndexes = outputIndexes,
10014         .operandValues = operandValues,
10015         .pools = pools,
10016         .relaxComputationFloat32toFloat16 = true,
10017     };
10018 }
10019 
is_ignored_zero_sized_nchw_relaxed(int i)10020 inline bool is_ignored_zero_sized_nchw_relaxed(int i) {
10021   static std::set<int> ignore = {};
10022   return ignore.find(i) != ignore.end();
10023 }
10024 
10025 // Create the model
createTestModel_zero_sized_nchw_quant8()10026 Model createTestModel_zero_sized_nchw_quant8() {
10027     const std::vector<Operand> operands = {
10028         {
10029             .type = OperandType::TENSOR_QUANT8_ASYMM,
10030             .dimensions = {1, 2},
10031             .numberOfConsumers = 1,
10032             .scale = 0.1f,
10033             .zeroPoint = 128,
10034             .lifetime = OperandLifeTime::CONSTANT_COPY,
10035             .location = {.poolIndex = 0, .offset = 0, .length = 2},
10036         },
10037         {
10038             .type = OperandType::TENSOR_QUANT16_ASYMM,
10039             .dimensions = {1, 8},
10040             .numberOfConsumers = 1,
10041             .scale = 0.125f,
10042             .zeroPoint = 0,
10043             .lifetime = OperandLifeTime::CONSTANT_COPY,
10044             .location = {.poolIndex = 0, .offset = 2, .length = 16},
10045         },
10046         {
10047             .type = OperandType::TENSOR_INT32,
10048             .dimensions = {1},
10049             .numberOfConsumers = 1,
10050             .scale = 0.0f,
10051             .zeroPoint = 0,
10052             .lifetime = OperandLifeTime::CONSTANT_COPY,
10053             .location = {.poolIndex = 0, .offset = 18, .length = 4},
10054         },
10055         {
10056             .type = OperandType::FLOAT32,
10057             .dimensions = {},
10058             .numberOfConsumers = 1,
10059             .scale = 0.0f,
10060             .zeroPoint = 0,
10061             .lifetime = OperandLifeTime::CONSTANT_COPY,
10062             .location = {.poolIndex = 0, .offset = 22, .length = 4},
10063         },
10064         {
10065             .type = OperandType::INT32,
10066             .dimensions = {},
10067             .numberOfConsumers = 1,
10068             .scale = 0.0f,
10069             .zeroPoint = 0,
10070             .lifetime = OperandLifeTime::CONSTANT_COPY,
10071             .location = {.poolIndex = 0, .offset = 26, .length = 4},
10072         },
10073         {
10074             .type = OperandType::INT32,
10075             .dimensions = {},
10076             .numberOfConsumers = 1,
10077             .scale = 0.0f,
10078             .zeroPoint = 0,
10079             .lifetime = OperandLifeTime::CONSTANT_COPY,
10080             .location = {.poolIndex = 0, .offset = 30, .length = 4},
10081         },
10082         {
10083             .type = OperandType::FLOAT32,
10084             .dimensions = {},
10085             .numberOfConsumers = 1,
10086             .scale = 0.0f,
10087             .zeroPoint = 0,
10088             .lifetime = OperandLifeTime::CONSTANT_COPY,
10089             .location = {.poolIndex = 0, .offset = 34, .length = 4},
10090         },
10091         {
10092             .type = OperandType::FLOAT32,
10093             .dimensions = {},
10094             .numberOfConsumers = 1,
10095             .scale = 0.0f,
10096             .zeroPoint = 0,
10097             .lifetime = OperandLifeTime::CONSTANT_COPY,
10098             .location = {.poolIndex = 0, .offset = 38, .length = 4},
10099         },
10100         {
10101             .type = OperandType::FLOAT32,
10102             .dimensions = {},
10103             .numberOfConsumers = 1,
10104             .scale = 0.0f,
10105             .zeroPoint = 0,
10106             .lifetime = OperandLifeTime::CONSTANT_COPY,
10107             .location = {.poolIndex = 0, .offset = 42, .length = 4},
10108         },
10109         {
10110             .type = OperandType::TENSOR_QUANT8_ASYMM,
10111             .dimensions = {0},
10112             .numberOfConsumers = 0,
10113             .scale = 0.1f,
10114             .zeroPoint = 128,
10115             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10116             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10117         },
10118         {
10119             .type = OperandType::TENSOR_QUANT16_ASYMM,
10120             .dimensions = {0, 4},
10121             .numberOfConsumers = 1,
10122             .scale = 0.125f,
10123             .zeroPoint = 0,
10124             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10125             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10126         },
10127         {
10128             .type = OperandType::TENSOR_INT32,
10129             .dimensions = {0},
10130             .numberOfConsumers = 0,
10131             .scale = 0.0f,
10132             .zeroPoint = 0,
10133             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10134             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10135         },
10136         {
10137             .type = OperandType::TENSOR_INT32,
10138             .dimensions = {0},
10139             .numberOfConsumers = 1,
10140             .scale = 0.0f,
10141             .zeroPoint = 0,
10142             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10143             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10144         },
10145         {
10146             .type = OperandType::TENSOR_QUANT8_ASYMM,
10147             .dimensions = {1, 1, 1, 1},
10148             .numberOfConsumers = 1,
10149             .scale = 0.1f,
10150             .zeroPoint = 128,
10151             .lifetime = OperandLifeTime::MODEL_INPUT,
10152             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10153         },
10154         {
10155             .type = OperandType::INT32,
10156             .dimensions = {},
10157             .numberOfConsumers = 1,
10158             .scale = 0.0f,
10159             .zeroPoint = 0,
10160             .lifetime = OperandLifeTime::CONSTANT_COPY,
10161             .location = {.poolIndex = 0, .offset = 46, .length = 4},
10162         },
10163         {
10164             .type = OperandType::INT32,
10165             .dimensions = {},
10166             .numberOfConsumers = 1,
10167             .scale = 0.0f,
10168             .zeroPoint = 0,
10169             .lifetime = OperandLifeTime::CONSTANT_COPY,
10170             .location = {.poolIndex = 0, .offset = 50, .length = 4},
10171         },
10172         {
10173             .type = OperandType::FLOAT32,
10174             .dimensions = {},
10175             .numberOfConsumers = 1,
10176             .scale = 0.0f,
10177             .zeroPoint = 0,
10178             .lifetime = OperandLifeTime::CONSTANT_COPY,
10179             .location = {.poolIndex = 0, .offset = 54, .length = 4},
10180         },
10181         {
10182             .type = OperandType::FLOAT32,
10183             .dimensions = {},
10184             .numberOfConsumers = 1,
10185             .scale = 0.0f,
10186             .zeroPoint = 0,
10187             .lifetime = OperandLifeTime::CONSTANT_COPY,
10188             .location = {.poolIndex = 0, .offset = 58, .length = 4},
10189         },
10190         {
10191             .type = OperandType::INT32,
10192             .dimensions = {},
10193             .numberOfConsumers = 1,
10194             .scale = 0.0f,
10195             .zeroPoint = 0,
10196             .lifetime = OperandLifeTime::CONSTANT_COPY,
10197             .location = {.poolIndex = 0, .offset = 62, .length = 4},
10198         },
10199         {
10200             .type = OperandType::INT32,
10201             .dimensions = {},
10202             .numberOfConsumers = 1,
10203             .scale = 0.0f,
10204             .zeroPoint = 0,
10205             .lifetime = OperandLifeTime::CONSTANT_COPY,
10206             .location = {.poolIndex = 0, .offset = 66, .length = 4},
10207         },
10208         {
10209             .type = OperandType::BOOL,
10210             .dimensions = {},
10211             .numberOfConsumers = 1,
10212             .scale = 0.0f,
10213             .zeroPoint = 0,
10214             .lifetime = OperandLifeTime::CONSTANT_COPY,
10215             .location = {.poolIndex = 0, .offset = 70, .length = 1},
10216         },
10217         {
10218             .type = OperandType::TENSOR_QUANT8_ASYMM,
10219             .dimensions = {0, 1, 2, 2},
10220             .numberOfConsumers = 0,
10221             .scale = 0.1f,
10222             .zeroPoint = 128,
10223             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10224             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10225         }
10226     };
10227 
10228     const std::vector<Operation> operations = {
10229         {
10230             .type = OperationType::BOX_WITH_NMS_LIMIT,
10231             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
10232             .outputs = {9, 10, 11, 12},
10233         },
10234         {
10235             .type = OperationType::ROI_ALIGN,
10236             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
10237             .outputs = {21},
10238         }
10239     };
10240 
10241     const std::vector<uint32_t> inputIndexes = {13};
10242     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
10243     std::vector<uint8_t> operandValues = {
10244       137, 129, 8, 0, 8, 0, 80, 0, 80, 0, 0, 0, 0, 0, 80, 0, 80, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
10245     };
10246     const std::vector<hidl_memory> pools = {};
10247 
10248     return {
10249         .operands = operands,
10250         .operations = operations,
10251         .inputIndexes = inputIndexes,
10252         .outputIndexes = outputIndexes,
10253         .operandValues = operandValues,
10254         .pools = pools,
10255     };
10256 }
10257 
is_ignored_zero_sized_nchw_quant8(int i)10258 inline bool is_ignored_zero_sized_nchw_quant8(int i) {
10259   static std::set<int> ignore = {};
10260   return ignore.find(i) != ignore.end();
10261 }
10262 
10263 // Create the model
createTestModel_zero_sized_nchw_float16()10264 Model createTestModel_zero_sized_nchw_float16() {
10265     const std::vector<Operand> operands = {
10266         {
10267             .type = OperandType::TENSOR_FLOAT16,
10268             .dimensions = {1, 2},
10269             .numberOfConsumers = 1,
10270             .scale = 0.0f,
10271             .zeroPoint = 0,
10272             .lifetime = OperandLifeTime::CONSTANT_COPY,
10273             .location = {.poolIndex = 0, .offset = 0, .length = 4},
10274         },
10275         {
10276             .type = OperandType::TENSOR_FLOAT16,
10277             .dimensions = {1, 8},
10278             .numberOfConsumers = 1,
10279             .scale = 0.0f,
10280             .zeroPoint = 0,
10281             .lifetime = OperandLifeTime::CONSTANT_COPY,
10282             .location = {.poolIndex = 0, .offset = 4, .length = 16},
10283         },
10284         {
10285             .type = OperandType::TENSOR_INT32,
10286             .dimensions = {1},
10287             .numberOfConsumers = 1,
10288             .scale = 0.0f,
10289             .zeroPoint = 0,
10290             .lifetime = OperandLifeTime::CONSTANT_COPY,
10291             .location = {.poolIndex = 0, .offset = 20, .length = 4},
10292         },
10293         {
10294             .type = OperandType::FLOAT16,
10295             .dimensions = {},
10296             .numberOfConsumers = 1,
10297             .scale = 0.0f,
10298             .zeroPoint = 0,
10299             .lifetime = OperandLifeTime::CONSTANT_COPY,
10300             .location = {.poolIndex = 0, .offset = 24, .length = 2},
10301         },
10302         {
10303             .type = OperandType::INT32,
10304             .dimensions = {},
10305             .numberOfConsumers = 1,
10306             .scale = 0.0f,
10307             .zeroPoint = 0,
10308             .lifetime = OperandLifeTime::CONSTANT_COPY,
10309             .location = {.poolIndex = 0, .offset = 26, .length = 4},
10310         },
10311         {
10312             .type = OperandType::INT32,
10313             .dimensions = {},
10314             .numberOfConsumers = 1,
10315             .scale = 0.0f,
10316             .zeroPoint = 0,
10317             .lifetime = OperandLifeTime::CONSTANT_COPY,
10318             .location = {.poolIndex = 0, .offset = 30, .length = 4},
10319         },
10320         {
10321             .type = OperandType::FLOAT16,
10322             .dimensions = {},
10323             .numberOfConsumers = 1,
10324             .scale = 0.0f,
10325             .zeroPoint = 0,
10326             .lifetime = OperandLifeTime::CONSTANT_COPY,
10327             .location = {.poolIndex = 0, .offset = 34, .length = 2},
10328         },
10329         {
10330             .type = OperandType::FLOAT16,
10331             .dimensions = {},
10332             .numberOfConsumers = 1,
10333             .scale = 0.0f,
10334             .zeroPoint = 0,
10335             .lifetime = OperandLifeTime::CONSTANT_COPY,
10336             .location = {.poolIndex = 0, .offset = 36, .length = 2},
10337         },
10338         {
10339             .type = OperandType::FLOAT16,
10340             .dimensions = {},
10341             .numberOfConsumers = 1,
10342             .scale = 0.0f,
10343             .zeroPoint = 0,
10344             .lifetime = OperandLifeTime::CONSTANT_COPY,
10345             .location = {.poolIndex = 0, .offset = 38, .length = 2},
10346         },
10347         {
10348             .type = OperandType::TENSOR_FLOAT16,
10349             .dimensions = {0},
10350             .numberOfConsumers = 0,
10351             .scale = 0.0f,
10352             .zeroPoint = 0,
10353             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10354             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10355         },
10356         {
10357             .type = OperandType::TENSOR_FLOAT16,
10358             .dimensions = {0, 4},
10359             .numberOfConsumers = 1,
10360             .scale = 0.0f,
10361             .zeroPoint = 0,
10362             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10363             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10364         },
10365         {
10366             .type = OperandType::TENSOR_INT32,
10367             .dimensions = {0},
10368             .numberOfConsumers = 0,
10369             .scale = 0.0f,
10370             .zeroPoint = 0,
10371             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10372             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10373         },
10374         {
10375             .type = OperandType::TENSOR_INT32,
10376             .dimensions = {0},
10377             .numberOfConsumers = 1,
10378             .scale = 0.0f,
10379             .zeroPoint = 0,
10380             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10381             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10382         },
10383         {
10384             .type = OperandType::TENSOR_FLOAT16,
10385             .dimensions = {1, 1, 1, 1},
10386             .numberOfConsumers = 1,
10387             .scale = 0.0f,
10388             .zeroPoint = 0,
10389             .lifetime = OperandLifeTime::MODEL_INPUT,
10390             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10391         },
10392         {
10393             .type = OperandType::INT32,
10394             .dimensions = {},
10395             .numberOfConsumers = 1,
10396             .scale = 0.0f,
10397             .zeroPoint = 0,
10398             .lifetime = OperandLifeTime::CONSTANT_COPY,
10399             .location = {.poolIndex = 0, .offset = 40, .length = 4},
10400         },
10401         {
10402             .type = OperandType::INT32,
10403             .dimensions = {},
10404             .numberOfConsumers = 1,
10405             .scale = 0.0f,
10406             .zeroPoint = 0,
10407             .lifetime = OperandLifeTime::CONSTANT_COPY,
10408             .location = {.poolIndex = 0, .offset = 44, .length = 4},
10409         },
10410         {
10411             .type = OperandType::FLOAT16,
10412             .dimensions = {},
10413             .numberOfConsumers = 1,
10414             .scale = 0.0f,
10415             .zeroPoint = 0,
10416             .lifetime = OperandLifeTime::CONSTANT_COPY,
10417             .location = {.poolIndex = 0, .offset = 48, .length = 2},
10418         },
10419         {
10420             .type = OperandType::FLOAT16,
10421             .dimensions = {},
10422             .numberOfConsumers = 1,
10423             .scale = 0.0f,
10424             .zeroPoint = 0,
10425             .lifetime = OperandLifeTime::CONSTANT_COPY,
10426             .location = {.poolIndex = 0, .offset = 50, .length = 2},
10427         },
10428         {
10429             .type = OperandType::INT32,
10430             .dimensions = {},
10431             .numberOfConsumers = 1,
10432             .scale = 0.0f,
10433             .zeroPoint = 0,
10434             .lifetime = OperandLifeTime::CONSTANT_COPY,
10435             .location = {.poolIndex = 0, .offset = 52, .length = 4},
10436         },
10437         {
10438             .type = OperandType::INT32,
10439             .dimensions = {},
10440             .numberOfConsumers = 1,
10441             .scale = 0.0f,
10442             .zeroPoint = 0,
10443             .lifetime = OperandLifeTime::CONSTANT_COPY,
10444             .location = {.poolIndex = 0, .offset = 56, .length = 4},
10445         },
10446         {
10447             .type = OperandType::BOOL,
10448             .dimensions = {},
10449             .numberOfConsumers = 1,
10450             .scale = 0.0f,
10451             .zeroPoint = 0,
10452             .lifetime = OperandLifeTime::CONSTANT_COPY,
10453             .location = {.poolIndex = 0, .offset = 60, .length = 1},
10454         },
10455         {
10456             .type = OperandType::TENSOR_FLOAT16,
10457             .dimensions = {0, 1, 2, 2},
10458             .numberOfConsumers = 0,
10459             .scale = 0.0f,
10460             .zeroPoint = 0,
10461             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10462             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10463         }
10464     };
10465 
10466     const std::vector<Operation> operations = {
10467         {
10468             .type = OperationType::BOX_WITH_NMS_LIMIT,
10469             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
10470             .outputs = {9, 10, 11, 12},
10471         },
10472         {
10473             .type = OperationType::ROI_ALIGN,
10474             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
10475             .outputs = {21},
10476         }
10477     };
10478 
10479     const std::vector<uint32_t> inputIndexes = {13};
10480     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
10481     std::vector<uint8_t> operandValues = {
10482       51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
10483     };
10484     const std::vector<hidl_memory> pools = {};
10485 
10486     return {
10487         .operands = operands,
10488         .operations = operations,
10489         .inputIndexes = inputIndexes,
10490         .outputIndexes = outputIndexes,
10491         .operandValues = operandValues,
10492         .pools = pools,
10493     };
10494 }
10495 
is_ignored_zero_sized_nchw_float16(int i)10496 inline bool is_ignored_zero_sized_nchw_float16(int i) {
10497   static std::set<int> ignore = {};
10498   return ignore.find(i) != ignore.end();
10499 }
10500 
10501 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nhwc()10502 Model createTestModel_zero_sized_dynamic_output_shape_nhwc() {
10503     const std::vector<Operand> operands = {
10504         {
10505             .type = OperandType::TENSOR_FLOAT32,
10506             .dimensions = {1, 2},
10507             .numberOfConsumers = 1,
10508             .scale = 0.0f,
10509             .zeroPoint = 0,
10510             .lifetime = OperandLifeTime::CONSTANT_COPY,
10511             .location = {.poolIndex = 0, .offset = 0, .length = 8},
10512         },
10513         {
10514             .type = OperandType::TENSOR_FLOAT32,
10515             .dimensions = {1, 8},
10516             .numberOfConsumers = 1,
10517             .scale = 0.0f,
10518             .zeroPoint = 0,
10519             .lifetime = OperandLifeTime::CONSTANT_COPY,
10520             .location = {.poolIndex = 0, .offset = 8, .length = 32},
10521         },
10522         {
10523             .type = OperandType::TENSOR_INT32,
10524             .dimensions = {1},
10525             .numberOfConsumers = 1,
10526             .scale = 0.0f,
10527             .zeroPoint = 0,
10528             .lifetime = OperandLifeTime::CONSTANT_COPY,
10529             .location = {.poolIndex = 0, .offset = 40, .length = 4},
10530         },
10531         {
10532             .type = OperandType::FLOAT32,
10533             .dimensions = {},
10534             .numberOfConsumers = 1,
10535             .scale = 0.0f,
10536             .zeroPoint = 0,
10537             .lifetime = OperandLifeTime::CONSTANT_COPY,
10538             .location = {.poolIndex = 0, .offset = 44, .length = 4},
10539         },
10540         {
10541             .type = OperandType::INT32,
10542             .dimensions = {},
10543             .numberOfConsumers = 1,
10544             .scale = 0.0f,
10545             .zeroPoint = 0,
10546             .lifetime = OperandLifeTime::CONSTANT_COPY,
10547             .location = {.poolIndex = 0, .offset = 48, .length = 4},
10548         },
10549         {
10550             .type = OperandType::INT32,
10551             .dimensions = {},
10552             .numberOfConsumers = 1,
10553             .scale = 0.0f,
10554             .zeroPoint = 0,
10555             .lifetime = OperandLifeTime::CONSTANT_COPY,
10556             .location = {.poolIndex = 0, .offset = 52, .length = 4},
10557         },
10558         {
10559             .type = OperandType::FLOAT32,
10560             .dimensions = {},
10561             .numberOfConsumers = 1,
10562             .scale = 0.0f,
10563             .zeroPoint = 0,
10564             .lifetime = OperandLifeTime::CONSTANT_COPY,
10565             .location = {.poolIndex = 0, .offset = 56, .length = 4},
10566         },
10567         {
10568             .type = OperandType::FLOAT32,
10569             .dimensions = {},
10570             .numberOfConsumers = 1,
10571             .scale = 0.0f,
10572             .zeroPoint = 0,
10573             .lifetime = OperandLifeTime::CONSTANT_COPY,
10574             .location = {.poolIndex = 0, .offset = 60, .length = 4},
10575         },
10576         {
10577             .type = OperandType::FLOAT32,
10578             .dimensions = {},
10579             .numberOfConsumers = 1,
10580             .scale = 0.0f,
10581             .zeroPoint = 0,
10582             .lifetime = OperandLifeTime::CONSTANT_COPY,
10583             .location = {.poolIndex = 0, .offset = 64, .length = 4},
10584         },
10585         {
10586             .type = OperandType::TENSOR_FLOAT32,
10587             .dimensions = {0},
10588             .numberOfConsumers = 0,
10589             .scale = 0.0f,
10590             .zeroPoint = 0,
10591             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10592             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10593         },
10594         {
10595             .type = OperandType::TENSOR_FLOAT32,
10596             .dimensions = {0, 4},
10597             .numberOfConsumers = 1,
10598             .scale = 0.0f,
10599             .zeroPoint = 0,
10600             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10601             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10602         },
10603         {
10604             .type = OperandType::TENSOR_INT32,
10605             .dimensions = {0},
10606             .numberOfConsumers = 0,
10607             .scale = 0.0f,
10608             .zeroPoint = 0,
10609             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10610             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10611         },
10612         {
10613             .type = OperandType::TENSOR_INT32,
10614             .dimensions = {0},
10615             .numberOfConsumers = 1,
10616             .scale = 0.0f,
10617             .zeroPoint = 0,
10618             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10619             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10620         },
10621         {
10622             .type = OperandType::TENSOR_FLOAT32,
10623             .dimensions = {1, 1, 1, 1},
10624             .numberOfConsumers = 1,
10625             .scale = 0.0f,
10626             .zeroPoint = 0,
10627             .lifetime = OperandLifeTime::MODEL_INPUT,
10628             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10629         },
10630         {
10631             .type = OperandType::INT32,
10632             .dimensions = {},
10633             .numberOfConsumers = 1,
10634             .scale = 0.0f,
10635             .zeroPoint = 0,
10636             .lifetime = OperandLifeTime::CONSTANT_COPY,
10637             .location = {.poolIndex = 0, .offset = 68, .length = 4},
10638         },
10639         {
10640             .type = OperandType::INT32,
10641             .dimensions = {},
10642             .numberOfConsumers = 1,
10643             .scale = 0.0f,
10644             .zeroPoint = 0,
10645             .lifetime = OperandLifeTime::CONSTANT_COPY,
10646             .location = {.poolIndex = 0, .offset = 72, .length = 4},
10647         },
10648         {
10649             .type = OperandType::FLOAT32,
10650             .dimensions = {},
10651             .numberOfConsumers = 1,
10652             .scale = 0.0f,
10653             .zeroPoint = 0,
10654             .lifetime = OperandLifeTime::CONSTANT_COPY,
10655             .location = {.poolIndex = 0, .offset = 76, .length = 4},
10656         },
10657         {
10658             .type = OperandType::FLOAT32,
10659             .dimensions = {},
10660             .numberOfConsumers = 1,
10661             .scale = 0.0f,
10662             .zeroPoint = 0,
10663             .lifetime = OperandLifeTime::CONSTANT_COPY,
10664             .location = {.poolIndex = 0, .offset = 80, .length = 4},
10665         },
10666         {
10667             .type = OperandType::INT32,
10668             .dimensions = {},
10669             .numberOfConsumers = 1,
10670             .scale = 0.0f,
10671             .zeroPoint = 0,
10672             .lifetime = OperandLifeTime::CONSTANT_COPY,
10673             .location = {.poolIndex = 0, .offset = 84, .length = 4},
10674         },
10675         {
10676             .type = OperandType::INT32,
10677             .dimensions = {},
10678             .numberOfConsumers = 1,
10679             .scale = 0.0f,
10680             .zeroPoint = 0,
10681             .lifetime = OperandLifeTime::CONSTANT_COPY,
10682             .location = {.poolIndex = 0, .offset = 88, .length = 4},
10683         },
10684         {
10685             .type = OperandType::BOOL,
10686             .dimensions = {},
10687             .numberOfConsumers = 1,
10688             .scale = 0.0f,
10689             .zeroPoint = 0,
10690             .lifetime = OperandLifeTime::CONSTANT_COPY,
10691             .location = {.poolIndex = 0, .offset = 92, .length = 1},
10692         },
10693         {
10694             .type = OperandType::TENSOR_FLOAT32,
10695             .dimensions = {0, 0, 0, 0},
10696             .numberOfConsumers = 0,
10697             .scale = 0.0f,
10698             .zeroPoint = 0,
10699             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10700             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10701         }
10702     };
10703 
10704     const std::vector<Operation> operations = {
10705         {
10706             .type = OperationType::BOX_WITH_NMS_LIMIT,
10707             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
10708             .outputs = {9, 10, 11, 12},
10709         },
10710         {
10711             .type = OperationType::ROI_ALIGN,
10712             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
10713             .outputs = {21},
10714         }
10715     };
10716 
10717     const std::vector<uint32_t> inputIndexes = {13};
10718     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
10719     std::vector<uint8_t> operandValues = {
10720       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
10721     };
10722     const std::vector<hidl_memory> pools = {};
10723 
10724     return {
10725         .operands = operands,
10726         .operations = operations,
10727         .inputIndexes = inputIndexes,
10728         .outputIndexes = outputIndexes,
10729         .operandValues = operandValues,
10730         .pools = pools,
10731     };
10732 }
10733 
is_ignored_zero_sized_dynamic_output_shape_nhwc(int i)10734 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc(int i) {
10735   static std::set<int> ignore = {};
10736   return ignore.find(i) != ignore.end();
10737 }
10738 
10739 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nhwc_relaxed()10740 Model createTestModel_zero_sized_dynamic_output_shape_nhwc_relaxed() {
10741     const std::vector<Operand> operands = {
10742         {
10743             .type = OperandType::TENSOR_FLOAT32,
10744             .dimensions = {1, 2},
10745             .numberOfConsumers = 1,
10746             .scale = 0.0f,
10747             .zeroPoint = 0,
10748             .lifetime = OperandLifeTime::CONSTANT_COPY,
10749             .location = {.poolIndex = 0, .offset = 0, .length = 8},
10750         },
10751         {
10752             .type = OperandType::TENSOR_FLOAT32,
10753             .dimensions = {1, 8},
10754             .numberOfConsumers = 1,
10755             .scale = 0.0f,
10756             .zeroPoint = 0,
10757             .lifetime = OperandLifeTime::CONSTANT_COPY,
10758             .location = {.poolIndex = 0, .offset = 8, .length = 32},
10759         },
10760         {
10761             .type = OperandType::TENSOR_INT32,
10762             .dimensions = {1},
10763             .numberOfConsumers = 1,
10764             .scale = 0.0f,
10765             .zeroPoint = 0,
10766             .lifetime = OperandLifeTime::CONSTANT_COPY,
10767             .location = {.poolIndex = 0, .offset = 40, .length = 4},
10768         },
10769         {
10770             .type = OperandType::FLOAT32,
10771             .dimensions = {},
10772             .numberOfConsumers = 1,
10773             .scale = 0.0f,
10774             .zeroPoint = 0,
10775             .lifetime = OperandLifeTime::CONSTANT_COPY,
10776             .location = {.poolIndex = 0, .offset = 44, .length = 4},
10777         },
10778         {
10779             .type = OperandType::INT32,
10780             .dimensions = {},
10781             .numberOfConsumers = 1,
10782             .scale = 0.0f,
10783             .zeroPoint = 0,
10784             .lifetime = OperandLifeTime::CONSTANT_COPY,
10785             .location = {.poolIndex = 0, .offset = 48, .length = 4},
10786         },
10787         {
10788             .type = OperandType::INT32,
10789             .dimensions = {},
10790             .numberOfConsumers = 1,
10791             .scale = 0.0f,
10792             .zeroPoint = 0,
10793             .lifetime = OperandLifeTime::CONSTANT_COPY,
10794             .location = {.poolIndex = 0, .offset = 52, .length = 4},
10795         },
10796         {
10797             .type = OperandType::FLOAT32,
10798             .dimensions = {},
10799             .numberOfConsumers = 1,
10800             .scale = 0.0f,
10801             .zeroPoint = 0,
10802             .lifetime = OperandLifeTime::CONSTANT_COPY,
10803             .location = {.poolIndex = 0, .offset = 56, .length = 4},
10804         },
10805         {
10806             .type = OperandType::FLOAT32,
10807             .dimensions = {},
10808             .numberOfConsumers = 1,
10809             .scale = 0.0f,
10810             .zeroPoint = 0,
10811             .lifetime = OperandLifeTime::CONSTANT_COPY,
10812             .location = {.poolIndex = 0, .offset = 60, .length = 4},
10813         },
10814         {
10815             .type = OperandType::FLOAT32,
10816             .dimensions = {},
10817             .numberOfConsumers = 1,
10818             .scale = 0.0f,
10819             .zeroPoint = 0,
10820             .lifetime = OperandLifeTime::CONSTANT_COPY,
10821             .location = {.poolIndex = 0, .offset = 64, .length = 4},
10822         },
10823         {
10824             .type = OperandType::TENSOR_FLOAT32,
10825             .dimensions = {0},
10826             .numberOfConsumers = 0,
10827             .scale = 0.0f,
10828             .zeroPoint = 0,
10829             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10830             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10831         },
10832         {
10833             .type = OperandType::TENSOR_FLOAT32,
10834             .dimensions = {0, 4},
10835             .numberOfConsumers = 1,
10836             .scale = 0.0f,
10837             .zeroPoint = 0,
10838             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10839             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10840         },
10841         {
10842             .type = OperandType::TENSOR_INT32,
10843             .dimensions = {0},
10844             .numberOfConsumers = 0,
10845             .scale = 0.0f,
10846             .zeroPoint = 0,
10847             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10848             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10849         },
10850         {
10851             .type = OperandType::TENSOR_INT32,
10852             .dimensions = {0},
10853             .numberOfConsumers = 1,
10854             .scale = 0.0f,
10855             .zeroPoint = 0,
10856             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
10857             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10858         },
10859         {
10860             .type = OperandType::TENSOR_FLOAT32,
10861             .dimensions = {1, 1, 1, 1},
10862             .numberOfConsumers = 1,
10863             .scale = 0.0f,
10864             .zeroPoint = 0,
10865             .lifetime = OperandLifeTime::MODEL_INPUT,
10866             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10867         },
10868         {
10869             .type = OperandType::INT32,
10870             .dimensions = {},
10871             .numberOfConsumers = 1,
10872             .scale = 0.0f,
10873             .zeroPoint = 0,
10874             .lifetime = OperandLifeTime::CONSTANT_COPY,
10875             .location = {.poolIndex = 0, .offset = 68, .length = 4},
10876         },
10877         {
10878             .type = OperandType::INT32,
10879             .dimensions = {},
10880             .numberOfConsumers = 1,
10881             .scale = 0.0f,
10882             .zeroPoint = 0,
10883             .lifetime = OperandLifeTime::CONSTANT_COPY,
10884             .location = {.poolIndex = 0, .offset = 72, .length = 4},
10885         },
10886         {
10887             .type = OperandType::FLOAT32,
10888             .dimensions = {},
10889             .numberOfConsumers = 1,
10890             .scale = 0.0f,
10891             .zeroPoint = 0,
10892             .lifetime = OperandLifeTime::CONSTANT_COPY,
10893             .location = {.poolIndex = 0, .offset = 76, .length = 4},
10894         },
10895         {
10896             .type = OperandType::FLOAT32,
10897             .dimensions = {},
10898             .numberOfConsumers = 1,
10899             .scale = 0.0f,
10900             .zeroPoint = 0,
10901             .lifetime = OperandLifeTime::CONSTANT_COPY,
10902             .location = {.poolIndex = 0, .offset = 80, .length = 4},
10903         },
10904         {
10905             .type = OperandType::INT32,
10906             .dimensions = {},
10907             .numberOfConsumers = 1,
10908             .scale = 0.0f,
10909             .zeroPoint = 0,
10910             .lifetime = OperandLifeTime::CONSTANT_COPY,
10911             .location = {.poolIndex = 0, .offset = 84, .length = 4},
10912         },
10913         {
10914             .type = OperandType::INT32,
10915             .dimensions = {},
10916             .numberOfConsumers = 1,
10917             .scale = 0.0f,
10918             .zeroPoint = 0,
10919             .lifetime = OperandLifeTime::CONSTANT_COPY,
10920             .location = {.poolIndex = 0, .offset = 88, .length = 4},
10921         },
10922         {
10923             .type = OperandType::BOOL,
10924             .dimensions = {},
10925             .numberOfConsumers = 1,
10926             .scale = 0.0f,
10927             .zeroPoint = 0,
10928             .lifetime = OperandLifeTime::CONSTANT_COPY,
10929             .location = {.poolIndex = 0, .offset = 92, .length = 1},
10930         },
10931         {
10932             .type = OperandType::TENSOR_FLOAT32,
10933             .dimensions = {0, 0, 0, 0},
10934             .numberOfConsumers = 0,
10935             .scale = 0.0f,
10936             .zeroPoint = 0,
10937             .lifetime = OperandLifeTime::MODEL_OUTPUT,
10938             .location = {.poolIndex = 0, .offset = 0, .length = 0},
10939         }
10940     };
10941 
10942     const std::vector<Operation> operations = {
10943         {
10944             .type = OperationType::BOX_WITH_NMS_LIMIT,
10945             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
10946             .outputs = {9, 10, 11, 12},
10947         },
10948         {
10949             .type = OperationType::ROI_ALIGN,
10950             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
10951             .outputs = {21},
10952         }
10953     };
10954 
10955     const std::vector<uint32_t> inputIndexes = {13};
10956     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
10957     std::vector<uint8_t> operandValues = {
10958       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
10959     };
10960     const std::vector<hidl_memory> pools = {};
10961 
10962     return {
10963         .operands = operands,
10964         .operations = operations,
10965         .inputIndexes = inputIndexes,
10966         .outputIndexes = outputIndexes,
10967         .operandValues = operandValues,
10968         .pools = pools,
10969         .relaxComputationFloat32toFloat16 = true,
10970     };
10971 }
10972 
is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed(int i)10973 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed(int i) {
10974   static std::set<int> ignore = {};
10975   return ignore.find(i) != ignore.end();
10976 }
10977 
10978 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nhwc_quant8()10979 Model createTestModel_zero_sized_dynamic_output_shape_nhwc_quant8() {
10980     const std::vector<Operand> operands = {
10981         {
10982             .type = OperandType::TENSOR_QUANT8_ASYMM,
10983             .dimensions = {1, 2},
10984             .numberOfConsumers = 1,
10985             .scale = 0.1f,
10986             .zeroPoint = 128,
10987             .lifetime = OperandLifeTime::CONSTANT_COPY,
10988             .location = {.poolIndex = 0, .offset = 0, .length = 2},
10989         },
10990         {
10991             .type = OperandType::TENSOR_QUANT16_ASYMM,
10992             .dimensions = {1, 8},
10993             .numberOfConsumers = 1,
10994             .scale = 0.125f,
10995             .zeroPoint = 0,
10996             .lifetime = OperandLifeTime::CONSTANT_COPY,
10997             .location = {.poolIndex = 0, .offset = 2, .length = 16},
10998         },
10999         {
11000             .type = OperandType::TENSOR_INT32,
11001             .dimensions = {1},
11002             .numberOfConsumers = 1,
11003             .scale = 0.0f,
11004             .zeroPoint = 0,
11005             .lifetime = OperandLifeTime::CONSTANT_COPY,
11006             .location = {.poolIndex = 0, .offset = 18, .length = 4},
11007         },
11008         {
11009             .type = OperandType::FLOAT32,
11010             .dimensions = {},
11011             .numberOfConsumers = 1,
11012             .scale = 0.0f,
11013             .zeroPoint = 0,
11014             .lifetime = OperandLifeTime::CONSTANT_COPY,
11015             .location = {.poolIndex = 0, .offset = 22, .length = 4},
11016         },
11017         {
11018             .type = OperandType::INT32,
11019             .dimensions = {},
11020             .numberOfConsumers = 1,
11021             .scale = 0.0f,
11022             .zeroPoint = 0,
11023             .lifetime = OperandLifeTime::CONSTANT_COPY,
11024             .location = {.poolIndex = 0, .offset = 26, .length = 4},
11025         },
11026         {
11027             .type = OperandType::INT32,
11028             .dimensions = {},
11029             .numberOfConsumers = 1,
11030             .scale = 0.0f,
11031             .zeroPoint = 0,
11032             .lifetime = OperandLifeTime::CONSTANT_COPY,
11033             .location = {.poolIndex = 0, .offset = 30, .length = 4},
11034         },
11035         {
11036             .type = OperandType::FLOAT32,
11037             .dimensions = {},
11038             .numberOfConsumers = 1,
11039             .scale = 0.0f,
11040             .zeroPoint = 0,
11041             .lifetime = OperandLifeTime::CONSTANT_COPY,
11042             .location = {.poolIndex = 0, .offset = 34, .length = 4},
11043         },
11044         {
11045             .type = OperandType::FLOAT32,
11046             .dimensions = {},
11047             .numberOfConsumers = 1,
11048             .scale = 0.0f,
11049             .zeroPoint = 0,
11050             .lifetime = OperandLifeTime::CONSTANT_COPY,
11051             .location = {.poolIndex = 0, .offset = 38, .length = 4},
11052         },
11053         {
11054             .type = OperandType::FLOAT32,
11055             .dimensions = {},
11056             .numberOfConsumers = 1,
11057             .scale = 0.0f,
11058             .zeroPoint = 0,
11059             .lifetime = OperandLifeTime::CONSTANT_COPY,
11060             .location = {.poolIndex = 0, .offset = 42, .length = 4},
11061         },
11062         {
11063             .type = OperandType::TENSOR_QUANT8_ASYMM,
11064             .dimensions = {0},
11065             .numberOfConsumers = 0,
11066             .scale = 0.1f,
11067             .zeroPoint = 128,
11068             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11069             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11070         },
11071         {
11072             .type = OperandType::TENSOR_QUANT16_ASYMM,
11073             .dimensions = {0, 4},
11074             .numberOfConsumers = 1,
11075             .scale = 0.125f,
11076             .zeroPoint = 0,
11077             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11078             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11079         },
11080         {
11081             .type = OperandType::TENSOR_INT32,
11082             .dimensions = {0},
11083             .numberOfConsumers = 0,
11084             .scale = 0.0f,
11085             .zeroPoint = 0,
11086             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11087             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11088         },
11089         {
11090             .type = OperandType::TENSOR_INT32,
11091             .dimensions = {0},
11092             .numberOfConsumers = 1,
11093             .scale = 0.0f,
11094             .zeroPoint = 0,
11095             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11096             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11097         },
11098         {
11099             .type = OperandType::TENSOR_QUANT8_ASYMM,
11100             .dimensions = {1, 1, 1, 1},
11101             .numberOfConsumers = 1,
11102             .scale = 0.1f,
11103             .zeroPoint = 128,
11104             .lifetime = OperandLifeTime::MODEL_INPUT,
11105             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11106         },
11107         {
11108             .type = OperandType::INT32,
11109             .dimensions = {},
11110             .numberOfConsumers = 1,
11111             .scale = 0.0f,
11112             .zeroPoint = 0,
11113             .lifetime = OperandLifeTime::CONSTANT_COPY,
11114             .location = {.poolIndex = 0, .offset = 46, .length = 4},
11115         },
11116         {
11117             .type = OperandType::INT32,
11118             .dimensions = {},
11119             .numberOfConsumers = 1,
11120             .scale = 0.0f,
11121             .zeroPoint = 0,
11122             .lifetime = OperandLifeTime::CONSTANT_COPY,
11123             .location = {.poolIndex = 0, .offset = 50, .length = 4},
11124         },
11125         {
11126             .type = OperandType::FLOAT32,
11127             .dimensions = {},
11128             .numberOfConsumers = 1,
11129             .scale = 0.0f,
11130             .zeroPoint = 0,
11131             .lifetime = OperandLifeTime::CONSTANT_COPY,
11132             .location = {.poolIndex = 0, .offset = 54, .length = 4},
11133         },
11134         {
11135             .type = OperandType::FLOAT32,
11136             .dimensions = {},
11137             .numberOfConsumers = 1,
11138             .scale = 0.0f,
11139             .zeroPoint = 0,
11140             .lifetime = OperandLifeTime::CONSTANT_COPY,
11141             .location = {.poolIndex = 0, .offset = 58, .length = 4},
11142         },
11143         {
11144             .type = OperandType::INT32,
11145             .dimensions = {},
11146             .numberOfConsumers = 1,
11147             .scale = 0.0f,
11148             .zeroPoint = 0,
11149             .lifetime = OperandLifeTime::CONSTANT_COPY,
11150             .location = {.poolIndex = 0, .offset = 62, .length = 4},
11151         },
11152         {
11153             .type = OperandType::INT32,
11154             .dimensions = {},
11155             .numberOfConsumers = 1,
11156             .scale = 0.0f,
11157             .zeroPoint = 0,
11158             .lifetime = OperandLifeTime::CONSTANT_COPY,
11159             .location = {.poolIndex = 0, .offset = 66, .length = 4},
11160         },
11161         {
11162             .type = OperandType::BOOL,
11163             .dimensions = {},
11164             .numberOfConsumers = 1,
11165             .scale = 0.0f,
11166             .zeroPoint = 0,
11167             .lifetime = OperandLifeTime::CONSTANT_COPY,
11168             .location = {.poolIndex = 0, .offset = 70, .length = 1},
11169         },
11170         {
11171             .type = OperandType::TENSOR_QUANT8_ASYMM,
11172             .dimensions = {0, 0, 0, 0},
11173             .numberOfConsumers = 0,
11174             .scale = 0.1f,
11175             .zeroPoint = 128,
11176             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11177             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11178         }
11179     };
11180 
11181     const std::vector<Operation> operations = {
11182         {
11183             .type = OperationType::BOX_WITH_NMS_LIMIT,
11184             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
11185             .outputs = {9, 10, 11, 12},
11186         },
11187         {
11188             .type = OperationType::ROI_ALIGN,
11189             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
11190             .outputs = {21},
11191         }
11192     };
11193 
11194     const std::vector<uint32_t> inputIndexes = {13};
11195     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
11196     std::vector<uint8_t> operandValues = {
11197       137, 129, 8, 0, 8, 0, 80, 0, 80, 0, 0, 0, 0, 0, 80, 0, 80, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
11198     };
11199     const std::vector<hidl_memory> pools = {};
11200 
11201     return {
11202         .operands = operands,
11203         .operations = operations,
11204         .inputIndexes = inputIndexes,
11205         .outputIndexes = outputIndexes,
11206         .operandValues = operandValues,
11207         .pools = pools,
11208     };
11209 }
11210 
is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8(int i)11211 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8(int i) {
11212   static std::set<int> ignore = {};
11213   return ignore.find(i) != ignore.end();
11214 }
11215 
11216 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nhwc_float16()11217 Model createTestModel_zero_sized_dynamic_output_shape_nhwc_float16() {
11218     const std::vector<Operand> operands = {
11219         {
11220             .type = OperandType::TENSOR_FLOAT16,
11221             .dimensions = {1, 2},
11222             .numberOfConsumers = 1,
11223             .scale = 0.0f,
11224             .zeroPoint = 0,
11225             .lifetime = OperandLifeTime::CONSTANT_COPY,
11226             .location = {.poolIndex = 0, .offset = 0, .length = 4},
11227         },
11228         {
11229             .type = OperandType::TENSOR_FLOAT16,
11230             .dimensions = {1, 8},
11231             .numberOfConsumers = 1,
11232             .scale = 0.0f,
11233             .zeroPoint = 0,
11234             .lifetime = OperandLifeTime::CONSTANT_COPY,
11235             .location = {.poolIndex = 0, .offset = 4, .length = 16},
11236         },
11237         {
11238             .type = OperandType::TENSOR_INT32,
11239             .dimensions = {1},
11240             .numberOfConsumers = 1,
11241             .scale = 0.0f,
11242             .zeroPoint = 0,
11243             .lifetime = OperandLifeTime::CONSTANT_COPY,
11244             .location = {.poolIndex = 0, .offset = 20, .length = 4},
11245         },
11246         {
11247             .type = OperandType::FLOAT16,
11248             .dimensions = {},
11249             .numberOfConsumers = 1,
11250             .scale = 0.0f,
11251             .zeroPoint = 0,
11252             .lifetime = OperandLifeTime::CONSTANT_COPY,
11253             .location = {.poolIndex = 0, .offset = 24, .length = 2},
11254         },
11255         {
11256             .type = OperandType::INT32,
11257             .dimensions = {},
11258             .numberOfConsumers = 1,
11259             .scale = 0.0f,
11260             .zeroPoint = 0,
11261             .lifetime = OperandLifeTime::CONSTANT_COPY,
11262             .location = {.poolIndex = 0, .offset = 26, .length = 4},
11263         },
11264         {
11265             .type = OperandType::INT32,
11266             .dimensions = {},
11267             .numberOfConsumers = 1,
11268             .scale = 0.0f,
11269             .zeroPoint = 0,
11270             .lifetime = OperandLifeTime::CONSTANT_COPY,
11271             .location = {.poolIndex = 0, .offset = 30, .length = 4},
11272         },
11273         {
11274             .type = OperandType::FLOAT16,
11275             .dimensions = {},
11276             .numberOfConsumers = 1,
11277             .scale = 0.0f,
11278             .zeroPoint = 0,
11279             .lifetime = OperandLifeTime::CONSTANT_COPY,
11280             .location = {.poolIndex = 0, .offset = 34, .length = 2},
11281         },
11282         {
11283             .type = OperandType::FLOAT16,
11284             .dimensions = {},
11285             .numberOfConsumers = 1,
11286             .scale = 0.0f,
11287             .zeroPoint = 0,
11288             .lifetime = OperandLifeTime::CONSTANT_COPY,
11289             .location = {.poolIndex = 0, .offset = 36, .length = 2},
11290         },
11291         {
11292             .type = OperandType::FLOAT16,
11293             .dimensions = {},
11294             .numberOfConsumers = 1,
11295             .scale = 0.0f,
11296             .zeroPoint = 0,
11297             .lifetime = OperandLifeTime::CONSTANT_COPY,
11298             .location = {.poolIndex = 0, .offset = 38, .length = 2},
11299         },
11300         {
11301             .type = OperandType::TENSOR_FLOAT16,
11302             .dimensions = {0},
11303             .numberOfConsumers = 0,
11304             .scale = 0.0f,
11305             .zeroPoint = 0,
11306             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11307             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11308         },
11309         {
11310             .type = OperandType::TENSOR_FLOAT16,
11311             .dimensions = {0, 4},
11312             .numberOfConsumers = 1,
11313             .scale = 0.0f,
11314             .zeroPoint = 0,
11315             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11316             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11317         },
11318         {
11319             .type = OperandType::TENSOR_INT32,
11320             .dimensions = {0},
11321             .numberOfConsumers = 0,
11322             .scale = 0.0f,
11323             .zeroPoint = 0,
11324             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11325             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11326         },
11327         {
11328             .type = OperandType::TENSOR_INT32,
11329             .dimensions = {0},
11330             .numberOfConsumers = 1,
11331             .scale = 0.0f,
11332             .zeroPoint = 0,
11333             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11334             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11335         },
11336         {
11337             .type = OperandType::TENSOR_FLOAT16,
11338             .dimensions = {1, 1, 1, 1},
11339             .numberOfConsumers = 1,
11340             .scale = 0.0f,
11341             .zeroPoint = 0,
11342             .lifetime = OperandLifeTime::MODEL_INPUT,
11343             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11344         },
11345         {
11346             .type = OperandType::INT32,
11347             .dimensions = {},
11348             .numberOfConsumers = 1,
11349             .scale = 0.0f,
11350             .zeroPoint = 0,
11351             .lifetime = OperandLifeTime::CONSTANT_COPY,
11352             .location = {.poolIndex = 0, .offset = 40, .length = 4},
11353         },
11354         {
11355             .type = OperandType::INT32,
11356             .dimensions = {},
11357             .numberOfConsumers = 1,
11358             .scale = 0.0f,
11359             .zeroPoint = 0,
11360             .lifetime = OperandLifeTime::CONSTANT_COPY,
11361             .location = {.poolIndex = 0, .offset = 44, .length = 4},
11362         },
11363         {
11364             .type = OperandType::FLOAT16,
11365             .dimensions = {},
11366             .numberOfConsumers = 1,
11367             .scale = 0.0f,
11368             .zeroPoint = 0,
11369             .lifetime = OperandLifeTime::CONSTANT_COPY,
11370             .location = {.poolIndex = 0, .offset = 48, .length = 2},
11371         },
11372         {
11373             .type = OperandType::FLOAT16,
11374             .dimensions = {},
11375             .numberOfConsumers = 1,
11376             .scale = 0.0f,
11377             .zeroPoint = 0,
11378             .lifetime = OperandLifeTime::CONSTANT_COPY,
11379             .location = {.poolIndex = 0, .offset = 50, .length = 2},
11380         },
11381         {
11382             .type = OperandType::INT32,
11383             .dimensions = {},
11384             .numberOfConsumers = 1,
11385             .scale = 0.0f,
11386             .zeroPoint = 0,
11387             .lifetime = OperandLifeTime::CONSTANT_COPY,
11388             .location = {.poolIndex = 0, .offset = 52, .length = 4},
11389         },
11390         {
11391             .type = OperandType::INT32,
11392             .dimensions = {},
11393             .numberOfConsumers = 1,
11394             .scale = 0.0f,
11395             .zeroPoint = 0,
11396             .lifetime = OperandLifeTime::CONSTANT_COPY,
11397             .location = {.poolIndex = 0, .offset = 56, .length = 4},
11398         },
11399         {
11400             .type = OperandType::BOOL,
11401             .dimensions = {},
11402             .numberOfConsumers = 1,
11403             .scale = 0.0f,
11404             .zeroPoint = 0,
11405             .lifetime = OperandLifeTime::CONSTANT_COPY,
11406             .location = {.poolIndex = 0, .offset = 60, .length = 1},
11407         },
11408         {
11409             .type = OperandType::TENSOR_FLOAT16,
11410             .dimensions = {0, 0, 0, 0},
11411             .numberOfConsumers = 0,
11412             .scale = 0.0f,
11413             .zeroPoint = 0,
11414             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11415             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11416         }
11417     };
11418 
11419     const std::vector<Operation> operations = {
11420         {
11421             .type = OperationType::BOX_WITH_NMS_LIMIT,
11422             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
11423             .outputs = {9, 10, 11, 12},
11424         },
11425         {
11426             .type = OperationType::ROI_ALIGN,
11427             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
11428             .outputs = {21},
11429         }
11430     };
11431 
11432     const std::vector<uint32_t> inputIndexes = {13};
11433     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
11434     std::vector<uint8_t> operandValues = {
11435       51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 0
11436     };
11437     const std::vector<hidl_memory> pools = {};
11438 
11439     return {
11440         .operands = operands,
11441         .operations = operations,
11442         .inputIndexes = inputIndexes,
11443         .outputIndexes = outputIndexes,
11444         .operandValues = operandValues,
11445         .pools = pools,
11446     };
11447 }
11448 
is_ignored_zero_sized_dynamic_output_shape_nhwc_float16(int i)11449 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16(int i) {
11450   static std::set<int> ignore = {};
11451   return ignore.find(i) != ignore.end();
11452 }
11453 
11454 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nchw()11455 Model createTestModel_zero_sized_dynamic_output_shape_nchw() {
11456     const std::vector<Operand> operands = {
11457         {
11458             .type = OperandType::TENSOR_FLOAT32,
11459             .dimensions = {1, 2},
11460             .numberOfConsumers = 1,
11461             .scale = 0.0f,
11462             .zeroPoint = 0,
11463             .lifetime = OperandLifeTime::CONSTANT_COPY,
11464             .location = {.poolIndex = 0, .offset = 0, .length = 8},
11465         },
11466         {
11467             .type = OperandType::TENSOR_FLOAT32,
11468             .dimensions = {1, 8},
11469             .numberOfConsumers = 1,
11470             .scale = 0.0f,
11471             .zeroPoint = 0,
11472             .lifetime = OperandLifeTime::CONSTANT_COPY,
11473             .location = {.poolIndex = 0, .offset = 8, .length = 32},
11474         },
11475         {
11476             .type = OperandType::TENSOR_INT32,
11477             .dimensions = {1},
11478             .numberOfConsumers = 1,
11479             .scale = 0.0f,
11480             .zeroPoint = 0,
11481             .lifetime = OperandLifeTime::CONSTANT_COPY,
11482             .location = {.poolIndex = 0, .offset = 40, .length = 4},
11483         },
11484         {
11485             .type = OperandType::FLOAT32,
11486             .dimensions = {},
11487             .numberOfConsumers = 1,
11488             .scale = 0.0f,
11489             .zeroPoint = 0,
11490             .lifetime = OperandLifeTime::CONSTANT_COPY,
11491             .location = {.poolIndex = 0, .offset = 44, .length = 4},
11492         },
11493         {
11494             .type = OperandType::INT32,
11495             .dimensions = {},
11496             .numberOfConsumers = 1,
11497             .scale = 0.0f,
11498             .zeroPoint = 0,
11499             .lifetime = OperandLifeTime::CONSTANT_COPY,
11500             .location = {.poolIndex = 0, .offset = 48, .length = 4},
11501         },
11502         {
11503             .type = OperandType::INT32,
11504             .dimensions = {},
11505             .numberOfConsumers = 1,
11506             .scale = 0.0f,
11507             .zeroPoint = 0,
11508             .lifetime = OperandLifeTime::CONSTANT_COPY,
11509             .location = {.poolIndex = 0, .offset = 52, .length = 4},
11510         },
11511         {
11512             .type = OperandType::FLOAT32,
11513             .dimensions = {},
11514             .numberOfConsumers = 1,
11515             .scale = 0.0f,
11516             .zeroPoint = 0,
11517             .lifetime = OperandLifeTime::CONSTANT_COPY,
11518             .location = {.poolIndex = 0, .offset = 56, .length = 4},
11519         },
11520         {
11521             .type = OperandType::FLOAT32,
11522             .dimensions = {},
11523             .numberOfConsumers = 1,
11524             .scale = 0.0f,
11525             .zeroPoint = 0,
11526             .lifetime = OperandLifeTime::CONSTANT_COPY,
11527             .location = {.poolIndex = 0, .offset = 60, .length = 4},
11528         },
11529         {
11530             .type = OperandType::FLOAT32,
11531             .dimensions = {},
11532             .numberOfConsumers = 1,
11533             .scale = 0.0f,
11534             .zeroPoint = 0,
11535             .lifetime = OperandLifeTime::CONSTANT_COPY,
11536             .location = {.poolIndex = 0, .offset = 64, .length = 4},
11537         },
11538         {
11539             .type = OperandType::TENSOR_FLOAT32,
11540             .dimensions = {0},
11541             .numberOfConsumers = 0,
11542             .scale = 0.0f,
11543             .zeroPoint = 0,
11544             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11545             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11546         },
11547         {
11548             .type = OperandType::TENSOR_FLOAT32,
11549             .dimensions = {0, 4},
11550             .numberOfConsumers = 1,
11551             .scale = 0.0f,
11552             .zeroPoint = 0,
11553             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11554             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11555         },
11556         {
11557             .type = OperandType::TENSOR_INT32,
11558             .dimensions = {0},
11559             .numberOfConsumers = 0,
11560             .scale = 0.0f,
11561             .zeroPoint = 0,
11562             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11563             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11564         },
11565         {
11566             .type = OperandType::TENSOR_INT32,
11567             .dimensions = {0},
11568             .numberOfConsumers = 1,
11569             .scale = 0.0f,
11570             .zeroPoint = 0,
11571             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11572             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11573         },
11574         {
11575             .type = OperandType::TENSOR_FLOAT32,
11576             .dimensions = {1, 1, 1, 1},
11577             .numberOfConsumers = 1,
11578             .scale = 0.0f,
11579             .zeroPoint = 0,
11580             .lifetime = OperandLifeTime::MODEL_INPUT,
11581             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11582         },
11583         {
11584             .type = OperandType::INT32,
11585             .dimensions = {},
11586             .numberOfConsumers = 1,
11587             .scale = 0.0f,
11588             .zeroPoint = 0,
11589             .lifetime = OperandLifeTime::CONSTANT_COPY,
11590             .location = {.poolIndex = 0, .offset = 68, .length = 4},
11591         },
11592         {
11593             .type = OperandType::INT32,
11594             .dimensions = {},
11595             .numberOfConsumers = 1,
11596             .scale = 0.0f,
11597             .zeroPoint = 0,
11598             .lifetime = OperandLifeTime::CONSTANT_COPY,
11599             .location = {.poolIndex = 0, .offset = 72, .length = 4},
11600         },
11601         {
11602             .type = OperandType::FLOAT32,
11603             .dimensions = {},
11604             .numberOfConsumers = 1,
11605             .scale = 0.0f,
11606             .zeroPoint = 0,
11607             .lifetime = OperandLifeTime::CONSTANT_COPY,
11608             .location = {.poolIndex = 0, .offset = 76, .length = 4},
11609         },
11610         {
11611             .type = OperandType::FLOAT32,
11612             .dimensions = {},
11613             .numberOfConsumers = 1,
11614             .scale = 0.0f,
11615             .zeroPoint = 0,
11616             .lifetime = OperandLifeTime::CONSTANT_COPY,
11617             .location = {.poolIndex = 0, .offset = 80, .length = 4},
11618         },
11619         {
11620             .type = OperandType::INT32,
11621             .dimensions = {},
11622             .numberOfConsumers = 1,
11623             .scale = 0.0f,
11624             .zeroPoint = 0,
11625             .lifetime = OperandLifeTime::CONSTANT_COPY,
11626             .location = {.poolIndex = 0, .offset = 84, .length = 4},
11627         },
11628         {
11629             .type = OperandType::INT32,
11630             .dimensions = {},
11631             .numberOfConsumers = 1,
11632             .scale = 0.0f,
11633             .zeroPoint = 0,
11634             .lifetime = OperandLifeTime::CONSTANT_COPY,
11635             .location = {.poolIndex = 0, .offset = 88, .length = 4},
11636         },
11637         {
11638             .type = OperandType::BOOL,
11639             .dimensions = {},
11640             .numberOfConsumers = 1,
11641             .scale = 0.0f,
11642             .zeroPoint = 0,
11643             .lifetime = OperandLifeTime::CONSTANT_COPY,
11644             .location = {.poolIndex = 0, .offset = 92, .length = 1},
11645         },
11646         {
11647             .type = OperandType::TENSOR_FLOAT32,
11648             .dimensions = {0, 0, 0, 0},
11649             .numberOfConsumers = 0,
11650             .scale = 0.0f,
11651             .zeroPoint = 0,
11652             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11653             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11654         }
11655     };
11656 
11657     const std::vector<Operation> operations = {
11658         {
11659             .type = OperationType::BOX_WITH_NMS_LIMIT,
11660             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
11661             .outputs = {9, 10, 11, 12},
11662         },
11663         {
11664             .type = OperationType::ROI_ALIGN,
11665             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
11666             .outputs = {21},
11667         }
11668     };
11669 
11670     const std::vector<uint32_t> inputIndexes = {13};
11671     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
11672     std::vector<uint8_t> operandValues = {
11673       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
11674     };
11675     const std::vector<hidl_memory> pools = {};
11676 
11677     return {
11678         .operands = operands,
11679         .operations = operations,
11680         .inputIndexes = inputIndexes,
11681         .outputIndexes = outputIndexes,
11682         .operandValues = operandValues,
11683         .pools = pools,
11684     };
11685 }
11686 
is_ignored_zero_sized_dynamic_output_shape_nchw(int i)11687 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw(int i) {
11688   static std::set<int> ignore = {};
11689   return ignore.find(i) != ignore.end();
11690 }
11691 
11692 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nchw_relaxed()11693 Model createTestModel_zero_sized_dynamic_output_shape_nchw_relaxed() {
11694     const std::vector<Operand> operands = {
11695         {
11696             .type = OperandType::TENSOR_FLOAT32,
11697             .dimensions = {1, 2},
11698             .numberOfConsumers = 1,
11699             .scale = 0.0f,
11700             .zeroPoint = 0,
11701             .lifetime = OperandLifeTime::CONSTANT_COPY,
11702             .location = {.poolIndex = 0, .offset = 0, .length = 8},
11703         },
11704         {
11705             .type = OperandType::TENSOR_FLOAT32,
11706             .dimensions = {1, 8},
11707             .numberOfConsumers = 1,
11708             .scale = 0.0f,
11709             .zeroPoint = 0,
11710             .lifetime = OperandLifeTime::CONSTANT_COPY,
11711             .location = {.poolIndex = 0, .offset = 8, .length = 32},
11712         },
11713         {
11714             .type = OperandType::TENSOR_INT32,
11715             .dimensions = {1},
11716             .numberOfConsumers = 1,
11717             .scale = 0.0f,
11718             .zeroPoint = 0,
11719             .lifetime = OperandLifeTime::CONSTANT_COPY,
11720             .location = {.poolIndex = 0, .offset = 40, .length = 4},
11721         },
11722         {
11723             .type = OperandType::FLOAT32,
11724             .dimensions = {},
11725             .numberOfConsumers = 1,
11726             .scale = 0.0f,
11727             .zeroPoint = 0,
11728             .lifetime = OperandLifeTime::CONSTANT_COPY,
11729             .location = {.poolIndex = 0, .offset = 44, .length = 4},
11730         },
11731         {
11732             .type = OperandType::INT32,
11733             .dimensions = {},
11734             .numberOfConsumers = 1,
11735             .scale = 0.0f,
11736             .zeroPoint = 0,
11737             .lifetime = OperandLifeTime::CONSTANT_COPY,
11738             .location = {.poolIndex = 0, .offset = 48, .length = 4},
11739         },
11740         {
11741             .type = OperandType::INT32,
11742             .dimensions = {},
11743             .numberOfConsumers = 1,
11744             .scale = 0.0f,
11745             .zeroPoint = 0,
11746             .lifetime = OperandLifeTime::CONSTANT_COPY,
11747             .location = {.poolIndex = 0, .offset = 52, .length = 4},
11748         },
11749         {
11750             .type = OperandType::FLOAT32,
11751             .dimensions = {},
11752             .numberOfConsumers = 1,
11753             .scale = 0.0f,
11754             .zeroPoint = 0,
11755             .lifetime = OperandLifeTime::CONSTANT_COPY,
11756             .location = {.poolIndex = 0, .offset = 56, .length = 4},
11757         },
11758         {
11759             .type = OperandType::FLOAT32,
11760             .dimensions = {},
11761             .numberOfConsumers = 1,
11762             .scale = 0.0f,
11763             .zeroPoint = 0,
11764             .lifetime = OperandLifeTime::CONSTANT_COPY,
11765             .location = {.poolIndex = 0, .offset = 60, .length = 4},
11766         },
11767         {
11768             .type = OperandType::FLOAT32,
11769             .dimensions = {},
11770             .numberOfConsumers = 1,
11771             .scale = 0.0f,
11772             .zeroPoint = 0,
11773             .lifetime = OperandLifeTime::CONSTANT_COPY,
11774             .location = {.poolIndex = 0, .offset = 64, .length = 4},
11775         },
11776         {
11777             .type = OperandType::TENSOR_FLOAT32,
11778             .dimensions = {0},
11779             .numberOfConsumers = 0,
11780             .scale = 0.0f,
11781             .zeroPoint = 0,
11782             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11783             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11784         },
11785         {
11786             .type = OperandType::TENSOR_FLOAT32,
11787             .dimensions = {0, 4},
11788             .numberOfConsumers = 1,
11789             .scale = 0.0f,
11790             .zeroPoint = 0,
11791             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11792             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11793         },
11794         {
11795             .type = OperandType::TENSOR_INT32,
11796             .dimensions = {0},
11797             .numberOfConsumers = 0,
11798             .scale = 0.0f,
11799             .zeroPoint = 0,
11800             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11801             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11802         },
11803         {
11804             .type = OperandType::TENSOR_INT32,
11805             .dimensions = {0},
11806             .numberOfConsumers = 1,
11807             .scale = 0.0f,
11808             .zeroPoint = 0,
11809             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
11810             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11811         },
11812         {
11813             .type = OperandType::TENSOR_FLOAT32,
11814             .dimensions = {1, 1, 1, 1},
11815             .numberOfConsumers = 1,
11816             .scale = 0.0f,
11817             .zeroPoint = 0,
11818             .lifetime = OperandLifeTime::MODEL_INPUT,
11819             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11820         },
11821         {
11822             .type = OperandType::INT32,
11823             .dimensions = {},
11824             .numberOfConsumers = 1,
11825             .scale = 0.0f,
11826             .zeroPoint = 0,
11827             .lifetime = OperandLifeTime::CONSTANT_COPY,
11828             .location = {.poolIndex = 0, .offset = 68, .length = 4},
11829         },
11830         {
11831             .type = OperandType::INT32,
11832             .dimensions = {},
11833             .numberOfConsumers = 1,
11834             .scale = 0.0f,
11835             .zeroPoint = 0,
11836             .lifetime = OperandLifeTime::CONSTANT_COPY,
11837             .location = {.poolIndex = 0, .offset = 72, .length = 4},
11838         },
11839         {
11840             .type = OperandType::FLOAT32,
11841             .dimensions = {},
11842             .numberOfConsumers = 1,
11843             .scale = 0.0f,
11844             .zeroPoint = 0,
11845             .lifetime = OperandLifeTime::CONSTANT_COPY,
11846             .location = {.poolIndex = 0, .offset = 76, .length = 4},
11847         },
11848         {
11849             .type = OperandType::FLOAT32,
11850             .dimensions = {},
11851             .numberOfConsumers = 1,
11852             .scale = 0.0f,
11853             .zeroPoint = 0,
11854             .lifetime = OperandLifeTime::CONSTANT_COPY,
11855             .location = {.poolIndex = 0, .offset = 80, .length = 4},
11856         },
11857         {
11858             .type = OperandType::INT32,
11859             .dimensions = {},
11860             .numberOfConsumers = 1,
11861             .scale = 0.0f,
11862             .zeroPoint = 0,
11863             .lifetime = OperandLifeTime::CONSTANT_COPY,
11864             .location = {.poolIndex = 0, .offset = 84, .length = 4},
11865         },
11866         {
11867             .type = OperandType::INT32,
11868             .dimensions = {},
11869             .numberOfConsumers = 1,
11870             .scale = 0.0f,
11871             .zeroPoint = 0,
11872             .lifetime = OperandLifeTime::CONSTANT_COPY,
11873             .location = {.poolIndex = 0, .offset = 88, .length = 4},
11874         },
11875         {
11876             .type = OperandType::BOOL,
11877             .dimensions = {},
11878             .numberOfConsumers = 1,
11879             .scale = 0.0f,
11880             .zeroPoint = 0,
11881             .lifetime = OperandLifeTime::CONSTANT_COPY,
11882             .location = {.poolIndex = 0, .offset = 92, .length = 1},
11883         },
11884         {
11885             .type = OperandType::TENSOR_FLOAT32,
11886             .dimensions = {0, 0, 0, 0},
11887             .numberOfConsumers = 0,
11888             .scale = 0.0f,
11889             .zeroPoint = 0,
11890             .lifetime = OperandLifeTime::MODEL_OUTPUT,
11891             .location = {.poolIndex = 0, .offset = 0, .length = 0},
11892         }
11893     };
11894 
11895     const std::vector<Operation> operations = {
11896         {
11897             .type = OperationType::BOX_WITH_NMS_LIMIT,
11898             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
11899             .outputs = {9, 10, 11, 12},
11900         },
11901         {
11902             .type = OperationType::ROI_ALIGN,
11903             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
11904             .outputs = {21},
11905         }
11906     };
11907 
11908     const std::vector<uint32_t> inputIndexes = {13};
11909     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
11910     std::vector<uint8_t> operandValues = {
11911       102, 102, 102, 63, 205, 204, 204, 61, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 32, 65, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
11912     };
11913     const std::vector<hidl_memory> pools = {};
11914 
11915     return {
11916         .operands = operands,
11917         .operations = operations,
11918         .inputIndexes = inputIndexes,
11919         .outputIndexes = outputIndexes,
11920         .operandValues = operandValues,
11921         .pools = pools,
11922         .relaxComputationFloat32toFloat16 = true,
11923     };
11924 }
11925 
is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed(int i)11926 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed(int i) {
11927   static std::set<int> ignore = {};
11928   return ignore.find(i) != ignore.end();
11929 }
11930 
11931 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nchw_quant8()11932 Model createTestModel_zero_sized_dynamic_output_shape_nchw_quant8() {
11933     const std::vector<Operand> operands = {
11934         {
11935             .type = OperandType::TENSOR_QUANT8_ASYMM,
11936             .dimensions = {1, 2},
11937             .numberOfConsumers = 1,
11938             .scale = 0.1f,
11939             .zeroPoint = 128,
11940             .lifetime = OperandLifeTime::CONSTANT_COPY,
11941             .location = {.poolIndex = 0, .offset = 0, .length = 2},
11942         },
11943         {
11944             .type = OperandType::TENSOR_QUANT16_ASYMM,
11945             .dimensions = {1, 8},
11946             .numberOfConsumers = 1,
11947             .scale = 0.125f,
11948             .zeroPoint = 0,
11949             .lifetime = OperandLifeTime::CONSTANT_COPY,
11950             .location = {.poolIndex = 0, .offset = 2, .length = 16},
11951         },
11952         {
11953             .type = OperandType::TENSOR_INT32,
11954             .dimensions = {1},
11955             .numberOfConsumers = 1,
11956             .scale = 0.0f,
11957             .zeroPoint = 0,
11958             .lifetime = OperandLifeTime::CONSTANT_COPY,
11959             .location = {.poolIndex = 0, .offset = 18, .length = 4},
11960         },
11961         {
11962             .type = OperandType::FLOAT32,
11963             .dimensions = {},
11964             .numberOfConsumers = 1,
11965             .scale = 0.0f,
11966             .zeroPoint = 0,
11967             .lifetime = OperandLifeTime::CONSTANT_COPY,
11968             .location = {.poolIndex = 0, .offset = 22, .length = 4},
11969         },
11970         {
11971             .type = OperandType::INT32,
11972             .dimensions = {},
11973             .numberOfConsumers = 1,
11974             .scale = 0.0f,
11975             .zeroPoint = 0,
11976             .lifetime = OperandLifeTime::CONSTANT_COPY,
11977             .location = {.poolIndex = 0, .offset = 26, .length = 4},
11978         },
11979         {
11980             .type = OperandType::INT32,
11981             .dimensions = {},
11982             .numberOfConsumers = 1,
11983             .scale = 0.0f,
11984             .zeroPoint = 0,
11985             .lifetime = OperandLifeTime::CONSTANT_COPY,
11986             .location = {.poolIndex = 0, .offset = 30, .length = 4},
11987         },
11988         {
11989             .type = OperandType::FLOAT32,
11990             .dimensions = {},
11991             .numberOfConsumers = 1,
11992             .scale = 0.0f,
11993             .zeroPoint = 0,
11994             .lifetime = OperandLifeTime::CONSTANT_COPY,
11995             .location = {.poolIndex = 0, .offset = 34, .length = 4},
11996         },
11997         {
11998             .type = OperandType::FLOAT32,
11999             .dimensions = {},
12000             .numberOfConsumers = 1,
12001             .scale = 0.0f,
12002             .zeroPoint = 0,
12003             .lifetime = OperandLifeTime::CONSTANT_COPY,
12004             .location = {.poolIndex = 0, .offset = 38, .length = 4},
12005         },
12006         {
12007             .type = OperandType::FLOAT32,
12008             .dimensions = {},
12009             .numberOfConsumers = 1,
12010             .scale = 0.0f,
12011             .zeroPoint = 0,
12012             .lifetime = OperandLifeTime::CONSTANT_COPY,
12013             .location = {.poolIndex = 0, .offset = 42, .length = 4},
12014         },
12015         {
12016             .type = OperandType::TENSOR_QUANT8_ASYMM,
12017             .dimensions = {0},
12018             .numberOfConsumers = 0,
12019             .scale = 0.1f,
12020             .zeroPoint = 128,
12021             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12022             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12023         },
12024         {
12025             .type = OperandType::TENSOR_QUANT16_ASYMM,
12026             .dimensions = {0, 4},
12027             .numberOfConsumers = 1,
12028             .scale = 0.125f,
12029             .zeroPoint = 0,
12030             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
12031             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12032         },
12033         {
12034             .type = OperandType::TENSOR_INT32,
12035             .dimensions = {0},
12036             .numberOfConsumers = 0,
12037             .scale = 0.0f,
12038             .zeroPoint = 0,
12039             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12040             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12041         },
12042         {
12043             .type = OperandType::TENSOR_INT32,
12044             .dimensions = {0},
12045             .numberOfConsumers = 1,
12046             .scale = 0.0f,
12047             .zeroPoint = 0,
12048             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
12049             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12050         },
12051         {
12052             .type = OperandType::TENSOR_QUANT8_ASYMM,
12053             .dimensions = {1, 1, 1, 1},
12054             .numberOfConsumers = 1,
12055             .scale = 0.1f,
12056             .zeroPoint = 128,
12057             .lifetime = OperandLifeTime::MODEL_INPUT,
12058             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12059         },
12060         {
12061             .type = OperandType::INT32,
12062             .dimensions = {},
12063             .numberOfConsumers = 1,
12064             .scale = 0.0f,
12065             .zeroPoint = 0,
12066             .lifetime = OperandLifeTime::CONSTANT_COPY,
12067             .location = {.poolIndex = 0, .offset = 46, .length = 4},
12068         },
12069         {
12070             .type = OperandType::INT32,
12071             .dimensions = {},
12072             .numberOfConsumers = 1,
12073             .scale = 0.0f,
12074             .zeroPoint = 0,
12075             .lifetime = OperandLifeTime::CONSTANT_COPY,
12076             .location = {.poolIndex = 0, .offset = 50, .length = 4},
12077         },
12078         {
12079             .type = OperandType::FLOAT32,
12080             .dimensions = {},
12081             .numberOfConsumers = 1,
12082             .scale = 0.0f,
12083             .zeroPoint = 0,
12084             .lifetime = OperandLifeTime::CONSTANT_COPY,
12085             .location = {.poolIndex = 0, .offset = 54, .length = 4},
12086         },
12087         {
12088             .type = OperandType::FLOAT32,
12089             .dimensions = {},
12090             .numberOfConsumers = 1,
12091             .scale = 0.0f,
12092             .zeroPoint = 0,
12093             .lifetime = OperandLifeTime::CONSTANT_COPY,
12094             .location = {.poolIndex = 0, .offset = 58, .length = 4},
12095         },
12096         {
12097             .type = OperandType::INT32,
12098             .dimensions = {},
12099             .numberOfConsumers = 1,
12100             .scale = 0.0f,
12101             .zeroPoint = 0,
12102             .lifetime = OperandLifeTime::CONSTANT_COPY,
12103             .location = {.poolIndex = 0, .offset = 62, .length = 4},
12104         },
12105         {
12106             .type = OperandType::INT32,
12107             .dimensions = {},
12108             .numberOfConsumers = 1,
12109             .scale = 0.0f,
12110             .zeroPoint = 0,
12111             .lifetime = OperandLifeTime::CONSTANT_COPY,
12112             .location = {.poolIndex = 0, .offset = 66, .length = 4},
12113         },
12114         {
12115             .type = OperandType::BOOL,
12116             .dimensions = {},
12117             .numberOfConsumers = 1,
12118             .scale = 0.0f,
12119             .zeroPoint = 0,
12120             .lifetime = OperandLifeTime::CONSTANT_COPY,
12121             .location = {.poolIndex = 0, .offset = 70, .length = 1},
12122         },
12123         {
12124             .type = OperandType::TENSOR_QUANT8_ASYMM,
12125             .dimensions = {0, 0, 0, 0},
12126             .numberOfConsumers = 0,
12127             .scale = 0.1f,
12128             .zeroPoint = 128,
12129             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12130             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12131         }
12132     };
12133 
12134     const std::vector<Operation> operations = {
12135         {
12136             .type = OperationType::BOX_WITH_NMS_LIMIT,
12137             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
12138             .outputs = {9, 10, 11, 12},
12139         },
12140         {
12141             .type = OperationType::ROI_ALIGN,
12142             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
12143             .outputs = {21},
12144         }
12145     };
12146 
12147     const std::vector<uint32_t> inputIndexes = {13};
12148     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
12149     std::vector<uint8_t> operandValues = {
12150       137, 129, 8, 0, 8, 0, 80, 0, 80, 0, 0, 0, 0, 0, 80, 0, 80, 0, 0, 0, 0, 0, 154, 153, 153, 62, 255, 255, 255, 255, 0, 0, 0, 0, 205, 204, 204, 62, 0, 0, 128, 63, 154, 153, 153, 62, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
12151     };
12152     const std::vector<hidl_memory> pools = {};
12153 
12154     return {
12155         .operands = operands,
12156         .operations = operations,
12157         .inputIndexes = inputIndexes,
12158         .outputIndexes = outputIndexes,
12159         .operandValues = operandValues,
12160         .pools = pools,
12161     };
12162 }
12163 
is_ignored_zero_sized_dynamic_output_shape_nchw_quant8(int i)12164 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8(int i) {
12165   static std::set<int> ignore = {};
12166   return ignore.find(i) != ignore.end();
12167 }
12168 
12169 // Create the model
createTestModel_zero_sized_dynamic_output_shape_nchw_float16()12170 Model createTestModel_zero_sized_dynamic_output_shape_nchw_float16() {
12171     const std::vector<Operand> operands = {
12172         {
12173             .type = OperandType::TENSOR_FLOAT16,
12174             .dimensions = {1, 2},
12175             .numberOfConsumers = 1,
12176             .scale = 0.0f,
12177             .zeroPoint = 0,
12178             .lifetime = OperandLifeTime::CONSTANT_COPY,
12179             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12180         },
12181         {
12182             .type = OperandType::TENSOR_FLOAT16,
12183             .dimensions = {1, 8},
12184             .numberOfConsumers = 1,
12185             .scale = 0.0f,
12186             .zeroPoint = 0,
12187             .lifetime = OperandLifeTime::CONSTANT_COPY,
12188             .location = {.poolIndex = 0, .offset = 4, .length = 16},
12189         },
12190         {
12191             .type = OperandType::TENSOR_INT32,
12192             .dimensions = {1},
12193             .numberOfConsumers = 1,
12194             .scale = 0.0f,
12195             .zeroPoint = 0,
12196             .lifetime = OperandLifeTime::CONSTANT_COPY,
12197             .location = {.poolIndex = 0, .offset = 20, .length = 4},
12198         },
12199         {
12200             .type = OperandType::FLOAT16,
12201             .dimensions = {},
12202             .numberOfConsumers = 1,
12203             .scale = 0.0f,
12204             .zeroPoint = 0,
12205             .lifetime = OperandLifeTime::CONSTANT_COPY,
12206             .location = {.poolIndex = 0, .offset = 24, .length = 2},
12207         },
12208         {
12209             .type = OperandType::INT32,
12210             .dimensions = {},
12211             .numberOfConsumers = 1,
12212             .scale = 0.0f,
12213             .zeroPoint = 0,
12214             .lifetime = OperandLifeTime::CONSTANT_COPY,
12215             .location = {.poolIndex = 0, .offset = 26, .length = 4},
12216         },
12217         {
12218             .type = OperandType::INT32,
12219             .dimensions = {},
12220             .numberOfConsumers = 1,
12221             .scale = 0.0f,
12222             .zeroPoint = 0,
12223             .lifetime = OperandLifeTime::CONSTANT_COPY,
12224             .location = {.poolIndex = 0, .offset = 30, .length = 4},
12225         },
12226         {
12227             .type = OperandType::FLOAT16,
12228             .dimensions = {},
12229             .numberOfConsumers = 1,
12230             .scale = 0.0f,
12231             .zeroPoint = 0,
12232             .lifetime = OperandLifeTime::CONSTANT_COPY,
12233             .location = {.poolIndex = 0, .offset = 34, .length = 2},
12234         },
12235         {
12236             .type = OperandType::FLOAT16,
12237             .dimensions = {},
12238             .numberOfConsumers = 1,
12239             .scale = 0.0f,
12240             .zeroPoint = 0,
12241             .lifetime = OperandLifeTime::CONSTANT_COPY,
12242             .location = {.poolIndex = 0, .offset = 36, .length = 2},
12243         },
12244         {
12245             .type = OperandType::FLOAT16,
12246             .dimensions = {},
12247             .numberOfConsumers = 1,
12248             .scale = 0.0f,
12249             .zeroPoint = 0,
12250             .lifetime = OperandLifeTime::CONSTANT_COPY,
12251             .location = {.poolIndex = 0, .offset = 38, .length = 2},
12252         },
12253         {
12254             .type = OperandType::TENSOR_FLOAT16,
12255             .dimensions = {0},
12256             .numberOfConsumers = 0,
12257             .scale = 0.0f,
12258             .zeroPoint = 0,
12259             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12260             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12261         },
12262         {
12263             .type = OperandType::TENSOR_FLOAT16,
12264             .dimensions = {0, 4},
12265             .numberOfConsumers = 1,
12266             .scale = 0.0f,
12267             .zeroPoint = 0,
12268             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
12269             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12270         },
12271         {
12272             .type = OperandType::TENSOR_INT32,
12273             .dimensions = {0},
12274             .numberOfConsumers = 0,
12275             .scale = 0.0f,
12276             .zeroPoint = 0,
12277             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12278             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12279         },
12280         {
12281             .type = OperandType::TENSOR_INT32,
12282             .dimensions = {0},
12283             .numberOfConsumers = 1,
12284             .scale = 0.0f,
12285             .zeroPoint = 0,
12286             .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
12287             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12288         },
12289         {
12290             .type = OperandType::TENSOR_FLOAT16,
12291             .dimensions = {1, 1, 1, 1},
12292             .numberOfConsumers = 1,
12293             .scale = 0.0f,
12294             .zeroPoint = 0,
12295             .lifetime = OperandLifeTime::MODEL_INPUT,
12296             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12297         },
12298         {
12299             .type = OperandType::INT32,
12300             .dimensions = {},
12301             .numberOfConsumers = 1,
12302             .scale = 0.0f,
12303             .zeroPoint = 0,
12304             .lifetime = OperandLifeTime::CONSTANT_COPY,
12305             .location = {.poolIndex = 0, .offset = 40, .length = 4},
12306         },
12307         {
12308             .type = OperandType::INT32,
12309             .dimensions = {},
12310             .numberOfConsumers = 1,
12311             .scale = 0.0f,
12312             .zeroPoint = 0,
12313             .lifetime = OperandLifeTime::CONSTANT_COPY,
12314             .location = {.poolIndex = 0, .offset = 44, .length = 4},
12315         },
12316         {
12317             .type = OperandType::FLOAT16,
12318             .dimensions = {},
12319             .numberOfConsumers = 1,
12320             .scale = 0.0f,
12321             .zeroPoint = 0,
12322             .lifetime = OperandLifeTime::CONSTANT_COPY,
12323             .location = {.poolIndex = 0, .offset = 48, .length = 2},
12324         },
12325         {
12326             .type = OperandType::FLOAT16,
12327             .dimensions = {},
12328             .numberOfConsumers = 1,
12329             .scale = 0.0f,
12330             .zeroPoint = 0,
12331             .lifetime = OperandLifeTime::CONSTANT_COPY,
12332             .location = {.poolIndex = 0, .offset = 50, .length = 2},
12333         },
12334         {
12335             .type = OperandType::INT32,
12336             .dimensions = {},
12337             .numberOfConsumers = 1,
12338             .scale = 0.0f,
12339             .zeroPoint = 0,
12340             .lifetime = OperandLifeTime::CONSTANT_COPY,
12341             .location = {.poolIndex = 0, .offset = 52, .length = 4},
12342         },
12343         {
12344             .type = OperandType::INT32,
12345             .dimensions = {},
12346             .numberOfConsumers = 1,
12347             .scale = 0.0f,
12348             .zeroPoint = 0,
12349             .lifetime = OperandLifeTime::CONSTANT_COPY,
12350             .location = {.poolIndex = 0, .offset = 56, .length = 4},
12351         },
12352         {
12353             .type = OperandType::BOOL,
12354             .dimensions = {},
12355             .numberOfConsumers = 1,
12356             .scale = 0.0f,
12357             .zeroPoint = 0,
12358             .lifetime = OperandLifeTime::CONSTANT_COPY,
12359             .location = {.poolIndex = 0, .offset = 60, .length = 1},
12360         },
12361         {
12362             .type = OperandType::TENSOR_FLOAT16,
12363             .dimensions = {0, 0, 0, 0},
12364             .numberOfConsumers = 0,
12365             .scale = 0.0f,
12366             .zeroPoint = 0,
12367             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12368             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12369         }
12370     };
12371 
12372     const std::vector<Operation> operations = {
12373         {
12374             .type = OperationType::BOX_WITH_NMS_LIMIT,
12375             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8},
12376             .outputs = {9, 10, 11, 12},
12377         },
12378         {
12379             .type = OperationType::ROI_ALIGN,
12380             .inputs = {13, 10, 12, 14, 15, 16, 17, 18, 19, 20},
12381             .outputs = {21},
12382         }
12383     };
12384 
12385     const std::vector<uint32_t> inputIndexes = {13};
12386     const std::vector<uint32_t> outputIndexes = {9, 11, 21};
12387     std::vector<uint8_t> operandValues = {
12388       51, 59, 102, 46, 0, 60, 0, 60, 0, 73, 0, 73, 0, 0, 0, 0, 0, 73, 0, 73, 0, 0, 0, 0, 205, 52, 255, 255, 255, 255, 0, 0, 0, 0, 102, 54, 0, 60, 205, 52, 2, 0, 0, 0, 2, 0, 0, 0, 0, 64, 0, 64, 4, 0, 0, 0, 4, 0, 0, 0, 1
12389     };
12390     const std::vector<hidl_memory> pools = {};
12391 
12392     return {
12393         .operands = operands,
12394         .operations = operations,
12395         .inputIndexes = inputIndexes,
12396         .outputIndexes = outputIndexes,
12397         .operandValues = operandValues,
12398         .pools = pools,
12399     };
12400 }
12401 
is_ignored_zero_sized_dynamic_output_shape_nchw_float16(int i)12402 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16(int i) {
12403   static std::set<int> ignore = {};
12404   return ignore.find(i) != ignore.end();
12405 }
12406 
12407 // Create the model
createTestModel_nhwc_5()12408 Model createTestModel_nhwc_5() {
12409     const std::vector<Operand> operands = {
12410         {
12411             .type = OperandType::TENSOR_FLOAT32,
12412             .dimensions = {1, 512, 8, 1},
12413             .numberOfConsumers = 1,
12414             .scale = 0.0f,
12415             .zeroPoint = 0,
12416             .lifetime = OperandLifeTime::MODEL_INPUT,
12417             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12418         },
12419         {
12420             .type = OperandType::TENSOR_FLOAT32,
12421             .dimensions = {1, 4},
12422             .numberOfConsumers = 1,
12423             .scale = 0.0f,
12424             .zeroPoint = 0,
12425             .lifetime = OperandLifeTime::MODEL_INPUT,
12426             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12427         },
12428         {
12429             .type = OperandType::TENSOR_INT32,
12430             .dimensions = {1},
12431             .numberOfConsumers = 1,
12432             .scale = 0.0f,
12433             .zeroPoint = 0,
12434             .lifetime = OperandLifeTime::CONSTANT_COPY,
12435             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12436         },
12437         {
12438             .type = OperandType::INT32,
12439             .dimensions = {},
12440             .numberOfConsumers = 1,
12441             .scale = 0.0f,
12442             .zeroPoint = 0,
12443             .lifetime = OperandLifeTime::CONSTANT_COPY,
12444             .location = {.poolIndex = 0, .offset = 4, .length = 4},
12445         },
12446         {
12447             .type = OperandType::INT32,
12448             .dimensions = {},
12449             .numberOfConsumers = 1,
12450             .scale = 0.0f,
12451             .zeroPoint = 0,
12452             .lifetime = OperandLifeTime::CONSTANT_COPY,
12453             .location = {.poolIndex = 0, .offset = 8, .length = 4},
12454         },
12455         {
12456             .type = OperandType::FLOAT32,
12457             .dimensions = {},
12458             .numberOfConsumers = 1,
12459             .scale = 0.0f,
12460             .zeroPoint = 0,
12461             .lifetime = OperandLifeTime::CONSTANT_COPY,
12462             .location = {.poolIndex = 0, .offset = 12, .length = 4},
12463         },
12464         {
12465             .type = OperandType::FLOAT32,
12466             .dimensions = {},
12467             .numberOfConsumers = 1,
12468             .scale = 0.0f,
12469             .zeroPoint = 0,
12470             .lifetime = OperandLifeTime::CONSTANT_COPY,
12471             .location = {.poolIndex = 0, .offset = 16, .length = 4},
12472         },
12473         {
12474             .type = OperandType::INT32,
12475             .dimensions = {},
12476             .numberOfConsumers = 1,
12477             .scale = 0.0f,
12478             .zeroPoint = 0,
12479             .lifetime = OperandLifeTime::CONSTANT_COPY,
12480             .location = {.poolIndex = 0, .offset = 20, .length = 4},
12481         },
12482         {
12483             .type = OperandType::INT32,
12484             .dimensions = {},
12485             .numberOfConsumers = 1,
12486             .scale = 0.0f,
12487             .zeroPoint = 0,
12488             .lifetime = OperandLifeTime::CONSTANT_COPY,
12489             .location = {.poolIndex = 0, .offset = 24, .length = 4},
12490         },
12491         {
12492             .type = OperandType::BOOL,
12493             .dimensions = {},
12494             .numberOfConsumers = 1,
12495             .scale = 0.0f,
12496             .zeroPoint = 0,
12497             .lifetime = OperandLifeTime::CONSTANT_COPY,
12498             .location = {.poolIndex = 0, .offset = 28, .length = 1},
12499         },
12500         {
12501             .type = OperandType::TENSOR_FLOAT32,
12502             .dimensions = {1, 128, 4, 1},
12503             .numberOfConsumers = 0,
12504             .scale = 0.0f,
12505             .zeroPoint = 0,
12506             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12507             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12508         }
12509     };
12510 
12511     const std::vector<Operation> operations = {
12512         {
12513             .type = OperationType::ROI_ALIGN,
12514             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
12515             .outputs = {10},
12516         }
12517     };
12518 
12519     const std::vector<uint32_t> inputIndexes = {0, 1};
12520     const std::vector<uint32_t> outputIndexes = {10};
12521     std::vector<uint8_t> operandValues = {
12522       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
12523     };
12524     const std::vector<hidl_memory> pools = {};
12525 
12526     return {
12527         .operands = operands,
12528         .operations = operations,
12529         .inputIndexes = inputIndexes,
12530         .outputIndexes = outputIndexes,
12531         .operandValues = operandValues,
12532         .pools = pools,
12533     };
12534 }
12535 
is_ignored_nhwc_5(int i)12536 inline bool is_ignored_nhwc_5(int i) {
12537   static std::set<int> ignore = {};
12538   return ignore.find(i) != ignore.end();
12539 }
12540 
12541 // Create the model
createTestModel_nhwc_relaxed_5()12542 Model createTestModel_nhwc_relaxed_5() {
12543     const std::vector<Operand> operands = {
12544         {
12545             .type = OperandType::TENSOR_FLOAT32,
12546             .dimensions = {1, 512, 8, 1},
12547             .numberOfConsumers = 1,
12548             .scale = 0.0f,
12549             .zeroPoint = 0,
12550             .lifetime = OperandLifeTime::MODEL_INPUT,
12551             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12552         },
12553         {
12554             .type = OperandType::TENSOR_FLOAT32,
12555             .dimensions = {1, 4},
12556             .numberOfConsumers = 1,
12557             .scale = 0.0f,
12558             .zeroPoint = 0,
12559             .lifetime = OperandLifeTime::MODEL_INPUT,
12560             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12561         },
12562         {
12563             .type = OperandType::TENSOR_INT32,
12564             .dimensions = {1},
12565             .numberOfConsumers = 1,
12566             .scale = 0.0f,
12567             .zeroPoint = 0,
12568             .lifetime = OperandLifeTime::CONSTANT_COPY,
12569             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12570         },
12571         {
12572             .type = OperandType::INT32,
12573             .dimensions = {},
12574             .numberOfConsumers = 1,
12575             .scale = 0.0f,
12576             .zeroPoint = 0,
12577             .lifetime = OperandLifeTime::CONSTANT_COPY,
12578             .location = {.poolIndex = 0, .offset = 4, .length = 4},
12579         },
12580         {
12581             .type = OperandType::INT32,
12582             .dimensions = {},
12583             .numberOfConsumers = 1,
12584             .scale = 0.0f,
12585             .zeroPoint = 0,
12586             .lifetime = OperandLifeTime::CONSTANT_COPY,
12587             .location = {.poolIndex = 0, .offset = 8, .length = 4},
12588         },
12589         {
12590             .type = OperandType::FLOAT32,
12591             .dimensions = {},
12592             .numberOfConsumers = 1,
12593             .scale = 0.0f,
12594             .zeroPoint = 0,
12595             .lifetime = OperandLifeTime::CONSTANT_COPY,
12596             .location = {.poolIndex = 0, .offset = 12, .length = 4},
12597         },
12598         {
12599             .type = OperandType::FLOAT32,
12600             .dimensions = {},
12601             .numberOfConsumers = 1,
12602             .scale = 0.0f,
12603             .zeroPoint = 0,
12604             .lifetime = OperandLifeTime::CONSTANT_COPY,
12605             .location = {.poolIndex = 0, .offset = 16, .length = 4},
12606         },
12607         {
12608             .type = OperandType::INT32,
12609             .dimensions = {},
12610             .numberOfConsumers = 1,
12611             .scale = 0.0f,
12612             .zeroPoint = 0,
12613             .lifetime = OperandLifeTime::CONSTANT_COPY,
12614             .location = {.poolIndex = 0, .offset = 20, .length = 4},
12615         },
12616         {
12617             .type = OperandType::INT32,
12618             .dimensions = {},
12619             .numberOfConsumers = 1,
12620             .scale = 0.0f,
12621             .zeroPoint = 0,
12622             .lifetime = OperandLifeTime::CONSTANT_COPY,
12623             .location = {.poolIndex = 0, .offset = 24, .length = 4},
12624         },
12625         {
12626             .type = OperandType::BOOL,
12627             .dimensions = {},
12628             .numberOfConsumers = 1,
12629             .scale = 0.0f,
12630             .zeroPoint = 0,
12631             .lifetime = OperandLifeTime::CONSTANT_COPY,
12632             .location = {.poolIndex = 0, .offset = 28, .length = 1},
12633         },
12634         {
12635             .type = OperandType::TENSOR_FLOAT32,
12636             .dimensions = {1, 128, 4, 1},
12637             .numberOfConsumers = 0,
12638             .scale = 0.0f,
12639             .zeroPoint = 0,
12640             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12641             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12642         }
12643     };
12644 
12645     const std::vector<Operation> operations = {
12646         {
12647             .type = OperationType::ROI_ALIGN,
12648             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
12649             .outputs = {10},
12650         }
12651     };
12652 
12653     const std::vector<uint32_t> inputIndexes = {0, 1};
12654     const std::vector<uint32_t> outputIndexes = {10};
12655     std::vector<uint8_t> operandValues = {
12656       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
12657     };
12658     const std::vector<hidl_memory> pools = {};
12659 
12660     return {
12661         .operands = operands,
12662         .operations = operations,
12663         .inputIndexes = inputIndexes,
12664         .outputIndexes = outputIndexes,
12665         .operandValues = operandValues,
12666         .pools = pools,
12667         .relaxComputationFloat32toFloat16 = true,
12668     };
12669 }
12670 
is_ignored_nhwc_relaxed_5(int i)12671 inline bool is_ignored_nhwc_relaxed_5(int i) {
12672   static std::set<int> ignore = {};
12673   return ignore.find(i) != ignore.end();
12674 }
12675 
12676 // Create the model
createTestModel_nhwc_quant8_5()12677 Model createTestModel_nhwc_quant8_5() {
12678     const std::vector<Operand> operands = {
12679         {
12680             .type = OperandType::TENSOR_QUANT8_ASYMM,
12681             .dimensions = {1, 512, 8, 1},
12682             .numberOfConsumers = 1,
12683             .scale = 0.25f,
12684             .zeroPoint = 128,
12685             .lifetime = OperandLifeTime::MODEL_INPUT,
12686             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12687         },
12688         {
12689             .type = OperandType::TENSOR_QUANT16_ASYMM,
12690             .dimensions = {1, 4},
12691             .numberOfConsumers = 1,
12692             .scale = 0.125f,
12693             .zeroPoint = 0,
12694             .lifetime = OperandLifeTime::MODEL_INPUT,
12695             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12696         },
12697         {
12698             .type = OperandType::TENSOR_INT32,
12699             .dimensions = {1},
12700             .numberOfConsumers = 1,
12701             .scale = 0.0f,
12702             .zeroPoint = 0,
12703             .lifetime = OperandLifeTime::CONSTANT_COPY,
12704             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12705         },
12706         {
12707             .type = OperandType::INT32,
12708             .dimensions = {},
12709             .numberOfConsumers = 1,
12710             .scale = 0.0f,
12711             .zeroPoint = 0,
12712             .lifetime = OperandLifeTime::CONSTANT_COPY,
12713             .location = {.poolIndex = 0, .offset = 4, .length = 4},
12714         },
12715         {
12716             .type = OperandType::INT32,
12717             .dimensions = {},
12718             .numberOfConsumers = 1,
12719             .scale = 0.0f,
12720             .zeroPoint = 0,
12721             .lifetime = OperandLifeTime::CONSTANT_COPY,
12722             .location = {.poolIndex = 0, .offset = 8, .length = 4},
12723         },
12724         {
12725             .type = OperandType::FLOAT32,
12726             .dimensions = {},
12727             .numberOfConsumers = 1,
12728             .scale = 0.0f,
12729             .zeroPoint = 0,
12730             .lifetime = OperandLifeTime::CONSTANT_COPY,
12731             .location = {.poolIndex = 0, .offset = 12, .length = 4},
12732         },
12733         {
12734             .type = OperandType::FLOAT32,
12735             .dimensions = {},
12736             .numberOfConsumers = 1,
12737             .scale = 0.0f,
12738             .zeroPoint = 0,
12739             .lifetime = OperandLifeTime::CONSTANT_COPY,
12740             .location = {.poolIndex = 0, .offset = 16, .length = 4},
12741         },
12742         {
12743             .type = OperandType::INT32,
12744             .dimensions = {},
12745             .numberOfConsumers = 1,
12746             .scale = 0.0f,
12747             .zeroPoint = 0,
12748             .lifetime = OperandLifeTime::CONSTANT_COPY,
12749             .location = {.poolIndex = 0, .offset = 20, .length = 4},
12750         },
12751         {
12752             .type = OperandType::INT32,
12753             .dimensions = {},
12754             .numberOfConsumers = 1,
12755             .scale = 0.0f,
12756             .zeroPoint = 0,
12757             .lifetime = OperandLifeTime::CONSTANT_COPY,
12758             .location = {.poolIndex = 0, .offset = 24, .length = 4},
12759         },
12760         {
12761             .type = OperandType::BOOL,
12762             .dimensions = {},
12763             .numberOfConsumers = 1,
12764             .scale = 0.0f,
12765             .zeroPoint = 0,
12766             .lifetime = OperandLifeTime::CONSTANT_COPY,
12767             .location = {.poolIndex = 0, .offset = 28, .length = 1},
12768         },
12769         {
12770             .type = OperandType::TENSOR_QUANT8_ASYMM,
12771             .dimensions = {1, 128, 4, 1},
12772             .numberOfConsumers = 0,
12773             .scale = 0.0625f,
12774             .zeroPoint = 128,
12775             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12776             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12777         }
12778     };
12779 
12780     const std::vector<Operation> operations = {
12781         {
12782             .type = OperationType::ROI_ALIGN,
12783             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
12784             .outputs = {10},
12785         }
12786     };
12787 
12788     const std::vector<uint32_t> inputIndexes = {0, 1};
12789     const std::vector<uint32_t> outputIndexes = {10};
12790     std::vector<uint8_t> operandValues = {
12791       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
12792     };
12793     const std::vector<hidl_memory> pools = {};
12794 
12795     return {
12796         .operands = operands,
12797         .operations = operations,
12798         .inputIndexes = inputIndexes,
12799         .outputIndexes = outputIndexes,
12800         .operandValues = operandValues,
12801         .pools = pools,
12802     };
12803 }
12804 
is_ignored_nhwc_quant8_5(int i)12805 inline bool is_ignored_nhwc_quant8_5(int i) {
12806   static std::set<int> ignore = {};
12807   return ignore.find(i) != ignore.end();
12808 }
12809 
12810 // Create the model
createTestModel_nhwc_float16_5()12811 Model createTestModel_nhwc_float16_5() {
12812     const std::vector<Operand> operands = {
12813         {
12814             .type = OperandType::TENSOR_FLOAT16,
12815             .dimensions = {1, 512, 8, 1},
12816             .numberOfConsumers = 1,
12817             .scale = 0.0f,
12818             .zeroPoint = 0,
12819             .lifetime = OperandLifeTime::MODEL_INPUT,
12820             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12821         },
12822         {
12823             .type = OperandType::TENSOR_FLOAT16,
12824             .dimensions = {1, 4},
12825             .numberOfConsumers = 1,
12826             .scale = 0.0f,
12827             .zeroPoint = 0,
12828             .lifetime = OperandLifeTime::MODEL_INPUT,
12829             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12830         },
12831         {
12832             .type = OperandType::TENSOR_INT32,
12833             .dimensions = {1},
12834             .numberOfConsumers = 1,
12835             .scale = 0.0f,
12836             .zeroPoint = 0,
12837             .lifetime = OperandLifeTime::CONSTANT_COPY,
12838             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12839         },
12840         {
12841             .type = OperandType::INT32,
12842             .dimensions = {},
12843             .numberOfConsumers = 1,
12844             .scale = 0.0f,
12845             .zeroPoint = 0,
12846             .lifetime = OperandLifeTime::CONSTANT_COPY,
12847             .location = {.poolIndex = 0, .offset = 4, .length = 4},
12848         },
12849         {
12850             .type = OperandType::INT32,
12851             .dimensions = {},
12852             .numberOfConsumers = 1,
12853             .scale = 0.0f,
12854             .zeroPoint = 0,
12855             .lifetime = OperandLifeTime::CONSTANT_COPY,
12856             .location = {.poolIndex = 0, .offset = 8, .length = 4},
12857         },
12858         {
12859             .type = OperandType::FLOAT16,
12860             .dimensions = {},
12861             .numberOfConsumers = 1,
12862             .scale = 0.0f,
12863             .zeroPoint = 0,
12864             .lifetime = OperandLifeTime::CONSTANT_COPY,
12865             .location = {.poolIndex = 0, .offset = 12, .length = 2},
12866         },
12867         {
12868             .type = OperandType::FLOAT16,
12869             .dimensions = {},
12870             .numberOfConsumers = 1,
12871             .scale = 0.0f,
12872             .zeroPoint = 0,
12873             .lifetime = OperandLifeTime::CONSTANT_COPY,
12874             .location = {.poolIndex = 0, .offset = 14, .length = 2},
12875         },
12876         {
12877             .type = OperandType::INT32,
12878             .dimensions = {},
12879             .numberOfConsumers = 1,
12880             .scale = 0.0f,
12881             .zeroPoint = 0,
12882             .lifetime = OperandLifeTime::CONSTANT_COPY,
12883             .location = {.poolIndex = 0, .offset = 16, .length = 4},
12884         },
12885         {
12886             .type = OperandType::INT32,
12887             .dimensions = {},
12888             .numberOfConsumers = 1,
12889             .scale = 0.0f,
12890             .zeroPoint = 0,
12891             .lifetime = OperandLifeTime::CONSTANT_COPY,
12892             .location = {.poolIndex = 0, .offset = 20, .length = 4},
12893         },
12894         {
12895             .type = OperandType::BOOL,
12896             .dimensions = {},
12897             .numberOfConsumers = 1,
12898             .scale = 0.0f,
12899             .zeroPoint = 0,
12900             .lifetime = OperandLifeTime::CONSTANT_COPY,
12901             .location = {.poolIndex = 0, .offset = 24, .length = 1},
12902         },
12903         {
12904             .type = OperandType::TENSOR_FLOAT16,
12905             .dimensions = {1, 128, 4, 1},
12906             .numberOfConsumers = 0,
12907             .scale = 0.0f,
12908             .zeroPoint = 0,
12909             .lifetime = OperandLifeTime::MODEL_OUTPUT,
12910             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12911         }
12912     };
12913 
12914     const std::vector<Operation> operations = {
12915         {
12916             .type = OperationType::ROI_ALIGN,
12917             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
12918             .outputs = {10},
12919         }
12920     };
12921 
12922     const std::vector<uint32_t> inputIndexes = {0, 1};
12923     const std::vector<uint32_t> outputIndexes = {10};
12924     std::vector<uint8_t> operandValues = {
12925       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 60, 0, 84, 10, 0, 0, 0, 10, 0, 0, 0, 0
12926     };
12927     const std::vector<hidl_memory> pools = {};
12928 
12929     return {
12930         .operands = operands,
12931         .operations = operations,
12932         .inputIndexes = inputIndexes,
12933         .outputIndexes = outputIndexes,
12934         .operandValues = operandValues,
12935         .pools = pools,
12936     };
12937 }
12938 
is_ignored_nhwc_float16_5(int i)12939 inline bool is_ignored_nhwc_float16_5(int i) {
12940   static std::set<int> ignore = {};
12941   return ignore.find(i) != ignore.end();
12942 }
12943 
12944 // Create the model
createTestModel_nchw_5()12945 Model createTestModel_nchw_5() {
12946     const std::vector<Operand> operands = {
12947         {
12948             .type = OperandType::TENSOR_FLOAT32,
12949             .dimensions = {1, 1, 512, 8},
12950             .numberOfConsumers = 1,
12951             .scale = 0.0f,
12952             .zeroPoint = 0,
12953             .lifetime = OperandLifeTime::MODEL_INPUT,
12954             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12955         },
12956         {
12957             .type = OperandType::TENSOR_FLOAT32,
12958             .dimensions = {1, 4},
12959             .numberOfConsumers = 1,
12960             .scale = 0.0f,
12961             .zeroPoint = 0,
12962             .lifetime = OperandLifeTime::MODEL_INPUT,
12963             .location = {.poolIndex = 0, .offset = 0, .length = 0},
12964         },
12965         {
12966             .type = OperandType::TENSOR_INT32,
12967             .dimensions = {1},
12968             .numberOfConsumers = 1,
12969             .scale = 0.0f,
12970             .zeroPoint = 0,
12971             .lifetime = OperandLifeTime::CONSTANT_COPY,
12972             .location = {.poolIndex = 0, .offset = 0, .length = 4},
12973         },
12974         {
12975             .type = OperandType::INT32,
12976             .dimensions = {},
12977             .numberOfConsumers = 1,
12978             .scale = 0.0f,
12979             .zeroPoint = 0,
12980             .lifetime = OperandLifeTime::CONSTANT_COPY,
12981             .location = {.poolIndex = 0, .offset = 4, .length = 4},
12982         },
12983         {
12984             .type = OperandType::INT32,
12985             .dimensions = {},
12986             .numberOfConsumers = 1,
12987             .scale = 0.0f,
12988             .zeroPoint = 0,
12989             .lifetime = OperandLifeTime::CONSTANT_COPY,
12990             .location = {.poolIndex = 0, .offset = 8, .length = 4},
12991         },
12992         {
12993             .type = OperandType::FLOAT32,
12994             .dimensions = {},
12995             .numberOfConsumers = 1,
12996             .scale = 0.0f,
12997             .zeroPoint = 0,
12998             .lifetime = OperandLifeTime::CONSTANT_COPY,
12999             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13000         },
13001         {
13002             .type = OperandType::FLOAT32,
13003             .dimensions = {},
13004             .numberOfConsumers = 1,
13005             .scale = 0.0f,
13006             .zeroPoint = 0,
13007             .lifetime = OperandLifeTime::CONSTANT_COPY,
13008             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13009         },
13010         {
13011             .type = OperandType::INT32,
13012             .dimensions = {},
13013             .numberOfConsumers = 1,
13014             .scale = 0.0f,
13015             .zeroPoint = 0,
13016             .lifetime = OperandLifeTime::CONSTANT_COPY,
13017             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13018         },
13019         {
13020             .type = OperandType::INT32,
13021             .dimensions = {},
13022             .numberOfConsumers = 1,
13023             .scale = 0.0f,
13024             .zeroPoint = 0,
13025             .lifetime = OperandLifeTime::CONSTANT_COPY,
13026             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13027         },
13028         {
13029             .type = OperandType::BOOL,
13030             .dimensions = {},
13031             .numberOfConsumers = 1,
13032             .scale = 0.0f,
13033             .zeroPoint = 0,
13034             .lifetime = OperandLifeTime::CONSTANT_COPY,
13035             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13036         },
13037         {
13038             .type = OperandType::TENSOR_FLOAT32,
13039             .dimensions = {1, 1, 128, 4},
13040             .numberOfConsumers = 0,
13041             .scale = 0.0f,
13042             .zeroPoint = 0,
13043             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13044             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13045         }
13046     };
13047 
13048     const std::vector<Operation> operations = {
13049         {
13050             .type = OperationType::ROI_ALIGN,
13051             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13052             .outputs = {10},
13053         }
13054     };
13055 
13056     const std::vector<uint32_t> inputIndexes = {0, 1};
13057     const std::vector<uint32_t> outputIndexes = {10};
13058     std::vector<uint8_t> operandValues = {
13059       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
13060     };
13061     const std::vector<hidl_memory> pools = {};
13062 
13063     return {
13064         .operands = operands,
13065         .operations = operations,
13066         .inputIndexes = inputIndexes,
13067         .outputIndexes = outputIndexes,
13068         .operandValues = operandValues,
13069         .pools = pools,
13070     };
13071 }
13072 
is_ignored_nchw_5(int i)13073 inline bool is_ignored_nchw_5(int i) {
13074   static std::set<int> ignore = {};
13075   return ignore.find(i) != ignore.end();
13076 }
13077 
13078 // Create the model
createTestModel_nchw_relaxed_5()13079 Model createTestModel_nchw_relaxed_5() {
13080     const std::vector<Operand> operands = {
13081         {
13082             .type = OperandType::TENSOR_FLOAT32,
13083             .dimensions = {1, 1, 512, 8},
13084             .numberOfConsumers = 1,
13085             .scale = 0.0f,
13086             .zeroPoint = 0,
13087             .lifetime = OperandLifeTime::MODEL_INPUT,
13088             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13089         },
13090         {
13091             .type = OperandType::TENSOR_FLOAT32,
13092             .dimensions = {1, 4},
13093             .numberOfConsumers = 1,
13094             .scale = 0.0f,
13095             .zeroPoint = 0,
13096             .lifetime = OperandLifeTime::MODEL_INPUT,
13097             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13098         },
13099         {
13100             .type = OperandType::TENSOR_INT32,
13101             .dimensions = {1},
13102             .numberOfConsumers = 1,
13103             .scale = 0.0f,
13104             .zeroPoint = 0,
13105             .lifetime = OperandLifeTime::CONSTANT_COPY,
13106             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13107         },
13108         {
13109             .type = OperandType::INT32,
13110             .dimensions = {},
13111             .numberOfConsumers = 1,
13112             .scale = 0.0f,
13113             .zeroPoint = 0,
13114             .lifetime = OperandLifeTime::CONSTANT_COPY,
13115             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13116         },
13117         {
13118             .type = OperandType::INT32,
13119             .dimensions = {},
13120             .numberOfConsumers = 1,
13121             .scale = 0.0f,
13122             .zeroPoint = 0,
13123             .lifetime = OperandLifeTime::CONSTANT_COPY,
13124             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13125         },
13126         {
13127             .type = OperandType::FLOAT32,
13128             .dimensions = {},
13129             .numberOfConsumers = 1,
13130             .scale = 0.0f,
13131             .zeroPoint = 0,
13132             .lifetime = OperandLifeTime::CONSTANT_COPY,
13133             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13134         },
13135         {
13136             .type = OperandType::FLOAT32,
13137             .dimensions = {},
13138             .numberOfConsumers = 1,
13139             .scale = 0.0f,
13140             .zeroPoint = 0,
13141             .lifetime = OperandLifeTime::CONSTANT_COPY,
13142             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13143         },
13144         {
13145             .type = OperandType::INT32,
13146             .dimensions = {},
13147             .numberOfConsumers = 1,
13148             .scale = 0.0f,
13149             .zeroPoint = 0,
13150             .lifetime = OperandLifeTime::CONSTANT_COPY,
13151             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13152         },
13153         {
13154             .type = OperandType::INT32,
13155             .dimensions = {},
13156             .numberOfConsumers = 1,
13157             .scale = 0.0f,
13158             .zeroPoint = 0,
13159             .lifetime = OperandLifeTime::CONSTANT_COPY,
13160             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13161         },
13162         {
13163             .type = OperandType::BOOL,
13164             .dimensions = {},
13165             .numberOfConsumers = 1,
13166             .scale = 0.0f,
13167             .zeroPoint = 0,
13168             .lifetime = OperandLifeTime::CONSTANT_COPY,
13169             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13170         },
13171         {
13172             .type = OperandType::TENSOR_FLOAT32,
13173             .dimensions = {1, 1, 128, 4},
13174             .numberOfConsumers = 0,
13175             .scale = 0.0f,
13176             .zeroPoint = 0,
13177             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13178             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13179         }
13180     };
13181 
13182     const std::vector<Operation> operations = {
13183         {
13184             .type = OperationType::ROI_ALIGN,
13185             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13186             .outputs = {10},
13187         }
13188     };
13189 
13190     const std::vector<uint32_t> inputIndexes = {0, 1};
13191     const std::vector<uint32_t> outputIndexes = {10};
13192     std::vector<uint8_t> operandValues = {
13193       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
13194     };
13195     const std::vector<hidl_memory> pools = {};
13196 
13197     return {
13198         .operands = operands,
13199         .operations = operations,
13200         .inputIndexes = inputIndexes,
13201         .outputIndexes = outputIndexes,
13202         .operandValues = operandValues,
13203         .pools = pools,
13204         .relaxComputationFloat32toFloat16 = true,
13205     };
13206 }
13207 
is_ignored_nchw_relaxed_5(int i)13208 inline bool is_ignored_nchw_relaxed_5(int i) {
13209   static std::set<int> ignore = {};
13210   return ignore.find(i) != ignore.end();
13211 }
13212 
13213 // Create the model
createTestModel_nchw_quant8_5()13214 Model createTestModel_nchw_quant8_5() {
13215     const std::vector<Operand> operands = {
13216         {
13217             .type = OperandType::TENSOR_QUANT8_ASYMM,
13218             .dimensions = {1, 1, 512, 8},
13219             .numberOfConsumers = 1,
13220             .scale = 0.25f,
13221             .zeroPoint = 128,
13222             .lifetime = OperandLifeTime::MODEL_INPUT,
13223             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13224         },
13225         {
13226             .type = OperandType::TENSOR_QUANT16_ASYMM,
13227             .dimensions = {1, 4},
13228             .numberOfConsumers = 1,
13229             .scale = 0.125f,
13230             .zeroPoint = 0,
13231             .lifetime = OperandLifeTime::MODEL_INPUT,
13232             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13233         },
13234         {
13235             .type = OperandType::TENSOR_INT32,
13236             .dimensions = {1},
13237             .numberOfConsumers = 1,
13238             .scale = 0.0f,
13239             .zeroPoint = 0,
13240             .lifetime = OperandLifeTime::CONSTANT_COPY,
13241             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13242         },
13243         {
13244             .type = OperandType::INT32,
13245             .dimensions = {},
13246             .numberOfConsumers = 1,
13247             .scale = 0.0f,
13248             .zeroPoint = 0,
13249             .lifetime = OperandLifeTime::CONSTANT_COPY,
13250             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13251         },
13252         {
13253             .type = OperandType::INT32,
13254             .dimensions = {},
13255             .numberOfConsumers = 1,
13256             .scale = 0.0f,
13257             .zeroPoint = 0,
13258             .lifetime = OperandLifeTime::CONSTANT_COPY,
13259             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13260         },
13261         {
13262             .type = OperandType::FLOAT32,
13263             .dimensions = {},
13264             .numberOfConsumers = 1,
13265             .scale = 0.0f,
13266             .zeroPoint = 0,
13267             .lifetime = OperandLifeTime::CONSTANT_COPY,
13268             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13269         },
13270         {
13271             .type = OperandType::FLOAT32,
13272             .dimensions = {},
13273             .numberOfConsumers = 1,
13274             .scale = 0.0f,
13275             .zeroPoint = 0,
13276             .lifetime = OperandLifeTime::CONSTANT_COPY,
13277             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13278         },
13279         {
13280             .type = OperandType::INT32,
13281             .dimensions = {},
13282             .numberOfConsumers = 1,
13283             .scale = 0.0f,
13284             .zeroPoint = 0,
13285             .lifetime = OperandLifeTime::CONSTANT_COPY,
13286             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13287         },
13288         {
13289             .type = OperandType::INT32,
13290             .dimensions = {},
13291             .numberOfConsumers = 1,
13292             .scale = 0.0f,
13293             .zeroPoint = 0,
13294             .lifetime = OperandLifeTime::CONSTANT_COPY,
13295             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13296         },
13297         {
13298             .type = OperandType::BOOL,
13299             .dimensions = {},
13300             .numberOfConsumers = 1,
13301             .scale = 0.0f,
13302             .zeroPoint = 0,
13303             .lifetime = OperandLifeTime::CONSTANT_COPY,
13304             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13305         },
13306         {
13307             .type = OperandType::TENSOR_QUANT8_ASYMM,
13308             .dimensions = {1, 1, 128, 4},
13309             .numberOfConsumers = 0,
13310             .scale = 0.0625f,
13311             .zeroPoint = 128,
13312             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13313             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13314         }
13315     };
13316 
13317     const std::vector<Operation> operations = {
13318         {
13319             .type = OperationType::ROI_ALIGN,
13320             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13321             .outputs = {10},
13322         }
13323     };
13324 
13325     const std::vector<uint32_t> inputIndexes = {0, 1};
13326     const std::vector<uint32_t> outputIndexes = {10};
13327     std::vector<uint8_t> operandValues = {
13328       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
13329     };
13330     const std::vector<hidl_memory> pools = {};
13331 
13332     return {
13333         .operands = operands,
13334         .operations = operations,
13335         .inputIndexes = inputIndexes,
13336         .outputIndexes = outputIndexes,
13337         .operandValues = operandValues,
13338         .pools = pools,
13339     };
13340 }
13341 
is_ignored_nchw_quant8_5(int i)13342 inline bool is_ignored_nchw_quant8_5(int i) {
13343   static std::set<int> ignore = {};
13344   return ignore.find(i) != ignore.end();
13345 }
13346 
13347 // Create the model
createTestModel_nchw_float16_5()13348 Model createTestModel_nchw_float16_5() {
13349     const std::vector<Operand> operands = {
13350         {
13351             .type = OperandType::TENSOR_FLOAT16,
13352             .dimensions = {1, 1, 512, 8},
13353             .numberOfConsumers = 1,
13354             .scale = 0.0f,
13355             .zeroPoint = 0,
13356             .lifetime = OperandLifeTime::MODEL_INPUT,
13357             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13358         },
13359         {
13360             .type = OperandType::TENSOR_FLOAT16,
13361             .dimensions = {1, 4},
13362             .numberOfConsumers = 1,
13363             .scale = 0.0f,
13364             .zeroPoint = 0,
13365             .lifetime = OperandLifeTime::MODEL_INPUT,
13366             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13367         },
13368         {
13369             .type = OperandType::TENSOR_INT32,
13370             .dimensions = {1},
13371             .numberOfConsumers = 1,
13372             .scale = 0.0f,
13373             .zeroPoint = 0,
13374             .lifetime = OperandLifeTime::CONSTANT_COPY,
13375             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13376         },
13377         {
13378             .type = OperandType::INT32,
13379             .dimensions = {},
13380             .numberOfConsumers = 1,
13381             .scale = 0.0f,
13382             .zeroPoint = 0,
13383             .lifetime = OperandLifeTime::CONSTANT_COPY,
13384             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13385         },
13386         {
13387             .type = OperandType::INT32,
13388             .dimensions = {},
13389             .numberOfConsumers = 1,
13390             .scale = 0.0f,
13391             .zeroPoint = 0,
13392             .lifetime = OperandLifeTime::CONSTANT_COPY,
13393             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13394         },
13395         {
13396             .type = OperandType::FLOAT16,
13397             .dimensions = {},
13398             .numberOfConsumers = 1,
13399             .scale = 0.0f,
13400             .zeroPoint = 0,
13401             .lifetime = OperandLifeTime::CONSTANT_COPY,
13402             .location = {.poolIndex = 0, .offset = 12, .length = 2},
13403         },
13404         {
13405             .type = OperandType::FLOAT16,
13406             .dimensions = {},
13407             .numberOfConsumers = 1,
13408             .scale = 0.0f,
13409             .zeroPoint = 0,
13410             .lifetime = OperandLifeTime::CONSTANT_COPY,
13411             .location = {.poolIndex = 0, .offset = 14, .length = 2},
13412         },
13413         {
13414             .type = OperandType::INT32,
13415             .dimensions = {},
13416             .numberOfConsumers = 1,
13417             .scale = 0.0f,
13418             .zeroPoint = 0,
13419             .lifetime = OperandLifeTime::CONSTANT_COPY,
13420             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13421         },
13422         {
13423             .type = OperandType::INT32,
13424             .dimensions = {},
13425             .numberOfConsumers = 1,
13426             .scale = 0.0f,
13427             .zeroPoint = 0,
13428             .lifetime = OperandLifeTime::CONSTANT_COPY,
13429             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13430         },
13431         {
13432             .type = OperandType::BOOL,
13433             .dimensions = {},
13434             .numberOfConsumers = 1,
13435             .scale = 0.0f,
13436             .zeroPoint = 0,
13437             .lifetime = OperandLifeTime::CONSTANT_COPY,
13438             .location = {.poolIndex = 0, .offset = 24, .length = 1},
13439         },
13440         {
13441             .type = OperandType::TENSOR_FLOAT16,
13442             .dimensions = {1, 1, 128, 4},
13443             .numberOfConsumers = 0,
13444             .scale = 0.0f,
13445             .zeroPoint = 0,
13446             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13447             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13448         }
13449     };
13450 
13451     const std::vector<Operation> operations = {
13452         {
13453             .type = OperationType::ROI_ALIGN,
13454             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13455             .outputs = {10},
13456         }
13457     };
13458 
13459     const std::vector<uint32_t> inputIndexes = {0, 1};
13460     const std::vector<uint32_t> outputIndexes = {10};
13461     std::vector<uint8_t> operandValues = {
13462       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 60, 0, 84, 10, 0, 0, 0, 10, 0, 0, 0, 1
13463     };
13464     const std::vector<hidl_memory> pools = {};
13465 
13466     return {
13467         .operands = operands,
13468         .operations = operations,
13469         .inputIndexes = inputIndexes,
13470         .outputIndexes = outputIndexes,
13471         .operandValues = operandValues,
13472         .pools = pools,
13473     };
13474 }
13475 
is_ignored_nchw_float16_5(int i)13476 inline bool is_ignored_nchw_float16_5(int i) {
13477   static std::set<int> ignore = {};
13478   return ignore.find(i) != ignore.end();
13479 }
13480 
13481 // Create the model
createTestModel_dynamic_output_shape_nhwc_5()13482 Model createTestModel_dynamic_output_shape_nhwc_5() {
13483     const std::vector<Operand> operands = {
13484         {
13485             .type = OperandType::TENSOR_FLOAT32,
13486             .dimensions = {1, 512, 8, 1},
13487             .numberOfConsumers = 1,
13488             .scale = 0.0f,
13489             .zeroPoint = 0,
13490             .lifetime = OperandLifeTime::MODEL_INPUT,
13491             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13492         },
13493         {
13494             .type = OperandType::TENSOR_FLOAT32,
13495             .dimensions = {1, 4},
13496             .numberOfConsumers = 1,
13497             .scale = 0.0f,
13498             .zeroPoint = 0,
13499             .lifetime = OperandLifeTime::MODEL_INPUT,
13500             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13501         },
13502         {
13503             .type = OperandType::TENSOR_INT32,
13504             .dimensions = {1},
13505             .numberOfConsumers = 1,
13506             .scale = 0.0f,
13507             .zeroPoint = 0,
13508             .lifetime = OperandLifeTime::CONSTANT_COPY,
13509             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13510         },
13511         {
13512             .type = OperandType::INT32,
13513             .dimensions = {},
13514             .numberOfConsumers = 1,
13515             .scale = 0.0f,
13516             .zeroPoint = 0,
13517             .lifetime = OperandLifeTime::CONSTANT_COPY,
13518             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13519         },
13520         {
13521             .type = OperandType::INT32,
13522             .dimensions = {},
13523             .numberOfConsumers = 1,
13524             .scale = 0.0f,
13525             .zeroPoint = 0,
13526             .lifetime = OperandLifeTime::CONSTANT_COPY,
13527             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13528         },
13529         {
13530             .type = OperandType::FLOAT32,
13531             .dimensions = {},
13532             .numberOfConsumers = 1,
13533             .scale = 0.0f,
13534             .zeroPoint = 0,
13535             .lifetime = OperandLifeTime::CONSTANT_COPY,
13536             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13537         },
13538         {
13539             .type = OperandType::FLOAT32,
13540             .dimensions = {},
13541             .numberOfConsumers = 1,
13542             .scale = 0.0f,
13543             .zeroPoint = 0,
13544             .lifetime = OperandLifeTime::CONSTANT_COPY,
13545             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13546         },
13547         {
13548             .type = OperandType::INT32,
13549             .dimensions = {},
13550             .numberOfConsumers = 1,
13551             .scale = 0.0f,
13552             .zeroPoint = 0,
13553             .lifetime = OperandLifeTime::CONSTANT_COPY,
13554             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13555         },
13556         {
13557             .type = OperandType::INT32,
13558             .dimensions = {},
13559             .numberOfConsumers = 1,
13560             .scale = 0.0f,
13561             .zeroPoint = 0,
13562             .lifetime = OperandLifeTime::CONSTANT_COPY,
13563             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13564         },
13565         {
13566             .type = OperandType::BOOL,
13567             .dimensions = {},
13568             .numberOfConsumers = 1,
13569             .scale = 0.0f,
13570             .zeroPoint = 0,
13571             .lifetime = OperandLifeTime::CONSTANT_COPY,
13572             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13573         },
13574         {
13575             .type = OperandType::TENSOR_FLOAT32,
13576             .dimensions = {0, 0, 0, 0},
13577             .numberOfConsumers = 0,
13578             .scale = 0.0f,
13579             .zeroPoint = 0,
13580             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13581             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13582         }
13583     };
13584 
13585     const std::vector<Operation> operations = {
13586         {
13587             .type = OperationType::ROI_ALIGN,
13588             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13589             .outputs = {10},
13590         }
13591     };
13592 
13593     const std::vector<uint32_t> inputIndexes = {0, 1};
13594     const std::vector<uint32_t> outputIndexes = {10};
13595     std::vector<uint8_t> operandValues = {
13596       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
13597     };
13598     const std::vector<hidl_memory> pools = {};
13599 
13600     return {
13601         .operands = operands,
13602         .operations = operations,
13603         .inputIndexes = inputIndexes,
13604         .outputIndexes = outputIndexes,
13605         .operandValues = operandValues,
13606         .pools = pools,
13607     };
13608 }
13609 
is_ignored_dynamic_output_shape_nhwc_5(int i)13610 inline bool is_ignored_dynamic_output_shape_nhwc_5(int i) {
13611   static std::set<int> ignore = {};
13612   return ignore.find(i) != ignore.end();
13613 }
13614 
13615 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed_5()13616 Model createTestModel_dynamic_output_shape_nhwc_relaxed_5() {
13617     const std::vector<Operand> operands = {
13618         {
13619             .type = OperandType::TENSOR_FLOAT32,
13620             .dimensions = {1, 512, 8, 1},
13621             .numberOfConsumers = 1,
13622             .scale = 0.0f,
13623             .zeroPoint = 0,
13624             .lifetime = OperandLifeTime::MODEL_INPUT,
13625             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13626         },
13627         {
13628             .type = OperandType::TENSOR_FLOAT32,
13629             .dimensions = {1, 4},
13630             .numberOfConsumers = 1,
13631             .scale = 0.0f,
13632             .zeroPoint = 0,
13633             .lifetime = OperandLifeTime::MODEL_INPUT,
13634             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13635         },
13636         {
13637             .type = OperandType::TENSOR_INT32,
13638             .dimensions = {1},
13639             .numberOfConsumers = 1,
13640             .scale = 0.0f,
13641             .zeroPoint = 0,
13642             .lifetime = OperandLifeTime::CONSTANT_COPY,
13643             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13644         },
13645         {
13646             .type = OperandType::INT32,
13647             .dimensions = {},
13648             .numberOfConsumers = 1,
13649             .scale = 0.0f,
13650             .zeroPoint = 0,
13651             .lifetime = OperandLifeTime::CONSTANT_COPY,
13652             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13653         },
13654         {
13655             .type = OperandType::INT32,
13656             .dimensions = {},
13657             .numberOfConsumers = 1,
13658             .scale = 0.0f,
13659             .zeroPoint = 0,
13660             .lifetime = OperandLifeTime::CONSTANT_COPY,
13661             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13662         },
13663         {
13664             .type = OperandType::FLOAT32,
13665             .dimensions = {},
13666             .numberOfConsumers = 1,
13667             .scale = 0.0f,
13668             .zeroPoint = 0,
13669             .lifetime = OperandLifeTime::CONSTANT_COPY,
13670             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13671         },
13672         {
13673             .type = OperandType::FLOAT32,
13674             .dimensions = {},
13675             .numberOfConsumers = 1,
13676             .scale = 0.0f,
13677             .zeroPoint = 0,
13678             .lifetime = OperandLifeTime::CONSTANT_COPY,
13679             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13680         },
13681         {
13682             .type = OperandType::INT32,
13683             .dimensions = {},
13684             .numberOfConsumers = 1,
13685             .scale = 0.0f,
13686             .zeroPoint = 0,
13687             .lifetime = OperandLifeTime::CONSTANT_COPY,
13688             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13689         },
13690         {
13691             .type = OperandType::INT32,
13692             .dimensions = {},
13693             .numberOfConsumers = 1,
13694             .scale = 0.0f,
13695             .zeroPoint = 0,
13696             .lifetime = OperandLifeTime::CONSTANT_COPY,
13697             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13698         },
13699         {
13700             .type = OperandType::BOOL,
13701             .dimensions = {},
13702             .numberOfConsumers = 1,
13703             .scale = 0.0f,
13704             .zeroPoint = 0,
13705             .lifetime = OperandLifeTime::CONSTANT_COPY,
13706             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13707         },
13708         {
13709             .type = OperandType::TENSOR_FLOAT32,
13710             .dimensions = {0, 0, 0, 0},
13711             .numberOfConsumers = 0,
13712             .scale = 0.0f,
13713             .zeroPoint = 0,
13714             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13715             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13716         }
13717     };
13718 
13719     const std::vector<Operation> operations = {
13720         {
13721             .type = OperationType::ROI_ALIGN,
13722             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13723             .outputs = {10},
13724         }
13725     };
13726 
13727     const std::vector<uint32_t> inputIndexes = {0, 1};
13728     const std::vector<uint32_t> outputIndexes = {10};
13729     std::vector<uint8_t> operandValues = {
13730       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
13731     };
13732     const std::vector<hidl_memory> pools = {};
13733 
13734     return {
13735         .operands = operands,
13736         .operations = operations,
13737         .inputIndexes = inputIndexes,
13738         .outputIndexes = outputIndexes,
13739         .operandValues = operandValues,
13740         .pools = pools,
13741         .relaxComputationFloat32toFloat16 = true,
13742     };
13743 }
13744 
is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i)13745 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i) {
13746   static std::set<int> ignore = {};
13747   return ignore.find(i) != ignore.end();
13748 }
13749 
13750 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8_5()13751 Model createTestModel_dynamic_output_shape_nhwc_quant8_5() {
13752     const std::vector<Operand> operands = {
13753         {
13754             .type = OperandType::TENSOR_QUANT8_ASYMM,
13755             .dimensions = {1, 512, 8, 1},
13756             .numberOfConsumers = 1,
13757             .scale = 0.25f,
13758             .zeroPoint = 128,
13759             .lifetime = OperandLifeTime::MODEL_INPUT,
13760             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13761         },
13762         {
13763             .type = OperandType::TENSOR_QUANT16_ASYMM,
13764             .dimensions = {1, 4},
13765             .numberOfConsumers = 1,
13766             .scale = 0.125f,
13767             .zeroPoint = 0,
13768             .lifetime = OperandLifeTime::MODEL_INPUT,
13769             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13770         },
13771         {
13772             .type = OperandType::TENSOR_INT32,
13773             .dimensions = {1},
13774             .numberOfConsumers = 1,
13775             .scale = 0.0f,
13776             .zeroPoint = 0,
13777             .lifetime = OperandLifeTime::CONSTANT_COPY,
13778             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13779         },
13780         {
13781             .type = OperandType::INT32,
13782             .dimensions = {},
13783             .numberOfConsumers = 1,
13784             .scale = 0.0f,
13785             .zeroPoint = 0,
13786             .lifetime = OperandLifeTime::CONSTANT_COPY,
13787             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13788         },
13789         {
13790             .type = OperandType::INT32,
13791             .dimensions = {},
13792             .numberOfConsumers = 1,
13793             .scale = 0.0f,
13794             .zeroPoint = 0,
13795             .lifetime = OperandLifeTime::CONSTANT_COPY,
13796             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13797         },
13798         {
13799             .type = OperandType::FLOAT32,
13800             .dimensions = {},
13801             .numberOfConsumers = 1,
13802             .scale = 0.0f,
13803             .zeroPoint = 0,
13804             .lifetime = OperandLifeTime::CONSTANT_COPY,
13805             .location = {.poolIndex = 0, .offset = 12, .length = 4},
13806         },
13807         {
13808             .type = OperandType::FLOAT32,
13809             .dimensions = {},
13810             .numberOfConsumers = 1,
13811             .scale = 0.0f,
13812             .zeroPoint = 0,
13813             .lifetime = OperandLifeTime::CONSTANT_COPY,
13814             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13815         },
13816         {
13817             .type = OperandType::INT32,
13818             .dimensions = {},
13819             .numberOfConsumers = 1,
13820             .scale = 0.0f,
13821             .zeroPoint = 0,
13822             .lifetime = OperandLifeTime::CONSTANT_COPY,
13823             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13824         },
13825         {
13826             .type = OperandType::INT32,
13827             .dimensions = {},
13828             .numberOfConsumers = 1,
13829             .scale = 0.0f,
13830             .zeroPoint = 0,
13831             .lifetime = OperandLifeTime::CONSTANT_COPY,
13832             .location = {.poolIndex = 0, .offset = 24, .length = 4},
13833         },
13834         {
13835             .type = OperandType::BOOL,
13836             .dimensions = {},
13837             .numberOfConsumers = 1,
13838             .scale = 0.0f,
13839             .zeroPoint = 0,
13840             .lifetime = OperandLifeTime::CONSTANT_COPY,
13841             .location = {.poolIndex = 0, .offset = 28, .length = 1},
13842         },
13843         {
13844             .type = OperandType::TENSOR_QUANT8_ASYMM,
13845             .dimensions = {0, 0, 0, 0},
13846             .numberOfConsumers = 0,
13847             .scale = 0.0625f,
13848             .zeroPoint = 128,
13849             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13850             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13851         }
13852     };
13853 
13854     const std::vector<Operation> operations = {
13855         {
13856             .type = OperationType::ROI_ALIGN,
13857             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13858             .outputs = {10},
13859         }
13860     };
13861 
13862     const std::vector<uint32_t> inputIndexes = {0, 1};
13863     const std::vector<uint32_t> outputIndexes = {10};
13864     std::vector<uint8_t> operandValues = {
13865       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 0
13866     };
13867     const std::vector<hidl_memory> pools = {};
13868 
13869     return {
13870         .operands = operands,
13871         .operations = operations,
13872         .inputIndexes = inputIndexes,
13873         .outputIndexes = outputIndexes,
13874         .operandValues = operandValues,
13875         .pools = pools,
13876     };
13877 }
13878 
is_ignored_dynamic_output_shape_nhwc_quant8_5(int i)13879 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_5(int i) {
13880   static std::set<int> ignore = {};
13881   return ignore.find(i) != ignore.end();
13882 }
13883 
13884 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16_5()13885 Model createTestModel_dynamic_output_shape_nhwc_float16_5() {
13886     const std::vector<Operand> operands = {
13887         {
13888             .type = OperandType::TENSOR_FLOAT16,
13889             .dimensions = {1, 512, 8, 1},
13890             .numberOfConsumers = 1,
13891             .scale = 0.0f,
13892             .zeroPoint = 0,
13893             .lifetime = OperandLifeTime::MODEL_INPUT,
13894             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13895         },
13896         {
13897             .type = OperandType::TENSOR_FLOAT16,
13898             .dimensions = {1, 4},
13899             .numberOfConsumers = 1,
13900             .scale = 0.0f,
13901             .zeroPoint = 0,
13902             .lifetime = OperandLifeTime::MODEL_INPUT,
13903             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13904         },
13905         {
13906             .type = OperandType::TENSOR_INT32,
13907             .dimensions = {1},
13908             .numberOfConsumers = 1,
13909             .scale = 0.0f,
13910             .zeroPoint = 0,
13911             .lifetime = OperandLifeTime::CONSTANT_COPY,
13912             .location = {.poolIndex = 0, .offset = 0, .length = 4},
13913         },
13914         {
13915             .type = OperandType::INT32,
13916             .dimensions = {},
13917             .numberOfConsumers = 1,
13918             .scale = 0.0f,
13919             .zeroPoint = 0,
13920             .lifetime = OperandLifeTime::CONSTANT_COPY,
13921             .location = {.poolIndex = 0, .offset = 4, .length = 4},
13922         },
13923         {
13924             .type = OperandType::INT32,
13925             .dimensions = {},
13926             .numberOfConsumers = 1,
13927             .scale = 0.0f,
13928             .zeroPoint = 0,
13929             .lifetime = OperandLifeTime::CONSTANT_COPY,
13930             .location = {.poolIndex = 0, .offset = 8, .length = 4},
13931         },
13932         {
13933             .type = OperandType::FLOAT16,
13934             .dimensions = {},
13935             .numberOfConsumers = 1,
13936             .scale = 0.0f,
13937             .zeroPoint = 0,
13938             .lifetime = OperandLifeTime::CONSTANT_COPY,
13939             .location = {.poolIndex = 0, .offset = 12, .length = 2},
13940         },
13941         {
13942             .type = OperandType::FLOAT16,
13943             .dimensions = {},
13944             .numberOfConsumers = 1,
13945             .scale = 0.0f,
13946             .zeroPoint = 0,
13947             .lifetime = OperandLifeTime::CONSTANT_COPY,
13948             .location = {.poolIndex = 0, .offset = 14, .length = 2},
13949         },
13950         {
13951             .type = OperandType::INT32,
13952             .dimensions = {},
13953             .numberOfConsumers = 1,
13954             .scale = 0.0f,
13955             .zeroPoint = 0,
13956             .lifetime = OperandLifeTime::CONSTANT_COPY,
13957             .location = {.poolIndex = 0, .offset = 16, .length = 4},
13958         },
13959         {
13960             .type = OperandType::INT32,
13961             .dimensions = {},
13962             .numberOfConsumers = 1,
13963             .scale = 0.0f,
13964             .zeroPoint = 0,
13965             .lifetime = OperandLifeTime::CONSTANT_COPY,
13966             .location = {.poolIndex = 0, .offset = 20, .length = 4},
13967         },
13968         {
13969             .type = OperandType::BOOL,
13970             .dimensions = {},
13971             .numberOfConsumers = 1,
13972             .scale = 0.0f,
13973             .zeroPoint = 0,
13974             .lifetime = OperandLifeTime::CONSTANT_COPY,
13975             .location = {.poolIndex = 0, .offset = 24, .length = 1},
13976         },
13977         {
13978             .type = OperandType::TENSOR_FLOAT16,
13979             .dimensions = {0, 0, 0, 0},
13980             .numberOfConsumers = 0,
13981             .scale = 0.0f,
13982             .zeroPoint = 0,
13983             .lifetime = OperandLifeTime::MODEL_OUTPUT,
13984             .location = {.poolIndex = 0, .offset = 0, .length = 0},
13985         }
13986     };
13987 
13988     const std::vector<Operation> operations = {
13989         {
13990             .type = OperationType::ROI_ALIGN,
13991             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
13992             .outputs = {10},
13993         }
13994     };
13995 
13996     const std::vector<uint32_t> inputIndexes = {0, 1};
13997     const std::vector<uint32_t> outputIndexes = {10};
13998     std::vector<uint8_t> operandValues = {
13999       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 60, 0, 84, 10, 0, 0, 0, 10, 0, 0, 0, 0
14000     };
14001     const std::vector<hidl_memory> pools = {};
14002 
14003     return {
14004         .operands = operands,
14005         .operations = operations,
14006         .inputIndexes = inputIndexes,
14007         .outputIndexes = outputIndexes,
14008         .operandValues = operandValues,
14009         .pools = pools,
14010     };
14011 }
14012 
is_ignored_dynamic_output_shape_nhwc_float16_5(int i)14013 inline bool is_ignored_dynamic_output_shape_nhwc_float16_5(int i) {
14014   static std::set<int> ignore = {};
14015   return ignore.find(i) != ignore.end();
14016 }
14017 
14018 // Create the model
createTestModel_dynamic_output_shape_nchw_5()14019 Model createTestModel_dynamic_output_shape_nchw_5() {
14020     const std::vector<Operand> operands = {
14021         {
14022             .type = OperandType::TENSOR_FLOAT32,
14023             .dimensions = {1, 1, 512, 8},
14024             .numberOfConsumers = 1,
14025             .scale = 0.0f,
14026             .zeroPoint = 0,
14027             .lifetime = OperandLifeTime::MODEL_INPUT,
14028             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14029         },
14030         {
14031             .type = OperandType::TENSOR_FLOAT32,
14032             .dimensions = {1, 4},
14033             .numberOfConsumers = 1,
14034             .scale = 0.0f,
14035             .zeroPoint = 0,
14036             .lifetime = OperandLifeTime::MODEL_INPUT,
14037             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14038         },
14039         {
14040             .type = OperandType::TENSOR_INT32,
14041             .dimensions = {1},
14042             .numberOfConsumers = 1,
14043             .scale = 0.0f,
14044             .zeroPoint = 0,
14045             .lifetime = OperandLifeTime::CONSTANT_COPY,
14046             .location = {.poolIndex = 0, .offset = 0, .length = 4},
14047         },
14048         {
14049             .type = OperandType::INT32,
14050             .dimensions = {},
14051             .numberOfConsumers = 1,
14052             .scale = 0.0f,
14053             .zeroPoint = 0,
14054             .lifetime = OperandLifeTime::CONSTANT_COPY,
14055             .location = {.poolIndex = 0, .offset = 4, .length = 4},
14056         },
14057         {
14058             .type = OperandType::INT32,
14059             .dimensions = {},
14060             .numberOfConsumers = 1,
14061             .scale = 0.0f,
14062             .zeroPoint = 0,
14063             .lifetime = OperandLifeTime::CONSTANT_COPY,
14064             .location = {.poolIndex = 0, .offset = 8, .length = 4},
14065         },
14066         {
14067             .type = OperandType::FLOAT32,
14068             .dimensions = {},
14069             .numberOfConsumers = 1,
14070             .scale = 0.0f,
14071             .zeroPoint = 0,
14072             .lifetime = OperandLifeTime::CONSTANT_COPY,
14073             .location = {.poolIndex = 0, .offset = 12, .length = 4},
14074         },
14075         {
14076             .type = OperandType::FLOAT32,
14077             .dimensions = {},
14078             .numberOfConsumers = 1,
14079             .scale = 0.0f,
14080             .zeroPoint = 0,
14081             .lifetime = OperandLifeTime::CONSTANT_COPY,
14082             .location = {.poolIndex = 0, .offset = 16, .length = 4},
14083         },
14084         {
14085             .type = OperandType::INT32,
14086             .dimensions = {},
14087             .numberOfConsumers = 1,
14088             .scale = 0.0f,
14089             .zeroPoint = 0,
14090             .lifetime = OperandLifeTime::CONSTANT_COPY,
14091             .location = {.poolIndex = 0, .offset = 20, .length = 4},
14092         },
14093         {
14094             .type = OperandType::INT32,
14095             .dimensions = {},
14096             .numberOfConsumers = 1,
14097             .scale = 0.0f,
14098             .zeroPoint = 0,
14099             .lifetime = OperandLifeTime::CONSTANT_COPY,
14100             .location = {.poolIndex = 0, .offset = 24, .length = 4},
14101         },
14102         {
14103             .type = OperandType::BOOL,
14104             .dimensions = {},
14105             .numberOfConsumers = 1,
14106             .scale = 0.0f,
14107             .zeroPoint = 0,
14108             .lifetime = OperandLifeTime::CONSTANT_COPY,
14109             .location = {.poolIndex = 0, .offset = 28, .length = 1},
14110         },
14111         {
14112             .type = OperandType::TENSOR_FLOAT32,
14113             .dimensions = {0, 0, 0, 0},
14114             .numberOfConsumers = 0,
14115             .scale = 0.0f,
14116             .zeroPoint = 0,
14117             .lifetime = OperandLifeTime::MODEL_OUTPUT,
14118             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14119         }
14120     };
14121 
14122     const std::vector<Operation> operations = {
14123         {
14124             .type = OperationType::ROI_ALIGN,
14125             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
14126             .outputs = {10},
14127         }
14128     };
14129 
14130     const std::vector<uint32_t> inputIndexes = {0, 1};
14131     const std::vector<uint32_t> outputIndexes = {10};
14132     std::vector<uint8_t> operandValues = {
14133       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
14134     };
14135     const std::vector<hidl_memory> pools = {};
14136 
14137     return {
14138         .operands = operands,
14139         .operations = operations,
14140         .inputIndexes = inputIndexes,
14141         .outputIndexes = outputIndexes,
14142         .operandValues = operandValues,
14143         .pools = pools,
14144     };
14145 }
14146 
is_ignored_dynamic_output_shape_nchw_5(int i)14147 inline bool is_ignored_dynamic_output_shape_nchw_5(int i) {
14148   static std::set<int> ignore = {};
14149   return ignore.find(i) != ignore.end();
14150 }
14151 
14152 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed_5()14153 Model createTestModel_dynamic_output_shape_nchw_relaxed_5() {
14154     const std::vector<Operand> operands = {
14155         {
14156             .type = OperandType::TENSOR_FLOAT32,
14157             .dimensions = {1, 1, 512, 8},
14158             .numberOfConsumers = 1,
14159             .scale = 0.0f,
14160             .zeroPoint = 0,
14161             .lifetime = OperandLifeTime::MODEL_INPUT,
14162             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14163         },
14164         {
14165             .type = OperandType::TENSOR_FLOAT32,
14166             .dimensions = {1, 4},
14167             .numberOfConsumers = 1,
14168             .scale = 0.0f,
14169             .zeroPoint = 0,
14170             .lifetime = OperandLifeTime::MODEL_INPUT,
14171             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14172         },
14173         {
14174             .type = OperandType::TENSOR_INT32,
14175             .dimensions = {1},
14176             .numberOfConsumers = 1,
14177             .scale = 0.0f,
14178             .zeroPoint = 0,
14179             .lifetime = OperandLifeTime::CONSTANT_COPY,
14180             .location = {.poolIndex = 0, .offset = 0, .length = 4},
14181         },
14182         {
14183             .type = OperandType::INT32,
14184             .dimensions = {},
14185             .numberOfConsumers = 1,
14186             .scale = 0.0f,
14187             .zeroPoint = 0,
14188             .lifetime = OperandLifeTime::CONSTANT_COPY,
14189             .location = {.poolIndex = 0, .offset = 4, .length = 4},
14190         },
14191         {
14192             .type = OperandType::INT32,
14193             .dimensions = {},
14194             .numberOfConsumers = 1,
14195             .scale = 0.0f,
14196             .zeroPoint = 0,
14197             .lifetime = OperandLifeTime::CONSTANT_COPY,
14198             .location = {.poolIndex = 0, .offset = 8, .length = 4},
14199         },
14200         {
14201             .type = OperandType::FLOAT32,
14202             .dimensions = {},
14203             .numberOfConsumers = 1,
14204             .scale = 0.0f,
14205             .zeroPoint = 0,
14206             .lifetime = OperandLifeTime::CONSTANT_COPY,
14207             .location = {.poolIndex = 0, .offset = 12, .length = 4},
14208         },
14209         {
14210             .type = OperandType::FLOAT32,
14211             .dimensions = {},
14212             .numberOfConsumers = 1,
14213             .scale = 0.0f,
14214             .zeroPoint = 0,
14215             .lifetime = OperandLifeTime::CONSTANT_COPY,
14216             .location = {.poolIndex = 0, .offset = 16, .length = 4},
14217         },
14218         {
14219             .type = OperandType::INT32,
14220             .dimensions = {},
14221             .numberOfConsumers = 1,
14222             .scale = 0.0f,
14223             .zeroPoint = 0,
14224             .lifetime = OperandLifeTime::CONSTANT_COPY,
14225             .location = {.poolIndex = 0, .offset = 20, .length = 4},
14226         },
14227         {
14228             .type = OperandType::INT32,
14229             .dimensions = {},
14230             .numberOfConsumers = 1,
14231             .scale = 0.0f,
14232             .zeroPoint = 0,
14233             .lifetime = OperandLifeTime::CONSTANT_COPY,
14234             .location = {.poolIndex = 0, .offset = 24, .length = 4},
14235         },
14236         {
14237             .type = OperandType::BOOL,
14238             .dimensions = {},
14239             .numberOfConsumers = 1,
14240             .scale = 0.0f,
14241             .zeroPoint = 0,
14242             .lifetime = OperandLifeTime::CONSTANT_COPY,
14243             .location = {.poolIndex = 0, .offset = 28, .length = 1},
14244         },
14245         {
14246             .type = OperandType::TENSOR_FLOAT32,
14247             .dimensions = {0, 0, 0, 0},
14248             .numberOfConsumers = 0,
14249             .scale = 0.0f,
14250             .zeroPoint = 0,
14251             .lifetime = OperandLifeTime::MODEL_OUTPUT,
14252             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14253         }
14254     };
14255 
14256     const std::vector<Operation> operations = {
14257         {
14258             .type = OperationType::ROI_ALIGN,
14259             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
14260             .outputs = {10},
14261         }
14262     };
14263 
14264     const std::vector<uint32_t> inputIndexes = {0, 1};
14265     const std::vector<uint32_t> outputIndexes = {10};
14266     std::vector<uint8_t> operandValues = {
14267       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
14268     };
14269     const std::vector<hidl_memory> pools = {};
14270 
14271     return {
14272         .operands = operands,
14273         .operations = operations,
14274         .inputIndexes = inputIndexes,
14275         .outputIndexes = outputIndexes,
14276         .operandValues = operandValues,
14277         .pools = pools,
14278         .relaxComputationFloat32toFloat16 = true,
14279     };
14280 }
14281 
is_ignored_dynamic_output_shape_nchw_relaxed_5(int i)14282 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_5(int i) {
14283   static std::set<int> ignore = {};
14284   return ignore.find(i) != ignore.end();
14285 }
14286 
14287 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8_5()14288 Model createTestModel_dynamic_output_shape_nchw_quant8_5() {
14289     const std::vector<Operand> operands = {
14290         {
14291             .type = OperandType::TENSOR_QUANT8_ASYMM,
14292             .dimensions = {1, 1, 512, 8},
14293             .numberOfConsumers = 1,
14294             .scale = 0.25f,
14295             .zeroPoint = 128,
14296             .lifetime = OperandLifeTime::MODEL_INPUT,
14297             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14298         },
14299         {
14300             .type = OperandType::TENSOR_QUANT16_ASYMM,
14301             .dimensions = {1, 4},
14302             .numberOfConsumers = 1,
14303             .scale = 0.125f,
14304             .zeroPoint = 0,
14305             .lifetime = OperandLifeTime::MODEL_INPUT,
14306             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14307         },
14308         {
14309             .type = OperandType::TENSOR_INT32,
14310             .dimensions = {1},
14311             .numberOfConsumers = 1,
14312             .scale = 0.0f,
14313             .zeroPoint = 0,
14314             .lifetime = OperandLifeTime::CONSTANT_COPY,
14315             .location = {.poolIndex = 0, .offset = 0, .length = 4},
14316         },
14317         {
14318             .type = OperandType::INT32,
14319             .dimensions = {},
14320             .numberOfConsumers = 1,
14321             .scale = 0.0f,
14322             .zeroPoint = 0,
14323             .lifetime = OperandLifeTime::CONSTANT_COPY,
14324             .location = {.poolIndex = 0, .offset = 4, .length = 4},
14325         },
14326         {
14327             .type = OperandType::INT32,
14328             .dimensions = {},
14329             .numberOfConsumers = 1,
14330             .scale = 0.0f,
14331             .zeroPoint = 0,
14332             .lifetime = OperandLifeTime::CONSTANT_COPY,
14333             .location = {.poolIndex = 0, .offset = 8, .length = 4},
14334         },
14335         {
14336             .type = OperandType::FLOAT32,
14337             .dimensions = {},
14338             .numberOfConsumers = 1,
14339             .scale = 0.0f,
14340             .zeroPoint = 0,
14341             .lifetime = OperandLifeTime::CONSTANT_COPY,
14342             .location = {.poolIndex = 0, .offset = 12, .length = 4},
14343         },
14344         {
14345             .type = OperandType::FLOAT32,
14346             .dimensions = {},
14347             .numberOfConsumers = 1,
14348             .scale = 0.0f,
14349             .zeroPoint = 0,
14350             .lifetime = OperandLifeTime::CONSTANT_COPY,
14351             .location = {.poolIndex = 0, .offset = 16, .length = 4},
14352         },
14353         {
14354             .type = OperandType::INT32,
14355             .dimensions = {},
14356             .numberOfConsumers = 1,
14357             .scale = 0.0f,
14358             .zeroPoint = 0,
14359             .lifetime = OperandLifeTime::CONSTANT_COPY,
14360             .location = {.poolIndex = 0, .offset = 20, .length = 4},
14361         },
14362         {
14363             .type = OperandType::INT32,
14364             .dimensions = {},
14365             .numberOfConsumers = 1,
14366             .scale = 0.0f,
14367             .zeroPoint = 0,
14368             .lifetime = OperandLifeTime::CONSTANT_COPY,
14369             .location = {.poolIndex = 0, .offset = 24, .length = 4},
14370         },
14371         {
14372             .type = OperandType::BOOL,
14373             .dimensions = {},
14374             .numberOfConsumers = 1,
14375             .scale = 0.0f,
14376             .zeroPoint = 0,
14377             .lifetime = OperandLifeTime::CONSTANT_COPY,
14378             .location = {.poolIndex = 0, .offset = 28, .length = 1},
14379         },
14380         {
14381             .type = OperandType::TENSOR_QUANT8_ASYMM,
14382             .dimensions = {0, 0, 0, 0},
14383             .numberOfConsumers = 0,
14384             .scale = 0.0625f,
14385             .zeroPoint = 128,
14386             .lifetime = OperandLifeTime::MODEL_OUTPUT,
14387             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14388         }
14389     };
14390 
14391     const std::vector<Operation> operations = {
14392         {
14393             .type = OperationType::ROI_ALIGN,
14394             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
14395             .outputs = {10},
14396         }
14397     };
14398 
14399     const std::vector<uint32_t> inputIndexes = {0, 1};
14400     const std::vector<uint32_t> outputIndexes = {10};
14401     std::vector<uint8_t> operandValues = {
14402       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 66, 10, 0, 0, 0, 10, 0, 0, 0, 1
14403     };
14404     const std::vector<hidl_memory> pools = {};
14405 
14406     return {
14407         .operands = operands,
14408         .operations = operations,
14409         .inputIndexes = inputIndexes,
14410         .outputIndexes = outputIndexes,
14411         .operandValues = operandValues,
14412         .pools = pools,
14413     };
14414 }
14415 
is_ignored_dynamic_output_shape_nchw_quant8_5(int i)14416 inline bool is_ignored_dynamic_output_shape_nchw_quant8_5(int i) {
14417   static std::set<int> ignore = {};
14418   return ignore.find(i) != ignore.end();
14419 }
14420 
14421 // Create the model
createTestModel_dynamic_output_shape_nchw_float16_5()14422 Model createTestModel_dynamic_output_shape_nchw_float16_5() {
14423     const std::vector<Operand> operands = {
14424         {
14425             .type = OperandType::TENSOR_FLOAT16,
14426             .dimensions = {1, 1, 512, 8},
14427             .numberOfConsumers = 1,
14428             .scale = 0.0f,
14429             .zeroPoint = 0,
14430             .lifetime = OperandLifeTime::MODEL_INPUT,
14431             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14432         },
14433         {
14434             .type = OperandType::TENSOR_FLOAT16,
14435             .dimensions = {1, 4},
14436             .numberOfConsumers = 1,
14437             .scale = 0.0f,
14438             .zeroPoint = 0,
14439             .lifetime = OperandLifeTime::MODEL_INPUT,
14440             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14441         },
14442         {
14443             .type = OperandType::TENSOR_INT32,
14444             .dimensions = {1},
14445             .numberOfConsumers = 1,
14446             .scale = 0.0f,
14447             .zeroPoint = 0,
14448             .lifetime = OperandLifeTime::CONSTANT_COPY,
14449             .location = {.poolIndex = 0, .offset = 0, .length = 4},
14450         },
14451         {
14452             .type = OperandType::INT32,
14453             .dimensions = {},
14454             .numberOfConsumers = 1,
14455             .scale = 0.0f,
14456             .zeroPoint = 0,
14457             .lifetime = OperandLifeTime::CONSTANT_COPY,
14458             .location = {.poolIndex = 0, .offset = 4, .length = 4},
14459         },
14460         {
14461             .type = OperandType::INT32,
14462             .dimensions = {},
14463             .numberOfConsumers = 1,
14464             .scale = 0.0f,
14465             .zeroPoint = 0,
14466             .lifetime = OperandLifeTime::CONSTANT_COPY,
14467             .location = {.poolIndex = 0, .offset = 8, .length = 4},
14468         },
14469         {
14470             .type = OperandType::FLOAT16,
14471             .dimensions = {},
14472             .numberOfConsumers = 1,
14473             .scale = 0.0f,
14474             .zeroPoint = 0,
14475             .lifetime = OperandLifeTime::CONSTANT_COPY,
14476             .location = {.poolIndex = 0, .offset = 12, .length = 2},
14477         },
14478         {
14479             .type = OperandType::FLOAT16,
14480             .dimensions = {},
14481             .numberOfConsumers = 1,
14482             .scale = 0.0f,
14483             .zeroPoint = 0,
14484             .lifetime = OperandLifeTime::CONSTANT_COPY,
14485             .location = {.poolIndex = 0, .offset = 14, .length = 2},
14486         },
14487         {
14488             .type = OperandType::INT32,
14489             .dimensions = {},
14490             .numberOfConsumers = 1,
14491             .scale = 0.0f,
14492             .zeroPoint = 0,
14493             .lifetime = OperandLifeTime::CONSTANT_COPY,
14494             .location = {.poolIndex = 0, .offset = 16, .length = 4},
14495         },
14496         {
14497             .type = OperandType::INT32,
14498             .dimensions = {},
14499             .numberOfConsumers = 1,
14500             .scale = 0.0f,
14501             .zeroPoint = 0,
14502             .lifetime = OperandLifeTime::CONSTANT_COPY,
14503             .location = {.poolIndex = 0, .offset = 20, .length = 4},
14504         },
14505         {
14506             .type = OperandType::BOOL,
14507             .dimensions = {},
14508             .numberOfConsumers = 1,
14509             .scale = 0.0f,
14510             .zeroPoint = 0,
14511             .lifetime = OperandLifeTime::CONSTANT_COPY,
14512             .location = {.poolIndex = 0, .offset = 24, .length = 1},
14513         },
14514         {
14515             .type = OperandType::TENSOR_FLOAT16,
14516             .dimensions = {0, 0, 0, 0},
14517             .numberOfConsumers = 0,
14518             .scale = 0.0f,
14519             .zeroPoint = 0,
14520             .lifetime = OperandLifeTime::MODEL_OUTPUT,
14521             .location = {.poolIndex = 0, .offset = 0, .length = 0},
14522         }
14523     };
14524 
14525     const std::vector<Operation> operations = {
14526         {
14527             .type = OperationType::ROI_ALIGN,
14528             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
14529             .outputs = {10},
14530         }
14531     };
14532 
14533     const std::vector<uint32_t> inputIndexes = {0, 1};
14534     const std::vector<uint32_t> outputIndexes = {10};
14535     std::vector<uint8_t> operandValues = {
14536       0, 0, 0, 0, 128, 0, 0, 0, 4, 0, 0, 0, 0, 60, 0, 84, 10, 0, 0, 0, 10, 0, 0, 0, 1
14537     };
14538     const std::vector<hidl_memory> pools = {};
14539 
14540     return {
14541         .operands = operands,
14542         .operations = operations,
14543         .inputIndexes = inputIndexes,
14544         .outputIndexes = outputIndexes,
14545         .operandValues = operandValues,
14546         .pools = pools,
14547     };
14548 }
14549 
is_ignored_dynamic_output_shape_nchw_float16_5(int i)14550 inline bool is_ignored_dynamic_output_shape_nchw_float16_5(int i) {
14551   static std::set<int> ignore = {};
14552   return ignore.find(i) != ignore.end();
14553 }
14554 
14555