• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: topk_v2.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
5   OperandType type1(Type::INT32, {});
6   OperandType type2(Type::TENSOR_INT32, {2, 2});
7   // Phase 1, operands
8   auto input = model->addOperand(&type0);
9   auto k = model->addOperand(&type1);
10   auto out_values = model->addOperand(&type0);
11   auto out_indices = model->addOperand(&type2);
12   // Phase 2, operations
13   static int32_t k_init[] = {2};
14   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
15   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
16   // Phase 3, inputs and outputs
17   model->identifyInputsAndOutputs(
18     {input},
19     {out_values, out_indices});
20   assert(model->isValid());
21 }
22 
is_ignored(int i)23 inline bool is_ignored(int i) {
24   static std::set<int> ignore = {};
25   return ignore.find(i) != ignore.end();
26 }
27 
CreateModel_relaxed(Model * model)28 void CreateModel_relaxed(Model *model) {
29   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
30   OperandType type1(Type::INT32, {});
31   OperandType type2(Type::TENSOR_INT32, {2, 2});
32   // Phase 1, operands
33   auto input = model->addOperand(&type0);
34   auto k = model->addOperand(&type1);
35   auto out_values = model->addOperand(&type0);
36   auto out_indices = model->addOperand(&type2);
37   // Phase 2, operations
38   static int32_t k_init[] = {2};
39   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
40   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
41   // Phase 3, inputs and outputs
42   model->identifyInputsAndOutputs(
43     {input},
44     {out_values, out_indices});
45   // Phase 4: set relaxed execution
46   model->relaxComputationFloat32toFloat16(true);
47   assert(model->isValid());
48 }
49 
is_ignored_relaxed(int i)50 inline bool is_ignored_relaxed(int i) {
51   static std::set<int> ignore = {};
52   return ignore.find(i) != ignore.end();
53 }
54 
CreateModel_float16(Model * model)55 void CreateModel_float16(Model *model) {
56   OperandType type1(Type::INT32, {});
57   OperandType type11(Type::TENSOR_FLOAT16, {2, 2});
58   OperandType type2(Type::TENSOR_INT32, {2, 2});
59   // Phase 1, operands
60   auto input = model->addOperand(&type11);
61   auto k = model->addOperand(&type1);
62   auto out_values = model->addOperand(&type11);
63   auto out_indices = model->addOperand(&type2);
64   // Phase 2, operations
65   static int32_t k_init[] = {2};
66   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
67   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
68   // Phase 3, inputs and outputs
69   model->identifyInputsAndOutputs(
70     {input},
71     {out_values, out_indices});
72   assert(model->isValid());
73 }
74 
is_ignored_float16(int i)75 inline bool is_ignored_float16(int i) {
76   static std::set<int> ignore = {};
77   return ignore.find(i) != ignore.end();
78 }
79 
CreateModel_dynamic_output_shape(Model * model)80 void CreateModel_dynamic_output_shape(Model *model) {
81   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
82   OperandType type1(Type::INT32, {});
83   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
84   OperandType type13(Type::TENSOR_INT32, {0, 0});
85   // Phase 1, operands
86   auto input = model->addOperand(&type0);
87   auto k = model->addOperand(&type1);
88   auto out_values = model->addOperand(&type12);
89   auto out_indices = model->addOperand(&type13);
90   // Phase 2, operations
91   static int32_t k_init[] = {2};
92   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
93   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
94   // Phase 3, inputs and outputs
95   model->identifyInputsAndOutputs(
96     {input},
97     {out_values, out_indices});
98   assert(model->isValid());
99 }
100 
is_ignored_dynamic_output_shape(int i)101 inline bool is_ignored_dynamic_output_shape(int i) {
102   static std::set<int> ignore = {};
103   return ignore.find(i) != ignore.end();
104 }
105 
CreateModel_dynamic_output_shape_relaxed(Model * model)106 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
107   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
108   OperandType type1(Type::INT32, {});
109   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
110   OperandType type13(Type::TENSOR_INT32, {0, 0});
111   // Phase 1, operands
112   auto input = model->addOperand(&type0);
113   auto k = model->addOperand(&type1);
114   auto out_values = model->addOperand(&type12);
115   auto out_indices = model->addOperand(&type13);
116   // Phase 2, operations
117   static int32_t k_init[] = {2};
118   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
119   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
120   // Phase 3, inputs and outputs
121   model->identifyInputsAndOutputs(
122     {input},
123     {out_values, out_indices});
124   // Phase 4: set relaxed execution
125   model->relaxComputationFloat32toFloat16(true);
126   assert(model->isValid());
127 }
128 
is_ignored_dynamic_output_shape_relaxed(int i)129 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
130   static std::set<int> ignore = {};
131   return ignore.find(i) != ignore.end();
132 }
133 
CreateModel_dynamic_output_shape_float16(Model * model)134 void CreateModel_dynamic_output_shape_float16(Model *model) {
135   OperandType type1(Type::INT32, {});
136   OperandType type11(Type::TENSOR_FLOAT16, {2, 2});
137   OperandType type13(Type::TENSOR_INT32, {0, 0});
138   OperandType type14(Type::TENSOR_FLOAT16, {0, 0});
139   // Phase 1, operands
140   auto input = model->addOperand(&type11);
141   auto k = model->addOperand(&type1);
142   auto out_values = model->addOperand(&type14);
143   auto out_indices = model->addOperand(&type13);
144   // Phase 2, operations
145   static int32_t k_init[] = {2};
146   model->setOperandValue(k, k_init, sizeof(int32_t) * 1);
147   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input, k}, {out_values, out_indices});
148   // Phase 3, inputs and outputs
149   model->identifyInputsAndOutputs(
150     {input},
151     {out_values, out_indices});
152   assert(model->isValid());
153 }
154 
is_ignored_dynamic_output_shape_float16(int i)155 inline bool is_ignored_dynamic_output_shape_float16(int i) {
156   static std::set<int> ignore = {};
157   return ignore.find(i) != ignore.end();
158 }
159 
CreateModel_2(Model * model)160 void CreateModel_2(Model *model) {
161   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
162   OperandType type1(Type::INT32, {});
163   OperandType type2(Type::TENSOR_INT32, {2, 2});
164   OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
165   // Phase 1, operands
166   auto input1 = model->addOperand(&type3);
167   auto k1 = model->addOperand(&type1);
168   auto out_values1 = model->addOperand(&type0);
169   auto out_indices1 = model->addOperand(&type2);
170   // Phase 2, operations
171   static int32_t k1_init[] = {2};
172   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
173   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
174   // Phase 3, inputs and outputs
175   model->identifyInputsAndOutputs(
176     {input1},
177     {out_values1, out_indices1});
178   assert(model->isValid());
179 }
180 
is_ignored_2(int i)181 inline bool is_ignored_2(int i) {
182   static std::set<int> ignore = {};
183   return ignore.find(i) != ignore.end();
184 }
185 
CreateModel_relaxed_2(Model * model)186 void CreateModel_relaxed_2(Model *model) {
187   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
188   OperandType type1(Type::INT32, {});
189   OperandType type2(Type::TENSOR_INT32, {2, 2});
190   OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
191   // Phase 1, operands
192   auto input1 = model->addOperand(&type3);
193   auto k1 = model->addOperand(&type1);
194   auto out_values1 = model->addOperand(&type0);
195   auto out_indices1 = model->addOperand(&type2);
196   // Phase 2, operations
197   static int32_t k1_init[] = {2};
198   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
199   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
200   // Phase 3, inputs and outputs
201   model->identifyInputsAndOutputs(
202     {input1},
203     {out_values1, out_indices1});
204   // Phase 4: set relaxed execution
205   model->relaxComputationFloat32toFloat16(true);
206   assert(model->isValid());
207 }
208 
is_ignored_relaxed_2(int i)209 inline bool is_ignored_relaxed_2(int i) {
210   static std::set<int> ignore = {};
211   return ignore.find(i) != ignore.end();
212 }
213 
CreateModel_float16_2(Model * model)214 void CreateModel_float16_2(Model *model) {
215   OperandType type1(Type::INT32, {});
216   OperandType type11(Type::TENSOR_FLOAT16, {2, 2});
217   OperandType type15(Type::TENSOR_FLOAT16, {2, 3});
218   OperandType type2(Type::TENSOR_INT32, {2, 2});
219   // Phase 1, operands
220   auto input1 = model->addOperand(&type15);
221   auto k1 = model->addOperand(&type1);
222   auto out_values1 = model->addOperand(&type11);
223   auto out_indices1 = model->addOperand(&type2);
224   // Phase 2, operations
225   static int32_t k1_init[] = {2};
226   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
227   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
228   // Phase 3, inputs and outputs
229   model->identifyInputsAndOutputs(
230     {input1},
231     {out_values1, out_indices1});
232   assert(model->isValid());
233 }
234 
is_ignored_float16_2(int i)235 inline bool is_ignored_float16_2(int i) {
236   static std::set<int> ignore = {};
237   return ignore.find(i) != ignore.end();
238 }
239 
CreateModel_dynamic_output_shape_2(Model * model)240 void CreateModel_dynamic_output_shape_2(Model *model) {
241   OperandType type1(Type::INT32, {});
242   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
243   OperandType type13(Type::TENSOR_INT32, {0, 0});
244   OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
245   // Phase 1, operands
246   auto input1 = model->addOperand(&type3);
247   auto k1 = model->addOperand(&type1);
248   auto out_values1 = model->addOperand(&type12);
249   auto out_indices1 = model->addOperand(&type13);
250   // Phase 2, operations
251   static int32_t k1_init[] = {2};
252   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
253   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
254   // Phase 3, inputs and outputs
255   model->identifyInputsAndOutputs(
256     {input1},
257     {out_values1, out_indices1});
258   assert(model->isValid());
259 }
260 
is_ignored_dynamic_output_shape_2(int i)261 inline bool is_ignored_dynamic_output_shape_2(int i) {
262   static std::set<int> ignore = {};
263   return ignore.find(i) != ignore.end();
264 }
265 
CreateModel_dynamic_output_shape_relaxed_2(Model * model)266 void CreateModel_dynamic_output_shape_relaxed_2(Model *model) {
267   OperandType type1(Type::INT32, {});
268   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
269   OperandType type13(Type::TENSOR_INT32, {0, 0});
270   OperandType type3(Type::TENSOR_FLOAT32, {2, 3});
271   // Phase 1, operands
272   auto input1 = model->addOperand(&type3);
273   auto k1 = model->addOperand(&type1);
274   auto out_values1 = model->addOperand(&type12);
275   auto out_indices1 = model->addOperand(&type13);
276   // Phase 2, operations
277   static int32_t k1_init[] = {2};
278   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
279   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
280   // Phase 3, inputs and outputs
281   model->identifyInputsAndOutputs(
282     {input1},
283     {out_values1, out_indices1});
284   // Phase 4: set relaxed execution
285   model->relaxComputationFloat32toFloat16(true);
286   assert(model->isValid());
287 }
288 
is_ignored_dynamic_output_shape_relaxed_2(int i)289 inline bool is_ignored_dynamic_output_shape_relaxed_2(int i) {
290   static std::set<int> ignore = {};
291   return ignore.find(i) != ignore.end();
292 }
293 
CreateModel_dynamic_output_shape_float16_2(Model * model)294 void CreateModel_dynamic_output_shape_float16_2(Model *model) {
295   OperandType type1(Type::INT32, {});
296   OperandType type13(Type::TENSOR_INT32, {0, 0});
297   OperandType type14(Type::TENSOR_FLOAT16, {0, 0});
298   OperandType type15(Type::TENSOR_FLOAT16, {2, 3});
299   // Phase 1, operands
300   auto input1 = model->addOperand(&type15);
301   auto k1 = model->addOperand(&type1);
302   auto out_values1 = model->addOperand(&type14);
303   auto out_indices1 = model->addOperand(&type13);
304   // Phase 2, operations
305   static int32_t k1_init[] = {2};
306   model->setOperandValue(k1, k1_init, sizeof(int32_t) * 1);
307   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input1, k1}, {out_values1, out_indices1});
308   // Phase 3, inputs and outputs
309   model->identifyInputsAndOutputs(
310     {input1},
311     {out_values1, out_indices1});
312   assert(model->isValid());
313 }
314 
is_ignored_dynamic_output_shape_float16_2(int i)315 inline bool is_ignored_dynamic_output_shape_float16_2(int i) {
316   static std::set<int> ignore = {};
317   return ignore.find(i) != ignore.end();
318 }
319 
CreateModel_3(Model * model)320 void CreateModel_3(Model *model) {
321   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
322   OperandType type1(Type::INT32, {});
323   OperandType type2(Type::TENSOR_INT32, {2, 2});
324   OperandType type4(Type::TENSOR_FLOAT32, {2, 4});
325   // Phase 1, operands
326   auto input2 = model->addOperand(&type4);
327   auto k2 = model->addOperand(&type1);
328   auto out_values2 = model->addOperand(&type0);
329   auto out_indices2 = model->addOperand(&type2);
330   // Phase 2, operations
331   static int32_t k2_init[] = {2};
332   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
333   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
334   // Phase 3, inputs and outputs
335   model->identifyInputsAndOutputs(
336     {input2},
337     {out_values2, out_indices2});
338   assert(model->isValid());
339 }
340 
is_ignored_3(int i)341 inline bool is_ignored_3(int i) {
342   static std::set<int> ignore = {};
343   return ignore.find(i) != ignore.end();
344 }
345 
CreateModel_relaxed_3(Model * model)346 void CreateModel_relaxed_3(Model *model) {
347   OperandType type0(Type::TENSOR_FLOAT32, {2, 2});
348   OperandType type1(Type::INT32, {});
349   OperandType type2(Type::TENSOR_INT32, {2, 2});
350   OperandType type4(Type::TENSOR_FLOAT32, {2, 4});
351   // Phase 1, operands
352   auto input2 = model->addOperand(&type4);
353   auto k2 = model->addOperand(&type1);
354   auto out_values2 = model->addOperand(&type0);
355   auto out_indices2 = model->addOperand(&type2);
356   // Phase 2, operations
357   static int32_t k2_init[] = {2};
358   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
359   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
360   // Phase 3, inputs and outputs
361   model->identifyInputsAndOutputs(
362     {input2},
363     {out_values2, out_indices2});
364   // Phase 4: set relaxed execution
365   model->relaxComputationFloat32toFloat16(true);
366   assert(model->isValid());
367 }
368 
is_ignored_relaxed_3(int i)369 inline bool is_ignored_relaxed_3(int i) {
370   static std::set<int> ignore = {};
371   return ignore.find(i) != ignore.end();
372 }
373 
CreateModel_float16_3(Model * model)374 void CreateModel_float16_3(Model *model) {
375   OperandType type1(Type::INT32, {});
376   OperandType type11(Type::TENSOR_FLOAT16, {2, 2});
377   OperandType type16(Type::TENSOR_FLOAT16, {2, 4});
378   OperandType type2(Type::TENSOR_INT32, {2, 2});
379   // Phase 1, operands
380   auto input2 = model->addOperand(&type16);
381   auto k2 = model->addOperand(&type1);
382   auto out_values2 = model->addOperand(&type11);
383   auto out_indices2 = model->addOperand(&type2);
384   // Phase 2, operations
385   static int32_t k2_init[] = {2};
386   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
387   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
388   // Phase 3, inputs and outputs
389   model->identifyInputsAndOutputs(
390     {input2},
391     {out_values2, out_indices2});
392   assert(model->isValid());
393 }
394 
is_ignored_float16_3(int i)395 inline bool is_ignored_float16_3(int i) {
396   static std::set<int> ignore = {};
397   return ignore.find(i) != ignore.end();
398 }
399 
CreateModel_dynamic_output_shape_3(Model * model)400 void CreateModel_dynamic_output_shape_3(Model *model) {
401   OperandType type1(Type::INT32, {});
402   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
403   OperandType type13(Type::TENSOR_INT32, {0, 0});
404   OperandType type4(Type::TENSOR_FLOAT32, {2, 4});
405   // Phase 1, operands
406   auto input2 = model->addOperand(&type4);
407   auto k2 = model->addOperand(&type1);
408   auto out_values2 = model->addOperand(&type12);
409   auto out_indices2 = model->addOperand(&type13);
410   // Phase 2, operations
411   static int32_t k2_init[] = {2};
412   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
413   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
414   // Phase 3, inputs and outputs
415   model->identifyInputsAndOutputs(
416     {input2},
417     {out_values2, out_indices2});
418   assert(model->isValid());
419 }
420 
is_ignored_dynamic_output_shape_3(int i)421 inline bool is_ignored_dynamic_output_shape_3(int i) {
422   static std::set<int> ignore = {};
423   return ignore.find(i) != ignore.end();
424 }
425 
CreateModel_dynamic_output_shape_relaxed_3(Model * model)426 void CreateModel_dynamic_output_shape_relaxed_3(Model *model) {
427   OperandType type1(Type::INT32, {});
428   OperandType type12(Type::TENSOR_FLOAT32, {0, 0});
429   OperandType type13(Type::TENSOR_INT32, {0, 0});
430   OperandType type4(Type::TENSOR_FLOAT32, {2, 4});
431   // Phase 1, operands
432   auto input2 = model->addOperand(&type4);
433   auto k2 = model->addOperand(&type1);
434   auto out_values2 = model->addOperand(&type12);
435   auto out_indices2 = model->addOperand(&type13);
436   // Phase 2, operations
437   static int32_t k2_init[] = {2};
438   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
439   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
440   // Phase 3, inputs and outputs
441   model->identifyInputsAndOutputs(
442     {input2},
443     {out_values2, out_indices2});
444   // Phase 4: set relaxed execution
445   model->relaxComputationFloat32toFloat16(true);
446   assert(model->isValid());
447 }
448 
is_ignored_dynamic_output_shape_relaxed_3(int i)449 inline bool is_ignored_dynamic_output_shape_relaxed_3(int i) {
450   static std::set<int> ignore = {};
451   return ignore.find(i) != ignore.end();
452 }
453 
CreateModel_dynamic_output_shape_float16_3(Model * model)454 void CreateModel_dynamic_output_shape_float16_3(Model *model) {
455   OperandType type1(Type::INT32, {});
456   OperandType type13(Type::TENSOR_INT32, {0, 0});
457   OperandType type14(Type::TENSOR_FLOAT16, {0, 0});
458   OperandType type16(Type::TENSOR_FLOAT16, {2, 4});
459   // Phase 1, operands
460   auto input2 = model->addOperand(&type16);
461   auto k2 = model->addOperand(&type1);
462   auto out_values2 = model->addOperand(&type14);
463   auto out_indices2 = model->addOperand(&type13);
464   // Phase 2, operations
465   static int32_t k2_init[] = {2};
466   model->setOperandValue(k2, k2_init, sizeof(int32_t) * 1);
467   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input2, k2}, {out_values2, out_indices2});
468   // Phase 3, inputs and outputs
469   model->identifyInputsAndOutputs(
470     {input2},
471     {out_values2, out_indices2});
472   assert(model->isValid());
473 }
474 
is_ignored_dynamic_output_shape_float16_3(int i)475 inline bool is_ignored_dynamic_output_shape_float16_3(int i) {
476   static std::set<int> ignore = {};
477   return ignore.find(i) != ignore.end();
478 }
479 
CreateModel_4(Model * model)480 void CreateModel_4(Model *model) {
481   OperandType type1(Type::INT32, {});
482   OperandType type5(Type::TENSOR_FLOAT32, {8});
483   OperandType type6(Type::TENSOR_FLOAT32, {2});
484   OperandType type7(Type::TENSOR_INT32, {2});
485   // Phase 1, operands
486   auto input3 = model->addOperand(&type5);
487   auto k3 = model->addOperand(&type1);
488   auto out_values3 = model->addOperand(&type6);
489   auto out_indices3 = model->addOperand(&type7);
490   // Phase 2, operations
491   static int32_t k3_init[] = {2};
492   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
493   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
494   // Phase 3, inputs and outputs
495   model->identifyInputsAndOutputs(
496     {input3},
497     {out_values3, out_indices3});
498   assert(model->isValid());
499 }
500 
is_ignored_4(int i)501 inline bool is_ignored_4(int i) {
502   static std::set<int> ignore = {};
503   return ignore.find(i) != ignore.end();
504 }
505 
CreateModel_relaxed_4(Model * model)506 void CreateModel_relaxed_4(Model *model) {
507   OperandType type1(Type::INT32, {});
508   OperandType type5(Type::TENSOR_FLOAT32, {8});
509   OperandType type6(Type::TENSOR_FLOAT32, {2});
510   OperandType type7(Type::TENSOR_INT32, {2});
511   // Phase 1, operands
512   auto input3 = model->addOperand(&type5);
513   auto k3 = model->addOperand(&type1);
514   auto out_values3 = model->addOperand(&type6);
515   auto out_indices3 = model->addOperand(&type7);
516   // Phase 2, operations
517   static int32_t k3_init[] = {2};
518   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
519   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
520   // Phase 3, inputs and outputs
521   model->identifyInputsAndOutputs(
522     {input3},
523     {out_values3, out_indices3});
524   // Phase 4: set relaxed execution
525   model->relaxComputationFloat32toFloat16(true);
526   assert(model->isValid());
527 }
528 
is_ignored_relaxed_4(int i)529 inline bool is_ignored_relaxed_4(int i) {
530   static std::set<int> ignore = {};
531   return ignore.find(i) != ignore.end();
532 }
533 
CreateModel_float16_4(Model * model)534 void CreateModel_float16_4(Model *model) {
535   OperandType type1(Type::INT32, {});
536   OperandType type17(Type::TENSOR_FLOAT16, {8});
537   OperandType type18(Type::TENSOR_FLOAT16, {2});
538   OperandType type7(Type::TENSOR_INT32, {2});
539   // Phase 1, operands
540   auto input3 = model->addOperand(&type17);
541   auto k3 = model->addOperand(&type1);
542   auto out_values3 = model->addOperand(&type18);
543   auto out_indices3 = model->addOperand(&type7);
544   // Phase 2, operations
545   static int32_t k3_init[] = {2};
546   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
547   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
548   // Phase 3, inputs and outputs
549   model->identifyInputsAndOutputs(
550     {input3},
551     {out_values3, out_indices3});
552   assert(model->isValid());
553 }
554 
is_ignored_float16_4(int i)555 inline bool is_ignored_float16_4(int i) {
556   static std::set<int> ignore = {};
557   return ignore.find(i) != ignore.end();
558 }
559 
CreateModel_dynamic_output_shape_4(Model * model)560 void CreateModel_dynamic_output_shape_4(Model *model) {
561   OperandType type1(Type::INT32, {});
562   OperandType type19(Type::TENSOR_FLOAT32, {0});
563   OperandType type20(Type::TENSOR_INT32, {0});
564   OperandType type5(Type::TENSOR_FLOAT32, {8});
565   // Phase 1, operands
566   auto input3 = model->addOperand(&type5);
567   auto k3 = model->addOperand(&type1);
568   auto out_values3 = model->addOperand(&type19);
569   auto out_indices3 = model->addOperand(&type20);
570   // Phase 2, operations
571   static int32_t k3_init[] = {2};
572   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
573   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
574   // Phase 3, inputs and outputs
575   model->identifyInputsAndOutputs(
576     {input3},
577     {out_values3, out_indices3});
578   assert(model->isValid());
579 }
580 
is_ignored_dynamic_output_shape_4(int i)581 inline bool is_ignored_dynamic_output_shape_4(int i) {
582   static std::set<int> ignore = {};
583   return ignore.find(i) != ignore.end();
584 }
585 
CreateModel_dynamic_output_shape_relaxed_4(Model * model)586 void CreateModel_dynamic_output_shape_relaxed_4(Model *model) {
587   OperandType type1(Type::INT32, {});
588   OperandType type19(Type::TENSOR_FLOAT32, {0});
589   OperandType type20(Type::TENSOR_INT32, {0});
590   OperandType type5(Type::TENSOR_FLOAT32, {8});
591   // Phase 1, operands
592   auto input3 = model->addOperand(&type5);
593   auto k3 = model->addOperand(&type1);
594   auto out_values3 = model->addOperand(&type19);
595   auto out_indices3 = model->addOperand(&type20);
596   // Phase 2, operations
597   static int32_t k3_init[] = {2};
598   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
599   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
600   // Phase 3, inputs and outputs
601   model->identifyInputsAndOutputs(
602     {input3},
603     {out_values3, out_indices3});
604   // Phase 4: set relaxed execution
605   model->relaxComputationFloat32toFloat16(true);
606   assert(model->isValid());
607 }
608 
is_ignored_dynamic_output_shape_relaxed_4(int i)609 inline bool is_ignored_dynamic_output_shape_relaxed_4(int i) {
610   static std::set<int> ignore = {};
611   return ignore.find(i) != ignore.end();
612 }
613 
CreateModel_dynamic_output_shape_float16_4(Model * model)614 void CreateModel_dynamic_output_shape_float16_4(Model *model) {
615   OperandType type1(Type::INT32, {});
616   OperandType type17(Type::TENSOR_FLOAT16, {8});
617   OperandType type20(Type::TENSOR_INT32, {0});
618   OperandType type21(Type::TENSOR_FLOAT16, {0});
619   // Phase 1, operands
620   auto input3 = model->addOperand(&type17);
621   auto k3 = model->addOperand(&type1);
622   auto out_values3 = model->addOperand(&type21);
623   auto out_indices3 = model->addOperand(&type20);
624   // Phase 2, operations
625   static int32_t k3_init[] = {2};
626   model->setOperandValue(k3, k3_init, sizeof(int32_t) * 1);
627   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input3, k3}, {out_values3, out_indices3});
628   // Phase 3, inputs and outputs
629   model->identifyInputsAndOutputs(
630     {input3},
631     {out_values3, out_indices3});
632   assert(model->isValid());
633 }
634 
is_ignored_dynamic_output_shape_float16_4(int i)635 inline bool is_ignored_dynamic_output_shape_float16_4(int i) {
636   static std::set<int> ignore = {};
637   return ignore.find(i) != ignore.end();
638 }
639 
CreateModel_5(Model * model)640 void CreateModel_5(Model *model) {
641   OperandType type1(Type::INT32, {});
642   OperandType type2(Type::TENSOR_INT32, {2, 2});
643   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
644   OperandType type9(Type::TENSOR_QUANT8_ASYMM, {2, 2}, 2.0f, 128);
645   // Phase 1, operands
646   auto input4 = model->addOperand(&type8);
647   auto k4 = model->addOperand(&type1);
648   auto out_values4 = model->addOperand(&type9);
649   auto out_indices4 = model->addOperand(&type2);
650   // Phase 2, operations
651   static int32_t k4_init[] = {2};
652   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
653   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
654   // Phase 3, inputs and outputs
655   model->identifyInputsAndOutputs(
656     {input4},
657     {out_values4, out_indices4});
658   assert(model->isValid());
659 }
660 
is_ignored_5(int i)661 inline bool is_ignored_5(int i) {
662   static std::set<int> ignore = {};
663   return ignore.find(i) != ignore.end();
664 }
665 
CreateModel_relaxed_5(Model * model)666 void CreateModel_relaxed_5(Model *model) {
667   OperandType type1(Type::INT32, {});
668   OperandType type2(Type::TENSOR_INT32, {2, 2});
669   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
670   OperandType type9(Type::TENSOR_QUANT8_ASYMM, {2, 2}, 2.0f, 128);
671   // Phase 1, operands
672   auto input4 = model->addOperand(&type8);
673   auto k4 = model->addOperand(&type1);
674   auto out_values4 = model->addOperand(&type9);
675   auto out_indices4 = model->addOperand(&type2);
676   // Phase 2, operations
677   static int32_t k4_init[] = {2};
678   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
679   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
680   // Phase 3, inputs and outputs
681   model->identifyInputsAndOutputs(
682     {input4},
683     {out_values4, out_indices4});
684   // Phase 4: set relaxed execution
685   model->relaxComputationFloat32toFloat16(true);
686   assert(model->isValid());
687 }
688 
is_ignored_relaxed_5(int i)689 inline bool is_ignored_relaxed_5(int i) {
690   static std::set<int> ignore = {};
691   return ignore.find(i) != ignore.end();
692 }
693 
CreateModel_float16_5(Model * model)694 void CreateModel_float16_5(Model *model) {
695   OperandType type1(Type::INT32, {});
696   OperandType type2(Type::TENSOR_INT32, {2, 2});
697   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
698   OperandType type9(Type::TENSOR_QUANT8_ASYMM, {2, 2}, 2.0f, 128);
699   // Phase 1, operands
700   auto input4 = model->addOperand(&type8);
701   auto k4 = model->addOperand(&type1);
702   auto out_values4 = model->addOperand(&type9);
703   auto out_indices4 = model->addOperand(&type2);
704   // Phase 2, operations
705   static int32_t k4_init[] = {2};
706   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
707   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
708   // Phase 3, inputs and outputs
709   model->identifyInputsAndOutputs(
710     {input4},
711     {out_values4, out_indices4});
712   assert(model->isValid());
713 }
714 
is_ignored_float16_5(int i)715 inline bool is_ignored_float16_5(int i) {
716   static std::set<int> ignore = {};
717   return ignore.find(i) != ignore.end();
718 }
719 
CreateModel_dynamic_output_shape_5(Model * model)720 void CreateModel_dynamic_output_shape_5(Model *model) {
721   OperandType type1(Type::INT32, {});
722   OperandType type13(Type::TENSOR_INT32, {0, 0});
723   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {0, 0}, 2.0f, 128);
724   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
725   // Phase 1, operands
726   auto input4 = model->addOperand(&type8);
727   auto k4 = model->addOperand(&type1);
728   auto out_values4 = model->addOperand(&type22);
729   auto out_indices4 = model->addOperand(&type13);
730   // Phase 2, operations
731   static int32_t k4_init[] = {2};
732   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
733   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
734   // Phase 3, inputs and outputs
735   model->identifyInputsAndOutputs(
736     {input4},
737     {out_values4, out_indices4});
738   assert(model->isValid());
739 }
740 
is_ignored_dynamic_output_shape_5(int i)741 inline bool is_ignored_dynamic_output_shape_5(int i) {
742   static std::set<int> ignore = {};
743   return ignore.find(i) != ignore.end();
744 }
745 
CreateModel_dynamic_output_shape_relaxed_5(Model * model)746 void CreateModel_dynamic_output_shape_relaxed_5(Model *model) {
747   OperandType type1(Type::INT32, {});
748   OperandType type13(Type::TENSOR_INT32, {0, 0});
749   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {0, 0}, 2.0f, 128);
750   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
751   // Phase 1, operands
752   auto input4 = model->addOperand(&type8);
753   auto k4 = model->addOperand(&type1);
754   auto out_values4 = model->addOperand(&type22);
755   auto out_indices4 = model->addOperand(&type13);
756   // Phase 2, operations
757   static int32_t k4_init[] = {2};
758   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
759   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
760   // Phase 3, inputs and outputs
761   model->identifyInputsAndOutputs(
762     {input4},
763     {out_values4, out_indices4});
764   // Phase 4: set relaxed execution
765   model->relaxComputationFloat32toFloat16(true);
766   assert(model->isValid());
767 }
768 
is_ignored_dynamic_output_shape_relaxed_5(int i)769 inline bool is_ignored_dynamic_output_shape_relaxed_5(int i) {
770   static std::set<int> ignore = {};
771   return ignore.find(i) != ignore.end();
772 }
773 
CreateModel_dynamic_output_shape_float16_5(Model * model)774 void CreateModel_dynamic_output_shape_float16_5(Model *model) {
775   OperandType type1(Type::INT32, {});
776   OperandType type13(Type::TENSOR_INT32, {0, 0});
777   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {0, 0}, 2.0f, 128);
778   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {2, 3}, 2.0f, 128);
779   // Phase 1, operands
780   auto input4 = model->addOperand(&type8);
781   auto k4 = model->addOperand(&type1);
782   auto out_values4 = model->addOperand(&type22);
783   auto out_indices4 = model->addOperand(&type13);
784   // Phase 2, operations
785   static int32_t k4_init[] = {2};
786   model->setOperandValue(k4, k4_init, sizeof(int32_t) * 1);
787   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input4, k4}, {out_values4, out_indices4});
788   // Phase 3, inputs and outputs
789   model->identifyInputsAndOutputs(
790     {input4},
791     {out_values4, out_indices4});
792   assert(model->isValid());
793 }
794 
is_ignored_dynamic_output_shape_float16_5(int i)795 inline bool is_ignored_dynamic_output_shape_float16_5(int i) {
796   static std::set<int> ignore = {};
797   return ignore.find(i) != ignore.end();
798 }
799 
CreateModel_6(Model * model)800 void CreateModel_6(Model *model) {
801   OperandType type1(Type::INT32, {});
802   OperandType type10(Type::TENSOR_INT32, {2, 3});
803   OperandType type2(Type::TENSOR_INT32, {2, 2});
804   // Phase 1, operands
805   auto input5 = model->addOperand(&type10);
806   auto k5 = model->addOperand(&type1);
807   auto out_values5 = model->addOperand(&type2);
808   auto out_indices5 = model->addOperand(&type2);
809   // Phase 2, operations
810   static int32_t k5_init[] = {2};
811   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
812   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
813   // Phase 3, inputs and outputs
814   model->identifyInputsAndOutputs(
815     {input5},
816     {out_values5, out_indices5});
817   assert(model->isValid());
818 }
819 
is_ignored_6(int i)820 inline bool is_ignored_6(int i) {
821   static std::set<int> ignore = {};
822   return ignore.find(i) != ignore.end();
823 }
824 
CreateModel_relaxed_6(Model * model)825 void CreateModel_relaxed_6(Model *model) {
826   OperandType type1(Type::INT32, {});
827   OperandType type10(Type::TENSOR_INT32, {2, 3});
828   OperandType type2(Type::TENSOR_INT32, {2, 2});
829   // Phase 1, operands
830   auto input5 = model->addOperand(&type10);
831   auto k5 = model->addOperand(&type1);
832   auto out_values5 = model->addOperand(&type2);
833   auto out_indices5 = model->addOperand(&type2);
834   // Phase 2, operations
835   static int32_t k5_init[] = {2};
836   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
837   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
838   // Phase 3, inputs and outputs
839   model->identifyInputsAndOutputs(
840     {input5},
841     {out_values5, out_indices5});
842   // Phase 4: set relaxed execution
843   model->relaxComputationFloat32toFloat16(true);
844   assert(model->isValid());
845 }
846 
is_ignored_relaxed_6(int i)847 inline bool is_ignored_relaxed_6(int i) {
848   static std::set<int> ignore = {};
849   return ignore.find(i) != ignore.end();
850 }
851 
CreateModel_float16_6(Model * model)852 void CreateModel_float16_6(Model *model) {
853   OperandType type1(Type::INT32, {});
854   OperandType type10(Type::TENSOR_INT32, {2, 3});
855   OperandType type2(Type::TENSOR_INT32, {2, 2});
856   // Phase 1, operands
857   auto input5 = model->addOperand(&type10);
858   auto k5 = model->addOperand(&type1);
859   auto out_values5 = model->addOperand(&type2);
860   auto out_indices5 = model->addOperand(&type2);
861   // Phase 2, operations
862   static int32_t k5_init[] = {2};
863   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
864   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
865   // Phase 3, inputs and outputs
866   model->identifyInputsAndOutputs(
867     {input5},
868     {out_values5, out_indices5});
869   assert(model->isValid());
870 }
871 
is_ignored_float16_6(int i)872 inline bool is_ignored_float16_6(int i) {
873   static std::set<int> ignore = {};
874   return ignore.find(i) != ignore.end();
875 }
876 
CreateModel_dynamic_output_shape_6(Model * model)877 void CreateModel_dynamic_output_shape_6(Model *model) {
878   OperandType type1(Type::INT32, {});
879   OperandType type10(Type::TENSOR_INT32, {2, 3});
880   OperandType type13(Type::TENSOR_INT32, {0, 0});
881   // Phase 1, operands
882   auto input5 = model->addOperand(&type10);
883   auto k5 = model->addOperand(&type1);
884   auto out_values5 = model->addOperand(&type13);
885   auto out_indices5 = model->addOperand(&type13);
886   // Phase 2, operations
887   static int32_t k5_init[] = {2};
888   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
889   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
890   // Phase 3, inputs and outputs
891   model->identifyInputsAndOutputs(
892     {input5},
893     {out_values5, out_indices5});
894   assert(model->isValid());
895 }
896 
is_ignored_dynamic_output_shape_6(int i)897 inline bool is_ignored_dynamic_output_shape_6(int i) {
898   static std::set<int> ignore = {};
899   return ignore.find(i) != ignore.end();
900 }
901 
CreateModel_dynamic_output_shape_relaxed_6(Model * model)902 void CreateModel_dynamic_output_shape_relaxed_6(Model *model) {
903   OperandType type1(Type::INT32, {});
904   OperandType type10(Type::TENSOR_INT32, {2, 3});
905   OperandType type13(Type::TENSOR_INT32, {0, 0});
906   // Phase 1, operands
907   auto input5 = model->addOperand(&type10);
908   auto k5 = model->addOperand(&type1);
909   auto out_values5 = model->addOperand(&type13);
910   auto out_indices5 = model->addOperand(&type13);
911   // Phase 2, operations
912   static int32_t k5_init[] = {2};
913   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
914   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
915   // Phase 3, inputs and outputs
916   model->identifyInputsAndOutputs(
917     {input5},
918     {out_values5, out_indices5});
919   // Phase 4: set relaxed execution
920   model->relaxComputationFloat32toFloat16(true);
921   assert(model->isValid());
922 }
923 
is_ignored_dynamic_output_shape_relaxed_6(int i)924 inline bool is_ignored_dynamic_output_shape_relaxed_6(int i) {
925   static std::set<int> ignore = {};
926   return ignore.find(i) != ignore.end();
927 }
928 
CreateModel_dynamic_output_shape_float16_6(Model * model)929 void CreateModel_dynamic_output_shape_float16_6(Model *model) {
930   OperandType type1(Type::INT32, {});
931   OperandType type10(Type::TENSOR_INT32, {2, 3});
932   OperandType type13(Type::TENSOR_INT32, {0, 0});
933   // Phase 1, operands
934   auto input5 = model->addOperand(&type10);
935   auto k5 = model->addOperand(&type1);
936   auto out_values5 = model->addOperand(&type13);
937   auto out_indices5 = model->addOperand(&type13);
938   // Phase 2, operations
939   static int32_t k5_init[] = {2};
940   model->setOperandValue(k5, k5_init, sizeof(int32_t) * 1);
941   model->addOperation(ANEURALNETWORKS_TOPK_V2, {input5, k5}, {out_values5, out_indices5});
942   // Phase 3, inputs and outputs
943   model->identifyInputsAndOutputs(
944     {input5},
945     {out_values5, out_indices5});
946   assert(model->isValid());
947 }
948 
is_ignored_dynamic_output_shape_float16_6(int i)949 inline bool is_ignored_dynamic_output_shape_float16_6(int i) {
950   static std::set<int> ignore = {};
951   return ignore.find(i) != ignore.end();
952 }
953 
954