• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: argmax_2.mod.py). Do not edit
3 // Create the model
createTestModel()4 Model createTestModel() {
5     const std::vector<Operand> operands = {
6         {
7             .type = OperandType::TENSOR_FLOAT32,
8             .dimensions = {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::INT32,
17             .dimensions = {},
18             .numberOfConsumers = 1,
19             .scale = 0.0f,
20             .zeroPoint = 0,
21             .lifetime = OperandLifeTime::CONSTANT_COPY,
22             .location = {.poolIndex = 0, .offset = 0, .length = 4},
23         },
24         {
25             .type = OperandType::TENSOR_INT32,
26             .dimensions = {2},
27             .numberOfConsumers = 0,
28             .scale = 0.0f,
29             .zeroPoint = 0,
30             .lifetime = OperandLifeTime::MODEL_OUTPUT,
31             .location = {.poolIndex = 0, .offset = 0, .length = 0},
32         }
33     };
34 
35     const std::vector<Operation> operations = {
36         {
37             .type = OperationType::ARGMAX,
38             .inputs = {0, 1},
39             .outputs = {2},
40         }
41     };
42 
43     const std::vector<uint32_t> inputIndexes = {0};
44     const std::vector<uint32_t> outputIndexes = {2};
45     std::vector<uint8_t> operandValues = {
46       0, 0, 0, 0
47     };
48     const std::vector<hidl_memory> pools = {};
49 
50     return {
51         .operands = operands,
52         .operations = operations,
53         .inputIndexes = inputIndexes,
54         .outputIndexes = outputIndexes,
55         .operandValues = operandValues,
56         .pools = pools,
57     };
58 }
59 
is_ignored(int i)60 inline bool is_ignored(int i) {
61   static std::set<int> ignore = {};
62   return ignore.find(i) != ignore.end();
63 }
64 
65 // Create the model
createTestModel_relaxed()66 Model createTestModel_relaxed() {
67     const std::vector<Operand> operands = {
68         {
69             .type = OperandType::TENSOR_FLOAT32,
70             .dimensions = {2, 2},
71             .numberOfConsumers = 1,
72             .scale = 0.0f,
73             .zeroPoint = 0,
74             .lifetime = OperandLifeTime::MODEL_INPUT,
75             .location = {.poolIndex = 0, .offset = 0, .length = 0},
76         },
77         {
78             .type = OperandType::INT32,
79             .dimensions = {},
80             .numberOfConsumers = 1,
81             .scale = 0.0f,
82             .zeroPoint = 0,
83             .lifetime = OperandLifeTime::CONSTANT_COPY,
84             .location = {.poolIndex = 0, .offset = 0, .length = 4},
85         },
86         {
87             .type = OperandType::TENSOR_INT32,
88             .dimensions = {2},
89             .numberOfConsumers = 0,
90             .scale = 0.0f,
91             .zeroPoint = 0,
92             .lifetime = OperandLifeTime::MODEL_OUTPUT,
93             .location = {.poolIndex = 0, .offset = 0, .length = 0},
94         }
95     };
96 
97     const std::vector<Operation> operations = {
98         {
99             .type = OperationType::ARGMAX,
100             .inputs = {0, 1},
101             .outputs = {2},
102         }
103     };
104 
105     const std::vector<uint32_t> inputIndexes = {0};
106     const std::vector<uint32_t> outputIndexes = {2};
107     std::vector<uint8_t> operandValues = {
108       0, 0, 0, 0
109     };
110     const std::vector<hidl_memory> pools = {};
111 
112     return {
113         .operands = operands,
114         .operations = operations,
115         .inputIndexes = inputIndexes,
116         .outputIndexes = outputIndexes,
117         .operandValues = operandValues,
118         .pools = pools,
119         .relaxComputationFloat32toFloat16 = true,
120     };
121 }
122 
is_ignored_relaxed(int i)123 inline bool is_ignored_relaxed(int i) {
124   static std::set<int> ignore = {};
125   return ignore.find(i) != ignore.end();
126 }
127 
128 // Create the model
createTestModel_float16()129 Model createTestModel_float16() {
130     const std::vector<Operand> operands = {
131         {
132             .type = OperandType::TENSOR_FLOAT16,
133             .dimensions = {2, 2},
134             .numberOfConsumers = 1,
135             .scale = 0.0f,
136             .zeroPoint = 0,
137             .lifetime = OperandLifeTime::MODEL_INPUT,
138             .location = {.poolIndex = 0, .offset = 0, .length = 0},
139         },
140         {
141             .type = OperandType::INT32,
142             .dimensions = {},
143             .numberOfConsumers = 1,
144             .scale = 0.0f,
145             .zeroPoint = 0,
146             .lifetime = OperandLifeTime::CONSTANT_COPY,
147             .location = {.poolIndex = 0, .offset = 0, .length = 4},
148         },
149         {
150             .type = OperandType::TENSOR_INT32,
151             .dimensions = {2},
152             .numberOfConsumers = 0,
153             .scale = 0.0f,
154             .zeroPoint = 0,
155             .lifetime = OperandLifeTime::MODEL_OUTPUT,
156             .location = {.poolIndex = 0, .offset = 0, .length = 0},
157         }
158     };
159 
160     const std::vector<Operation> operations = {
161         {
162             .type = OperationType::ARGMAX,
163             .inputs = {0, 1},
164             .outputs = {2},
165         }
166     };
167 
168     const std::vector<uint32_t> inputIndexes = {0};
169     const std::vector<uint32_t> outputIndexes = {2};
170     std::vector<uint8_t> operandValues = {
171       0, 0, 0, 0
172     };
173     const std::vector<hidl_memory> pools = {};
174 
175     return {
176         .operands = operands,
177         .operations = operations,
178         .inputIndexes = inputIndexes,
179         .outputIndexes = outputIndexes,
180         .operandValues = operandValues,
181         .pools = pools,
182     };
183 }
184 
is_ignored_float16(int i)185 inline bool is_ignored_float16(int i) {
186   static std::set<int> ignore = {};
187   return ignore.find(i) != ignore.end();
188 }
189 
190 // Create the model
createTestModel_int32()191 Model createTestModel_int32() {
192     const std::vector<Operand> operands = {
193         {
194             .type = OperandType::TENSOR_INT32,
195             .dimensions = {2, 2},
196             .numberOfConsumers = 1,
197             .scale = 0.0f,
198             .zeroPoint = 0,
199             .lifetime = OperandLifeTime::MODEL_INPUT,
200             .location = {.poolIndex = 0, .offset = 0, .length = 0},
201         },
202         {
203             .type = OperandType::INT32,
204             .dimensions = {},
205             .numberOfConsumers = 1,
206             .scale = 0.0f,
207             .zeroPoint = 0,
208             .lifetime = OperandLifeTime::CONSTANT_COPY,
209             .location = {.poolIndex = 0, .offset = 0, .length = 4},
210         },
211         {
212             .type = OperandType::TENSOR_INT32,
213             .dimensions = {2},
214             .numberOfConsumers = 0,
215             .scale = 0.0f,
216             .zeroPoint = 0,
217             .lifetime = OperandLifeTime::MODEL_OUTPUT,
218             .location = {.poolIndex = 0, .offset = 0, .length = 0},
219         }
220     };
221 
222     const std::vector<Operation> operations = {
223         {
224             .type = OperationType::ARGMAX,
225             .inputs = {0, 1},
226             .outputs = {2},
227         }
228     };
229 
230     const std::vector<uint32_t> inputIndexes = {0};
231     const std::vector<uint32_t> outputIndexes = {2};
232     std::vector<uint8_t> operandValues = {
233       0, 0, 0, 0
234     };
235     const std::vector<hidl_memory> pools = {};
236 
237     return {
238         .operands = operands,
239         .operations = operations,
240         .inputIndexes = inputIndexes,
241         .outputIndexes = outputIndexes,
242         .operandValues = operandValues,
243         .pools = pools,
244     };
245 }
246 
is_ignored_int32(int i)247 inline bool is_ignored_int32(int i) {
248   static std::set<int> ignore = {};
249   return ignore.find(i) != ignore.end();
250 }
251 
252 // Create the model
createTestModel_quant8()253 Model createTestModel_quant8() {
254     const std::vector<Operand> operands = {
255         {
256             .type = OperandType::TENSOR_QUANT8_ASYMM,
257             .dimensions = {2, 2},
258             .numberOfConsumers = 1,
259             .scale = 1.0f,
260             .zeroPoint = 0,
261             .lifetime = OperandLifeTime::MODEL_INPUT,
262             .location = {.poolIndex = 0, .offset = 0, .length = 0},
263         },
264         {
265             .type = OperandType::INT32,
266             .dimensions = {},
267             .numberOfConsumers = 1,
268             .scale = 0.0f,
269             .zeroPoint = 0,
270             .lifetime = OperandLifeTime::CONSTANT_COPY,
271             .location = {.poolIndex = 0, .offset = 0, .length = 4},
272         },
273         {
274             .type = OperandType::TENSOR_INT32,
275             .dimensions = {2},
276             .numberOfConsumers = 0,
277             .scale = 0.0f,
278             .zeroPoint = 0,
279             .lifetime = OperandLifeTime::MODEL_OUTPUT,
280             .location = {.poolIndex = 0, .offset = 0, .length = 0},
281         }
282     };
283 
284     const std::vector<Operation> operations = {
285         {
286             .type = OperationType::ARGMAX,
287             .inputs = {0, 1},
288             .outputs = {2},
289         }
290     };
291 
292     const std::vector<uint32_t> inputIndexes = {0};
293     const std::vector<uint32_t> outputIndexes = {2};
294     std::vector<uint8_t> operandValues = {
295       0, 0, 0, 0
296     };
297     const std::vector<hidl_memory> pools = {};
298 
299     return {
300         .operands = operands,
301         .operations = operations,
302         .inputIndexes = inputIndexes,
303         .outputIndexes = outputIndexes,
304         .operandValues = operandValues,
305         .pools = pools,
306     };
307 }
308 
is_ignored_quant8(int i)309 inline bool is_ignored_quant8(int i) {
310   static std::set<int> ignore = {};
311   return ignore.find(i) != ignore.end();
312 }
313 
314 // Create the model
createTestModel_dynamic_output_shape()315 Model createTestModel_dynamic_output_shape() {
316     const std::vector<Operand> operands = {
317         {
318             .type = OperandType::TENSOR_FLOAT32,
319             .dimensions = {2, 2},
320             .numberOfConsumers = 1,
321             .scale = 0.0f,
322             .zeroPoint = 0,
323             .lifetime = OperandLifeTime::MODEL_INPUT,
324             .location = {.poolIndex = 0, .offset = 0, .length = 0},
325         },
326         {
327             .type = OperandType::INT32,
328             .dimensions = {},
329             .numberOfConsumers = 1,
330             .scale = 0.0f,
331             .zeroPoint = 0,
332             .lifetime = OperandLifeTime::CONSTANT_COPY,
333             .location = {.poolIndex = 0, .offset = 0, .length = 4},
334         },
335         {
336             .type = OperandType::TENSOR_INT32,
337             .dimensions = {0},
338             .numberOfConsumers = 0,
339             .scale = 0.0f,
340             .zeroPoint = 0,
341             .lifetime = OperandLifeTime::MODEL_OUTPUT,
342             .location = {.poolIndex = 0, .offset = 0, .length = 0},
343         }
344     };
345 
346     const std::vector<Operation> operations = {
347         {
348             .type = OperationType::ARGMAX,
349             .inputs = {0, 1},
350             .outputs = {2},
351         }
352     };
353 
354     const std::vector<uint32_t> inputIndexes = {0};
355     const std::vector<uint32_t> outputIndexes = {2};
356     std::vector<uint8_t> operandValues = {
357       0, 0, 0, 0
358     };
359     const std::vector<hidl_memory> pools = {};
360 
361     return {
362         .operands = operands,
363         .operations = operations,
364         .inputIndexes = inputIndexes,
365         .outputIndexes = outputIndexes,
366         .operandValues = operandValues,
367         .pools = pools,
368     };
369 }
370 
is_ignored_dynamic_output_shape(int i)371 inline bool is_ignored_dynamic_output_shape(int i) {
372   static std::set<int> ignore = {};
373   return ignore.find(i) != ignore.end();
374 }
375 
376 // Create the model
createTestModel_dynamic_output_shape_relaxed()377 Model createTestModel_dynamic_output_shape_relaxed() {
378     const std::vector<Operand> operands = {
379         {
380             .type = OperandType::TENSOR_FLOAT32,
381             .dimensions = {2, 2},
382             .numberOfConsumers = 1,
383             .scale = 0.0f,
384             .zeroPoint = 0,
385             .lifetime = OperandLifeTime::MODEL_INPUT,
386             .location = {.poolIndex = 0, .offset = 0, .length = 0},
387         },
388         {
389             .type = OperandType::INT32,
390             .dimensions = {},
391             .numberOfConsumers = 1,
392             .scale = 0.0f,
393             .zeroPoint = 0,
394             .lifetime = OperandLifeTime::CONSTANT_COPY,
395             .location = {.poolIndex = 0, .offset = 0, .length = 4},
396         },
397         {
398             .type = OperandType::TENSOR_INT32,
399             .dimensions = {0},
400             .numberOfConsumers = 0,
401             .scale = 0.0f,
402             .zeroPoint = 0,
403             .lifetime = OperandLifeTime::MODEL_OUTPUT,
404             .location = {.poolIndex = 0, .offset = 0, .length = 0},
405         }
406     };
407 
408     const std::vector<Operation> operations = {
409         {
410             .type = OperationType::ARGMAX,
411             .inputs = {0, 1},
412             .outputs = {2},
413         }
414     };
415 
416     const std::vector<uint32_t> inputIndexes = {0};
417     const std::vector<uint32_t> outputIndexes = {2};
418     std::vector<uint8_t> operandValues = {
419       0, 0, 0, 0
420     };
421     const std::vector<hidl_memory> pools = {};
422 
423     return {
424         .operands = operands,
425         .operations = operations,
426         .inputIndexes = inputIndexes,
427         .outputIndexes = outputIndexes,
428         .operandValues = operandValues,
429         .pools = pools,
430         .relaxComputationFloat32toFloat16 = true,
431     };
432 }
433 
is_ignored_dynamic_output_shape_relaxed(int i)434 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
435   static std::set<int> ignore = {};
436   return ignore.find(i) != ignore.end();
437 }
438 
439 // Create the model
createTestModel_dynamic_output_shape_float16()440 Model createTestModel_dynamic_output_shape_float16() {
441     const std::vector<Operand> operands = {
442         {
443             .type = OperandType::TENSOR_FLOAT16,
444             .dimensions = {2, 2},
445             .numberOfConsumers = 1,
446             .scale = 0.0f,
447             .zeroPoint = 0,
448             .lifetime = OperandLifeTime::MODEL_INPUT,
449             .location = {.poolIndex = 0, .offset = 0, .length = 0},
450         },
451         {
452             .type = OperandType::INT32,
453             .dimensions = {},
454             .numberOfConsumers = 1,
455             .scale = 0.0f,
456             .zeroPoint = 0,
457             .lifetime = OperandLifeTime::CONSTANT_COPY,
458             .location = {.poolIndex = 0, .offset = 0, .length = 4},
459         },
460         {
461             .type = OperandType::TENSOR_INT32,
462             .dimensions = {0},
463             .numberOfConsumers = 0,
464             .scale = 0.0f,
465             .zeroPoint = 0,
466             .lifetime = OperandLifeTime::MODEL_OUTPUT,
467             .location = {.poolIndex = 0, .offset = 0, .length = 0},
468         }
469     };
470 
471     const std::vector<Operation> operations = {
472         {
473             .type = OperationType::ARGMAX,
474             .inputs = {0, 1},
475             .outputs = {2},
476         }
477     };
478 
479     const std::vector<uint32_t> inputIndexes = {0};
480     const std::vector<uint32_t> outputIndexes = {2};
481     std::vector<uint8_t> operandValues = {
482       0, 0, 0, 0
483     };
484     const std::vector<hidl_memory> pools = {};
485 
486     return {
487         .operands = operands,
488         .operations = operations,
489         .inputIndexes = inputIndexes,
490         .outputIndexes = outputIndexes,
491         .operandValues = operandValues,
492         .pools = pools,
493     };
494 }
495 
is_ignored_dynamic_output_shape_float16(int i)496 inline bool is_ignored_dynamic_output_shape_float16(int i) {
497   static std::set<int> ignore = {};
498   return ignore.find(i) != ignore.end();
499 }
500 
501 // Create the model
createTestModel_dynamic_output_shape_int32()502 Model createTestModel_dynamic_output_shape_int32() {
503     const std::vector<Operand> operands = {
504         {
505             .type = OperandType::TENSOR_INT32,
506             .dimensions = {2, 2},
507             .numberOfConsumers = 1,
508             .scale = 0.0f,
509             .zeroPoint = 0,
510             .lifetime = OperandLifeTime::MODEL_INPUT,
511             .location = {.poolIndex = 0, .offset = 0, .length = 0},
512         },
513         {
514             .type = OperandType::INT32,
515             .dimensions = {},
516             .numberOfConsumers = 1,
517             .scale = 0.0f,
518             .zeroPoint = 0,
519             .lifetime = OperandLifeTime::CONSTANT_COPY,
520             .location = {.poolIndex = 0, .offset = 0, .length = 4},
521         },
522         {
523             .type = OperandType::TENSOR_INT32,
524             .dimensions = {0},
525             .numberOfConsumers = 0,
526             .scale = 0.0f,
527             .zeroPoint = 0,
528             .lifetime = OperandLifeTime::MODEL_OUTPUT,
529             .location = {.poolIndex = 0, .offset = 0, .length = 0},
530         }
531     };
532 
533     const std::vector<Operation> operations = {
534         {
535             .type = OperationType::ARGMAX,
536             .inputs = {0, 1},
537             .outputs = {2},
538         }
539     };
540 
541     const std::vector<uint32_t> inputIndexes = {0};
542     const std::vector<uint32_t> outputIndexes = {2};
543     std::vector<uint8_t> operandValues = {
544       0, 0, 0, 0
545     };
546     const std::vector<hidl_memory> pools = {};
547 
548     return {
549         .operands = operands,
550         .operations = operations,
551         .inputIndexes = inputIndexes,
552         .outputIndexes = outputIndexes,
553         .operandValues = operandValues,
554         .pools = pools,
555     };
556 }
557 
is_ignored_dynamic_output_shape_int32(int i)558 inline bool is_ignored_dynamic_output_shape_int32(int i) {
559   static std::set<int> ignore = {};
560   return ignore.find(i) != ignore.end();
561 }
562 
563 // Create the model
createTestModel_dynamic_output_shape_quant8()564 Model createTestModel_dynamic_output_shape_quant8() {
565     const std::vector<Operand> operands = {
566         {
567             .type = OperandType::TENSOR_QUANT8_ASYMM,
568             .dimensions = {2, 2},
569             .numberOfConsumers = 1,
570             .scale = 1.0f,
571             .zeroPoint = 0,
572             .lifetime = OperandLifeTime::MODEL_INPUT,
573             .location = {.poolIndex = 0, .offset = 0, .length = 0},
574         },
575         {
576             .type = OperandType::INT32,
577             .dimensions = {},
578             .numberOfConsumers = 1,
579             .scale = 0.0f,
580             .zeroPoint = 0,
581             .lifetime = OperandLifeTime::CONSTANT_COPY,
582             .location = {.poolIndex = 0, .offset = 0, .length = 4},
583         },
584         {
585             .type = OperandType::TENSOR_INT32,
586             .dimensions = {0},
587             .numberOfConsumers = 0,
588             .scale = 0.0f,
589             .zeroPoint = 0,
590             .lifetime = OperandLifeTime::MODEL_OUTPUT,
591             .location = {.poolIndex = 0, .offset = 0, .length = 0},
592         }
593     };
594 
595     const std::vector<Operation> operations = {
596         {
597             .type = OperationType::ARGMAX,
598             .inputs = {0, 1},
599             .outputs = {2},
600         }
601     };
602 
603     const std::vector<uint32_t> inputIndexes = {0};
604     const std::vector<uint32_t> outputIndexes = {2};
605     std::vector<uint8_t> operandValues = {
606       0, 0, 0, 0
607     };
608     const std::vector<hidl_memory> pools = {};
609 
610     return {
611         .operands = operands,
612         .operations = operations,
613         .inputIndexes = inputIndexes,
614         .outputIndexes = outputIndexes,
615         .operandValues = operandValues,
616         .pools = pools,
617     };
618 }
619 
is_ignored_dynamic_output_shape_quant8(int i)620 inline bool is_ignored_dynamic_output_shape_quant8(int i) {
621   static std::set<int> ignore = {};
622   return ignore.find(i) != ignore.end();
623 }
624 
625