1 // clang-format off
2 // Generated file (from: generate_proposals.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, 2, 2, 2},
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 = {1, 2, 2, 8},
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_FLOAT32,
26             .dimensions = {2, 4},
27             .numberOfConsumers = 1,
28             .scale = 0.0f,
29             .zeroPoint = 0,
30             .lifetime = OperandLifeTime::MODEL_INPUT,
31             .location = {.poolIndex = 0, .offset = 0, .length = 0},
32         },
33         {
34             .type = OperandType::TENSOR_FLOAT32,
35             .dimensions = {1, 2},
36             .numberOfConsumers = 1,
37             .scale = 0.0f,
38             .zeroPoint = 0,
39             .lifetime = OperandLifeTime::MODEL_INPUT,
40             .location = {.poolIndex = 0, .offset = 0, .length = 0},
41         },
42         {
43             .type = OperandType::FLOAT32,
44             .dimensions = {},
45             .numberOfConsumers = 1,
46             .scale = 0.0f,
47             .zeroPoint = 0,
48             .lifetime = OperandLifeTime::CONSTANT_COPY,
49             .location = {.poolIndex = 0, .offset = 0, .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 = 4, .length = 4},
59         },
60         {
61             .type = OperandType::INT32,
62             .dimensions = {},
63             .numberOfConsumers = 1,
64             .scale = 0.0f,
65             .zeroPoint = 0,
66             .lifetime = OperandLifeTime::CONSTANT_COPY,
67             .location = {.poolIndex = 0, .offset = 8, .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 = 12, .length = 4},
77         },
78         {
79             .type = OperandType::FLOAT32,
80             .dimensions = {},
81             .numberOfConsumers = 1,
82             .scale = 0.0f,
83             .zeroPoint = 0,
84             .lifetime = OperandLifeTime::CONSTANT_COPY,
85             .location = {.poolIndex = 0, .offset = 16, .length = 4},
86         },
87         {
88             .type = OperandType::FLOAT32,
89             .dimensions = {},
90             .numberOfConsumers = 1,
91             .scale = 0.0f,
92             .zeroPoint = 0,
93             .lifetime = OperandLifeTime::CONSTANT_COPY,
94             .location = {.poolIndex = 0, .offset = 20, .length = 4},
95         },
96         {
97             .type = OperandType::BOOL,
98             .dimensions = {},
99             .numberOfConsumers = 1,
100             .scale = 0.0f,
101             .zeroPoint = 0,
102             .lifetime = OperandLifeTime::CONSTANT_COPY,
103             .location = {.poolIndex = 0, .offset = 24, .length = 1},
104         },
105         {
106             .type = OperandType::TENSOR_FLOAT32,
107             .dimensions = {4},
108             .numberOfConsumers = 0,
109             .scale = 0.0f,
110             .zeroPoint = 0,
111             .lifetime = OperandLifeTime::MODEL_OUTPUT,
112             .location = {.poolIndex = 0, .offset = 0, .length = 0},
113         },
114         {
115             .type = OperandType::TENSOR_FLOAT32,
116             .dimensions = {4, 4},
117             .numberOfConsumers = 0,
118             .scale = 0.0f,
119             .zeroPoint = 0,
120             .lifetime = OperandLifeTime::MODEL_OUTPUT,
121             .location = {.poolIndex = 0, .offset = 0, .length = 0},
122         },
123         {
124             .type = OperandType::TENSOR_INT32,
125             .dimensions = {4},
126             .numberOfConsumers = 0,
127             .scale = 0.0f,
128             .zeroPoint = 0,
129             .lifetime = OperandLifeTime::MODEL_OUTPUT,
130             .location = {.poolIndex = 0, .offset = 0, .length = 0},
131         }
132     };
133 
134     const std::vector<Operation> operations = {
135         {
136             .type = OperationType::GENERATE_PROPOSALS,
137             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
138             .outputs = {11, 12, 13},
139         }
140     };
141 
142     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
143     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
144     std::vector<uint8_t> operandValues = {
145       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
146     };
147     const std::vector<hidl_memory> pools = {};
148 
149     return {
150         .operands = operands,
151         .operations = operations,
152         .inputIndexes = inputIndexes,
153         .outputIndexes = outputIndexes,
154         .operandValues = operandValues,
155         .pools = pools,
156     };
157 }
158 
is_ignored_nhwc(int i)159 inline bool is_ignored_nhwc(int i) {
160   static std::set<int> ignore = {};
161   return ignore.find(i) != ignore.end();
162 }
163 
164 // Create the model
createTestModel_nhwc_relaxed()165 Model createTestModel_nhwc_relaxed() {
166     const std::vector<Operand> operands = {
167         {
168             .type = OperandType::TENSOR_FLOAT32,
169             .dimensions = {1, 2, 2, 2},
170             .numberOfConsumers = 1,
171             .scale = 0.0f,
172             .zeroPoint = 0,
173             .lifetime = OperandLifeTime::MODEL_INPUT,
174             .location = {.poolIndex = 0, .offset = 0, .length = 0},
175         },
176         {
177             .type = OperandType::TENSOR_FLOAT32,
178             .dimensions = {1, 2, 2, 8},
179             .numberOfConsumers = 1,
180             .scale = 0.0f,
181             .zeroPoint = 0,
182             .lifetime = OperandLifeTime::MODEL_INPUT,
183             .location = {.poolIndex = 0, .offset = 0, .length = 0},
184         },
185         {
186             .type = OperandType::TENSOR_FLOAT32,
187             .dimensions = {2, 4},
188             .numberOfConsumers = 1,
189             .scale = 0.0f,
190             .zeroPoint = 0,
191             .lifetime = OperandLifeTime::MODEL_INPUT,
192             .location = {.poolIndex = 0, .offset = 0, .length = 0},
193         },
194         {
195             .type = OperandType::TENSOR_FLOAT32,
196             .dimensions = {1, 2},
197             .numberOfConsumers = 1,
198             .scale = 0.0f,
199             .zeroPoint = 0,
200             .lifetime = OperandLifeTime::MODEL_INPUT,
201             .location = {.poolIndex = 0, .offset = 0, .length = 0},
202         },
203         {
204             .type = OperandType::FLOAT32,
205             .dimensions = {},
206             .numberOfConsumers = 1,
207             .scale = 0.0f,
208             .zeroPoint = 0,
209             .lifetime = OperandLifeTime::CONSTANT_COPY,
210             .location = {.poolIndex = 0, .offset = 0, .length = 4},
211         },
212         {
213             .type = OperandType::FLOAT32,
214             .dimensions = {},
215             .numberOfConsumers = 1,
216             .scale = 0.0f,
217             .zeroPoint = 0,
218             .lifetime = OperandLifeTime::CONSTANT_COPY,
219             .location = {.poolIndex = 0, .offset = 4, .length = 4},
220         },
221         {
222             .type = OperandType::INT32,
223             .dimensions = {},
224             .numberOfConsumers = 1,
225             .scale = 0.0f,
226             .zeroPoint = 0,
227             .lifetime = OperandLifeTime::CONSTANT_COPY,
228             .location = {.poolIndex = 0, .offset = 8, .length = 4},
229         },
230         {
231             .type = OperandType::INT32,
232             .dimensions = {},
233             .numberOfConsumers = 1,
234             .scale = 0.0f,
235             .zeroPoint = 0,
236             .lifetime = OperandLifeTime::CONSTANT_COPY,
237             .location = {.poolIndex = 0, .offset = 12, .length = 4},
238         },
239         {
240             .type = OperandType::FLOAT32,
241             .dimensions = {},
242             .numberOfConsumers = 1,
243             .scale = 0.0f,
244             .zeroPoint = 0,
245             .lifetime = OperandLifeTime::CONSTANT_COPY,
246             .location = {.poolIndex = 0, .offset = 16, .length = 4},
247         },
248         {
249             .type = OperandType::FLOAT32,
250             .dimensions = {},
251             .numberOfConsumers = 1,
252             .scale = 0.0f,
253             .zeroPoint = 0,
254             .lifetime = OperandLifeTime::CONSTANT_COPY,
255             .location = {.poolIndex = 0, .offset = 20, .length = 4},
256         },
257         {
258             .type = OperandType::BOOL,
259             .dimensions = {},
260             .numberOfConsumers = 1,
261             .scale = 0.0f,
262             .zeroPoint = 0,
263             .lifetime = OperandLifeTime::CONSTANT_COPY,
264             .location = {.poolIndex = 0, .offset = 24, .length = 1},
265         },
266         {
267             .type = OperandType::TENSOR_FLOAT32,
268             .dimensions = {4},
269             .numberOfConsumers = 0,
270             .scale = 0.0f,
271             .zeroPoint = 0,
272             .lifetime = OperandLifeTime::MODEL_OUTPUT,
273             .location = {.poolIndex = 0, .offset = 0, .length = 0},
274         },
275         {
276             .type = OperandType::TENSOR_FLOAT32,
277             .dimensions = {4, 4},
278             .numberOfConsumers = 0,
279             .scale = 0.0f,
280             .zeroPoint = 0,
281             .lifetime = OperandLifeTime::MODEL_OUTPUT,
282             .location = {.poolIndex = 0, .offset = 0, .length = 0},
283         },
284         {
285             .type = OperandType::TENSOR_INT32,
286             .dimensions = {4},
287             .numberOfConsumers = 0,
288             .scale = 0.0f,
289             .zeroPoint = 0,
290             .lifetime = OperandLifeTime::MODEL_OUTPUT,
291             .location = {.poolIndex = 0, .offset = 0, .length = 0},
292         }
293     };
294 
295     const std::vector<Operation> operations = {
296         {
297             .type = OperationType::GENERATE_PROPOSALS,
298             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
299             .outputs = {11, 12, 13},
300         }
301     };
302 
303     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
304     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
305     std::vector<uint8_t> operandValues = {
306       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
307     };
308     const std::vector<hidl_memory> pools = {};
309 
310     return {
311         .operands = operands,
312         .operations = operations,
313         .inputIndexes = inputIndexes,
314         .outputIndexes = outputIndexes,
315         .operandValues = operandValues,
316         .pools = pools,
317         .relaxComputationFloat32toFloat16 = true,
318     };
319 }
320 
is_ignored_nhwc_relaxed(int i)321 inline bool is_ignored_nhwc_relaxed(int i) {
322   static std::set<int> ignore = {};
323   return ignore.find(i) != ignore.end();
324 }
325 
326 // Create the model
createTestModel_nhwc_quant8()327 Model createTestModel_nhwc_quant8() {
328     const std::vector<Operand> operands = {
329         {
330             .type = OperandType::TENSOR_QUANT8_ASYMM,
331             .dimensions = {1, 2, 2, 2},
332             .numberOfConsumers = 1,
333             .scale = 0.01f,
334             .zeroPoint = 100,
335             .lifetime = OperandLifeTime::MODEL_INPUT,
336             .location = {.poolIndex = 0, .offset = 0, .length = 0},
337         },
338         {
339             .type = OperandType::TENSOR_QUANT8_ASYMM,
340             .dimensions = {1, 2, 2, 8},
341             .numberOfConsumers = 1,
342             .scale = 0.05f,
343             .zeroPoint = 128,
344             .lifetime = OperandLifeTime::MODEL_INPUT,
345             .location = {.poolIndex = 0, .offset = 0, .length = 0},
346         },
347         {
348             .type = OperandType::TENSOR_QUANT16_SYMM,
349             .dimensions = {2, 4},
350             .numberOfConsumers = 1,
351             .scale = 0.125f,
352             .zeroPoint = 0,
353             .lifetime = OperandLifeTime::MODEL_INPUT,
354             .location = {.poolIndex = 0, .offset = 0, .length = 0},
355         },
356         {
357             .type = OperandType::TENSOR_QUANT16_ASYMM,
358             .dimensions = {1, 2},
359             .numberOfConsumers = 1,
360             .scale = 0.125f,
361             .zeroPoint = 0,
362             .lifetime = OperandLifeTime::MODEL_INPUT,
363             .location = {.poolIndex = 0, .offset = 0, .length = 0},
364         },
365         {
366             .type = OperandType::FLOAT32,
367             .dimensions = {},
368             .numberOfConsumers = 1,
369             .scale = 0.0f,
370             .zeroPoint = 0,
371             .lifetime = OperandLifeTime::CONSTANT_COPY,
372             .location = {.poolIndex = 0, .offset = 0, .length = 4},
373         },
374         {
375             .type = OperandType::FLOAT32,
376             .dimensions = {},
377             .numberOfConsumers = 1,
378             .scale = 0.0f,
379             .zeroPoint = 0,
380             .lifetime = OperandLifeTime::CONSTANT_COPY,
381             .location = {.poolIndex = 0, .offset = 4, .length = 4},
382         },
383         {
384             .type = OperandType::INT32,
385             .dimensions = {},
386             .numberOfConsumers = 1,
387             .scale = 0.0f,
388             .zeroPoint = 0,
389             .lifetime = OperandLifeTime::CONSTANT_COPY,
390             .location = {.poolIndex = 0, .offset = 8, .length = 4},
391         },
392         {
393             .type = OperandType::INT32,
394             .dimensions = {},
395             .numberOfConsumers = 1,
396             .scale = 0.0f,
397             .zeroPoint = 0,
398             .lifetime = OperandLifeTime::CONSTANT_COPY,
399             .location = {.poolIndex = 0, .offset = 12, .length = 4},
400         },
401         {
402             .type = OperandType::FLOAT32,
403             .dimensions = {},
404             .numberOfConsumers = 1,
405             .scale = 0.0f,
406             .zeroPoint = 0,
407             .lifetime = OperandLifeTime::CONSTANT_COPY,
408             .location = {.poolIndex = 0, .offset = 16, .length = 4},
409         },
410         {
411             .type = OperandType::FLOAT32,
412             .dimensions = {},
413             .numberOfConsumers = 1,
414             .scale = 0.0f,
415             .zeroPoint = 0,
416             .lifetime = OperandLifeTime::CONSTANT_COPY,
417             .location = {.poolIndex = 0, .offset = 20, .length = 4},
418         },
419         {
420             .type = OperandType::BOOL,
421             .dimensions = {},
422             .numberOfConsumers = 1,
423             .scale = 0.0f,
424             .zeroPoint = 0,
425             .lifetime = OperandLifeTime::CONSTANT_COPY,
426             .location = {.poolIndex = 0, .offset = 24, .length = 1},
427         },
428         {
429             .type = OperandType::TENSOR_QUANT8_ASYMM,
430             .dimensions = {4},
431             .numberOfConsumers = 0,
432             .scale = 0.01f,
433             .zeroPoint = 100,
434             .lifetime = OperandLifeTime::MODEL_OUTPUT,
435             .location = {.poolIndex = 0, .offset = 0, .length = 0},
436         },
437         {
438             .type = OperandType::TENSOR_QUANT16_ASYMM,
439             .dimensions = {4, 4},
440             .numberOfConsumers = 0,
441             .scale = 0.125f,
442             .zeroPoint = 0,
443             .lifetime = OperandLifeTime::MODEL_OUTPUT,
444             .location = {.poolIndex = 0, .offset = 0, .length = 0},
445         },
446         {
447             .type = OperandType::TENSOR_INT32,
448             .dimensions = {4},
449             .numberOfConsumers = 0,
450             .scale = 0.0f,
451             .zeroPoint = 0,
452             .lifetime = OperandLifeTime::MODEL_OUTPUT,
453             .location = {.poolIndex = 0, .offset = 0, .length = 0},
454         }
455     };
456 
457     const std::vector<Operation> operations = {
458         {
459             .type = OperationType::GENERATE_PROPOSALS,
460             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
461             .outputs = {11, 12, 13},
462         }
463     };
464 
465     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
466     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
467     std::vector<uint8_t> operandValues = {
468       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
469     };
470     const std::vector<hidl_memory> pools = {};
471 
472     return {
473         .operands = operands,
474         .operations = operations,
475         .inputIndexes = inputIndexes,
476         .outputIndexes = outputIndexes,
477         .operandValues = operandValues,
478         .pools = pools,
479     };
480 }
481 
is_ignored_nhwc_quant8(int i)482 inline bool is_ignored_nhwc_quant8(int i) {
483   static std::set<int> ignore = {};
484   return ignore.find(i) != ignore.end();
485 }
486 
487 // Create the model
createTestModel_nhwc_float16()488 Model createTestModel_nhwc_float16() {
489     const std::vector<Operand> operands = {
490         {
491             .type = OperandType::TENSOR_FLOAT16,
492             .dimensions = {1, 2, 2, 2},
493             .numberOfConsumers = 1,
494             .scale = 0.0f,
495             .zeroPoint = 0,
496             .lifetime = OperandLifeTime::MODEL_INPUT,
497             .location = {.poolIndex = 0, .offset = 0, .length = 0},
498         },
499         {
500             .type = OperandType::TENSOR_FLOAT16,
501             .dimensions = {1, 2, 2, 8},
502             .numberOfConsumers = 1,
503             .scale = 0.0f,
504             .zeroPoint = 0,
505             .lifetime = OperandLifeTime::MODEL_INPUT,
506             .location = {.poolIndex = 0, .offset = 0, .length = 0},
507         },
508         {
509             .type = OperandType::TENSOR_FLOAT16,
510             .dimensions = {2, 4},
511             .numberOfConsumers = 1,
512             .scale = 0.0f,
513             .zeroPoint = 0,
514             .lifetime = OperandLifeTime::MODEL_INPUT,
515             .location = {.poolIndex = 0, .offset = 0, .length = 0},
516         },
517         {
518             .type = OperandType::TENSOR_FLOAT16,
519             .dimensions = {1, 2},
520             .numberOfConsumers = 1,
521             .scale = 0.0f,
522             .zeroPoint = 0,
523             .lifetime = OperandLifeTime::MODEL_INPUT,
524             .location = {.poolIndex = 0, .offset = 0, .length = 0},
525         },
526         {
527             .type = OperandType::FLOAT16,
528             .dimensions = {},
529             .numberOfConsumers = 1,
530             .scale = 0.0f,
531             .zeroPoint = 0,
532             .lifetime = OperandLifeTime::CONSTANT_COPY,
533             .location = {.poolIndex = 0, .offset = 0, .length = 2},
534         },
535         {
536             .type = OperandType::FLOAT16,
537             .dimensions = {},
538             .numberOfConsumers = 1,
539             .scale = 0.0f,
540             .zeroPoint = 0,
541             .lifetime = OperandLifeTime::CONSTANT_COPY,
542             .location = {.poolIndex = 0, .offset = 2, .length = 2},
543         },
544         {
545             .type = OperandType::INT32,
546             .dimensions = {},
547             .numberOfConsumers = 1,
548             .scale = 0.0f,
549             .zeroPoint = 0,
550             .lifetime = OperandLifeTime::CONSTANT_COPY,
551             .location = {.poolIndex = 0, .offset = 4, .length = 4},
552         },
553         {
554             .type = OperandType::INT32,
555             .dimensions = {},
556             .numberOfConsumers = 1,
557             .scale = 0.0f,
558             .zeroPoint = 0,
559             .lifetime = OperandLifeTime::CONSTANT_COPY,
560             .location = {.poolIndex = 0, .offset = 8, .length = 4},
561         },
562         {
563             .type = OperandType::FLOAT16,
564             .dimensions = {},
565             .numberOfConsumers = 1,
566             .scale = 0.0f,
567             .zeroPoint = 0,
568             .lifetime = OperandLifeTime::CONSTANT_COPY,
569             .location = {.poolIndex = 0, .offset = 12, .length = 2},
570         },
571         {
572             .type = OperandType::FLOAT16,
573             .dimensions = {},
574             .numberOfConsumers = 1,
575             .scale = 0.0f,
576             .zeroPoint = 0,
577             .lifetime = OperandLifeTime::CONSTANT_COPY,
578             .location = {.poolIndex = 0, .offset = 14, .length = 2},
579         },
580         {
581             .type = OperandType::BOOL,
582             .dimensions = {},
583             .numberOfConsumers = 1,
584             .scale = 0.0f,
585             .zeroPoint = 0,
586             .lifetime = OperandLifeTime::CONSTANT_COPY,
587             .location = {.poolIndex = 0, .offset = 16, .length = 1},
588         },
589         {
590             .type = OperandType::TENSOR_FLOAT16,
591             .dimensions = {4},
592             .numberOfConsumers = 0,
593             .scale = 0.0f,
594             .zeroPoint = 0,
595             .lifetime = OperandLifeTime::MODEL_OUTPUT,
596             .location = {.poolIndex = 0, .offset = 0, .length = 0},
597         },
598         {
599             .type = OperandType::TENSOR_FLOAT16,
600             .dimensions = {4, 4},
601             .numberOfConsumers = 0,
602             .scale = 0.0f,
603             .zeroPoint = 0,
604             .lifetime = OperandLifeTime::MODEL_OUTPUT,
605             .location = {.poolIndex = 0, .offset = 0, .length = 0},
606         },
607         {
608             .type = OperandType::TENSOR_INT32,
609             .dimensions = {4},
610             .numberOfConsumers = 0,
611             .scale = 0.0f,
612             .zeroPoint = 0,
613             .lifetime = OperandLifeTime::MODEL_OUTPUT,
614             .location = {.poolIndex = 0, .offset = 0, .length = 0},
615         }
616     };
617 
618     const std::vector<Operation> operations = {
619         {
620             .type = OperationType::GENERATE_PROPOSALS,
621             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
622             .outputs = {11, 12, 13},
623         }
624     };
625 
626     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
627     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
628     std::vector<uint8_t> operandValues = {
629       0, 68, 0, 68, 255, 255, 255, 255, 255, 255, 255, 255, 205, 52, 0, 60, 0
630     };
631     const std::vector<hidl_memory> pools = {};
632 
633     return {
634         .operands = operands,
635         .operations = operations,
636         .inputIndexes = inputIndexes,
637         .outputIndexes = outputIndexes,
638         .operandValues = operandValues,
639         .pools = pools,
640     };
641 }
642 
is_ignored_nhwc_float16(int i)643 inline bool is_ignored_nhwc_float16(int i) {
644   static std::set<int> ignore = {};
645   return ignore.find(i) != ignore.end();
646 }
647 
648 // Create the model
createTestModel_nchw()649 Model createTestModel_nchw() {
650     const std::vector<Operand> operands = {
651         {
652             .type = OperandType::TENSOR_FLOAT32,
653             .dimensions = {1, 2, 2, 2},
654             .numberOfConsumers = 1,
655             .scale = 0.0f,
656             .zeroPoint = 0,
657             .lifetime = OperandLifeTime::MODEL_INPUT,
658             .location = {.poolIndex = 0, .offset = 0, .length = 0},
659         },
660         {
661             .type = OperandType::TENSOR_FLOAT32,
662             .dimensions = {1, 8, 2, 2},
663             .numberOfConsumers = 1,
664             .scale = 0.0f,
665             .zeroPoint = 0,
666             .lifetime = OperandLifeTime::MODEL_INPUT,
667             .location = {.poolIndex = 0, .offset = 0, .length = 0},
668         },
669         {
670             .type = OperandType::TENSOR_FLOAT32,
671             .dimensions = {2, 4},
672             .numberOfConsumers = 1,
673             .scale = 0.0f,
674             .zeroPoint = 0,
675             .lifetime = OperandLifeTime::MODEL_INPUT,
676             .location = {.poolIndex = 0, .offset = 0, .length = 0},
677         },
678         {
679             .type = OperandType::TENSOR_FLOAT32,
680             .dimensions = {1, 2},
681             .numberOfConsumers = 1,
682             .scale = 0.0f,
683             .zeroPoint = 0,
684             .lifetime = OperandLifeTime::MODEL_INPUT,
685             .location = {.poolIndex = 0, .offset = 0, .length = 0},
686         },
687         {
688             .type = OperandType::FLOAT32,
689             .dimensions = {},
690             .numberOfConsumers = 1,
691             .scale = 0.0f,
692             .zeroPoint = 0,
693             .lifetime = OperandLifeTime::CONSTANT_COPY,
694             .location = {.poolIndex = 0, .offset = 0, .length = 4},
695         },
696         {
697             .type = OperandType::FLOAT32,
698             .dimensions = {},
699             .numberOfConsumers = 1,
700             .scale = 0.0f,
701             .zeroPoint = 0,
702             .lifetime = OperandLifeTime::CONSTANT_COPY,
703             .location = {.poolIndex = 0, .offset = 4, .length = 4},
704         },
705         {
706             .type = OperandType::INT32,
707             .dimensions = {},
708             .numberOfConsumers = 1,
709             .scale = 0.0f,
710             .zeroPoint = 0,
711             .lifetime = OperandLifeTime::CONSTANT_COPY,
712             .location = {.poolIndex = 0, .offset = 8, .length = 4},
713         },
714         {
715             .type = OperandType::INT32,
716             .dimensions = {},
717             .numberOfConsumers = 1,
718             .scale = 0.0f,
719             .zeroPoint = 0,
720             .lifetime = OperandLifeTime::CONSTANT_COPY,
721             .location = {.poolIndex = 0, .offset = 12, .length = 4},
722         },
723         {
724             .type = OperandType::FLOAT32,
725             .dimensions = {},
726             .numberOfConsumers = 1,
727             .scale = 0.0f,
728             .zeroPoint = 0,
729             .lifetime = OperandLifeTime::CONSTANT_COPY,
730             .location = {.poolIndex = 0, .offset = 16, .length = 4},
731         },
732         {
733             .type = OperandType::FLOAT32,
734             .dimensions = {},
735             .numberOfConsumers = 1,
736             .scale = 0.0f,
737             .zeroPoint = 0,
738             .lifetime = OperandLifeTime::CONSTANT_COPY,
739             .location = {.poolIndex = 0, .offset = 20, .length = 4},
740         },
741         {
742             .type = OperandType::BOOL,
743             .dimensions = {},
744             .numberOfConsumers = 1,
745             .scale = 0.0f,
746             .zeroPoint = 0,
747             .lifetime = OperandLifeTime::CONSTANT_COPY,
748             .location = {.poolIndex = 0, .offset = 24, .length = 1},
749         },
750         {
751             .type = OperandType::TENSOR_FLOAT32,
752             .dimensions = {4},
753             .numberOfConsumers = 0,
754             .scale = 0.0f,
755             .zeroPoint = 0,
756             .lifetime = OperandLifeTime::MODEL_OUTPUT,
757             .location = {.poolIndex = 0, .offset = 0, .length = 0},
758         },
759         {
760             .type = OperandType::TENSOR_FLOAT32,
761             .dimensions = {4, 4},
762             .numberOfConsumers = 0,
763             .scale = 0.0f,
764             .zeroPoint = 0,
765             .lifetime = OperandLifeTime::MODEL_OUTPUT,
766             .location = {.poolIndex = 0, .offset = 0, .length = 0},
767         },
768         {
769             .type = OperandType::TENSOR_INT32,
770             .dimensions = {4},
771             .numberOfConsumers = 0,
772             .scale = 0.0f,
773             .zeroPoint = 0,
774             .lifetime = OperandLifeTime::MODEL_OUTPUT,
775             .location = {.poolIndex = 0, .offset = 0, .length = 0},
776         }
777     };
778 
779     const std::vector<Operation> operations = {
780         {
781             .type = OperationType::GENERATE_PROPOSALS,
782             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
783             .outputs = {11, 12, 13},
784         }
785     };
786 
787     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
788     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
789     std::vector<uint8_t> operandValues = {
790       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
791     };
792     const std::vector<hidl_memory> pools = {};
793 
794     return {
795         .operands = operands,
796         .operations = operations,
797         .inputIndexes = inputIndexes,
798         .outputIndexes = outputIndexes,
799         .operandValues = operandValues,
800         .pools = pools,
801     };
802 }
803 
is_ignored_nchw(int i)804 inline bool is_ignored_nchw(int i) {
805   static std::set<int> ignore = {};
806   return ignore.find(i) != ignore.end();
807 }
808 
809 // Create the model
createTestModel_nchw_relaxed()810 Model createTestModel_nchw_relaxed() {
811     const std::vector<Operand> operands = {
812         {
813             .type = OperandType::TENSOR_FLOAT32,
814             .dimensions = {1, 2, 2, 2},
815             .numberOfConsumers = 1,
816             .scale = 0.0f,
817             .zeroPoint = 0,
818             .lifetime = OperandLifeTime::MODEL_INPUT,
819             .location = {.poolIndex = 0, .offset = 0, .length = 0},
820         },
821         {
822             .type = OperandType::TENSOR_FLOAT32,
823             .dimensions = {1, 8, 2, 2},
824             .numberOfConsumers = 1,
825             .scale = 0.0f,
826             .zeroPoint = 0,
827             .lifetime = OperandLifeTime::MODEL_INPUT,
828             .location = {.poolIndex = 0, .offset = 0, .length = 0},
829         },
830         {
831             .type = OperandType::TENSOR_FLOAT32,
832             .dimensions = {2, 4},
833             .numberOfConsumers = 1,
834             .scale = 0.0f,
835             .zeroPoint = 0,
836             .lifetime = OperandLifeTime::MODEL_INPUT,
837             .location = {.poolIndex = 0, .offset = 0, .length = 0},
838         },
839         {
840             .type = OperandType::TENSOR_FLOAT32,
841             .dimensions = {1, 2},
842             .numberOfConsumers = 1,
843             .scale = 0.0f,
844             .zeroPoint = 0,
845             .lifetime = OperandLifeTime::MODEL_INPUT,
846             .location = {.poolIndex = 0, .offset = 0, .length = 0},
847         },
848         {
849             .type = OperandType::FLOAT32,
850             .dimensions = {},
851             .numberOfConsumers = 1,
852             .scale = 0.0f,
853             .zeroPoint = 0,
854             .lifetime = OperandLifeTime::CONSTANT_COPY,
855             .location = {.poolIndex = 0, .offset = 0, .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 = 4, .length = 4},
865         },
866         {
867             .type = OperandType::INT32,
868             .dimensions = {},
869             .numberOfConsumers = 1,
870             .scale = 0.0f,
871             .zeroPoint = 0,
872             .lifetime = OperandLifeTime::CONSTANT_COPY,
873             .location = {.poolIndex = 0, .offset = 8, .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 = 12, .length = 4},
883         },
884         {
885             .type = OperandType::FLOAT32,
886             .dimensions = {},
887             .numberOfConsumers = 1,
888             .scale = 0.0f,
889             .zeroPoint = 0,
890             .lifetime = OperandLifeTime::CONSTANT_COPY,
891             .location = {.poolIndex = 0, .offset = 16, .length = 4},
892         },
893         {
894             .type = OperandType::FLOAT32,
895             .dimensions = {},
896             .numberOfConsumers = 1,
897             .scale = 0.0f,
898             .zeroPoint = 0,
899             .lifetime = OperandLifeTime::CONSTANT_COPY,
900             .location = {.poolIndex = 0, .offset = 20, .length = 4},
901         },
902         {
903             .type = OperandType::BOOL,
904             .dimensions = {},
905             .numberOfConsumers = 1,
906             .scale = 0.0f,
907             .zeroPoint = 0,
908             .lifetime = OperandLifeTime::CONSTANT_COPY,
909             .location = {.poolIndex = 0, .offset = 24, .length = 1},
910         },
911         {
912             .type = OperandType::TENSOR_FLOAT32,
913             .dimensions = {4},
914             .numberOfConsumers = 0,
915             .scale = 0.0f,
916             .zeroPoint = 0,
917             .lifetime = OperandLifeTime::MODEL_OUTPUT,
918             .location = {.poolIndex = 0, .offset = 0, .length = 0},
919         },
920         {
921             .type = OperandType::TENSOR_FLOAT32,
922             .dimensions = {4, 4},
923             .numberOfConsumers = 0,
924             .scale = 0.0f,
925             .zeroPoint = 0,
926             .lifetime = OperandLifeTime::MODEL_OUTPUT,
927             .location = {.poolIndex = 0, .offset = 0, .length = 0},
928         },
929         {
930             .type = OperandType::TENSOR_INT32,
931             .dimensions = {4},
932             .numberOfConsumers = 0,
933             .scale = 0.0f,
934             .zeroPoint = 0,
935             .lifetime = OperandLifeTime::MODEL_OUTPUT,
936             .location = {.poolIndex = 0, .offset = 0, .length = 0},
937         }
938     };
939 
940     const std::vector<Operation> operations = {
941         {
942             .type = OperationType::GENERATE_PROPOSALS,
943             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
944             .outputs = {11, 12, 13},
945         }
946     };
947 
948     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
949     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
950     std::vector<uint8_t> operandValues = {
951       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
952     };
953     const std::vector<hidl_memory> pools = {};
954 
955     return {
956         .operands = operands,
957         .operations = operations,
958         .inputIndexes = inputIndexes,
959         .outputIndexes = outputIndexes,
960         .operandValues = operandValues,
961         .pools = pools,
962         .relaxComputationFloat32toFloat16 = true,
963     };
964 }
965 
is_ignored_nchw_relaxed(int i)966 inline bool is_ignored_nchw_relaxed(int i) {
967   static std::set<int> ignore = {};
968   return ignore.find(i) != ignore.end();
969 }
970 
971 // Create the model
createTestModel_nchw_quant8()972 Model createTestModel_nchw_quant8() {
973     const std::vector<Operand> operands = {
974         {
975             .type = OperandType::TENSOR_QUANT8_ASYMM,
976             .dimensions = {1, 2, 2, 2},
977             .numberOfConsumers = 1,
978             .scale = 0.01f,
979             .zeroPoint = 100,
980             .lifetime = OperandLifeTime::MODEL_INPUT,
981             .location = {.poolIndex = 0, .offset = 0, .length = 0},
982         },
983         {
984             .type = OperandType::TENSOR_QUANT8_ASYMM,
985             .dimensions = {1, 8, 2, 2},
986             .numberOfConsumers = 1,
987             .scale = 0.05f,
988             .zeroPoint = 128,
989             .lifetime = OperandLifeTime::MODEL_INPUT,
990             .location = {.poolIndex = 0, .offset = 0, .length = 0},
991         },
992         {
993             .type = OperandType::TENSOR_QUANT16_SYMM,
994             .dimensions = {2, 4},
995             .numberOfConsumers = 1,
996             .scale = 0.125f,
997             .zeroPoint = 0,
998             .lifetime = OperandLifeTime::MODEL_INPUT,
999             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1000         },
1001         {
1002             .type = OperandType::TENSOR_QUANT16_ASYMM,
1003             .dimensions = {1, 2},
1004             .numberOfConsumers = 1,
1005             .scale = 0.125f,
1006             .zeroPoint = 0,
1007             .lifetime = OperandLifeTime::MODEL_INPUT,
1008             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1009         },
1010         {
1011             .type = OperandType::FLOAT32,
1012             .dimensions = {},
1013             .numberOfConsumers = 1,
1014             .scale = 0.0f,
1015             .zeroPoint = 0,
1016             .lifetime = OperandLifeTime::CONSTANT_COPY,
1017             .location = {.poolIndex = 0, .offset = 0, .length = 4},
1018         },
1019         {
1020             .type = OperandType::FLOAT32,
1021             .dimensions = {},
1022             .numberOfConsumers = 1,
1023             .scale = 0.0f,
1024             .zeroPoint = 0,
1025             .lifetime = OperandLifeTime::CONSTANT_COPY,
1026             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1027         },
1028         {
1029             .type = OperandType::INT32,
1030             .dimensions = {},
1031             .numberOfConsumers = 1,
1032             .scale = 0.0f,
1033             .zeroPoint = 0,
1034             .lifetime = OperandLifeTime::CONSTANT_COPY,
1035             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1036         },
1037         {
1038             .type = OperandType::INT32,
1039             .dimensions = {},
1040             .numberOfConsumers = 1,
1041             .scale = 0.0f,
1042             .zeroPoint = 0,
1043             .lifetime = OperandLifeTime::CONSTANT_COPY,
1044             .location = {.poolIndex = 0, .offset = 12, .length = 4},
1045         },
1046         {
1047             .type = OperandType::FLOAT32,
1048             .dimensions = {},
1049             .numberOfConsumers = 1,
1050             .scale = 0.0f,
1051             .zeroPoint = 0,
1052             .lifetime = OperandLifeTime::CONSTANT_COPY,
1053             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1054         },
1055         {
1056             .type = OperandType::FLOAT32,
1057             .dimensions = {},
1058             .numberOfConsumers = 1,
1059             .scale = 0.0f,
1060             .zeroPoint = 0,
1061             .lifetime = OperandLifeTime::CONSTANT_COPY,
1062             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1063         },
1064         {
1065             .type = OperandType::BOOL,
1066             .dimensions = {},
1067             .numberOfConsumers = 1,
1068             .scale = 0.0f,
1069             .zeroPoint = 0,
1070             .lifetime = OperandLifeTime::CONSTANT_COPY,
1071             .location = {.poolIndex = 0, .offset = 24, .length = 1},
1072         },
1073         {
1074             .type = OperandType::TENSOR_QUANT8_ASYMM,
1075             .dimensions = {4},
1076             .numberOfConsumers = 0,
1077             .scale = 0.01f,
1078             .zeroPoint = 100,
1079             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1080             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1081         },
1082         {
1083             .type = OperandType::TENSOR_QUANT16_ASYMM,
1084             .dimensions = {4, 4},
1085             .numberOfConsumers = 0,
1086             .scale = 0.125f,
1087             .zeroPoint = 0,
1088             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1089             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1090         },
1091         {
1092             .type = OperandType::TENSOR_INT32,
1093             .dimensions = {4},
1094             .numberOfConsumers = 0,
1095             .scale = 0.0f,
1096             .zeroPoint = 0,
1097             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1098             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1099         }
1100     };
1101 
1102     const std::vector<Operation> operations = {
1103         {
1104             .type = OperationType::GENERATE_PROPOSALS,
1105             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1106             .outputs = {11, 12, 13},
1107         }
1108     };
1109 
1110     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1111     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1112     std::vector<uint8_t> operandValues = {
1113       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
1114     };
1115     const std::vector<hidl_memory> pools = {};
1116 
1117     return {
1118         .operands = operands,
1119         .operations = operations,
1120         .inputIndexes = inputIndexes,
1121         .outputIndexes = outputIndexes,
1122         .operandValues = operandValues,
1123         .pools = pools,
1124     };
1125 }
1126 
is_ignored_nchw_quant8(int i)1127 inline bool is_ignored_nchw_quant8(int i) {
1128   static std::set<int> ignore = {};
1129   return ignore.find(i) != ignore.end();
1130 }
1131 
1132 // Create the model
createTestModel_nchw_float16()1133 Model createTestModel_nchw_float16() {
1134     const std::vector<Operand> operands = {
1135         {
1136             .type = OperandType::TENSOR_FLOAT16,
1137             .dimensions = {1, 2, 2, 2},
1138             .numberOfConsumers = 1,
1139             .scale = 0.0f,
1140             .zeroPoint = 0,
1141             .lifetime = OperandLifeTime::MODEL_INPUT,
1142             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1143         },
1144         {
1145             .type = OperandType::TENSOR_FLOAT16,
1146             .dimensions = {1, 8, 2, 2},
1147             .numberOfConsumers = 1,
1148             .scale = 0.0f,
1149             .zeroPoint = 0,
1150             .lifetime = OperandLifeTime::MODEL_INPUT,
1151             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1152         },
1153         {
1154             .type = OperandType::TENSOR_FLOAT16,
1155             .dimensions = {2, 4},
1156             .numberOfConsumers = 1,
1157             .scale = 0.0f,
1158             .zeroPoint = 0,
1159             .lifetime = OperandLifeTime::MODEL_INPUT,
1160             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1161         },
1162         {
1163             .type = OperandType::TENSOR_FLOAT16,
1164             .dimensions = {1, 2},
1165             .numberOfConsumers = 1,
1166             .scale = 0.0f,
1167             .zeroPoint = 0,
1168             .lifetime = OperandLifeTime::MODEL_INPUT,
1169             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1170         },
1171         {
1172             .type = OperandType::FLOAT16,
1173             .dimensions = {},
1174             .numberOfConsumers = 1,
1175             .scale = 0.0f,
1176             .zeroPoint = 0,
1177             .lifetime = OperandLifeTime::CONSTANT_COPY,
1178             .location = {.poolIndex = 0, .offset = 0, .length = 2},
1179         },
1180         {
1181             .type = OperandType::FLOAT16,
1182             .dimensions = {},
1183             .numberOfConsumers = 1,
1184             .scale = 0.0f,
1185             .zeroPoint = 0,
1186             .lifetime = OperandLifeTime::CONSTANT_COPY,
1187             .location = {.poolIndex = 0, .offset = 2, .length = 2},
1188         },
1189         {
1190             .type = OperandType::INT32,
1191             .dimensions = {},
1192             .numberOfConsumers = 1,
1193             .scale = 0.0f,
1194             .zeroPoint = 0,
1195             .lifetime = OperandLifeTime::CONSTANT_COPY,
1196             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1197         },
1198         {
1199             .type = OperandType::INT32,
1200             .dimensions = {},
1201             .numberOfConsumers = 1,
1202             .scale = 0.0f,
1203             .zeroPoint = 0,
1204             .lifetime = OperandLifeTime::CONSTANT_COPY,
1205             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1206         },
1207         {
1208             .type = OperandType::FLOAT16,
1209             .dimensions = {},
1210             .numberOfConsumers = 1,
1211             .scale = 0.0f,
1212             .zeroPoint = 0,
1213             .lifetime = OperandLifeTime::CONSTANT_COPY,
1214             .location = {.poolIndex = 0, .offset = 12, .length = 2},
1215         },
1216         {
1217             .type = OperandType::FLOAT16,
1218             .dimensions = {},
1219             .numberOfConsumers = 1,
1220             .scale = 0.0f,
1221             .zeroPoint = 0,
1222             .lifetime = OperandLifeTime::CONSTANT_COPY,
1223             .location = {.poolIndex = 0, .offset = 14, .length = 2},
1224         },
1225         {
1226             .type = OperandType::BOOL,
1227             .dimensions = {},
1228             .numberOfConsumers = 1,
1229             .scale = 0.0f,
1230             .zeroPoint = 0,
1231             .lifetime = OperandLifeTime::CONSTANT_COPY,
1232             .location = {.poolIndex = 0, .offset = 16, .length = 1},
1233         },
1234         {
1235             .type = OperandType::TENSOR_FLOAT16,
1236             .dimensions = {4},
1237             .numberOfConsumers = 0,
1238             .scale = 0.0f,
1239             .zeroPoint = 0,
1240             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1241             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1242         },
1243         {
1244             .type = OperandType::TENSOR_FLOAT16,
1245             .dimensions = {4, 4},
1246             .numberOfConsumers = 0,
1247             .scale = 0.0f,
1248             .zeroPoint = 0,
1249             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1250             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1251         },
1252         {
1253             .type = OperandType::TENSOR_INT32,
1254             .dimensions = {4},
1255             .numberOfConsumers = 0,
1256             .scale = 0.0f,
1257             .zeroPoint = 0,
1258             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1259             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1260         }
1261     };
1262 
1263     const std::vector<Operation> operations = {
1264         {
1265             .type = OperationType::GENERATE_PROPOSALS,
1266             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1267             .outputs = {11, 12, 13},
1268         }
1269     };
1270 
1271     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1272     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1273     std::vector<uint8_t> operandValues = {
1274       0, 68, 0, 68, 255, 255, 255, 255, 255, 255, 255, 255, 205, 52, 0, 60, 1
1275     };
1276     const std::vector<hidl_memory> pools = {};
1277 
1278     return {
1279         .operands = operands,
1280         .operations = operations,
1281         .inputIndexes = inputIndexes,
1282         .outputIndexes = outputIndexes,
1283         .operandValues = operandValues,
1284         .pools = pools,
1285     };
1286 }
1287 
is_ignored_nchw_float16(int i)1288 inline bool is_ignored_nchw_float16(int i) {
1289   static std::set<int> ignore = {};
1290   return ignore.find(i) != ignore.end();
1291 }
1292 
1293 // Create the model
createTestModel_dynamic_output_shape_nhwc()1294 Model createTestModel_dynamic_output_shape_nhwc() {
1295     const std::vector<Operand> operands = {
1296         {
1297             .type = OperandType::TENSOR_FLOAT32,
1298             .dimensions = {1, 2, 2, 2},
1299             .numberOfConsumers = 1,
1300             .scale = 0.0f,
1301             .zeroPoint = 0,
1302             .lifetime = OperandLifeTime::MODEL_INPUT,
1303             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1304         },
1305         {
1306             .type = OperandType::TENSOR_FLOAT32,
1307             .dimensions = {1, 2, 2, 8},
1308             .numberOfConsumers = 1,
1309             .scale = 0.0f,
1310             .zeroPoint = 0,
1311             .lifetime = OperandLifeTime::MODEL_INPUT,
1312             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1313         },
1314         {
1315             .type = OperandType::TENSOR_FLOAT32,
1316             .dimensions = {2, 4},
1317             .numberOfConsumers = 1,
1318             .scale = 0.0f,
1319             .zeroPoint = 0,
1320             .lifetime = OperandLifeTime::MODEL_INPUT,
1321             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1322         },
1323         {
1324             .type = OperandType::TENSOR_FLOAT32,
1325             .dimensions = {1, 2},
1326             .numberOfConsumers = 1,
1327             .scale = 0.0f,
1328             .zeroPoint = 0,
1329             .lifetime = OperandLifeTime::MODEL_INPUT,
1330             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1331         },
1332         {
1333             .type = OperandType::FLOAT32,
1334             .dimensions = {},
1335             .numberOfConsumers = 1,
1336             .scale = 0.0f,
1337             .zeroPoint = 0,
1338             .lifetime = OperandLifeTime::CONSTANT_COPY,
1339             .location = {.poolIndex = 0, .offset = 0, .length = 4},
1340         },
1341         {
1342             .type = OperandType::FLOAT32,
1343             .dimensions = {},
1344             .numberOfConsumers = 1,
1345             .scale = 0.0f,
1346             .zeroPoint = 0,
1347             .lifetime = OperandLifeTime::CONSTANT_COPY,
1348             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1349         },
1350         {
1351             .type = OperandType::INT32,
1352             .dimensions = {},
1353             .numberOfConsumers = 1,
1354             .scale = 0.0f,
1355             .zeroPoint = 0,
1356             .lifetime = OperandLifeTime::CONSTANT_COPY,
1357             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1358         },
1359         {
1360             .type = OperandType::INT32,
1361             .dimensions = {},
1362             .numberOfConsumers = 1,
1363             .scale = 0.0f,
1364             .zeroPoint = 0,
1365             .lifetime = OperandLifeTime::CONSTANT_COPY,
1366             .location = {.poolIndex = 0, .offset = 12, .length = 4},
1367         },
1368         {
1369             .type = OperandType::FLOAT32,
1370             .dimensions = {},
1371             .numberOfConsumers = 1,
1372             .scale = 0.0f,
1373             .zeroPoint = 0,
1374             .lifetime = OperandLifeTime::CONSTANT_COPY,
1375             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1376         },
1377         {
1378             .type = OperandType::FLOAT32,
1379             .dimensions = {},
1380             .numberOfConsumers = 1,
1381             .scale = 0.0f,
1382             .zeroPoint = 0,
1383             .lifetime = OperandLifeTime::CONSTANT_COPY,
1384             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1385         },
1386         {
1387             .type = OperandType::BOOL,
1388             .dimensions = {},
1389             .numberOfConsumers = 1,
1390             .scale = 0.0f,
1391             .zeroPoint = 0,
1392             .lifetime = OperandLifeTime::CONSTANT_COPY,
1393             .location = {.poolIndex = 0, .offset = 24, .length = 1},
1394         },
1395         {
1396             .type = OperandType::TENSOR_FLOAT32,
1397             .dimensions = {0},
1398             .numberOfConsumers = 0,
1399             .scale = 0.0f,
1400             .zeroPoint = 0,
1401             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1402             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1403         },
1404         {
1405             .type = OperandType::TENSOR_FLOAT32,
1406             .dimensions = {0, 0},
1407             .numberOfConsumers = 0,
1408             .scale = 0.0f,
1409             .zeroPoint = 0,
1410             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1411             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1412         },
1413         {
1414             .type = OperandType::TENSOR_INT32,
1415             .dimensions = {0},
1416             .numberOfConsumers = 0,
1417             .scale = 0.0f,
1418             .zeroPoint = 0,
1419             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1420             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1421         }
1422     };
1423 
1424     const std::vector<Operation> operations = {
1425         {
1426             .type = OperationType::GENERATE_PROPOSALS,
1427             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1428             .outputs = {11, 12, 13},
1429         }
1430     };
1431 
1432     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1433     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1434     std::vector<uint8_t> operandValues = {
1435       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
1436     };
1437     const std::vector<hidl_memory> pools = {};
1438 
1439     return {
1440         .operands = operands,
1441         .operations = operations,
1442         .inputIndexes = inputIndexes,
1443         .outputIndexes = outputIndexes,
1444         .operandValues = operandValues,
1445         .pools = pools,
1446     };
1447 }
1448 
is_ignored_dynamic_output_shape_nhwc(int i)1449 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
1450   static std::set<int> ignore = {};
1451   return ignore.find(i) != ignore.end();
1452 }
1453 
1454 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed()1455 Model createTestModel_dynamic_output_shape_nhwc_relaxed() {
1456     const std::vector<Operand> operands = {
1457         {
1458             .type = OperandType::TENSOR_FLOAT32,
1459             .dimensions = {1, 2, 2, 2},
1460             .numberOfConsumers = 1,
1461             .scale = 0.0f,
1462             .zeroPoint = 0,
1463             .lifetime = OperandLifeTime::MODEL_INPUT,
1464             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1465         },
1466         {
1467             .type = OperandType::TENSOR_FLOAT32,
1468             .dimensions = {1, 2, 2, 8},
1469             .numberOfConsumers = 1,
1470             .scale = 0.0f,
1471             .zeroPoint = 0,
1472             .lifetime = OperandLifeTime::MODEL_INPUT,
1473             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1474         },
1475         {
1476             .type = OperandType::TENSOR_FLOAT32,
1477             .dimensions = {2, 4},
1478             .numberOfConsumers = 1,
1479             .scale = 0.0f,
1480             .zeroPoint = 0,
1481             .lifetime = OperandLifeTime::MODEL_INPUT,
1482             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1483         },
1484         {
1485             .type = OperandType::TENSOR_FLOAT32,
1486             .dimensions = {1, 2},
1487             .numberOfConsumers = 1,
1488             .scale = 0.0f,
1489             .zeroPoint = 0,
1490             .lifetime = OperandLifeTime::MODEL_INPUT,
1491             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1492         },
1493         {
1494             .type = OperandType::FLOAT32,
1495             .dimensions = {},
1496             .numberOfConsumers = 1,
1497             .scale = 0.0f,
1498             .zeroPoint = 0,
1499             .lifetime = OperandLifeTime::CONSTANT_COPY,
1500             .location = {.poolIndex = 0, .offset = 0, .length = 4},
1501         },
1502         {
1503             .type = OperandType::FLOAT32,
1504             .dimensions = {},
1505             .numberOfConsumers = 1,
1506             .scale = 0.0f,
1507             .zeroPoint = 0,
1508             .lifetime = OperandLifeTime::CONSTANT_COPY,
1509             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1510         },
1511         {
1512             .type = OperandType::INT32,
1513             .dimensions = {},
1514             .numberOfConsumers = 1,
1515             .scale = 0.0f,
1516             .zeroPoint = 0,
1517             .lifetime = OperandLifeTime::CONSTANT_COPY,
1518             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1519         },
1520         {
1521             .type = OperandType::INT32,
1522             .dimensions = {},
1523             .numberOfConsumers = 1,
1524             .scale = 0.0f,
1525             .zeroPoint = 0,
1526             .lifetime = OperandLifeTime::CONSTANT_COPY,
1527             .location = {.poolIndex = 0, .offset = 12, .length = 4},
1528         },
1529         {
1530             .type = OperandType::FLOAT32,
1531             .dimensions = {},
1532             .numberOfConsumers = 1,
1533             .scale = 0.0f,
1534             .zeroPoint = 0,
1535             .lifetime = OperandLifeTime::CONSTANT_COPY,
1536             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1537         },
1538         {
1539             .type = OperandType::FLOAT32,
1540             .dimensions = {},
1541             .numberOfConsumers = 1,
1542             .scale = 0.0f,
1543             .zeroPoint = 0,
1544             .lifetime = OperandLifeTime::CONSTANT_COPY,
1545             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1546         },
1547         {
1548             .type = OperandType::BOOL,
1549             .dimensions = {},
1550             .numberOfConsumers = 1,
1551             .scale = 0.0f,
1552             .zeroPoint = 0,
1553             .lifetime = OperandLifeTime::CONSTANT_COPY,
1554             .location = {.poolIndex = 0, .offset = 24, .length = 1},
1555         },
1556         {
1557             .type = OperandType::TENSOR_FLOAT32,
1558             .dimensions = {0},
1559             .numberOfConsumers = 0,
1560             .scale = 0.0f,
1561             .zeroPoint = 0,
1562             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1563             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1564         },
1565         {
1566             .type = OperandType::TENSOR_FLOAT32,
1567             .dimensions = {0, 0},
1568             .numberOfConsumers = 0,
1569             .scale = 0.0f,
1570             .zeroPoint = 0,
1571             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1572             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1573         },
1574         {
1575             .type = OperandType::TENSOR_INT32,
1576             .dimensions = {0},
1577             .numberOfConsumers = 0,
1578             .scale = 0.0f,
1579             .zeroPoint = 0,
1580             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1581             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1582         }
1583     };
1584 
1585     const std::vector<Operation> operations = {
1586         {
1587             .type = OperationType::GENERATE_PROPOSALS,
1588             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1589             .outputs = {11, 12, 13},
1590         }
1591     };
1592 
1593     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1594     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1595     std::vector<uint8_t> operandValues = {
1596       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
1597     };
1598     const std::vector<hidl_memory> pools = {};
1599 
1600     return {
1601         .operands = operands,
1602         .operations = operations,
1603         .inputIndexes = inputIndexes,
1604         .outputIndexes = outputIndexes,
1605         .operandValues = operandValues,
1606         .pools = pools,
1607         .relaxComputationFloat32toFloat16 = true,
1608     };
1609 }
1610 
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)1611 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
1612   static std::set<int> ignore = {};
1613   return ignore.find(i) != ignore.end();
1614 }
1615 
1616 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8()1617 Model createTestModel_dynamic_output_shape_nhwc_quant8() {
1618     const std::vector<Operand> operands = {
1619         {
1620             .type = OperandType::TENSOR_QUANT8_ASYMM,
1621             .dimensions = {1, 2, 2, 2},
1622             .numberOfConsumers = 1,
1623             .scale = 0.01f,
1624             .zeroPoint = 100,
1625             .lifetime = OperandLifeTime::MODEL_INPUT,
1626             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1627         },
1628         {
1629             .type = OperandType::TENSOR_QUANT8_ASYMM,
1630             .dimensions = {1, 2, 2, 8},
1631             .numberOfConsumers = 1,
1632             .scale = 0.05f,
1633             .zeroPoint = 128,
1634             .lifetime = OperandLifeTime::MODEL_INPUT,
1635             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1636         },
1637         {
1638             .type = OperandType::TENSOR_QUANT16_SYMM,
1639             .dimensions = {2, 4},
1640             .numberOfConsumers = 1,
1641             .scale = 0.125f,
1642             .zeroPoint = 0,
1643             .lifetime = OperandLifeTime::MODEL_INPUT,
1644             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1645         },
1646         {
1647             .type = OperandType::TENSOR_QUANT16_ASYMM,
1648             .dimensions = {1, 2},
1649             .numberOfConsumers = 1,
1650             .scale = 0.125f,
1651             .zeroPoint = 0,
1652             .lifetime = OperandLifeTime::MODEL_INPUT,
1653             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1654         },
1655         {
1656             .type = OperandType::FLOAT32,
1657             .dimensions = {},
1658             .numberOfConsumers = 1,
1659             .scale = 0.0f,
1660             .zeroPoint = 0,
1661             .lifetime = OperandLifeTime::CONSTANT_COPY,
1662             .location = {.poolIndex = 0, .offset = 0, .length = 4},
1663         },
1664         {
1665             .type = OperandType::FLOAT32,
1666             .dimensions = {},
1667             .numberOfConsumers = 1,
1668             .scale = 0.0f,
1669             .zeroPoint = 0,
1670             .lifetime = OperandLifeTime::CONSTANT_COPY,
1671             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1672         },
1673         {
1674             .type = OperandType::INT32,
1675             .dimensions = {},
1676             .numberOfConsumers = 1,
1677             .scale = 0.0f,
1678             .zeroPoint = 0,
1679             .lifetime = OperandLifeTime::CONSTANT_COPY,
1680             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1681         },
1682         {
1683             .type = OperandType::INT32,
1684             .dimensions = {},
1685             .numberOfConsumers = 1,
1686             .scale = 0.0f,
1687             .zeroPoint = 0,
1688             .lifetime = OperandLifeTime::CONSTANT_COPY,
1689             .location = {.poolIndex = 0, .offset = 12, .length = 4},
1690         },
1691         {
1692             .type = OperandType::FLOAT32,
1693             .dimensions = {},
1694             .numberOfConsumers = 1,
1695             .scale = 0.0f,
1696             .zeroPoint = 0,
1697             .lifetime = OperandLifeTime::CONSTANT_COPY,
1698             .location = {.poolIndex = 0, .offset = 16, .length = 4},
1699         },
1700         {
1701             .type = OperandType::FLOAT32,
1702             .dimensions = {},
1703             .numberOfConsumers = 1,
1704             .scale = 0.0f,
1705             .zeroPoint = 0,
1706             .lifetime = OperandLifeTime::CONSTANT_COPY,
1707             .location = {.poolIndex = 0, .offset = 20, .length = 4},
1708         },
1709         {
1710             .type = OperandType::BOOL,
1711             .dimensions = {},
1712             .numberOfConsumers = 1,
1713             .scale = 0.0f,
1714             .zeroPoint = 0,
1715             .lifetime = OperandLifeTime::CONSTANT_COPY,
1716             .location = {.poolIndex = 0, .offset = 24, .length = 1},
1717         },
1718         {
1719             .type = OperandType::TENSOR_QUANT8_ASYMM,
1720             .dimensions = {0},
1721             .numberOfConsumers = 0,
1722             .scale = 0.01f,
1723             .zeroPoint = 100,
1724             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1725             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1726         },
1727         {
1728             .type = OperandType::TENSOR_QUANT16_ASYMM,
1729             .dimensions = {0, 0},
1730             .numberOfConsumers = 0,
1731             .scale = 0.125f,
1732             .zeroPoint = 0,
1733             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1734             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1735         },
1736         {
1737             .type = OperandType::TENSOR_INT32,
1738             .dimensions = {0},
1739             .numberOfConsumers = 0,
1740             .scale = 0.0f,
1741             .zeroPoint = 0,
1742             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1743             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1744         }
1745     };
1746 
1747     const std::vector<Operation> operations = {
1748         {
1749             .type = OperationType::GENERATE_PROPOSALS,
1750             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1751             .outputs = {11, 12, 13},
1752         }
1753     };
1754 
1755     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1756     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1757     std::vector<uint8_t> operandValues = {
1758       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 0
1759     };
1760     const std::vector<hidl_memory> pools = {};
1761 
1762     return {
1763         .operands = operands,
1764         .operations = operations,
1765         .inputIndexes = inputIndexes,
1766         .outputIndexes = outputIndexes,
1767         .operandValues = operandValues,
1768         .pools = pools,
1769     };
1770 }
1771 
is_ignored_dynamic_output_shape_nhwc_quant8(int i)1772 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
1773   static std::set<int> ignore = {};
1774   return ignore.find(i) != ignore.end();
1775 }
1776 
1777 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16()1778 Model createTestModel_dynamic_output_shape_nhwc_float16() {
1779     const std::vector<Operand> operands = {
1780         {
1781             .type = OperandType::TENSOR_FLOAT16,
1782             .dimensions = {1, 2, 2, 2},
1783             .numberOfConsumers = 1,
1784             .scale = 0.0f,
1785             .zeroPoint = 0,
1786             .lifetime = OperandLifeTime::MODEL_INPUT,
1787             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1788         },
1789         {
1790             .type = OperandType::TENSOR_FLOAT16,
1791             .dimensions = {1, 2, 2, 8},
1792             .numberOfConsumers = 1,
1793             .scale = 0.0f,
1794             .zeroPoint = 0,
1795             .lifetime = OperandLifeTime::MODEL_INPUT,
1796             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1797         },
1798         {
1799             .type = OperandType::TENSOR_FLOAT16,
1800             .dimensions = {2, 4},
1801             .numberOfConsumers = 1,
1802             .scale = 0.0f,
1803             .zeroPoint = 0,
1804             .lifetime = OperandLifeTime::MODEL_INPUT,
1805             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1806         },
1807         {
1808             .type = OperandType::TENSOR_FLOAT16,
1809             .dimensions = {1, 2},
1810             .numberOfConsumers = 1,
1811             .scale = 0.0f,
1812             .zeroPoint = 0,
1813             .lifetime = OperandLifeTime::MODEL_INPUT,
1814             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1815         },
1816         {
1817             .type = OperandType::FLOAT16,
1818             .dimensions = {},
1819             .numberOfConsumers = 1,
1820             .scale = 0.0f,
1821             .zeroPoint = 0,
1822             .lifetime = OperandLifeTime::CONSTANT_COPY,
1823             .location = {.poolIndex = 0, .offset = 0, .length = 2},
1824         },
1825         {
1826             .type = OperandType::FLOAT16,
1827             .dimensions = {},
1828             .numberOfConsumers = 1,
1829             .scale = 0.0f,
1830             .zeroPoint = 0,
1831             .lifetime = OperandLifeTime::CONSTANT_COPY,
1832             .location = {.poolIndex = 0, .offset = 2, .length = 2},
1833         },
1834         {
1835             .type = OperandType::INT32,
1836             .dimensions = {},
1837             .numberOfConsumers = 1,
1838             .scale = 0.0f,
1839             .zeroPoint = 0,
1840             .lifetime = OperandLifeTime::CONSTANT_COPY,
1841             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1842         },
1843         {
1844             .type = OperandType::INT32,
1845             .dimensions = {},
1846             .numberOfConsumers = 1,
1847             .scale = 0.0f,
1848             .zeroPoint = 0,
1849             .lifetime = OperandLifeTime::CONSTANT_COPY,
1850             .location = {.poolIndex = 0, .offset = 8, .length = 4},
1851         },
1852         {
1853             .type = OperandType::FLOAT16,
1854             .dimensions = {},
1855             .numberOfConsumers = 1,
1856             .scale = 0.0f,
1857             .zeroPoint = 0,
1858             .lifetime = OperandLifeTime::CONSTANT_COPY,
1859             .location = {.poolIndex = 0, .offset = 12, .length = 2},
1860         },
1861         {
1862             .type = OperandType::FLOAT16,
1863             .dimensions = {},
1864             .numberOfConsumers = 1,
1865             .scale = 0.0f,
1866             .zeroPoint = 0,
1867             .lifetime = OperandLifeTime::CONSTANT_COPY,
1868             .location = {.poolIndex = 0, .offset = 14, .length = 2},
1869         },
1870         {
1871             .type = OperandType::BOOL,
1872             .dimensions = {},
1873             .numberOfConsumers = 1,
1874             .scale = 0.0f,
1875             .zeroPoint = 0,
1876             .lifetime = OperandLifeTime::CONSTANT_COPY,
1877             .location = {.poolIndex = 0, .offset = 16, .length = 1},
1878         },
1879         {
1880             .type = OperandType::TENSOR_FLOAT16,
1881             .dimensions = {0},
1882             .numberOfConsumers = 0,
1883             .scale = 0.0f,
1884             .zeroPoint = 0,
1885             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1886             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1887         },
1888         {
1889             .type = OperandType::TENSOR_FLOAT16,
1890             .dimensions = {0, 0},
1891             .numberOfConsumers = 0,
1892             .scale = 0.0f,
1893             .zeroPoint = 0,
1894             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1895             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1896         },
1897         {
1898             .type = OperandType::TENSOR_INT32,
1899             .dimensions = {0},
1900             .numberOfConsumers = 0,
1901             .scale = 0.0f,
1902             .zeroPoint = 0,
1903             .lifetime = OperandLifeTime::MODEL_OUTPUT,
1904             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1905         }
1906     };
1907 
1908     const std::vector<Operation> operations = {
1909         {
1910             .type = OperationType::GENERATE_PROPOSALS,
1911             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
1912             .outputs = {11, 12, 13},
1913         }
1914     };
1915 
1916     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
1917     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
1918     std::vector<uint8_t> operandValues = {
1919       0, 68, 0, 68, 255, 255, 255, 255, 255, 255, 255, 255, 205, 52, 0, 60, 0
1920     };
1921     const std::vector<hidl_memory> pools = {};
1922 
1923     return {
1924         .operands = operands,
1925         .operations = operations,
1926         .inputIndexes = inputIndexes,
1927         .outputIndexes = outputIndexes,
1928         .operandValues = operandValues,
1929         .pools = pools,
1930     };
1931 }
1932 
is_ignored_dynamic_output_shape_nhwc_float16(int i)1933 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
1934   static std::set<int> ignore = {};
1935   return ignore.find(i) != ignore.end();
1936 }
1937 
1938 // Create the model
createTestModel_dynamic_output_shape_nchw()1939 Model createTestModel_dynamic_output_shape_nchw() {
1940     const std::vector<Operand> operands = {
1941         {
1942             .type = OperandType::TENSOR_FLOAT32,
1943             .dimensions = {1, 2, 2, 2},
1944             .numberOfConsumers = 1,
1945             .scale = 0.0f,
1946             .zeroPoint = 0,
1947             .lifetime = OperandLifeTime::MODEL_INPUT,
1948             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1949         },
1950         {
1951             .type = OperandType::TENSOR_FLOAT32,
1952             .dimensions = {1, 8, 2, 2},
1953             .numberOfConsumers = 1,
1954             .scale = 0.0f,
1955             .zeroPoint = 0,
1956             .lifetime = OperandLifeTime::MODEL_INPUT,
1957             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1958         },
1959         {
1960             .type = OperandType::TENSOR_FLOAT32,
1961             .dimensions = {2, 4},
1962             .numberOfConsumers = 1,
1963             .scale = 0.0f,
1964             .zeroPoint = 0,
1965             .lifetime = OperandLifeTime::MODEL_INPUT,
1966             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1967         },
1968         {
1969             .type = OperandType::TENSOR_FLOAT32,
1970             .dimensions = {1, 2},
1971             .numberOfConsumers = 1,
1972             .scale = 0.0f,
1973             .zeroPoint = 0,
1974             .lifetime = OperandLifeTime::MODEL_INPUT,
1975             .location = {.poolIndex = 0, .offset = 0, .length = 0},
1976         },
1977         {
1978             .type = OperandType::FLOAT32,
1979             .dimensions = {},
1980             .numberOfConsumers = 1,
1981             .scale = 0.0f,
1982             .zeroPoint = 0,
1983             .lifetime = OperandLifeTime::CONSTANT_COPY,
1984             .location = {.poolIndex = 0, .offset = 0, .length = 4},
1985         },
1986         {
1987             .type = OperandType::FLOAT32,
1988             .dimensions = {},
1989             .numberOfConsumers = 1,
1990             .scale = 0.0f,
1991             .zeroPoint = 0,
1992             .lifetime = OperandLifeTime::CONSTANT_COPY,
1993             .location = {.poolIndex = 0, .offset = 4, .length = 4},
1994         },
1995         {
1996             .type = OperandType::INT32,
1997             .dimensions = {},
1998             .numberOfConsumers = 1,
1999             .scale = 0.0f,
2000             .zeroPoint = 0,
2001             .lifetime = OperandLifeTime::CONSTANT_COPY,
2002             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2003         },
2004         {
2005             .type = OperandType::INT32,
2006             .dimensions = {},
2007             .numberOfConsumers = 1,
2008             .scale = 0.0f,
2009             .zeroPoint = 0,
2010             .lifetime = OperandLifeTime::CONSTANT_COPY,
2011             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2012         },
2013         {
2014             .type = OperandType::FLOAT32,
2015             .dimensions = {},
2016             .numberOfConsumers = 1,
2017             .scale = 0.0f,
2018             .zeroPoint = 0,
2019             .lifetime = OperandLifeTime::CONSTANT_COPY,
2020             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2021         },
2022         {
2023             .type = OperandType::FLOAT32,
2024             .dimensions = {},
2025             .numberOfConsumers = 1,
2026             .scale = 0.0f,
2027             .zeroPoint = 0,
2028             .lifetime = OperandLifeTime::CONSTANT_COPY,
2029             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2030         },
2031         {
2032             .type = OperandType::BOOL,
2033             .dimensions = {},
2034             .numberOfConsumers = 1,
2035             .scale = 0.0f,
2036             .zeroPoint = 0,
2037             .lifetime = OperandLifeTime::CONSTANT_COPY,
2038             .location = {.poolIndex = 0, .offset = 24, .length = 1},
2039         },
2040         {
2041             .type = OperandType::TENSOR_FLOAT32,
2042             .dimensions = {0},
2043             .numberOfConsumers = 0,
2044             .scale = 0.0f,
2045             .zeroPoint = 0,
2046             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2047             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2048         },
2049         {
2050             .type = OperandType::TENSOR_FLOAT32,
2051             .dimensions = {0, 0},
2052             .numberOfConsumers = 0,
2053             .scale = 0.0f,
2054             .zeroPoint = 0,
2055             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2056             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2057         },
2058         {
2059             .type = OperandType::TENSOR_INT32,
2060             .dimensions = {0},
2061             .numberOfConsumers = 0,
2062             .scale = 0.0f,
2063             .zeroPoint = 0,
2064             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2065             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2066         }
2067     };
2068 
2069     const std::vector<Operation> operations = {
2070         {
2071             .type = OperationType::GENERATE_PROPOSALS,
2072             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2073             .outputs = {11, 12, 13},
2074         }
2075     };
2076 
2077     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2078     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2079     std::vector<uint8_t> operandValues = {
2080       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
2081     };
2082     const std::vector<hidl_memory> pools = {};
2083 
2084     return {
2085         .operands = operands,
2086         .operations = operations,
2087         .inputIndexes = inputIndexes,
2088         .outputIndexes = outputIndexes,
2089         .operandValues = operandValues,
2090         .pools = pools,
2091     };
2092 }
2093 
is_ignored_dynamic_output_shape_nchw(int i)2094 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
2095   static std::set<int> ignore = {};
2096   return ignore.find(i) != ignore.end();
2097 }
2098 
2099 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed()2100 Model createTestModel_dynamic_output_shape_nchw_relaxed() {
2101     const std::vector<Operand> operands = {
2102         {
2103             .type = OperandType::TENSOR_FLOAT32,
2104             .dimensions = {1, 2, 2, 2},
2105             .numberOfConsumers = 1,
2106             .scale = 0.0f,
2107             .zeroPoint = 0,
2108             .lifetime = OperandLifeTime::MODEL_INPUT,
2109             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2110         },
2111         {
2112             .type = OperandType::TENSOR_FLOAT32,
2113             .dimensions = {1, 8, 2, 2},
2114             .numberOfConsumers = 1,
2115             .scale = 0.0f,
2116             .zeroPoint = 0,
2117             .lifetime = OperandLifeTime::MODEL_INPUT,
2118             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2119         },
2120         {
2121             .type = OperandType::TENSOR_FLOAT32,
2122             .dimensions = {2, 4},
2123             .numberOfConsumers = 1,
2124             .scale = 0.0f,
2125             .zeroPoint = 0,
2126             .lifetime = OperandLifeTime::MODEL_INPUT,
2127             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2128         },
2129         {
2130             .type = OperandType::TENSOR_FLOAT32,
2131             .dimensions = {1, 2},
2132             .numberOfConsumers = 1,
2133             .scale = 0.0f,
2134             .zeroPoint = 0,
2135             .lifetime = OperandLifeTime::MODEL_INPUT,
2136             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2137         },
2138         {
2139             .type = OperandType::FLOAT32,
2140             .dimensions = {},
2141             .numberOfConsumers = 1,
2142             .scale = 0.0f,
2143             .zeroPoint = 0,
2144             .lifetime = OperandLifeTime::CONSTANT_COPY,
2145             .location = {.poolIndex = 0, .offset = 0, .length = 4},
2146         },
2147         {
2148             .type = OperandType::FLOAT32,
2149             .dimensions = {},
2150             .numberOfConsumers = 1,
2151             .scale = 0.0f,
2152             .zeroPoint = 0,
2153             .lifetime = OperandLifeTime::CONSTANT_COPY,
2154             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2155         },
2156         {
2157             .type = OperandType::INT32,
2158             .dimensions = {},
2159             .numberOfConsumers = 1,
2160             .scale = 0.0f,
2161             .zeroPoint = 0,
2162             .lifetime = OperandLifeTime::CONSTANT_COPY,
2163             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2164         },
2165         {
2166             .type = OperandType::INT32,
2167             .dimensions = {},
2168             .numberOfConsumers = 1,
2169             .scale = 0.0f,
2170             .zeroPoint = 0,
2171             .lifetime = OperandLifeTime::CONSTANT_COPY,
2172             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2173         },
2174         {
2175             .type = OperandType::FLOAT32,
2176             .dimensions = {},
2177             .numberOfConsumers = 1,
2178             .scale = 0.0f,
2179             .zeroPoint = 0,
2180             .lifetime = OperandLifeTime::CONSTANT_COPY,
2181             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2182         },
2183         {
2184             .type = OperandType::FLOAT32,
2185             .dimensions = {},
2186             .numberOfConsumers = 1,
2187             .scale = 0.0f,
2188             .zeroPoint = 0,
2189             .lifetime = OperandLifeTime::CONSTANT_COPY,
2190             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2191         },
2192         {
2193             .type = OperandType::BOOL,
2194             .dimensions = {},
2195             .numberOfConsumers = 1,
2196             .scale = 0.0f,
2197             .zeroPoint = 0,
2198             .lifetime = OperandLifeTime::CONSTANT_COPY,
2199             .location = {.poolIndex = 0, .offset = 24, .length = 1},
2200         },
2201         {
2202             .type = OperandType::TENSOR_FLOAT32,
2203             .dimensions = {0},
2204             .numberOfConsumers = 0,
2205             .scale = 0.0f,
2206             .zeroPoint = 0,
2207             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2208             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2209         },
2210         {
2211             .type = OperandType::TENSOR_FLOAT32,
2212             .dimensions = {0, 0},
2213             .numberOfConsumers = 0,
2214             .scale = 0.0f,
2215             .zeroPoint = 0,
2216             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2217             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2218         },
2219         {
2220             .type = OperandType::TENSOR_INT32,
2221             .dimensions = {0},
2222             .numberOfConsumers = 0,
2223             .scale = 0.0f,
2224             .zeroPoint = 0,
2225             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2226             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2227         }
2228     };
2229 
2230     const std::vector<Operation> operations = {
2231         {
2232             .type = OperationType::GENERATE_PROPOSALS,
2233             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2234             .outputs = {11, 12, 13},
2235         }
2236     };
2237 
2238     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2239     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2240     std::vector<uint8_t> operandValues = {
2241       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
2242     };
2243     const std::vector<hidl_memory> pools = {};
2244 
2245     return {
2246         .operands = operands,
2247         .operations = operations,
2248         .inputIndexes = inputIndexes,
2249         .outputIndexes = outputIndexes,
2250         .operandValues = operandValues,
2251         .pools = pools,
2252         .relaxComputationFloat32toFloat16 = true,
2253     };
2254 }
2255 
is_ignored_dynamic_output_shape_nchw_relaxed(int i)2256 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
2257   static std::set<int> ignore = {};
2258   return ignore.find(i) != ignore.end();
2259 }
2260 
2261 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8()2262 Model createTestModel_dynamic_output_shape_nchw_quant8() {
2263     const std::vector<Operand> operands = {
2264         {
2265             .type = OperandType::TENSOR_QUANT8_ASYMM,
2266             .dimensions = {1, 2, 2, 2},
2267             .numberOfConsumers = 1,
2268             .scale = 0.01f,
2269             .zeroPoint = 100,
2270             .lifetime = OperandLifeTime::MODEL_INPUT,
2271             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2272         },
2273         {
2274             .type = OperandType::TENSOR_QUANT8_ASYMM,
2275             .dimensions = {1, 8, 2, 2},
2276             .numberOfConsumers = 1,
2277             .scale = 0.05f,
2278             .zeroPoint = 128,
2279             .lifetime = OperandLifeTime::MODEL_INPUT,
2280             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2281         },
2282         {
2283             .type = OperandType::TENSOR_QUANT16_SYMM,
2284             .dimensions = {2, 4},
2285             .numberOfConsumers = 1,
2286             .scale = 0.125f,
2287             .zeroPoint = 0,
2288             .lifetime = OperandLifeTime::MODEL_INPUT,
2289             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2290         },
2291         {
2292             .type = OperandType::TENSOR_QUANT16_ASYMM,
2293             .dimensions = {1, 2},
2294             .numberOfConsumers = 1,
2295             .scale = 0.125f,
2296             .zeroPoint = 0,
2297             .lifetime = OperandLifeTime::MODEL_INPUT,
2298             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2299         },
2300         {
2301             .type = OperandType::FLOAT32,
2302             .dimensions = {},
2303             .numberOfConsumers = 1,
2304             .scale = 0.0f,
2305             .zeroPoint = 0,
2306             .lifetime = OperandLifeTime::CONSTANT_COPY,
2307             .location = {.poolIndex = 0, .offset = 0, .length = 4},
2308         },
2309         {
2310             .type = OperandType::FLOAT32,
2311             .dimensions = {},
2312             .numberOfConsumers = 1,
2313             .scale = 0.0f,
2314             .zeroPoint = 0,
2315             .lifetime = OperandLifeTime::CONSTANT_COPY,
2316             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2317         },
2318         {
2319             .type = OperandType::INT32,
2320             .dimensions = {},
2321             .numberOfConsumers = 1,
2322             .scale = 0.0f,
2323             .zeroPoint = 0,
2324             .lifetime = OperandLifeTime::CONSTANT_COPY,
2325             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2326         },
2327         {
2328             .type = OperandType::INT32,
2329             .dimensions = {},
2330             .numberOfConsumers = 1,
2331             .scale = 0.0f,
2332             .zeroPoint = 0,
2333             .lifetime = OperandLifeTime::CONSTANT_COPY,
2334             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2335         },
2336         {
2337             .type = OperandType::FLOAT32,
2338             .dimensions = {},
2339             .numberOfConsumers = 1,
2340             .scale = 0.0f,
2341             .zeroPoint = 0,
2342             .lifetime = OperandLifeTime::CONSTANT_COPY,
2343             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2344         },
2345         {
2346             .type = OperandType::FLOAT32,
2347             .dimensions = {},
2348             .numberOfConsumers = 1,
2349             .scale = 0.0f,
2350             .zeroPoint = 0,
2351             .lifetime = OperandLifeTime::CONSTANT_COPY,
2352             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2353         },
2354         {
2355             .type = OperandType::BOOL,
2356             .dimensions = {},
2357             .numberOfConsumers = 1,
2358             .scale = 0.0f,
2359             .zeroPoint = 0,
2360             .lifetime = OperandLifeTime::CONSTANT_COPY,
2361             .location = {.poolIndex = 0, .offset = 24, .length = 1},
2362         },
2363         {
2364             .type = OperandType::TENSOR_QUANT8_ASYMM,
2365             .dimensions = {0},
2366             .numberOfConsumers = 0,
2367             .scale = 0.01f,
2368             .zeroPoint = 100,
2369             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2370             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2371         },
2372         {
2373             .type = OperandType::TENSOR_QUANT16_ASYMM,
2374             .dimensions = {0, 0},
2375             .numberOfConsumers = 0,
2376             .scale = 0.125f,
2377             .zeroPoint = 0,
2378             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2379             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2380         },
2381         {
2382             .type = OperandType::TENSOR_INT32,
2383             .dimensions = {0},
2384             .numberOfConsumers = 0,
2385             .scale = 0.0f,
2386             .zeroPoint = 0,
2387             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2388             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2389         }
2390     };
2391 
2392     const std::vector<Operation> operations = {
2393         {
2394             .type = OperationType::GENERATE_PROPOSALS,
2395             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2396             .outputs = {11, 12, 13},
2397         }
2398     };
2399 
2400     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2401     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2402     std::vector<uint8_t> operandValues = {
2403       0, 0, 128, 64, 0, 0, 128, 64, 255, 255, 255, 255, 255, 255, 255, 255, 154, 153, 153, 62, 0, 0, 128, 63, 1
2404     };
2405     const std::vector<hidl_memory> pools = {};
2406 
2407     return {
2408         .operands = operands,
2409         .operations = operations,
2410         .inputIndexes = inputIndexes,
2411         .outputIndexes = outputIndexes,
2412         .operandValues = operandValues,
2413         .pools = pools,
2414     };
2415 }
2416 
is_ignored_dynamic_output_shape_nchw_quant8(int i)2417 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
2418   static std::set<int> ignore = {};
2419   return ignore.find(i) != ignore.end();
2420 }
2421 
2422 // Create the model
createTestModel_dynamic_output_shape_nchw_float16()2423 Model createTestModel_dynamic_output_shape_nchw_float16() {
2424     const std::vector<Operand> operands = {
2425         {
2426             .type = OperandType::TENSOR_FLOAT16,
2427             .dimensions = {1, 2, 2, 2},
2428             .numberOfConsumers = 1,
2429             .scale = 0.0f,
2430             .zeroPoint = 0,
2431             .lifetime = OperandLifeTime::MODEL_INPUT,
2432             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2433         },
2434         {
2435             .type = OperandType::TENSOR_FLOAT16,
2436             .dimensions = {1, 8, 2, 2},
2437             .numberOfConsumers = 1,
2438             .scale = 0.0f,
2439             .zeroPoint = 0,
2440             .lifetime = OperandLifeTime::MODEL_INPUT,
2441             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2442         },
2443         {
2444             .type = OperandType::TENSOR_FLOAT16,
2445             .dimensions = {2, 4},
2446             .numberOfConsumers = 1,
2447             .scale = 0.0f,
2448             .zeroPoint = 0,
2449             .lifetime = OperandLifeTime::MODEL_INPUT,
2450             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2451         },
2452         {
2453             .type = OperandType::TENSOR_FLOAT16,
2454             .dimensions = {1, 2},
2455             .numberOfConsumers = 1,
2456             .scale = 0.0f,
2457             .zeroPoint = 0,
2458             .lifetime = OperandLifeTime::MODEL_INPUT,
2459             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2460         },
2461         {
2462             .type = OperandType::FLOAT16,
2463             .dimensions = {},
2464             .numberOfConsumers = 1,
2465             .scale = 0.0f,
2466             .zeroPoint = 0,
2467             .lifetime = OperandLifeTime::CONSTANT_COPY,
2468             .location = {.poolIndex = 0, .offset = 0, .length = 2},
2469         },
2470         {
2471             .type = OperandType::FLOAT16,
2472             .dimensions = {},
2473             .numberOfConsumers = 1,
2474             .scale = 0.0f,
2475             .zeroPoint = 0,
2476             .lifetime = OperandLifeTime::CONSTANT_COPY,
2477             .location = {.poolIndex = 0, .offset = 2, .length = 2},
2478         },
2479         {
2480             .type = OperandType::INT32,
2481             .dimensions = {},
2482             .numberOfConsumers = 1,
2483             .scale = 0.0f,
2484             .zeroPoint = 0,
2485             .lifetime = OperandLifeTime::CONSTANT_COPY,
2486             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2487         },
2488         {
2489             .type = OperandType::INT32,
2490             .dimensions = {},
2491             .numberOfConsumers = 1,
2492             .scale = 0.0f,
2493             .zeroPoint = 0,
2494             .lifetime = OperandLifeTime::CONSTANT_COPY,
2495             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2496         },
2497         {
2498             .type = OperandType::FLOAT16,
2499             .dimensions = {},
2500             .numberOfConsumers = 1,
2501             .scale = 0.0f,
2502             .zeroPoint = 0,
2503             .lifetime = OperandLifeTime::CONSTANT_COPY,
2504             .location = {.poolIndex = 0, .offset = 12, .length = 2},
2505         },
2506         {
2507             .type = OperandType::FLOAT16,
2508             .dimensions = {},
2509             .numberOfConsumers = 1,
2510             .scale = 0.0f,
2511             .zeroPoint = 0,
2512             .lifetime = OperandLifeTime::CONSTANT_COPY,
2513             .location = {.poolIndex = 0, .offset = 14, .length = 2},
2514         },
2515         {
2516             .type = OperandType::BOOL,
2517             .dimensions = {},
2518             .numberOfConsumers = 1,
2519             .scale = 0.0f,
2520             .zeroPoint = 0,
2521             .lifetime = OperandLifeTime::CONSTANT_COPY,
2522             .location = {.poolIndex = 0, .offset = 16, .length = 1},
2523         },
2524         {
2525             .type = OperandType::TENSOR_FLOAT16,
2526             .dimensions = {0},
2527             .numberOfConsumers = 0,
2528             .scale = 0.0f,
2529             .zeroPoint = 0,
2530             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2531             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2532         },
2533         {
2534             .type = OperandType::TENSOR_FLOAT16,
2535             .dimensions = {0, 0},
2536             .numberOfConsumers = 0,
2537             .scale = 0.0f,
2538             .zeroPoint = 0,
2539             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2540             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2541         },
2542         {
2543             .type = OperandType::TENSOR_INT32,
2544             .dimensions = {0},
2545             .numberOfConsumers = 0,
2546             .scale = 0.0f,
2547             .zeroPoint = 0,
2548             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2549             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2550         }
2551     };
2552 
2553     const std::vector<Operation> operations = {
2554         {
2555             .type = OperationType::GENERATE_PROPOSALS,
2556             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2557             .outputs = {11, 12, 13},
2558         }
2559     };
2560 
2561     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2562     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2563     std::vector<uint8_t> operandValues = {
2564       0, 68, 0, 68, 255, 255, 255, 255, 255, 255, 255, 255, 205, 52, 0, 60, 1
2565     };
2566     const std::vector<hidl_memory> pools = {};
2567 
2568     return {
2569         .operands = operands,
2570         .operations = operations,
2571         .inputIndexes = inputIndexes,
2572         .outputIndexes = outputIndexes,
2573         .operandValues = operandValues,
2574         .pools = pools,
2575     };
2576 }
2577 
is_ignored_dynamic_output_shape_nchw_float16(int i)2578 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
2579   static std::set<int> ignore = {};
2580   return ignore.find(i) != ignore.end();
2581 }
2582 
2583 // Create the model
createTestModel_nhwc_2()2584 Model createTestModel_nhwc_2() {
2585     const std::vector<Operand> operands = {
2586         {
2587             .type = OperandType::TENSOR_FLOAT32,
2588             .dimensions = {2, 4, 4, 4},
2589             .numberOfConsumers = 1,
2590             .scale = 0.0f,
2591             .zeroPoint = 0,
2592             .lifetime = OperandLifeTime::MODEL_INPUT,
2593             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2594         },
2595         {
2596             .type = OperandType::TENSOR_FLOAT32,
2597             .dimensions = {2, 4, 4, 16},
2598             .numberOfConsumers = 1,
2599             .scale = 0.0f,
2600             .zeroPoint = 0,
2601             .lifetime = OperandLifeTime::MODEL_INPUT,
2602             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2603         },
2604         {
2605             .type = OperandType::TENSOR_FLOAT32,
2606             .dimensions = {4, 4},
2607             .numberOfConsumers = 1,
2608             .scale = 0.0f,
2609             .zeroPoint = 0,
2610             .lifetime = OperandLifeTime::MODEL_INPUT,
2611             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2612         },
2613         {
2614             .type = OperandType::TENSOR_FLOAT32,
2615             .dimensions = {2, 2},
2616             .numberOfConsumers = 1,
2617             .scale = 0.0f,
2618             .zeroPoint = 0,
2619             .lifetime = OperandLifeTime::MODEL_INPUT,
2620             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2621         },
2622         {
2623             .type = OperandType::FLOAT32,
2624             .dimensions = {},
2625             .numberOfConsumers = 1,
2626             .scale = 0.0f,
2627             .zeroPoint = 0,
2628             .lifetime = OperandLifeTime::CONSTANT_COPY,
2629             .location = {.poolIndex = 0, .offset = 0, .length = 4},
2630         },
2631         {
2632             .type = OperandType::FLOAT32,
2633             .dimensions = {},
2634             .numberOfConsumers = 1,
2635             .scale = 0.0f,
2636             .zeroPoint = 0,
2637             .lifetime = OperandLifeTime::CONSTANT_COPY,
2638             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2639         },
2640         {
2641             .type = OperandType::INT32,
2642             .dimensions = {},
2643             .numberOfConsumers = 1,
2644             .scale = 0.0f,
2645             .zeroPoint = 0,
2646             .lifetime = OperandLifeTime::CONSTANT_COPY,
2647             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2648         },
2649         {
2650             .type = OperandType::INT32,
2651             .dimensions = {},
2652             .numberOfConsumers = 1,
2653             .scale = 0.0f,
2654             .zeroPoint = 0,
2655             .lifetime = OperandLifeTime::CONSTANT_COPY,
2656             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2657         },
2658         {
2659             .type = OperandType::FLOAT32,
2660             .dimensions = {},
2661             .numberOfConsumers = 1,
2662             .scale = 0.0f,
2663             .zeroPoint = 0,
2664             .lifetime = OperandLifeTime::CONSTANT_COPY,
2665             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2666         },
2667         {
2668             .type = OperandType::FLOAT32,
2669             .dimensions = {},
2670             .numberOfConsumers = 1,
2671             .scale = 0.0f,
2672             .zeroPoint = 0,
2673             .lifetime = OperandLifeTime::CONSTANT_COPY,
2674             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2675         },
2676         {
2677             .type = OperandType::BOOL,
2678             .dimensions = {},
2679             .numberOfConsumers = 1,
2680             .scale = 0.0f,
2681             .zeroPoint = 0,
2682             .lifetime = OperandLifeTime::CONSTANT_COPY,
2683             .location = {.poolIndex = 0, .offset = 24, .length = 1},
2684         },
2685         {
2686             .type = OperandType::TENSOR_FLOAT32,
2687             .dimensions = {30},
2688             .numberOfConsumers = 0,
2689             .scale = 0.0f,
2690             .zeroPoint = 0,
2691             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2692             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2693         },
2694         {
2695             .type = OperandType::TENSOR_FLOAT32,
2696             .dimensions = {30, 4},
2697             .numberOfConsumers = 0,
2698             .scale = 0.0f,
2699             .zeroPoint = 0,
2700             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2701             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2702         },
2703         {
2704             .type = OperandType::TENSOR_INT32,
2705             .dimensions = {30},
2706             .numberOfConsumers = 0,
2707             .scale = 0.0f,
2708             .zeroPoint = 0,
2709             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2710             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2711         }
2712     };
2713 
2714     const std::vector<Operation> operations = {
2715         {
2716             .type = OperationType::GENERATE_PROPOSALS,
2717             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2718             .outputs = {11, 12, 13},
2719         }
2720     };
2721 
2722     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2723     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2724     std::vector<uint8_t> operandValues = {
2725       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
2726     };
2727     const std::vector<hidl_memory> pools = {};
2728 
2729     return {
2730         .operands = operands,
2731         .operations = operations,
2732         .inputIndexes = inputIndexes,
2733         .outputIndexes = outputIndexes,
2734         .operandValues = operandValues,
2735         .pools = pools,
2736     };
2737 }
2738 
is_ignored_nhwc_2(int i)2739 inline bool is_ignored_nhwc_2(int i) {
2740   static std::set<int> ignore = {};
2741   return ignore.find(i) != ignore.end();
2742 }
2743 
2744 // Create the model
createTestModel_nhwc_relaxed_2()2745 Model createTestModel_nhwc_relaxed_2() {
2746     const std::vector<Operand> operands = {
2747         {
2748             .type = OperandType::TENSOR_FLOAT32,
2749             .dimensions = {2, 4, 4, 4},
2750             .numberOfConsumers = 1,
2751             .scale = 0.0f,
2752             .zeroPoint = 0,
2753             .lifetime = OperandLifeTime::MODEL_INPUT,
2754             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2755         },
2756         {
2757             .type = OperandType::TENSOR_FLOAT32,
2758             .dimensions = {2, 4, 4, 16},
2759             .numberOfConsumers = 1,
2760             .scale = 0.0f,
2761             .zeroPoint = 0,
2762             .lifetime = OperandLifeTime::MODEL_INPUT,
2763             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2764         },
2765         {
2766             .type = OperandType::TENSOR_FLOAT32,
2767             .dimensions = {4, 4},
2768             .numberOfConsumers = 1,
2769             .scale = 0.0f,
2770             .zeroPoint = 0,
2771             .lifetime = OperandLifeTime::MODEL_INPUT,
2772             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2773         },
2774         {
2775             .type = OperandType::TENSOR_FLOAT32,
2776             .dimensions = {2, 2},
2777             .numberOfConsumers = 1,
2778             .scale = 0.0f,
2779             .zeroPoint = 0,
2780             .lifetime = OperandLifeTime::MODEL_INPUT,
2781             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2782         },
2783         {
2784             .type = OperandType::FLOAT32,
2785             .dimensions = {},
2786             .numberOfConsumers = 1,
2787             .scale = 0.0f,
2788             .zeroPoint = 0,
2789             .lifetime = OperandLifeTime::CONSTANT_COPY,
2790             .location = {.poolIndex = 0, .offset = 0, .length = 4},
2791         },
2792         {
2793             .type = OperandType::FLOAT32,
2794             .dimensions = {},
2795             .numberOfConsumers = 1,
2796             .scale = 0.0f,
2797             .zeroPoint = 0,
2798             .lifetime = OperandLifeTime::CONSTANT_COPY,
2799             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2800         },
2801         {
2802             .type = OperandType::INT32,
2803             .dimensions = {},
2804             .numberOfConsumers = 1,
2805             .scale = 0.0f,
2806             .zeroPoint = 0,
2807             .lifetime = OperandLifeTime::CONSTANT_COPY,
2808             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2809         },
2810         {
2811             .type = OperandType::INT32,
2812             .dimensions = {},
2813             .numberOfConsumers = 1,
2814             .scale = 0.0f,
2815             .zeroPoint = 0,
2816             .lifetime = OperandLifeTime::CONSTANT_COPY,
2817             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2818         },
2819         {
2820             .type = OperandType::FLOAT32,
2821             .dimensions = {},
2822             .numberOfConsumers = 1,
2823             .scale = 0.0f,
2824             .zeroPoint = 0,
2825             .lifetime = OperandLifeTime::CONSTANT_COPY,
2826             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2827         },
2828         {
2829             .type = OperandType::FLOAT32,
2830             .dimensions = {},
2831             .numberOfConsumers = 1,
2832             .scale = 0.0f,
2833             .zeroPoint = 0,
2834             .lifetime = OperandLifeTime::CONSTANT_COPY,
2835             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2836         },
2837         {
2838             .type = OperandType::BOOL,
2839             .dimensions = {},
2840             .numberOfConsumers = 1,
2841             .scale = 0.0f,
2842             .zeroPoint = 0,
2843             .lifetime = OperandLifeTime::CONSTANT_COPY,
2844             .location = {.poolIndex = 0, .offset = 24, .length = 1},
2845         },
2846         {
2847             .type = OperandType::TENSOR_FLOAT32,
2848             .dimensions = {30},
2849             .numberOfConsumers = 0,
2850             .scale = 0.0f,
2851             .zeroPoint = 0,
2852             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2853             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2854         },
2855         {
2856             .type = OperandType::TENSOR_FLOAT32,
2857             .dimensions = {30, 4},
2858             .numberOfConsumers = 0,
2859             .scale = 0.0f,
2860             .zeroPoint = 0,
2861             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2862             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2863         },
2864         {
2865             .type = OperandType::TENSOR_INT32,
2866             .dimensions = {30},
2867             .numberOfConsumers = 0,
2868             .scale = 0.0f,
2869             .zeroPoint = 0,
2870             .lifetime = OperandLifeTime::MODEL_OUTPUT,
2871             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2872         }
2873     };
2874 
2875     const std::vector<Operation> operations = {
2876         {
2877             .type = OperationType::GENERATE_PROPOSALS,
2878             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
2879             .outputs = {11, 12, 13},
2880         }
2881     };
2882 
2883     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
2884     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
2885     std::vector<uint8_t> operandValues = {
2886       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
2887     };
2888     const std::vector<hidl_memory> pools = {};
2889 
2890     return {
2891         .operands = operands,
2892         .operations = operations,
2893         .inputIndexes = inputIndexes,
2894         .outputIndexes = outputIndexes,
2895         .operandValues = operandValues,
2896         .pools = pools,
2897         .relaxComputationFloat32toFloat16 = true,
2898     };
2899 }
2900 
is_ignored_nhwc_relaxed_2(int i)2901 inline bool is_ignored_nhwc_relaxed_2(int i) {
2902   static std::set<int> ignore = {};
2903   return ignore.find(i) != ignore.end();
2904 }
2905 
2906 // Create the model
createTestModel_nhwc_quant8_2()2907 Model createTestModel_nhwc_quant8_2() {
2908     const std::vector<Operand> operands = {
2909         {
2910             .type = OperandType::TENSOR_QUANT8_ASYMM,
2911             .dimensions = {2, 4, 4, 4},
2912             .numberOfConsumers = 1,
2913             .scale = 0.005f,
2914             .zeroPoint = 0,
2915             .lifetime = OperandLifeTime::MODEL_INPUT,
2916             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2917         },
2918         {
2919             .type = OperandType::TENSOR_QUANT8_ASYMM,
2920             .dimensions = {2, 4, 4, 16},
2921             .numberOfConsumers = 1,
2922             .scale = 0.1f,
2923             .zeroPoint = 128,
2924             .lifetime = OperandLifeTime::MODEL_INPUT,
2925             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2926         },
2927         {
2928             .type = OperandType::TENSOR_QUANT16_SYMM,
2929             .dimensions = {4, 4},
2930             .numberOfConsumers = 1,
2931             .scale = 0.125f,
2932             .zeroPoint = 0,
2933             .lifetime = OperandLifeTime::MODEL_INPUT,
2934             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2935         },
2936         {
2937             .type = OperandType::TENSOR_QUANT16_ASYMM,
2938             .dimensions = {2, 2},
2939             .numberOfConsumers = 1,
2940             .scale = 0.125f,
2941             .zeroPoint = 0,
2942             .lifetime = OperandLifeTime::MODEL_INPUT,
2943             .location = {.poolIndex = 0, .offset = 0, .length = 0},
2944         },
2945         {
2946             .type = OperandType::FLOAT32,
2947             .dimensions = {},
2948             .numberOfConsumers = 1,
2949             .scale = 0.0f,
2950             .zeroPoint = 0,
2951             .lifetime = OperandLifeTime::CONSTANT_COPY,
2952             .location = {.poolIndex = 0, .offset = 0, .length = 4},
2953         },
2954         {
2955             .type = OperandType::FLOAT32,
2956             .dimensions = {},
2957             .numberOfConsumers = 1,
2958             .scale = 0.0f,
2959             .zeroPoint = 0,
2960             .lifetime = OperandLifeTime::CONSTANT_COPY,
2961             .location = {.poolIndex = 0, .offset = 4, .length = 4},
2962         },
2963         {
2964             .type = OperandType::INT32,
2965             .dimensions = {},
2966             .numberOfConsumers = 1,
2967             .scale = 0.0f,
2968             .zeroPoint = 0,
2969             .lifetime = OperandLifeTime::CONSTANT_COPY,
2970             .location = {.poolIndex = 0, .offset = 8, .length = 4},
2971         },
2972         {
2973             .type = OperandType::INT32,
2974             .dimensions = {},
2975             .numberOfConsumers = 1,
2976             .scale = 0.0f,
2977             .zeroPoint = 0,
2978             .lifetime = OperandLifeTime::CONSTANT_COPY,
2979             .location = {.poolIndex = 0, .offset = 12, .length = 4},
2980         },
2981         {
2982             .type = OperandType::FLOAT32,
2983             .dimensions = {},
2984             .numberOfConsumers = 1,
2985             .scale = 0.0f,
2986             .zeroPoint = 0,
2987             .lifetime = OperandLifeTime::CONSTANT_COPY,
2988             .location = {.poolIndex = 0, .offset = 16, .length = 4},
2989         },
2990         {
2991             .type = OperandType::FLOAT32,
2992             .dimensions = {},
2993             .numberOfConsumers = 1,
2994             .scale = 0.0f,
2995             .zeroPoint = 0,
2996             .lifetime = OperandLifeTime::CONSTANT_COPY,
2997             .location = {.poolIndex = 0, .offset = 20, .length = 4},
2998         },
2999         {
3000             .type = OperandType::BOOL,
3001             .dimensions = {},
3002             .numberOfConsumers = 1,
3003             .scale = 0.0f,
3004             .zeroPoint = 0,
3005             .lifetime = OperandLifeTime::CONSTANT_COPY,
3006             .location = {.poolIndex = 0, .offset = 24, .length = 1},
3007         },
3008         {
3009             .type = OperandType::TENSOR_QUANT8_ASYMM,
3010             .dimensions = {30},
3011             .numberOfConsumers = 0,
3012             .scale = 0.005f,
3013             .zeroPoint = 0,
3014             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3015             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3016         },
3017         {
3018             .type = OperandType::TENSOR_QUANT16_ASYMM,
3019             .dimensions = {30, 4},
3020             .numberOfConsumers = 0,
3021             .scale = 0.125f,
3022             .zeroPoint = 0,
3023             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3024             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3025         },
3026         {
3027             .type = OperandType::TENSOR_INT32,
3028             .dimensions = {30},
3029             .numberOfConsumers = 0,
3030             .scale = 0.0f,
3031             .zeroPoint = 0,
3032             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3033             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3034         }
3035     };
3036 
3037     const std::vector<Operation> operations = {
3038         {
3039             .type = OperationType::GENERATE_PROPOSALS,
3040             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3041             .outputs = {11, 12, 13},
3042         }
3043     };
3044 
3045     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3046     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3047     std::vector<uint8_t> operandValues = {
3048       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
3049     };
3050     const std::vector<hidl_memory> pools = {};
3051 
3052     return {
3053         .operands = operands,
3054         .operations = operations,
3055         .inputIndexes = inputIndexes,
3056         .outputIndexes = outputIndexes,
3057         .operandValues = operandValues,
3058         .pools = pools,
3059     };
3060 }
3061 
is_ignored_nhwc_quant8_2(int i)3062 inline bool is_ignored_nhwc_quant8_2(int i) {
3063   static std::set<int> ignore = {};
3064   return ignore.find(i) != ignore.end();
3065 }
3066 
3067 // Create the model
createTestModel_nhwc_float16_2()3068 Model createTestModel_nhwc_float16_2() {
3069     const std::vector<Operand> operands = {
3070         {
3071             .type = OperandType::TENSOR_FLOAT16,
3072             .dimensions = {2, 4, 4, 4},
3073             .numberOfConsumers = 1,
3074             .scale = 0.0f,
3075             .zeroPoint = 0,
3076             .lifetime = OperandLifeTime::MODEL_INPUT,
3077             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3078         },
3079         {
3080             .type = OperandType::TENSOR_FLOAT16,
3081             .dimensions = {2, 4, 4, 16},
3082             .numberOfConsumers = 1,
3083             .scale = 0.0f,
3084             .zeroPoint = 0,
3085             .lifetime = OperandLifeTime::MODEL_INPUT,
3086             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3087         },
3088         {
3089             .type = OperandType::TENSOR_FLOAT16,
3090             .dimensions = {4, 4},
3091             .numberOfConsumers = 1,
3092             .scale = 0.0f,
3093             .zeroPoint = 0,
3094             .lifetime = OperandLifeTime::MODEL_INPUT,
3095             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3096         },
3097         {
3098             .type = OperandType::TENSOR_FLOAT16,
3099             .dimensions = {2, 2},
3100             .numberOfConsumers = 1,
3101             .scale = 0.0f,
3102             .zeroPoint = 0,
3103             .lifetime = OperandLifeTime::MODEL_INPUT,
3104             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3105         },
3106         {
3107             .type = OperandType::FLOAT16,
3108             .dimensions = {},
3109             .numberOfConsumers = 1,
3110             .scale = 0.0f,
3111             .zeroPoint = 0,
3112             .lifetime = OperandLifeTime::CONSTANT_COPY,
3113             .location = {.poolIndex = 0, .offset = 0, .length = 2},
3114         },
3115         {
3116             .type = OperandType::FLOAT16,
3117             .dimensions = {},
3118             .numberOfConsumers = 1,
3119             .scale = 0.0f,
3120             .zeroPoint = 0,
3121             .lifetime = OperandLifeTime::CONSTANT_COPY,
3122             .location = {.poolIndex = 0, .offset = 2, .length = 2},
3123         },
3124         {
3125             .type = OperandType::INT32,
3126             .dimensions = {},
3127             .numberOfConsumers = 1,
3128             .scale = 0.0f,
3129             .zeroPoint = 0,
3130             .lifetime = OperandLifeTime::CONSTANT_COPY,
3131             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3132         },
3133         {
3134             .type = OperandType::INT32,
3135             .dimensions = {},
3136             .numberOfConsumers = 1,
3137             .scale = 0.0f,
3138             .zeroPoint = 0,
3139             .lifetime = OperandLifeTime::CONSTANT_COPY,
3140             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3141         },
3142         {
3143             .type = OperandType::FLOAT16,
3144             .dimensions = {},
3145             .numberOfConsumers = 1,
3146             .scale = 0.0f,
3147             .zeroPoint = 0,
3148             .lifetime = OperandLifeTime::CONSTANT_COPY,
3149             .location = {.poolIndex = 0, .offset = 12, .length = 2},
3150         },
3151         {
3152             .type = OperandType::FLOAT16,
3153             .dimensions = {},
3154             .numberOfConsumers = 1,
3155             .scale = 0.0f,
3156             .zeroPoint = 0,
3157             .lifetime = OperandLifeTime::CONSTANT_COPY,
3158             .location = {.poolIndex = 0, .offset = 14, .length = 2},
3159         },
3160         {
3161             .type = OperandType::BOOL,
3162             .dimensions = {},
3163             .numberOfConsumers = 1,
3164             .scale = 0.0f,
3165             .zeroPoint = 0,
3166             .lifetime = OperandLifeTime::CONSTANT_COPY,
3167             .location = {.poolIndex = 0, .offset = 16, .length = 1},
3168         },
3169         {
3170             .type = OperandType::TENSOR_FLOAT16,
3171             .dimensions = {30},
3172             .numberOfConsumers = 0,
3173             .scale = 0.0f,
3174             .zeroPoint = 0,
3175             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3176             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3177         },
3178         {
3179             .type = OperandType::TENSOR_FLOAT16,
3180             .dimensions = {30, 4},
3181             .numberOfConsumers = 0,
3182             .scale = 0.0f,
3183             .zeroPoint = 0,
3184             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3185             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3186         },
3187         {
3188             .type = OperandType::TENSOR_INT32,
3189             .dimensions = {30},
3190             .numberOfConsumers = 0,
3191             .scale = 0.0f,
3192             .zeroPoint = 0,
3193             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3194             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3195         }
3196     };
3197 
3198     const std::vector<Operation> operations = {
3199         {
3200             .type = OperationType::GENERATE_PROPOSALS,
3201             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3202             .outputs = {11, 12, 13},
3203         }
3204     };
3205 
3206     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3207     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3208     std::vector<uint8_t> operandValues = {
3209       0, 73, 0, 73, 32, 0, 0, 0, 16, 0, 0, 0, 102, 50, 0, 60, 0
3210     };
3211     const std::vector<hidl_memory> pools = {};
3212 
3213     return {
3214         .operands = operands,
3215         .operations = operations,
3216         .inputIndexes = inputIndexes,
3217         .outputIndexes = outputIndexes,
3218         .operandValues = operandValues,
3219         .pools = pools,
3220     };
3221 }
3222 
is_ignored_nhwc_float16_2(int i)3223 inline bool is_ignored_nhwc_float16_2(int i) {
3224   static std::set<int> ignore = {};
3225   return ignore.find(i) != ignore.end();
3226 }
3227 
3228 // Create the model
createTestModel_nchw_2()3229 Model createTestModel_nchw_2() {
3230     const std::vector<Operand> operands = {
3231         {
3232             .type = OperandType::TENSOR_FLOAT32,
3233             .dimensions = {2, 4, 4, 4},
3234             .numberOfConsumers = 1,
3235             .scale = 0.0f,
3236             .zeroPoint = 0,
3237             .lifetime = OperandLifeTime::MODEL_INPUT,
3238             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3239         },
3240         {
3241             .type = OperandType::TENSOR_FLOAT32,
3242             .dimensions = {2, 16, 4, 4},
3243             .numberOfConsumers = 1,
3244             .scale = 0.0f,
3245             .zeroPoint = 0,
3246             .lifetime = OperandLifeTime::MODEL_INPUT,
3247             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3248         },
3249         {
3250             .type = OperandType::TENSOR_FLOAT32,
3251             .dimensions = {4, 4},
3252             .numberOfConsumers = 1,
3253             .scale = 0.0f,
3254             .zeroPoint = 0,
3255             .lifetime = OperandLifeTime::MODEL_INPUT,
3256             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3257         },
3258         {
3259             .type = OperandType::TENSOR_FLOAT32,
3260             .dimensions = {2, 2},
3261             .numberOfConsumers = 1,
3262             .scale = 0.0f,
3263             .zeroPoint = 0,
3264             .lifetime = OperandLifeTime::MODEL_INPUT,
3265             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3266         },
3267         {
3268             .type = OperandType::FLOAT32,
3269             .dimensions = {},
3270             .numberOfConsumers = 1,
3271             .scale = 0.0f,
3272             .zeroPoint = 0,
3273             .lifetime = OperandLifeTime::CONSTANT_COPY,
3274             .location = {.poolIndex = 0, .offset = 0, .length = 4},
3275         },
3276         {
3277             .type = OperandType::FLOAT32,
3278             .dimensions = {},
3279             .numberOfConsumers = 1,
3280             .scale = 0.0f,
3281             .zeroPoint = 0,
3282             .lifetime = OperandLifeTime::CONSTANT_COPY,
3283             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3284         },
3285         {
3286             .type = OperandType::INT32,
3287             .dimensions = {},
3288             .numberOfConsumers = 1,
3289             .scale = 0.0f,
3290             .zeroPoint = 0,
3291             .lifetime = OperandLifeTime::CONSTANT_COPY,
3292             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3293         },
3294         {
3295             .type = OperandType::INT32,
3296             .dimensions = {},
3297             .numberOfConsumers = 1,
3298             .scale = 0.0f,
3299             .zeroPoint = 0,
3300             .lifetime = OperandLifeTime::CONSTANT_COPY,
3301             .location = {.poolIndex = 0, .offset = 12, .length = 4},
3302         },
3303         {
3304             .type = OperandType::FLOAT32,
3305             .dimensions = {},
3306             .numberOfConsumers = 1,
3307             .scale = 0.0f,
3308             .zeroPoint = 0,
3309             .lifetime = OperandLifeTime::CONSTANT_COPY,
3310             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3311         },
3312         {
3313             .type = OperandType::FLOAT32,
3314             .dimensions = {},
3315             .numberOfConsumers = 1,
3316             .scale = 0.0f,
3317             .zeroPoint = 0,
3318             .lifetime = OperandLifeTime::CONSTANT_COPY,
3319             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3320         },
3321         {
3322             .type = OperandType::BOOL,
3323             .dimensions = {},
3324             .numberOfConsumers = 1,
3325             .scale = 0.0f,
3326             .zeroPoint = 0,
3327             .lifetime = OperandLifeTime::CONSTANT_COPY,
3328             .location = {.poolIndex = 0, .offset = 24, .length = 1},
3329         },
3330         {
3331             .type = OperandType::TENSOR_FLOAT32,
3332             .dimensions = {30},
3333             .numberOfConsumers = 0,
3334             .scale = 0.0f,
3335             .zeroPoint = 0,
3336             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3337             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3338         },
3339         {
3340             .type = OperandType::TENSOR_FLOAT32,
3341             .dimensions = {30, 4},
3342             .numberOfConsumers = 0,
3343             .scale = 0.0f,
3344             .zeroPoint = 0,
3345             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3346             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3347         },
3348         {
3349             .type = OperandType::TENSOR_INT32,
3350             .dimensions = {30},
3351             .numberOfConsumers = 0,
3352             .scale = 0.0f,
3353             .zeroPoint = 0,
3354             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3355             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3356         }
3357     };
3358 
3359     const std::vector<Operation> operations = {
3360         {
3361             .type = OperationType::GENERATE_PROPOSALS,
3362             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3363             .outputs = {11, 12, 13},
3364         }
3365     };
3366 
3367     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3368     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3369     std::vector<uint8_t> operandValues = {
3370       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
3371     };
3372     const std::vector<hidl_memory> pools = {};
3373 
3374     return {
3375         .operands = operands,
3376         .operations = operations,
3377         .inputIndexes = inputIndexes,
3378         .outputIndexes = outputIndexes,
3379         .operandValues = operandValues,
3380         .pools = pools,
3381     };
3382 }
3383 
is_ignored_nchw_2(int i)3384 inline bool is_ignored_nchw_2(int i) {
3385   static std::set<int> ignore = {};
3386   return ignore.find(i) != ignore.end();
3387 }
3388 
3389 // Create the model
createTestModel_nchw_relaxed_2()3390 Model createTestModel_nchw_relaxed_2() {
3391     const std::vector<Operand> operands = {
3392         {
3393             .type = OperandType::TENSOR_FLOAT32,
3394             .dimensions = {2, 4, 4, 4},
3395             .numberOfConsumers = 1,
3396             .scale = 0.0f,
3397             .zeroPoint = 0,
3398             .lifetime = OperandLifeTime::MODEL_INPUT,
3399             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3400         },
3401         {
3402             .type = OperandType::TENSOR_FLOAT32,
3403             .dimensions = {2, 16, 4, 4},
3404             .numberOfConsumers = 1,
3405             .scale = 0.0f,
3406             .zeroPoint = 0,
3407             .lifetime = OperandLifeTime::MODEL_INPUT,
3408             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3409         },
3410         {
3411             .type = OperandType::TENSOR_FLOAT32,
3412             .dimensions = {4, 4},
3413             .numberOfConsumers = 1,
3414             .scale = 0.0f,
3415             .zeroPoint = 0,
3416             .lifetime = OperandLifeTime::MODEL_INPUT,
3417             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3418         },
3419         {
3420             .type = OperandType::TENSOR_FLOAT32,
3421             .dimensions = {2, 2},
3422             .numberOfConsumers = 1,
3423             .scale = 0.0f,
3424             .zeroPoint = 0,
3425             .lifetime = OperandLifeTime::MODEL_INPUT,
3426             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3427         },
3428         {
3429             .type = OperandType::FLOAT32,
3430             .dimensions = {},
3431             .numberOfConsumers = 1,
3432             .scale = 0.0f,
3433             .zeroPoint = 0,
3434             .lifetime = OperandLifeTime::CONSTANT_COPY,
3435             .location = {.poolIndex = 0, .offset = 0, .length = 4},
3436         },
3437         {
3438             .type = OperandType::FLOAT32,
3439             .dimensions = {},
3440             .numberOfConsumers = 1,
3441             .scale = 0.0f,
3442             .zeroPoint = 0,
3443             .lifetime = OperandLifeTime::CONSTANT_COPY,
3444             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3445         },
3446         {
3447             .type = OperandType::INT32,
3448             .dimensions = {},
3449             .numberOfConsumers = 1,
3450             .scale = 0.0f,
3451             .zeroPoint = 0,
3452             .lifetime = OperandLifeTime::CONSTANT_COPY,
3453             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3454         },
3455         {
3456             .type = OperandType::INT32,
3457             .dimensions = {},
3458             .numberOfConsumers = 1,
3459             .scale = 0.0f,
3460             .zeroPoint = 0,
3461             .lifetime = OperandLifeTime::CONSTANT_COPY,
3462             .location = {.poolIndex = 0, .offset = 12, .length = 4},
3463         },
3464         {
3465             .type = OperandType::FLOAT32,
3466             .dimensions = {},
3467             .numberOfConsumers = 1,
3468             .scale = 0.0f,
3469             .zeroPoint = 0,
3470             .lifetime = OperandLifeTime::CONSTANT_COPY,
3471             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3472         },
3473         {
3474             .type = OperandType::FLOAT32,
3475             .dimensions = {},
3476             .numberOfConsumers = 1,
3477             .scale = 0.0f,
3478             .zeroPoint = 0,
3479             .lifetime = OperandLifeTime::CONSTANT_COPY,
3480             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3481         },
3482         {
3483             .type = OperandType::BOOL,
3484             .dimensions = {},
3485             .numberOfConsumers = 1,
3486             .scale = 0.0f,
3487             .zeroPoint = 0,
3488             .lifetime = OperandLifeTime::CONSTANT_COPY,
3489             .location = {.poolIndex = 0, .offset = 24, .length = 1},
3490         },
3491         {
3492             .type = OperandType::TENSOR_FLOAT32,
3493             .dimensions = {30},
3494             .numberOfConsumers = 0,
3495             .scale = 0.0f,
3496             .zeroPoint = 0,
3497             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3498             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3499         },
3500         {
3501             .type = OperandType::TENSOR_FLOAT32,
3502             .dimensions = {30, 4},
3503             .numberOfConsumers = 0,
3504             .scale = 0.0f,
3505             .zeroPoint = 0,
3506             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3507             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3508         },
3509         {
3510             .type = OperandType::TENSOR_INT32,
3511             .dimensions = {30},
3512             .numberOfConsumers = 0,
3513             .scale = 0.0f,
3514             .zeroPoint = 0,
3515             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3516             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3517         }
3518     };
3519 
3520     const std::vector<Operation> operations = {
3521         {
3522             .type = OperationType::GENERATE_PROPOSALS,
3523             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3524             .outputs = {11, 12, 13},
3525         }
3526     };
3527 
3528     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3529     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3530     std::vector<uint8_t> operandValues = {
3531       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
3532     };
3533     const std::vector<hidl_memory> pools = {};
3534 
3535     return {
3536         .operands = operands,
3537         .operations = operations,
3538         .inputIndexes = inputIndexes,
3539         .outputIndexes = outputIndexes,
3540         .operandValues = operandValues,
3541         .pools = pools,
3542         .relaxComputationFloat32toFloat16 = true,
3543     };
3544 }
3545 
is_ignored_nchw_relaxed_2(int i)3546 inline bool is_ignored_nchw_relaxed_2(int i) {
3547   static std::set<int> ignore = {};
3548   return ignore.find(i) != ignore.end();
3549 }
3550 
3551 // Create the model
createTestModel_nchw_quant8_2()3552 Model createTestModel_nchw_quant8_2() {
3553     const std::vector<Operand> operands = {
3554         {
3555             .type = OperandType::TENSOR_QUANT8_ASYMM,
3556             .dimensions = {2, 4, 4, 4},
3557             .numberOfConsumers = 1,
3558             .scale = 0.005f,
3559             .zeroPoint = 0,
3560             .lifetime = OperandLifeTime::MODEL_INPUT,
3561             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3562         },
3563         {
3564             .type = OperandType::TENSOR_QUANT8_ASYMM,
3565             .dimensions = {2, 16, 4, 4},
3566             .numberOfConsumers = 1,
3567             .scale = 0.1f,
3568             .zeroPoint = 128,
3569             .lifetime = OperandLifeTime::MODEL_INPUT,
3570             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3571         },
3572         {
3573             .type = OperandType::TENSOR_QUANT16_SYMM,
3574             .dimensions = {4, 4},
3575             .numberOfConsumers = 1,
3576             .scale = 0.125f,
3577             .zeroPoint = 0,
3578             .lifetime = OperandLifeTime::MODEL_INPUT,
3579             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3580         },
3581         {
3582             .type = OperandType::TENSOR_QUANT16_ASYMM,
3583             .dimensions = {2, 2},
3584             .numberOfConsumers = 1,
3585             .scale = 0.125f,
3586             .zeroPoint = 0,
3587             .lifetime = OperandLifeTime::MODEL_INPUT,
3588             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3589         },
3590         {
3591             .type = OperandType::FLOAT32,
3592             .dimensions = {},
3593             .numberOfConsumers = 1,
3594             .scale = 0.0f,
3595             .zeroPoint = 0,
3596             .lifetime = OperandLifeTime::CONSTANT_COPY,
3597             .location = {.poolIndex = 0, .offset = 0, .length = 4},
3598         },
3599         {
3600             .type = OperandType::FLOAT32,
3601             .dimensions = {},
3602             .numberOfConsumers = 1,
3603             .scale = 0.0f,
3604             .zeroPoint = 0,
3605             .lifetime = OperandLifeTime::CONSTANT_COPY,
3606             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3607         },
3608         {
3609             .type = OperandType::INT32,
3610             .dimensions = {},
3611             .numberOfConsumers = 1,
3612             .scale = 0.0f,
3613             .zeroPoint = 0,
3614             .lifetime = OperandLifeTime::CONSTANT_COPY,
3615             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3616         },
3617         {
3618             .type = OperandType::INT32,
3619             .dimensions = {},
3620             .numberOfConsumers = 1,
3621             .scale = 0.0f,
3622             .zeroPoint = 0,
3623             .lifetime = OperandLifeTime::CONSTANT_COPY,
3624             .location = {.poolIndex = 0, .offset = 12, .length = 4},
3625         },
3626         {
3627             .type = OperandType::FLOAT32,
3628             .dimensions = {},
3629             .numberOfConsumers = 1,
3630             .scale = 0.0f,
3631             .zeroPoint = 0,
3632             .lifetime = OperandLifeTime::CONSTANT_COPY,
3633             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3634         },
3635         {
3636             .type = OperandType::FLOAT32,
3637             .dimensions = {},
3638             .numberOfConsumers = 1,
3639             .scale = 0.0f,
3640             .zeroPoint = 0,
3641             .lifetime = OperandLifeTime::CONSTANT_COPY,
3642             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3643         },
3644         {
3645             .type = OperandType::BOOL,
3646             .dimensions = {},
3647             .numberOfConsumers = 1,
3648             .scale = 0.0f,
3649             .zeroPoint = 0,
3650             .lifetime = OperandLifeTime::CONSTANT_COPY,
3651             .location = {.poolIndex = 0, .offset = 24, .length = 1},
3652         },
3653         {
3654             .type = OperandType::TENSOR_QUANT8_ASYMM,
3655             .dimensions = {30},
3656             .numberOfConsumers = 0,
3657             .scale = 0.005f,
3658             .zeroPoint = 0,
3659             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3660             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3661         },
3662         {
3663             .type = OperandType::TENSOR_QUANT16_ASYMM,
3664             .dimensions = {30, 4},
3665             .numberOfConsumers = 0,
3666             .scale = 0.125f,
3667             .zeroPoint = 0,
3668             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3669             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3670         },
3671         {
3672             .type = OperandType::TENSOR_INT32,
3673             .dimensions = {30},
3674             .numberOfConsumers = 0,
3675             .scale = 0.0f,
3676             .zeroPoint = 0,
3677             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3678             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3679         }
3680     };
3681 
3682     const std::vector<Operation> operations = {
3683         {
3684             .type = OperationType::GENERATE_PROPOSALS,
3685             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3686             .outputs = {11, 12, 13},
3687         }
3688     };
3689 
3690     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3691     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3692     std::vector<uint8_t> operandValues = {
3693       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
3694     };
3695     const std::vector<hidl_memory> pools = {};
3696 
3697     return {
3698         .operands = operands,
3699         .operations = operations,
3700         .inputIndexes = inputIndexes,
3701         .outputIndexes = outputIndexes,
3702         .operandValues = operandValues,
3703         .pools = pools,
3704     };
3705 }
3706 
is_ignored_nchw_quant8_2(int i)3707 inline bool is_ignored_nchw_quant8_2(int i) {
3708   static std::set<int> ignore = {};
3709   return ignore.find(i) != ignore.end();
3710 }
3711 
3712 // Create the model
createTestModel_nchw_float16_2()3713 Model createTestModel_nchw_float16_2() {
3714     const std::vector<Operand> operands = {
3715         {
3716             .type = OperandType::TENSOR_FLOAT16,
3717             .dimensions = {2, 4, 4, 4},
3718             .numberOfConsumers = 1,
3719             .scale = 0.0f,
3720             .zeroPoint = 0,
3721             .lifetime = OperandLifeTime::MODEL_INPUT,
3722             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3723         },
3724         {
3725             .type = OperandType::TENSOR_FLOAT16,
3726             .dimensions = {2, 16, 4, 4},
3727             .numberOfConsumers = 1,
3728             .scale = 0.0f,
3729             .zeroPoint = 0,
3730             .lifetime = OperandLifeTime::MODEL_INPUT,
3731             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3732         },
3733         {
3734             .type = OperandType::TENSOR_FLOAT16,
3735             .dimensions = {4, 4},
3736             .numberOfConsumers = 1,
3737             .scale = 0.0f,
3738             .zeroPoint = 0,
3739             .lifetime = OperandLifeTime::MODEL_INPUT,
3740             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3741         },
3742         {
3743             .type = OperandType::TENSOR_FLOAT16,
3744             .dimensions = {2, 2},
3745             .numberOfConsumers = 1,
3746             .scale = 0.0f,
3747             .zeroPoint = 0,
3748             .lifetime = OperandLifeTime::MODEL_INPUT,
3749             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3750         },
3751         {
3752             .type = OperandType::FLOAT16,
3753             .dimensions = {},
3754             .numberOfConsumers = 1,
3755             .scale = 0.0f,
3756             .zeroPoint = 0,
3757             .lifetime = OperandLifeTime::CONSTANT_COPY,
3758             .location = {.poolIndex = 0, .offset = 0, .length = 2},
3759         },
3760         {
3761             .type = OperandType::FLOAT16,
3762             .dimensions = {},
3763             .numberOfConsumers = 1,
3764             .scale = 0.0f,
3765             .zeroPoint = 0,
3766             .lifetime = OperandLifeTime::CONSTANT_COPY,
3767             .location = {.poolIndex = 0, .offset = 2, .length = 2},
3768         },
3769         {
3770             .type = OperandType::INT32,
3771             .dimensions = {},
3772             .numberOfConsumers = 1,
3773             .scale = 0.0f,
3774             .zeroPoint = 0,
3775             .lifetime = OperandLifeTime::CONSTANT_COPY,
3776             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3777         },
3778         {
3779             .type = OperandType::INT32,
3780             .dimensions = {},
3781             .numberOfConsumers = 1,
3782             .scale = 0.0f,
3783             .zeroPoint = 0,
3784             .lifetime = OperandLifeTime::CONSTANT_COPY,
3785             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3786         },
3787         {
3788             .type = OperandType::FLOAT16,
3789             .dimensions = {},
3790             .numberOfConsumers = 1,
3791             .scale = 0.0f,
3792             .zeroPoint = 0,
3793             .lifetime = OperandLifeTime::CONSTANT_COPY,
3794             .location = {.poolIndex = 0, .offset = 12, .length = 2},
3795         },
3796         {
3797             .type = OperandType::FLOAT16,
3798             .dimensions = {},
3799             .numberOfConsumers = 1,
3800             .scale = 0.0f,
3801             .zeroPoint = 0,
3802             .lifetime = OperandLifeTime::CONSTANT_COPY,
3803             .location = {.poolIndex = 0, .offset = 14, .length = 2},
3804         },
3805         {
3806             .type = OperandType::BOOL,
3807             .dimensions = {},
3808             .numberOfConsumers = 1,
3809             .scale = 0.0f,
3810             .zeroPoint = 0,
3811             .lifetime = OperandLifeTime::CONSTANT_COPY,
3812             .location = {.poolIndex = 0, .offset = 16, .length = 1},
3813         },
3814         {
3815             .type = OperandType::TENSOR_FLOAT16,
3816             .dimensions = {30},
3817             .numberOfConsumers = 0,
3818             .scale = 0.0f,
3819             .zeroPoint = 0,
3820             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3821             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3822         },
3823         {
3824             .type = OperandType::TENSOR_FLOAT16,
3825             .dimensions = {30, 4},
3826             .numberOfConsumers = 0,
3827             .scale = 0.0f,
3828             .zeroPoint = 0,
3829             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3830             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3831         },
3832         {
3833             .type = OperandType::TENSOR_INT32,
3834             .dimensions = {30},
3835             .numberOfConsumers = 0,
3836             .scale = 0.0f,
3837             .zeroPoint = 0,
3838             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3839             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3840         }
3841     };
3842 
3843     const std::vector<Operation> operations = {
3844         {
3845             .type = OperationType::GENERATE_PROPOSALS,
3846             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
3847             .outputs = {11, 12, 13},
3848         }
3849     };
3850 
3851     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
3852     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
3853     std::vector<uint8_t> operandValues = {
3854       0, 73, 0, 73, 32, 0, 0, 0, 16, 0, 0, 0, 102, 50, 0, 60, 1
3855     };
3856     const std::vector<hidl_memory> pools = {};
3857 
3858     return {
3859         .operands = operands,
3860         .operations = operations,
3861         .inputIndexes = inputIndexes,
3862         .outputIndexes = outputIndexes,
3863         .operandValues = operandValues,
3864         .pools = pools,
3865     };
3866 }
3867 
is_ignored_nchw_float16_2(int i)3868 inline bool is_ignored_nchw_float16_2(int i) {
3869   static std::set<int> ignore = {};
3870   return ignore.find(i) != ignore.end();
3871 }
3872 
3873 // Create the model
createTestModel_dynamic_output_shape_nhwc_2()3874 Model createTestModel_dynamic_output_shape_nhwc_2() {
3875     const std::vector<Operand> operands = {
3876         {
3877             .type = OperandType::TENSOR_FLOAT32,
3878             .dimensions = {2, 4, 4, 4},
3879             .numberOfConsumers = 1,
3880             .scale = 0.0f,
3881             .zeroPoint = 0,
3882             .lifetime = OperandLifeTime::MODEL_INPUT,
3883             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3884         },
3885         {
3886             .type = OperandType::TENSOR_FLOAT32,
3887             .dimensions = {2, 4, 4, 16},
3888             .numberOfConsumers = 1,
3889             .scale = 0.0f,
3890             .zeroPoint = 0,
3891             .lifetime = OperandLifeTime::MODEL_INPUT,
3892             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3893         },
3894         {
3895             .type = OperandType::TENSOR_FLOAT32,
3896             .dimensions = {4, 4},
3897             .numberOfConsumers = 1,
3898             .scale = 0.0f,
3899             .zeroPoint = 0,
3900             .lifetime = OperandLifeTime::MODEL_INPUT,
3901             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3902         },
3903         {
3904             .type = OperandType::TENSOR_FLOAT32,
3905             .dimensions = {2, 2},
3906             .numberOfConsumers = 1,
3907             .scale = 0.0f,
3908             .zeroPoint = 0,
3909             .lifetime = OperandLifeTime::MODEL_INPUT,
3910             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3911         },
3912         {
3913             .type = OperandType::FLOAT32,
3914             .dimensions = {},
3915             .numberOfConsumers = 1,
3916             .scale = 0.0f,
3917             .zeroPoint = 0,
3918             .lifetime = OperandLifeTime::CONSTANT_COPY,
3919             .location = {.poolIndex = 0, .offset = 0, .length = 4},
3920         },
3921         {
3922             .type = OperandType::FLOAT32,
3923             .dimensions = {},
3924             .numberOfConsumers = 1,
3925             .scale = 0.0f,
3926             .zeroPoint = 0,
3927             .lifetime = OperandLifeTime::CONSTANT_COPY,
3928             .location = {.poolIndex = 0, .offset = 4, .length = 4},
3929         },
3930         {
3931             .type = OperandType::INT32,
3932             .dimensions = {},
3933             .numberOfConsumers = 1,
3934             .scale = 0.0f,
3935             .zeroPoint = 0,
3936             .lifetime = OperandLifeTime::CONSTANT_COPY,
3937             .location = {.poolIndex = 0, .offset = 8, .length = 4},
3938         },
3939         {
3940             .type = OperandType::INT32,
3941             .dimensions = {},
3942             .numberOfConsumers = 1,
3943             .scale = 0.0f,
3944             .zeroPoint = 0,
3945             .lifetime = OperandLifeTime::CONSTANT_COPY,
3946             .location = {.poolIndex = 0, .offset = 12, .length = 4},
3947         },
3948         {
3949             .type = OperandType::FLOAT32,
3950             .dimensions = {},
3951             .numberOfConsumers = 1,
3952             .scale = 0.0f,
3953             .zeroPoint = 0,
3954             .lifetime = OperandLifeTime::CONSTANT_COPY,
3955             .location = {.poolIndex = 0, .offset = 16, .length = 4},
3956         },
3957         {
3958             .type = OperandType::FLOAT32,
3959             .dimensions = {},
3960             .numberOfConsumers = 1,
3961             .scale = 0.0f,
3962             .zeroPoint = 0,
3963             .lifetime = OperandLifeTime::CONSTANT_COPY,
3964             .location = {.poolIndex = 0, .offset = 20, .length = 4},
3965         },
3966         {
3967             .type = OperandType::BOOL,
3968             .dimensions = {},
3969             .numberOfConsumers = 1,
3970             .scale = 0.0f,
3971             .zeroPoint = 0,
3972             .lifetime = OperandLifeTime::CONSTANT_COPY,
3973             .location = {.poolIndex = 0, .offset = 24, .length = 1},
3974         },
3975         {
3976             .type = OperandType::TENSOR_FLOAT32,
3977             .dimensions = {0},
3978             .numberOfConsumers = 0,
3979             .scale = 0.0f,
3980             .zeroPoint = 0,
3981             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3982             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3983         },
3984         {
3985             .type = OperandType::TENSOR_FLOAT32,
3986             .dimensions = {0, 0},
3987             .numberOfConsumers = 0,
3988             .scale = 0.0f,
3989             .zeroPoint = 0,
3990             .lifetime = OperandLifeTime::MODEL_OUTPUT,
3991             .location = {.poolIndex = 0, .offset = 0, .length = 0},
3992         },
3993         {
3994             .type = OperandType::TENSOR_INT32,
3995             .dimensions = {0},
3996             .numberOfConsumers = 0,
3997             .scale = 0.0f,
3998             .zeroPoint = 0,
3999             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4000             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4001         }
4002     };
4003 
4004     const std::vector<Operation> operations = {
4005         {
4006             .type = OperationType::GENERATE_PROPOSALS,
4007             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4008             .outputs = {11, 12, 13},
4009         }
4010     };
4011 
4012     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4013     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4014     std::vector<uint8_t> operandValues = {
4015       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
4016     };
4017     const std::vector<hidl_memory> pools = {};
4018 
4019     return {
4020         .operands = operands,
4021         .operations = operations,
4022         .inputIndexes = inputIndexes,
4023         .outputIndexes = outputIndexes,
4024         .operandValues = operandValues,
4025         .pools = pools,
4026     };
4027 }
4028 
is_ignored_dynamic_output_shape_nhwc_2(int i)4029 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
4030   static std::set<int> ignore = {};
4031   return ignore.find(i) != ignore.end();
4032 }
4033 
4034 // Create the model
createTestModel_dynamic_output_shape_nhwc_relaxed_2()4035 Model createTestModel_dynamic_output_shape_nhwc_relaxed_2() {
4036     const std::vector<Operand> operands = {
4037         {
4038             .type = OperandType::TENSOR_FLOAT32,
4039             .dimensions = {2, 4, 4, 4},
4040             .numberOfConsumers = 1,
4041             .scale = 0.0f,
4042             .zeroPoint = 0,
4043             .lifetime = OperandLifeTime::MODEL_INPUT,
4044             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4045         },
4046         {
4047             .type = OperandType::TENSOR_FLOAT32,
4048             .dimensions = {2, 4, 4, 16},
4049             .numberOfConsumers = 1,
4050             .scale = 0.0f,
4051             .zeroPoint = 0,
4052             .lifetime = OperandLifeTime::MODEL_INPUT,
4053             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4054         },
4055         {
4056             .type = OperandType::TENSOR_FLOAT32,
4057             .dimensions = {4, 4},
4058             .numberOfConsumers = 1,
4059             .scale = 0.0f,
4060             .zeroPoint = 0,
4061             .lifetime = OperandLifeTime::MODEL_INPUT,
4062             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4063         },
4064         {
4065             .type = OperandType::TENSOR_FLOAT32,
4066             .dimensions = {2, 2},
4067             .numberOfConsumers = 1,
4068             .scale = 0.0f,
4069             .zeroPoint = 0,
4070             .lifetime = OperandLifeTime::MODEL_INPUT,
4071             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4072         },
4073         {
4074             .type = OperandType::FLOAT32,
4075             .dimensions = {},
4076             .numberOfConsumers = 1,
4077             .scale = 0.0f,
4078             .zeroPoint = 0,
4079             .lifetime = OperandLifeTime::CONSTANT_COPY,
4080             .location = {.poolIndex = 0, .offset = 0, .length = 4},
4081         },
4082         {
4083             .type = OperandType::FLOAT32,
4084             .dimensions = {},
4085             .numberOfConsumers = 1,
4086             .scale = 0.0f,
4087             .zeroPoint = 0,
4088             .lifetime = OperandLifeTime::CONSTANT_COPY,
4089             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4090         },
4091         {
4092             .type = OperandType::INT32,
4093             .dimensions = {},
4094             .numberOfConsumers = 1,
4095             .scale = 0.0f,
4096             .zeroPoint = 0,
4097             .lifetime = OperandLifeTime::CONSTANT_COPY,
4098             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4099         },
4100         {
4101             .type = OperandType::INT32,
4102             .dimensions = {},
4103             .numberOfConsumers = 1,
4104             .scale = 0.0f,
4105             .zeroPoint = 0,
4106             .lifetime = OperandLifeTime::CONSTANT_COPY,
4107             .location = {.poolIndex = 0, .offset = 12, .length = 4},
4108         },
4109         {
4110             .type = OperandType::FLOAT32,
4111             .dimensions = {},
4112             .numberOfConsumers = 1,
4113             .scale = 0.0f,
4114             .zeroPoint = 0,
4115             .lifetime = OperandLifeTime::CONSTANT_COPY,
4116             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4117         },
4118         {
4119             .type = OperandType::FLOAT32,
4120             .dimensions = {},
4121             .numberOfConsumers = 1,
4122             .scale = 0.0f,
4123             .zeroPoint = 0,
4124             .lifetime = OperandLifeTime::CONSTANT_COPY,
4125             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4126         },
4127         {
4128             .type = OperandType::BOOL,
4129             .dimensions = {},
4130             .numberOfConsumers = 1,
4131             .scale = 0.0f,
4132             .zeroPoint = 0,
4133             .lifetime = OperandLifeTime::CONSTANT_COPY,
4134             .location = {.poolIndex = 0, .offset = 24, .length = 1},
4135         },
4136         {
4137             .type = OperandType::TENSOR_FLOAT32,
4138             .dimensions = {0},
4139             .numberOfConsumers = 0,
4140             .scale = 0.0f,
4141             .zeroPoint = 0,
4142             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4143             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4144         },
4145         {
4146             .type = OperandType::TENSOR_FLOAT32,
4147             .dimensions = {0, 0},
4148             .numberOfConsumers = 0,
4149             .scale = 0.0f,
4150             .zeroPoint = 0,
4151             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4152             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4153         },
4154         {
4155             .type = OperandType::TENSOR_INT32,
4156             .dimensions = {0},
4157             .numberOfConsumers = 0,
4158             .scale = 0.0f,
4159             .zeroPoint = 0,
4160             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4161             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4162         }
4163     };
4164 
4165     const std::vector<Operation> operations = {
4166         {
4167             .type = OperationType::GENERATE_PROPOSALS,
4168             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4169             .outputs = {11, 12, 13},
4170         }
4171     };
4172 
4173     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4174     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4175     std::vector<uint8_t> operandValues = {
4176       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
4177     };
4178     const std::vector<hidl_memory> pools = {};
4179 
4180     return {
4181         .operands = operands,
4182         .operations = operations,
4183         .inputIndexes = inputIndexes,
4184         .outputIndexes = outputIndexes,
4185         .operandValues = operandValues,
4186         .pools = pools,
4187         .relaxComputationFloat32toFloat16 = true,
4188     };
4189 }
4190 
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)4191 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
4192   static std::set<int> ignore = {};
4193   return ignore.find(i) != ignore.end();
4194 }
4195 
4196 // Create the model
createTestModel_dynamic_output_shape_nhwc_quant8_2()4197 Model createTestModel_dynamic_output_shape_nhwc_quant8_2() {
4198     const std::vector<Operand> operands = {
4199         {
4200             .type = OperandType::TENSOR_QUANT8_ASYMM,
4201             .dimensions = {2, 4, 4, 4},
4202             .numberOfConsumers = 1,
4203             .scale = 0.005f,
4204             .zeroPoint = 0,
4205             .lifetime = OperandLifeTime::MODEL_INPUT,
4206             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4207         },
4208         {
4209             .type = OperandType::TENSOR_QUANT8_ASYMM,
4210             .dimensions = {2, 4, 4, 16},
4211             .numberOfConsumers = 1,
4212             .scale = 0.1f,
4213             .zeroPoint = 128,
4214             .lifetime = OperandLifeTime::MODEL_INPUT,
4215             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4216         },
4217         {
4218             .type = OperandType::TENSOR_QUANT16_SYMM,
4219             .dimensions = {4, 4},
4220             .numberOfConsumers = 1,
4221             .scale = 0.125f,
4222             .zeroPoint = 0,
4223             .lifetime = OperandLifeTime::MODEL_INPUT,
4224             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4225         },
4226         {
4227             .type = OperandType::TENSOR_QUANT16_ASYMM,
4228             .dimensions = {2, 2},
4229             .numberOfConsumers = 1,
4230             .scale = 0.125f,
4231             .zeroPoint = 0,
4232             .lifetime = OperandLifeTime::MODEL_INPUT,
4233             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4234         },
4235         {
4236             .type = OperandType::FLOAT32,
4237             .dimensions = {},
4238             .numberOfConsumers = 1,
4239             .scale = 0.0f,
4240             .zeroPoint = 0,
4241             .lifetime = OperandLifeTime::CONSTANT_COPY,
4242             .location = {.poolIndex = 0, .offset = 0, .length = 4},
4243         },
4244         {
4245             .type = OperandType::FLOAT32,
4246             .dimensions = {},
4247             .numberOfConsumers = 1,
4248             .scale = 0.0f,
4249             .zeroPoint = 0,
4250             .lifetime = OperandLifeTime::CONSTANT_COPY,
4251             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4252         },
4253         {
4254             .type = OperandType::INT32,
4255             .dimensions = {},
4256             .numberOfConsumers = 1,
4257             .scale = 0.0f,
4258             .zeroPoint = 0,
4259             .lifetime = OperandLifeTime::CONSTANT_COPY,
4260             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4261         },
4262         {
4263             .type = OperandType::INT32,
4264             .dimensions = {},
4265             .numberOfConsumers = 1,
4266             .scale = 0.0f,
4267             .zeroPoint = 0,
4268             .lifetime = OperandLifeTime::CONSTANT_COPY,
4269             .location = {.poolIndex = 0, .offset = 12, .length = 4},
4270         },
4271         {
4272             .type = OperandType::FLOAT32,
4273             .dimensions = {},
4274             .numberOfConsumers = 1,
4275             .scale = 0.0f,
4276             .zeroPoint = 0,
4277             .lifetime = OperandLifeTime::CONSTANT_COPY,
4278             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4279         },
4280         {
4281             .type = OperandType::FLOAT32,
4282             .dimensions = {},
4283             .numberOfConsumers = 1,
4284             .scale = 0.0f,
4285             .zeroPoint = 0,
4286             .lifetime = OperandLifeTime::CONSTANT_COPY,
4287             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4288         },
4289         {
4290             .type = OperandType::BOOL,
4291             .dimensions = {},
4292             .numberOfConsumers = 1,
4293             .scale = 0.0f,
4294             .zeroPoint = 0,
4295             .lifetime = OperandLifeTime::CONSTANT_COPY,
4296             .location = {.poolIndex = 0, .offset = 24, .length = 1},
4297         },
4298         {
4299             .type = OperandType::TENSOR_QUANT8_ASYMM,
4300             .dimensions = {0},
4301             .numberOfConsumers = 0,
4302             .scale = 0.005f,
4303             .zeroPoint = 0,
4304             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4305             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4306         },
4307         {
4308             .type = OperandType::TENSOR_QUANT16_ASYMM,
4309             .dimensions = {0, 0},
4310             .numberOfConsumers = 0,
4311             .scale = 0.125f,
4312             .zeroPoint = 0,
4313             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4314             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4315         },
4316         {
4317             .type = OperandType::TENSOR_INT32,
4318             .dimensions = {0},
4319             .numberOfConsumers = 0,
4320             .scale = 0.0f,
4321             .zeroPoint = 0,
4322             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4323             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4324         }
4325     };
4326 
4327     const std::vector<Operation> operations = {
4328         {
4329             .type = OperationType::GENERATE_PROPOSALS,
4330             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4331             .outputs = {11, 12, 13},
4332         }
4333     };
4334 
4335     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4336     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4337     std::vector<uint8_t> operandValues = {
4338       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 0
4339     };
4340     const std::vector<hidl_memory> pools = {};
4341 
4342     return {
4343         .operands = operands,
4344         .operations = operations,
4345         .inputIndexes = inputIndexes,
4346         .outputIndexes = outputIndexes,
4347         .operandValues = operandValues,
4348         .pools = pools,
4349     };
4350 }
4351 
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)4352 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
4353   static std::set<int> ignore = {};
4354   return ignore.find(i) != ignore.end();
4355 }
4356 
4357 // Create the model
createTestModel_dynamic_output_shape_nhwc_float16_2()4358 Model createTestModel_dynamic_output_shape_nhwc_float16_2() {
4359     const std::vector<Operand> operands = {
4360         {
4361             .type = OperandType::TENSOR_FLOAT16,
4362             .dimensions = {2, 4, 4, 4},
4363             .numberOfConsumers = 1,
4364             .scale = 0.0f,
4365             .zeroPoint = 0,
4366             .lifetime = OperandLifeTime::MODEL_INPUT,
4367             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4368         },
4369         {
4370             .type = OperandType::TENSOR_FLOAT16,
4371             .dimensions = {2, 4, 4, 16},
4372             .numberOfConsumers = 1,
4373             .scale = 0.0f,
4374             .zeroPoint = 0,
4375             .lifetime = OperandLifeTime::MODEL_INPUT,
4376             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4377         },
4378         {
4379             .type = OperandType::TENSOR_FLOAT16,
4380             .dimensions = {4, 4},
4381             .numberOfConsumers = 1,
4382             .scale = 0.0f,
4383             .zeroPoint = 0,
4384             .lifetime = OperandLifeTime::MODEL_INPUT,
4385             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4386         },
4387         {
4388             .type = OperandType::TENSOR_FLOAT16,
4389             .dimensions = {2, 2},
4390             .numberOfConsumers = 1,
4391             .scale = 0.0f,
4392             .zeroPoint = 0,
4393             .lifetime = OperandLifeTime::MODEL_INPUT,
4394             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4395         },
4396         {
4397             .type = OperandType::FLOAT16,
4398             .dimensions = {},
4399             .numberOfConsumers = 1,
4400             .scale = 0.0f,
4401             .zeroPoint = 0,
4402             .lifetime = OperandLifeTime::CONSTANT_COPY,
4403             .location = {.poolIndex = 0, .offset = 0, .length = 2},
4404         },
4405         {
4406             .type = OperandType::FLOAT16,
4407             .dimensions = {},
4408             .numberOfConsumers = 1,
4409             .scale = 0.0f,
4410             .zeroPoint = 0,
4411             .lifetime = OperandLifeTime::CONSTANT_COPY,
4412             .location = {.poolIndex = 0, .offset = 2, .length = 2},
4413         },
4414         {
4415             .type = OperandType::INT32,
4416             .dimensions = {},
4417             .numberOfConsumers = 1,
4418             .scale = 0.0f,
4419             .zeroPoint = 0,
4420             .lifetime = OperandLifeTime::CONSTANT_COPY,
4421             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4422         },
4423         {
4424             .type = OperandType::INT32,
4425             .dimensions = {},
4426             .numberOfConsumers = 1,
4427             .scale = 0.0f,
4428             .zeroPoint = 0,
4429             .lifetime = OperandLifeTime::CONSTANT_COPY,
4430             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4431         },
4432         {
4433             .type = OperandType::FLOAT16,
4434             .dimensions = {},
4435             .numberOfConsumers = 1,
4436             .scale = 0.0f,
4437             .zeroPoint = 0,
4438             .lifetime = OperandLifeTime::CONSTANT_COPY,
4439             .location = {.poolIndex = 0, .offset = 12, .length = 2},
4440         },
4441         {
4442             .type = OperandType::FLOAT16,
4443             .dimensions = {},
4444             .numberOfConsumers = 1,
4445             .scale = 0.0f,
4446             .zeroPoint = 0,
4447             .lifetime = OperandLifeTime::CONSTANT_COPY,
4448             .location = {.poolIndex = 0, .offset = 14, .length = 2},
4449         },
4450         {
4451             .type = OperandType::BOOL,
4452             .dimensions = {},
4453             .numberOfConsumers = 1,
4454             .scale = 0.0f,
4455             .zeroPoint = 0,
4456             .lifetime = OperandLifeTime::CONSTANT_COPY,
4457             .location = {.poolIndex = 0, .offset = 16, .length = 1},
4458         },
4459         {
4460             .type = OperandType::TENSOR_FLOAT16,
4461             .dimensions = {0},
4462             .numberOfConsumers = 0,
4463             .scale = 0.0f,
4464             .zeroPoint = 0,
4465             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4466             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4467         },
4468         {
4469             .type = OperandType::TENSOR_FLOAT16,
4470             .dimensions = {0, 0},
4471             .numberOfConsumers = 0,
4472             .scale = 0.0f,
4473             .zeroPoint = 0,
4474             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4475             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4476         },
4477         {
4478             .type = OperandType::TENSOR_INT32,
4479             .dimensions = {0},
4480             .numberOfConsumers = 0,
4481             .scale = 0.0f,
4482             .zeroPoint = 0,
4483             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4484             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4485         }
4486     };
4487 
4488     const std::vector<Operation> operations = {
4489         {
4490             .type = OperationType::GENERATE_PROPOSALS,
4491             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4492             .outputs = {11, 12, 13},
4493         }
4494     };
4495 
4496     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4497     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4498     std::vector<uint8_t> operandValues = {
4499       0, 73, 0, 73, 32, 0, 0, 0, 16, 0, 0, 0, 102, 50, 0, 60, 0
4500     };
4501     const std::vector<hidl_memory> pools = {};
4502 
4503     return {
4504         .operands = operands,
4505         .operations = operations,
4506         .inputIndexes = inputIndexes,
4507         .outputIndexes = outputIndexes,
4508         .operandValues = operandValues,
4509         .pools = pools,
4510     };
4511 }
4512 
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)4513 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
4514   static std::set<int> ignore = {};
4515   return ignore.find(i) != ignore.end();
4516 }
4517 
4518 // Create the model
createTestModel_dynamic_output_shape_nchw_2()4519 Model createTestModel_dynamic_output_shape_nchw_2() {
4520     const std::vector<Operand> operands = {
4521         {
4522             .type = OperandType::TENSOR_FLOAT32,
4523             .dimensions = {2, 4, 4, 4},
4524             .numberOfConsumers = 1,
4525             .scale = 0.0f,
4526             .zeroPoint = 0,
4527             .lifetime = OperandLifeTime::MODEL_INPUT,
4528             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4529         },
4530         {
4531             .type = OperandType::TENSOR_FLOAT32,
4532             .dimensions = {2, 16, 4, 4},
4533             .numberOfConsumers = 1,
4534             .scale = 0.0f,
4535             .zeroPoint = 0,
4536             .lifetime = OperandLifeTime::MODEL_INPUT,
4537             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4538         },
4539         {
4540             .type = OperandType::TENSOR_FLOAT32,
4541             .dimensions = {4, 4},
4542             .numberOfConsumers = 1,
4543             .scale = 0.0f,
4544             .zeroPoint = 0,
4545             .lifetime = OperandLifeTime::MODEL_INPUT,
4546             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4547         },
4548         {
4549             .type = OperandType::TENSOR_FLOAT32,
4550             .dimensions = {2, 2},
4551             .numberOfConsumers = 1,
4552             .scale = 0.0f,
4553             .zeroPoint = 0,
4554             .lifetime = OperandLifeTime::MODEL_INPUT,
4555             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4556         },
4557         {
4558             .type = OperandType::FLOAT32,
4559             .dimensions = {},
4560             .numberOfConsumers = 1,
4561             .scale = 0.0f,
4562             .zeroPoint = 0,
4563             .lifetime = OperandLifeTime::CONSTANT_COPY,
4564             .location = {.poolIndex = 0, .offset = 0, .length = 4},
4565         },
4566         {
4567             .type = OperandType::FLOAT32,
4568             .dimensions = {},
4569             .numberOfConsumers = 1,
4570             .scale = 0.0f,
4571             .zeroPoint = 0,
4572             .lifetime = OperandLifeTime::CONSTANT_COPY,
4573             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4574         },
4575         {
4576             .type = OperandType::INT32,
4577             .dimensions = {},
4578             .numberOfConsumers = 1,
4579             .scale = 0.0f,
4580             .zeroPoint = 0,
4581             .lifetime = OperandLifeTime::CONSTANT_COPY,
4582             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4583         },
4584         {
4585             .type = OperandType::INT32,
4586             .dimensions = {},
4587             .numberOfConsumers = 1,
4588             .scale = 0.0f,
4589             .zeroPoint = 0,
4590             .lifetime = OperandLifeTime::CONSTANT_COPY,
4591             .location = {.poolIndex = 0, .offset = 12, .length = 4},
4592         },
4593         {
4594             .type = OperandType::FLOAT32,
4595             .dimensions = {},
4596             .numberOfConsumers = 1,
4597             .scale = 0.0f,
4598             .zeroPoint = 0,
4599             .lifetime = OperandLifeTime::CONSTANT_COPY,
4600             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4601         },
4602         {
4603             .type = OperandType::FLOAT32,
4604             .dimensions = {},
4605             .numberOfConsumers = 1,
4606             .scale = 0.0f,
4607             .zeroPoint = 0,
4608             .lifetime = OperandLifeTime::CONSTANT_COPY,
4609             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4610         },
4611         {
4612             .type = OperandType::BOOL,
4613             .dimensions = {},
4614             .numberOfConsumers = 1,
4615             .scale = 0.0f,
4616             .zeroPoint = 0,
4617             .lifetime = OperandLifeTime::CONSTANT_COPY,
4618             .location = {.poolIndex = 0, .offset = 24, .length = 1},
4619         },
4620         {
4621             .type = OperandType::TENSOR_FLOAT32,
4622             .dimensions = {0},
4623             .numberOfConsumers = 0,
4624             .scale = 0.0f,
4625             .zeroPoint = 0,
4626             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4627             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4628         },
4629         {
4630             .type = OperandType::TENSOR_FLOAT32,
4631             .dimensions = {0, 0},
4632             .numberOfConsumers = 0,
4633             .scale = 0.0f,
4634             .zeroPoint = 0,
4635             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4636             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4637         },
4638         {
4639             .type = OperandType::TENSOR_INT32,
4640             .dimensions = {0},
4641             .numberOfConsumers = 0,
4642             .scale = 0.0f,
4643             .zeroPoint = 0,
4644             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4645             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4646         }
4647     };
4648 
4649     const std::vector<Operation> operations = {
4650         {
4651             .type = OperationType::GENERATE_PROPOSALS,
4652             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4653             .outputs = {11, 12, 13},
4654         }
4655     };
4656 
4657     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4658     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4659     std::vector<uint8_t> operandValues = {
4660       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
4661     };
4662     const std::vector<hidl_memory> pools = {};
4663 
4664     return {
4665         .operands = operands,
4666         .operations = operations,
4667         .inputIndexes = inputIndexes,
4668         .outputIndexes = outputIndexes,
4669         .operandValues = operandValues,
4670         .pools = pools,
4671     };
4672 }
4673 
is_ignored_dynamic_output_shape_nchw_2(int i)4674 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
4675   static std::set<int> ignore = {};
4676   return ignore.find(i) != ignore.end();
4677 }
4678 
4679 // Create the model
createTestModel_dynamic_output_shape_nchw_relaxed_2()4680 Model createTestModel_dynamic_output_shape_nchw_relaxed_2() {
4681     const std::vector<Operand> operands = {
4682         {
4683             .type = OperandType::TENSOR_FLOAT32,
4684             .dimensions = {2, 4, 4, 4},
4685             .numberOfConsumers = 1,
4686             .scale = 0.0f,
4687             .zeroPoint = 0,
4688             .lifetime = OperandLifeTime::MODEL_INPUT,
4689             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4690         },
4691         {
4692             .type = OperandType::TENSOR_FLOAT32,
4693             .dimensions = {2, 16, 4, 4},
4694             .numberOfConsumers = 1,
4695             .scale = 0.0f,
4696             .zeroPoint = 0,
4697             .lifetime = OperandLifeTime::MODEL_INPUT,
4698             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4699         },
4700         {
4701             .type = OperandType::TENSOR_FLOAT32,
4702             .dimensions = {4, 4},
4703             .numberOfConsumers = 1,
4704             .scale = 0.0f,
4705             .zeroPoint = 0,
4706             .lifetime = OperandLifeTime::MODEL_INPUT,
4707             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4708         },
4709         {
4710             .type = OperandType::TENSOR_FLOAT32,
4711             .dimensions = {2, 2},
4712             .numberOfConsumers = 1,
4713             .scale = 0.0f,
4714             .zeroPoint = 0,
4715             .lifetime = OperandLifeTime::MODEL_INPUT,
4716             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4717         },
4718         {
4719             .type = OperandType::FLOAT32,
4720             .dimensions = {},
4721             .numberOfConsumers = 1,
4722             .scale = 0.0f,
4723             .zeroPoint = 0,
4724             .lifetime = OperandLifeTime::CONSTANT_COPY,
4725             .location = {.poolIndex = 0, .offset = 0, .length = 4},
4726         },
4727         {
4728             .type = OperandType::FLOAT32,
4729             .dimensions = {},
4730             .numberOfConsumers = 1,
4731             .scale = 0.0f,
4732             .zeroPoint = 0,
4733             .lifetime = OperandLifeTime::CONSTANT_COPY,
4734             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4735         },
4736         {
4737             .type = OperandType::INT32,
4738             .dimensions = {},
4739             .numberOfConsumers = 1,
4740             .scale = 0.0f,
4741             .zeroPoint = 0,
4742             .lifetime = OperandLifeTime::CONSTANT_COPY,
4743             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4744         },
4745         {
4746             .type = OperandType::INT32,
4747             .dimensions = {},
4748             .numberOfConsumers = 1,
4749             .scale = 0.0f,
4750             .zeroPoint = 0,
4751             .lifetime = OperandLifeTime::CONSTANT_COPY,
4752             .location = {.poolIndex = 0, .offset = 12, .length = 4},
4753         },
4754         {
4755             .type = OperandType::FLOAT32,
4756             .dimensions = {},
4757             .numberOfConsumers = 1,
4758             .scale = 0.0f,
4759             .zeroPoint = 0,
4760             .lifetime = OperandLifeTime::CONSTANT_COPY,
4761             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4762         },
4763         {
4764             .type = OperandType::FLOAT32,
4765             .dimensions = {},
4766             .numberOfConsumers = 1,
4767             .scale = 0.0f,
4768             .zeroPoint = 0,
4769             .lifetime = OperandLifeTime::CONSTANT_COPY,
4770             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4771         },
4772         {
4773             .type = OperandType::BOOL,
4774             .dimensions = {},
4775             .numberOfConsumers = 1,
4776             .scale = 0.0f,
4777             .zeroPoint = 0,
4778             .lifetime = OperandLifeTime::CONSTANT_COPY,
4779             .location = {.poolIndex = 0, .offset = 24, .length = 1},
4780         },
4781         {
4782             .type = OperandType::TENSOR_FLOAT32,
4783             .dimensions = {0},
4784             .numberOfConsumers = 0,
4785             .scale = 0.0f,
4786             .zeroPoint = 0,
4787             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4788             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4789         },
4790         {
4791             .type = OperandType::TENSOR_FLOAT32,
4792             .dimensions = {0, 0},
4793             .numberOfConsumers = 0,
4794             .scale = 0.0f,
4795             .zeroPoint = 0,
4796             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4797             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4798         },
4799         {
4800             .type = OperandType::TENSOR_INT32,
4801             .dimensions = {0},
4802             .numberOfConsumers = 0,
4803             .scale = 0.0f,
4804             .zeroPoint = 0,
4805             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4806             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4807         }
4808     };
4809 
4810     const std::vector<Operation> operations = {
4811         {
4812             .type = OperationType::GENERATE_PROPOSALS,
4813             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4814             .outputs = {11, 12, 13},
4815         }
4816     };
4817 
4818     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4819     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4820     std::vector<uint8_t> operandValues = {
4821       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
4822     };
4823     const std::vector<hidl_memory> pools = {};
4824 
4825     return {
4826         .operands = operands,
4827         .operations = operations,
4828         .inputIndexes = inputIndexes,
4829         .outputIndexes = outputIndexes,
4830         .operandValues = operandValues,
4831         .pools = pools,
4832         .relaxComputationFloat32toFloat16 = true,
4833     };
4834 }
4835 
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)4836 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
4837   static std::set<int> ignore = {};
4838   return ignore.find(i) != ignore.end();
4839 }
4840 
4841 // Create the model
createTestModel_dynamic_output_shape_nchw_quant8_2()4842 Model createTestModel_dynamic_output_shape_nchw_quant8_2() {
4843     const std::vector<Operand> operands = {
4844         {
4845             .type = OperandType::TENSOR_QUANT8_ASYMM,
4846             .dimensions = {2, 4, 4, 4},
4847             .numberOfConsumers = 1,
4848             .scale = 0.005f,
4849             .zeroPoint = 0,
4850             .lifetime = OperandLifeTime::MODEL_INPUT,
4851             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4852         },
4853         {
4854             .type = OperandType::TENSOR_QUANT8_ASYMM,
4855             .dimensions = {2, 16, 4, 4},
4856             .numberOfConsumers = 1,
4857             .scale = 0.1f,
4858             .zeroPoint = 128,
4859             .lifetime = OperandLifeTime::MODEL_INPUT,
4860             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4861         },
4862         {
4863             .type = OperandType::TENSOR_QUANT16_SYMM,
4864             .dimensions = {4, 4},
4865             .numberOfConsumers = 1,
4866             .scale = 0.125f,
4867             .zeroPoint = 0,
4868             .lifetime = OperandLifeTime::MODEL_INPUT,
4869             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4870         },
4871         {
4872             .type = OperandType::TENSOR_QUANT16_ASYMM,
4873             .dimensions = {2, 2},
4874             .numberOfConsumers = 1,
4875             .scale = 0.125f,
4876             .zeroPoint = 0,
4877             .lifetime = OperandLifeTime::MODEL_INPUT,
4878             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4879         },
4880         {
4881             .type = OperandType::FLOAT32,
4882             .dimensions = {},
4883             .numberOfConsumers = 1,
4884             .scale = 0.0f,
4885             .zeroPoint = 0,
4886             .lifetime = OperandLifeTime::CONSTANT_COPY,
4887             .location = {.poolIndex = 0, .offset = 0, .length = 4},
4888         },
4889         {
4890             .type = OperandType::FLOAT32,
4891             .dimensions = {},
4892             .numberOfConsumers = 1,
4893             .scale = 0.0f,
4894             .zeroPoint = 0,
4895             .lifetime = OperandLifeTime::CONSTANT_COPY,
4896             .location = {.poolIndex = 0, .offset = 4, .length = 4},
4897         },
4898         {
4899             .type = OperandType::INT32,
4900             .dimensions = {},
4901             .numberOfConsumers = 1,
4902             .scale = 0.0f,
4903             .zeroPoint = 0,
4904             .lifetime = OperandLifeTime::CONSTANT_COPY,
4905             .location = {.poolIndex = 0, .offset = 8, .length = 4},
4906         },
4907         {
4908             .type = OperandType::INT32,
4909             .dimensions = {},
4910             .numberOfConsumers = 1,
4911             .scale = 0.0f,
4912             .zeroPoint = 0,
4913             .lifetime = OperandLifeTime::CONSTANT_COPY,
4914             .location = {.poolIndex = 0, .offset = 12, .length = 4},
4915         },
4916         {
4917             .type = OperandType::FLOAT32,
4918             .dimensions = {},
4919             .numberOfConsumers = 1,
4920             .scale = 0.0f,
4921             .zeroPoint = 0,
4922             .lifetime = OperandLifeTime::CONSTANT_COPY,
4923             .location = {.poolIndex = 0, .offset = 16, .length = 4},
4924         },
4925         {
4926             .type = OperandType::FLOAT32,
4927             .dimensions = {},
4928             .numberOfConsumers = 1,
4929             .scale = 0.0f,
4930             .zeroPoint = 0,
4931             .lifetime = OperandLifeTime::CONSTANT_COPY,
4932             .location = {.poolIndex = 0, .offset = 20, .length = 4},
4933         },
4934         {
4935             .type = OperandType::BOOL,
4936             .dimensions = {},
4937             .numberOfConsumers = 1,
4938             .scale = 0.0f,
4939             .zeroPoint = 0,
4940             .lifetime = OperandLifeTime::CONSTANT_COPY,
4941             .location = {.poolIndex = 0, .offset = 24, .length = 1},
4942         },
4943         {
4944             .type = OperandType::TENSOR_QUANT8_ASYMM,
4945             .dimensions = {0},
4946             .numberOfConsumers = 0,
4947             .scale = 0.005f,
4948             .zeroPoint = 0,
4949             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4950             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4951         },
4952         {
4953             .type = OperandType::TENSOR_QUANT16_ASYMM,
4954             .dimensions = {0, 0},
4955             .numberOfConsumers = 0,
4956             .scale = 0.125f,
4957             .zeroPoint = 0,
4958             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4959             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4960         },
4961         {
4962             .type = OperandType::TENSOR_INT32,
4963             .dimensions = {0},
4964             .numberOfConsumers = 0,
4965             .scale = 0.0f,
4966             .zeroPoint = 0,
4967             .lifetime = OperandLifeTime::MODEL_OUTPUT,
4968             .location = {.poolIndex = 0, .offset = 0, .length = 0},
4969         }
4970     };
4971 
4972     const std::vector<Operation> operations = {
4973         {
4974             .type = OperationType::GENERATE_PROPOSALS,
4975             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
4976             .outputs = {11, 12, 13},
4977         }
4978     };
4979 
4980     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
4981     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
4982     std::vector<uint8_t> operandValues = {
4983       0, 0, 32, 65, 0, 0, 32, 65, 32, 0, 0, 0, 16, 0, 0, 0, 205, 204, 76, 62, 0, 0, 128, 63, 1
4984     };
4985     const std::vector<hidl_memory> pools = {};
4986 
4987     return {
4988         .operands = operands,
4989         .operations = operations,
4990         .inputIndexes = inputIndexes,
4991         .outputIndexes = outputIndexes,
4992         .operandValues = operandValues,
4993         .pools = pools,
4994     };
4995 }
4996 
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)4997 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
4998   static std::set<int> ignore = {};
4999   return ignore.find(i) != ignore.end();
5000 }
5001 
5002 // Create the model
createTestModel_dynamic_output_shape_nchw_float16_2()5003 Model createTestModel_dynamic_output_shape_nchw_float16_2() {
5004     const std::vector<Operand> operands = {
5005         {
5006             .type = OperandType::TENSOR_FLOAT16,
5007             .dimensions = {2, 4, 4, 4},
5008             .numberOfConsumers = 1,
5009             .scale = 0.0f,
5010             .zeroPoint = 0,
5011             .lifetime = OperandLifeTime::MODEL_INPUT,
5012             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5013         },
5014         {
5015             .type = OperandType::TENSOR_FLOAT16,
5016             .dimensions = {2, 16, 4, 4},
5017             .numberOfConsumers = 1,
5018             .scale = 0.0f,
5019             .zeroPoint = 0,
5020             .lifetime = OperandLifeTime::MODEL_INPUT,
5021             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5022         },
5023         {
5024             .type = OperandType::TENSOR_FLOAT16,
5025             .dimensions = {4, 4},
5026             .numberOfConsumers = 1,
5027             .scale = 0.0f,
5028             .zeroPoint = 0,
5029             .lifetime = OperandLifeTime::MODEL_INPUT,
5030             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5031         },
5032         {
5033             .type = OperandType::TENSOR_FLOAT16,
5034             .dimensions = {2, 2},
5035             .numberOfConsumers = 1,
5036             .scale = 0.0f,
5037             .zeroPoint = 0,
5038             .lifetime = OperandLifeTime::MODEL_INPUT,
5039             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5040         },
5041         {
5042             .type = OperandType::FLOAT16,
5043             .dimensions = {},
5044             .numberOfConsumers = 1,
5045             .scale = 0.0f,
5046             .zeroPoint = 0,
5047             .lifetime = OperandLifeTime::CONSTANT_COPY,
5048             .location = {.poolIndex = 0, .offset = 0, .length = 2},
5049         },
5050         {
5051             .type = OperandType::FLOAT16,
5052             .dimensions = {},
5053             .numberOfConsumers = 1,
5054             .scale = 0.0f,
5055             .zeroPoint = 0,
5056             .lifetime = OperandLifeTime::CONSTANT_COPY,
5057             .location = {.poolIndex = 0, .offset = 2, .length = 2},
5058         },
5059         {
5060             .type = OperandType::INT32,
5061             .dimensions = {},
5062             .numberOfConsumers = 1,
5063             .scale = 0.0f,
5064             .zeroPoint = 0,
5065             .lifetime = OperandLifeTime::CONSTANT_COPY,
5066             .location = {.poolIndex = 0, .offset = 4, .length = 4},
5067         },
5068         {
5069             .type = OperandType::INT32,
5070             .dimensions = {},
5071             .numberOfConsumers = 1,
5072             .scale = 0.0f,
5073             .zeroPoint = 0,
5074             .lifetime = OperandLifeTime::CONSTANT_COPY,
5075             .location = {.poolIndex = 0, .offset = 8, .length = 4},
5076         },
5077         {
5078             .type = OperandType::FLOAT16,
5079             .dimensions = {},
5080             .numberOfConsumers = 1,
5081             .scale = 0.0f,
5082             .zeroPoint = 0,
5083             .lifetime = OperandLifeTime::CONSTANT_COPY,
5084             .location = {.poolIndex = 0, .offset = 12, .length = 2},
5085         },
5086         {
5087             .type = OperandType::FLOAT16,
5088             .dimensions = {},
5089             .numberOfConsumers = 1,
5090             .scale = 0.0f,
5091             .zeroPoint = 0,
5092             .lifetime = OperandLifeTime::CONSTANT_COPY,
5093             .location = {.poolIndex = 0, .offset = 14, .length = 2},
5094         },
5095         {
5096             .type = OperandType::BOOL,
5097             .dimensions = {},
5098             .numberOfConsumers = 1,
5099             .scale = 0.0f,
5100             .zeroPoint = 0,
5101             .lifetime = OperandLifeTime::CONSTANT_COPY,
5102             .location = {.poolIndex = 0, .offset = 16, .length = 1},
5103         },
5104         {
5105             .type = OperandType::TENSOR_FLOAT16,
5106             .dimensions = {0},
5107             .numberOfConsumers = 0,
5108             .scale = 0.0f,
5109             .zeroPoint = 0,
5110             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5111             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5112         },
5113         {
5114             .type = OperandType::TENSOR_FLOAT16,
5115             .dimensions = {0, 0},
5116             .numberOfConsumers = 0,
5117             .scale = 0.0f,
5118             .zeroPoint = 0,
5119             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5120             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5121         },
5122         {
5123             .type = OperandType::TENSOR_INT32,
5124             .dimensions = {0},
5125             .numberOfConsumers = 0,
5126             .scale = 0.0f,
5127             .zeroPoint = 0,
5128             .lifetime = OperandLifeTime::MODEL_OUTPUT,
5129             .location = {.poolIndex = 0, .offset = 0, .length = 0},
5130         }
5131     };
5132 
5133     const std::vector<Operation> operations = {
5134         {
5135             .type = OperationType::GENERATE_PROPOSALS,
5136             .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
5137             .outputs = {11, 12, 13},
5138         }
5139     };
5140 
5141     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3};
5142     const std::vector<uint32_t> outputIndexes = {11, 12, 13};
5143     std::vector<uint8_t> operandValues = {
5144       0, 73, 0, 73, 32, 0, 0, 0, 16, 0, 0, 0, 102, 50, 0, 60, 1
5145     };
5146     const std::vector<hidl_memory> pools = {};
5147 
5148     return {
5149         .operands = operands,
5150         .operations = operations,
5151         .inputIndexes = inputIndexes,
5152         .outputIndexes = outputIndexes,
5153         .operandValues = operandValues,
5154         .pools = pools,
5155     };
5156 }
5157 
is_ignored_dynamic_output_shape_nchw_float16_2(int i)5158 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
5159   static std::set<int> ignore = {};
5160   return ignore.find(i) != ignore.end();
5161 }
5162 
5163