• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: detection_postprocess.mod.py). Do not edit
CreateModel_regular(Model * model)3 void CreateModel_regular(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
5   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
6   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
7   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
8   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
9   OperandType type5(Type::TENSOR_INT32, {1, 3});
10   OperandType type6(Type::TENSOR_INT32, {1});
11   OperandType type7(Type::FLOAT32, {});
12   OperandType type8(Type::BOOL, {});
13   OperandType type9(Type::INT32, {});
14   // Phase 1, operands
15   auto scores = model->addOperand(&type0);
16   auto roi = model->addOperand(&type1);
17   auto anchors = model->addOperand(&type2);
18   auto param = model->addOperand(&type7);
19   auto param1 = model->addOperand(&type7);
20   auto param2 = model->addOperand(&type7);
21   auto param3 = model->addOperand(&type7);
22   auto param4 = model->addOperand(&type8);
23   auto param5 = model->addOperand(&type9);
24   auto param6 = model->addOperand(&type9);
25   auto param7 = model->addOperand(&type9);
26   auto param8 = model->addOperand(&type7);
27   auto param9 = model->addOperand(&type7);
28   auto param10 = model->addOperand(&type8);
29   auto scoresOut = model->addOperand(&type3);
30   auto roiOut = model->addOperand(&type4);
31   auto classesOut = model->addOperand(&type5);
32   auto detectionOut = model->addOperand(&type6);
33   // Phase 2, operations
34   static float param_init[] = {10.0f};
35   model->setOperandValue(param, param_init, sizeof(float) * 1);
36   static float param1_init[] = {10.0f};
37   model->setOperandValue(param1, param1_init, sizeof(float) * 1);
38   static float param2_init[] = {5.0f};
39   model->setOperandValue(param2, param2_init, sizeof(float) * 1);
40   static float param3_init[] = {5.0f};
41   model->setOperandValue(param3, param3_init, sizeof(float) * 1);
42   static bool8 param4_init[] = {true};
43   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
44   static int32_t param5_init[] = {3};
45   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
46   static int32_t param6_init[] = {1};
47   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
48   static int32_t param7_init[] = {1};
49   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
50   static float param8_init[] = {0.0f};
51   model->setOperandValue(param8, param8_init, sizeof(float) * 1);
52   static float param9_init[] = {0.5f};
53   model->setOperandValue(param9, param9_init, sizeof(float) * 1);
54   static bool8 param10_init[] = {false};
55   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
56   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
57   // Phase 3, inputs and outputs
58   model->identifyInputsAndOutputs(
59     {scores, roi, anchors},
60     {scoresOut, roiOut, classesOut, detectionOut});
61   assert(model->isValid());
62 }
63 
is_ignored_regular(int i)64 inline bool is_ignored_regular(int i) {
65   static std::set<int> ignore = {};
66   return ignore.find(i) != ignore.end();
67 }
68 
CreateModel_regular_relaxed(Model * model)69 void CreateModel_regular_relaxed(Model *model) {
70   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
71   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
72   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
73   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
74   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
75   OperandType type5(Type::TENSOR_INT32, {1, 3});
76   OperandType type6(Type::TENSOR_INT32, {1});
77   OperandType type7(Type::FLOAT32, {});
78   OperandType type8(Type::BOOL, {});
79   OperandType type9(Type::INT32, {});
80   // Phase 1, operands
81   auto scores = model->addOperand(&type0);
82   auto roi = model->addOperand(&type1);
83   auto anchors = model->addOperand(&type2);
84   auto param = model->addOperand(&type7);
85   auto param1 = model->addOperand(&type7);
86   auto param2 = model->addOperand(&type7);
87   auto param3 = model->addOperand(&type7);
88   auto param4 = model->addOperand(&type8);
89   auto param5 = model->addOperand(&type9);
90   auto param6 = model->addOperand(&type9);
91   auto param7 = model->addOperand(&type9);
92   auto param8 = model->addOperand(&type7);
93   auto param9 = model->addOperand(&type7);
94   auto param10 = model->addOperand(&type8);
95   auto scoresOut = model->addOperand(&type3);
96   auto roiOut = model->addOperand(&type4);
97   auto classesOut = model->addOperand(&type5);
98   auto detectionOut = model->addOperand(&type6);
99   // Phase 2, operations
100   static float param_init[] = {10.0f};
101   model->setOperandValue(param, param_init, sizeof(float) * 1);
102   static float param1_init[] = {10.0f};
103   model->setOperandValue(param1, param1_init, sizeof(float) * 1);
104   static float param2_init[] = {5.0f};
105   model->setOperandValue(param2, param2_init, sizeof(float) * 1);
106   static float param3_init[] = {5.0f};
107   model->setOperandValue(param3, param3_init, sizeof(float) * 1);
108   static bool8 param4_init[] = {true};
109   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
110   static int32_t param5_init[] = {3};
111   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
112   static int32_t param6_init[] = {1};
113   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
114   static int32_t param7_init[] = {1};
115   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
116   static float param8_init[] = {0.0f};
117   model->setOperandValue(param8, param8_init, sizeof(float) * 1);
118   static float param9_init[] = {0.5f};
119   model->setOperandValue(param9, param9_init, sizeof(float) * 1);
120   static bool8 param10_init[] = {false};
121   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
122   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
123   // Phase 3, inputs and outputs
124   model->identifyInputsAndOutputs(
125     {scores, roi, anchors},
126     {scoresOut, roiOut, classesOut, detectionOut});
127   // Phase 4: set relaxed execution
128   model->relaxComputationFloat32toFloat16(true);
129   assert(model->isValid());
130 }
131 
is_ignored_regular_relaxed(int i)132 inline bool is_ignored_regular_relaxed(int i) {
133   static std::set<int> ignore = {};
134   return ignore.find(i) != ignore.end();
135 }
136 
CreateModel_regular_float16(Model * model)137 void CreateModel_regular_float16(Model *model) {
138   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
139   OperandType type12(Type::FLOAT16, {});
140   OperandType type13(Type::TENSOR_FLOAT16, {1, 6, 4});
141   OperandType type14(Type::TENSOR_FLOAT16, {1, 3, 4});
142   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
143   OperandType type16(Type::TENSOR_FLOAT16, {1, 3});
144   OperandType type5(Type::TENSOR_INT32, {1, 3});
145   OperandType type6(Type::TENSOR_INT32, {1});
146   OperandType type8(Type::BOOL, {});
147   OperandType type9(Type::INT32, {});
148   // Phase 1, operands
149   auto scores = model->addOperand(&type15);
150   auto roi = model->addOperand(&type13);
151   auto anchors = model->addOperand(&type11);
152   auto param = model->addOperand(&type12);
153   auto param1 = model->addOperand(&type12);
154   auto param2 = model->addOperand(&type12);
155   auto param3 = model->addOperand(&type12);
156   auto param4 = model->addOperand(&type8);
157   auto param5 = model->addOperand(&type9);
158   auto param6 = model->addOperand(&type9);
159   auto param7 = model->addOperand(&type9);
160   auto param8 = model->addOperand(&type12);
161   auto param9 = model->addOperand(&type12);
162   auto param10 = model->addOperand(&type8);
163   auto scoresOut = model->addOperand(&type16);
164   auto roiOut = model->addOperand(&type14);
165   auto classesOut = model->addOperand(&type5);
166   auto detectionOut = model->addOperand(&type6);
167   // Phase 2, operations
168   static _Float16 param_init[] = {10.0f};
169   model->setOperandValue(param, param_init, sizeof(_Float16) * 1);
170   static _Float16 param1_init[] = {10.0f};
171   model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
172   static _Float16 param2_init[] = {5.0f};
173   model->setOperandValue(param2, param2_init, sizeof(_Float16) * 1);
174   static _Float16 param3_init[] = {5.0f};
175   model->setOperandValue(param3, param3_init, sizeof(_Float16) * 1);
176   static bool8 param4_init[] = {true};
177   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
178   static int32_t param5_init[] = {3};
179   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
180   static int32_t param6_init[] = {1};
181   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
182   static int32_t param7_init[] = {1};
183   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
184   static _Float16 param8_init[] = {0.0f};
185   model->setOperandValue(param8, param8_init, sizeof(_Float16) * 1);
186   static _Float16 param9_init[] = {0.5f};
187   model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
188   static bool8 param10_init[] = {false};
189   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
190   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
191   // Phase 3, inputs and outputs
192   model->identifyInputsAndOutputs(
193     {scores, roi, anchors},
194     {scoresOut, roiOut, classesOut, detectionOut});
195   assert(model->isValid());
196 }
197 
is_ignored_regular_float16(int i)198 inline bool is_ignored_regular_float16(int i) {
199   static std::set<int> ignore = {};
200   return ignore.find(i) != ignore.end();
201 }
202 
CreateModel_regular_dynamic_output_shape(Model * model)203 void CreateModel_regular_dynamic_output_shape(Model *model) {
204   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
205   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
206   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
207   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
208   OperandType type19(Type::TENSOR_INT32, {0, 0});
209   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
210   OperandType type20(Type::TENSOR_INT32, {0});
211   OperandType type7(Type::FLOAT32, {});
212   OperandType type8(Type::BOOL, {});
213   OperandType type9(Type::INT32, {});
214   // Phase 1, operands
215   auto scores = model->addOperand(&type0);
216   auto roi = model->addOperand(&type1);
217   auto anchors = model->addOperand(&type2);
218   auto param = model->addOperand(&type7);
219   auto param1 = model->addOperand(&type7);
220   auto param2 = model->addOperand(&type7);
221   auto param3 = model->addOperand(&type7);
222   auto param4 = model->addOperand(&type8);
223   auto param5 = model->addOperand(&type9);
224   auto param6 = model->addOperand(&type9);
225   auto param7 = model->addOperand(&type9);
226   auto param8 = model->addOperand(&type7);
227   auto param9 = model->addOperand(&type7);
228   auto param10 = model->addOperand(&type8);
229   auto scoresOut = model->addOperand(&type17);
230   auto roiOut = model->addOperand(&type18);
231   auto classesOut = model->addOperand(&type19);
232   auto detectionOut = model->addOperand(&type20);
233   // Phase 2, operations
234   static float param_init[] = {10.0f};
235   model->setOperandValue(param, param_init, sizeof(float) * 1);
236   static float param1_init[] = {10.0f};
237   model->setOperandValue(param1, param1_init, sizeof(float) * 1);
238   static float param2_init[] = {5.0f};
239   model->setOperandValue(param2, param2_init, sizeof(float) * 1);
240   static float param3_init[] = {5.0f};
241   model->setOperandValue(param3, param3_init, sizeof(float) * 1);
242   static bool8 param4_init[] = {true};
243   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
244   static int32_t param5_init[] = {3};
245   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
246   static int32_t param6_init[] = {1};
247   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
248   static int32_t param7_init[] = {1};
249   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
250   static float param8_init[] = {0.0f};
251   model->setOperandValue(param8, param8_init, sizeof(float) * 1);
252   static float param9_init[] = {0.5f};
253   model->setOperandValue(param9, param9_init, sizeof(float) * 1);
254   static bool8 param10_init[] = {false};
255   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
256   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
257   // Phase 3, inputs and outputs
258   model->identifyInputsAndOutputs(
259     {scores, roi, anchors},
260     {scoresOut, roiOut, classesOut, detectionOut});
261   assert(model->isValid());
262 }
263 
is_ignored_regular_dynamic_output_shape(int i)264 inline bool is_ignored_regular_dynamic_output_shape(int i) {
265   static std::set<int> ignore = {};
266   return ignore.find(i) != ignore.end();
267 }
268 
CreateModel_regular_dynamic_output_shape_relaxed(Model * model)269 void CreateModel_regular_dynamic_output_shape_relaxed(Model *model) {
270   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
271   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
272   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
273   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
274   OperandType type19(Type::TENSOR_INT32, {0, 0});
275   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
276   OperandType type20(Type::TENSOR_INT32, {0});
277   OperandType type7(Type::FLOAT32, {});
278   OperandType type8(Type::BOOL, {});
279   OperandType type9(Type::INT32, {});
280   // Phase 1, operands
281   auto scores = model->addOperand(&type0);
282   auto roi = model->addOperand(&type1);
283   auto anchors = model->addOperand(&type2);
284   auto param = model->addOperand(&type7);
285   auto param1 = model->addOperand(&type7);
286   auto param2 = model->addOperand(&type7);
287   auto param3 = model->addOperand(&type7);
288   auto param4 = model->addOperand(&type8);
289   auto param5 = model->addOperand(&type9);
290   auto param6 = model->addOperand(&type9);
291   auto param7 = model->addOperand(&type9);
292   auto param8 = model->addOperand(&type7);
293   auto param9 = model->addOperand(&type7);
294   auto param10 = model->addOperand(&type8);
295   auto scoresOut = model->addOperand(&type17);
296   auto roiOut = model->addOperand(&type18);
297   auto classesOut = model->addOperand(&type19);
298   auto detectionOut = model->addOperand(&type20);
299   // Phase 2, operations
300   static float param_init[] = {10.0f};
301   model->setOperandValue(param, param_init, sizeof(float) * 1);
302   static float param1_init[] = {10.0f};
303   model->setOperandValue(param1, param1_init, sizeof(float) * 1);
304   static float param2_init[] = {5.0f};
305   model->setOperandValue(param2, param2_init, sizeof(float) * 1);
306   static float param3_init[] = {5.0f};
307   model->setOperandValue(param3, param3_init, sizeof(float) * 1);
308   static bool8 param4_init[] = {true};
309   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
310   static int32_t param5_init[] = {3};
311   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
312   static int32_t param6_init[] = {1};
313   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
314   static int32_t param7_init[] = {1};
315   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
316   static float param8_init[] = {0.0f};
317   model->setOperandValue(param8, param8_init, sizeof(float) * 1);
318   static float param9_init[] = {0.5f};
319   model->setOperandValue(param9, param9_init, sizeof(float) * 1);
320   static bool8 param10_init[] = {false};
321   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
322   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
323   // Phase 3, inputs and outputs
324   model->identifyInputsAndOutputs(
325     {scores, roi, anchors},
326     {scoresOut, roiOut, classesOut, detectionOut});
327   // Phase 4: set relaxed execution
328   model->relaxComputationFloat32toFloat16(true);
329   assert(model->isValid());
330 }
331 
is_ignored_regular_dynamic_output_shape_relaxed(int i)332 inline bool is_ignored_regular_dynamic_output_shape_relaxed(int i) {
333   static std::set<int> ignore = {};
334   return ignore.find(i) != ignore.end();
335 }
336 
CreateModel_regular_dynamic_output_shape_float16(Model * model)337 void CreateModel_regular_dynamic_output_shape_float16(Model *model) {
338   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
339   OperandType type12(Type::FLOAT16, {});
340   OperandType type13(Type::TENSOR_FLOAT16, {1, 6, 4});
341   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
342   OperandType type19(Type::TENSOR_INT32, {0, 0});
343   OperandType type20(Type::TENSOR_INT32, {0});
344   OperandType type21(Type::TENSOR_FLOAT16, {0, 0});
345   OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
346   OperandType type8(Type::BOOL, {});
347   OperandType type9(Type::INT32, {});
348   // Phase 1, operands
349   auto scores = model->addOperand(&type15);
350   auto roi = model->addOperand(&type13);
351   auto anchors = model->addOperand(&type11);
352   auto param = model->addOperand(&type12);
353   auto param1 = model->addOperand(&type12);
354   auto param2 = model->addOperand(&type12);
355   auto param3 = model->addOperand(&type12);
356   auto param4 = model->addOperand(&type8);
357   auto param5 = model->addOperand(&type9);
358   auto param6 = model->addOperand(&type9);
359   auto param7 = model->addOperand(&type9);
360   auto param8 = model->addOperand(&type12);
361   auto param9 = model->addOperand(&type12);
362   auto param10 = model->addOperand(&type8);
363   auto scoresOut = model->addOperand(&type21);
364   auto roiOut = model->addOperand(&type22);
365   auto classesOut = model->addOperand(&type19);
366   auto detectionOut = model->addOperand(&type20);
367   // Phase 2, operations
368   static _Float16 param_init[] = {10.0f};
369   model->setOperandValue(param, param_init, sizeof(_Float16) * 1);
370   static _Float16 param1_init[] = {10.0f};
371   model->setOperandValue(param1, param1_init, sizeof(_Float16) * 1);
372   static _Float16 param2_init[] = {5.0f};
373   model->setOperandValue(param2, param2_init, sizeof(_Float16) * 1);
374   static _Float16 param3_init[] = {5.0f};
375   model->setOperandValue(param3, param3_init, sizeof(_Float16) * 1);
376   static bool8 param4_init[] = {true};
377   model->setOperandValue(param4, param4_init, sizeof(bool8) * 1);
378   static int32_t param5_init[] = {3};
379   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
380   static int32_t param6_init[] = {1};
381   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
382   static int32_t param7_init[] = {1};
383   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
384   static _Float16 param8_init[] = {0.0f};
385   model->setOperandValue(param8, param8_init, sizeof(_Float16) * 1);
386   static _Float16 param9_init[] = {0.5f};
387   model->setOperandValue(param9, param9_init, sizeof(_Float16) * 1);
388   static bool8 param10_init[] = {false};
389   model->setOperandValue(param10, param10_init, sizeof(bool8) * 1);
390   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores, roi, anchors, param, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10}, {scoresOut, roiOut, classesOut, detectionOut});
391   // Phase 3, inputs and outputs
392   model->identifyInputsAndOutputs(
393     {scores, roi, anchors},
394     {scoresOut, roiOut, classesOut, detectionOut});
395   assert(model->isValid());
396 }
397 
is_ignored_regular_dynamic_output_shape_float16(int i)398 inline bool is_ignored_regular_dynamic_output_shape_float16(int i) {
399   static std::set<int> ignore = {};
400   return ignore.find(i) != ignore.end();
401 }
402 
CreateModel(Model * model)403 void CreateModel(Model *model) {
404   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
405   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
406   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
407   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
408   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
409   OperandType type5(Type::TENSOR_INT32, {1, 3});
410   OperandType type6(Type::TENSOR_INT32, {1});
411   OperandType type7(Type::FLOAT32, {});
412   OperandType type8(Type::BOOL, {});
413   OperandType type9(Type::INT32, {});
414   // Phase 1, operands
415   auto scores1 = model->addOperand(&type0);
416   auto roi1 = model->addOperand(&type1);
417   auto anchors1 = model->addOperand(&type2);
418   auto param11 = model->addOperand(&type7);
419   auto param12 = model->addOperand(&type7);
420   auto param13 = model->addOperand(&type7);
421   auto param14 = model->addOperand(&type7);
422   auto param15 = model->addOperand(&type8);
423   auto param16 = model->addOperand(&type9);
424   auto param17 = model->addOperand(&type9);
425   auto param18 = model->addOperand(&type9);
426   auto param19 = model->addOperand(&type7);
427   auto param20 = model->addOperand(&type7);
428   auto param21 = model->addOperand(&type8);
429   auto scoresOut1 = model->addOperand(&type3);
430   auto roiOut1 = model->addOperand(&type4);
431   auto classesOut1 = model->addOperand(&type5);
432   auto detectionOut1 = model->addOperand(&type6);
433   // Phase 2, operations
434   static float param11_init[] = {10.0f};
435   model->setOperandValue(param11, param11_init, sizeof(float) * 1);
436   static float param12_init[] = {10.0f};
437   model->setOperandValue(param12, param12_init, sizeof(float) * 1);
438   static float param13_init[] = {5.0f};
439   model->setOperandValue(param13, param13_init, sizeof(float) * 1);
440   static float param14_init[] = {5.0f};
441   model->setOperandValue(param14, param14_init, sizeof(float) * 1);
442   static bool8 param15_init[] = {false};
443   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
444   static int32_t param16_init[] = {3};
445   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
446   static int32_t param17_init[] = {1};
447   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
448   static int32_t param18_init[] = {1};
449   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
450   static float param19_init[] = {0.0f};
451   model->setOperandValue(param19, param19_init, sizeof(float) * 1);
452   static float param20_init[] = {0.5f};
453   model->setOperandValue(param20, param20_init, sizeof(float) * 1);
454   static bool8 param21_init[] = {false};
455   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
456   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
457   // Phase 3, inputs and outputs
458   model->identifyInputsAndOutputs(
459     {scores1, roi1, anchors1},
460     {scoresOut1, roiOut1, classesOut1, detectionOut1});
461   assert(model->isValid());
462 }
463 
is_ignored(int i)464 inline bool is_ignored(int i) {
465   static std::set<int> ignore = {};
466   return ignore.find(i) != ignore.end();
467 }
468 
CreateModel_relaxed(Model * model)469 void CreateModel_relaxed(Model *model) {
470   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
471   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
472   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
473   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
474   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
475   OperandType type5(Type::TENSOR_INT32, {1, 3});
476   OperandType type6(Type::TENSOR_INT32, {1});
477   OperandType type7(Type::FLOAT32, {});
478   OperandType type8(Type::BOOL, {});
479   OperandType type9(Type::INT32, {});
480   // Phase 1, operands
481   auto scores1 = model->addOperand(&type0);
482   auto roi1 = model->addOperand(&type1);
483   auto anchors1 = model->addOperand(&type2);
484   auto param11 = model->addOperand(&type7);
485   auto param12 = model->addOperand(&type7);
486   auto param13 = model->addOperand(&type7);
487   auto param14 = model->addOperand(&type7);
488   auto param15 = model->addOperand(&type8);
489   auto param16 = model->addOperand(&type9);
490   auto param17 = model->addOperand(&type9);
491   auto param18 = model->addOperand(&type9);
492   auto param19 = model->addOperand(&type7);
493   auto param20 = model->addOperand(&type7);
494   auto param21 = model->addOperand(&type8);
495   auto scoresOut1 = model->addOperand(&type3);
496   auto roiOut1 = model->addOperand(&type4);
497   auto classesOut1 = model->addOperand(&type5);
498   auto detectionOut1 = model->addOperand(&type6);
499   // Phase 2, operations
500   static float param11_init[] = {10.0f};
501   model->setOperandValue(param11, param11_init, sizeof(float) * 1);
502   static float param12_init[] = {10.0f};
503   model->setOperandValue(param12, param12_init, sizeof(float) * 1);
504   static float param13_init[] = {5.0f};
505   model->setOperandValue(param13, param13_init, sizeof(float) * 1);
506   static float param14_init[] = {5.0f};
507   model->setOperandValue(param14, param14_init, sizeof(float) * 1);
508   static bool8 param15_init[] = {false};
509   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
510   static int32_t param16_init[] = {3};
511   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
512   static int32_t param17_init[] = {1};
513   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
514   static int32_t param18_init[] = {1};
515   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
516   static float param19_init[] = {0.0f};
517   model->setOperandValue(param19, param19_init, sizeof(float) * 1);
518   static float param20_init[] = {0.5f};
519   model->setOperandValue(param20, param20_init, sizeof(float) * 1);
520   static bool8 param21_init[] = {false};
521   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
522   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
523   // Phase 3, inputs and outputs
524   model->identifyInputsAndOutputs(
525     {scores1, roi1, anchors1},
526     {scoresOut1, roiOut1, classesOut1, detectionOut1});
527   // Phase 4: set relaxed execution
528   model->relaxComputationFloat32toFloat16(true);
529   assert(model->isValid());
530 }
531 
is_ignored_relaxed(int i)532 inline bool is_ignored_relaxed(int i) {
533   static std::set<int> ignore = {};
534   return ignore.find(i) != ignore.end();
535 }
536 
CreateModel_float16(Model * model)537 void CreateModel_float16(Model *model) {
538   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
539   OperandType type12(Type::FLOAT16, {});
540   OperandType type13(Type::TENSOR_FLOAT16, {1, 6, 4});
541   OperandType type14(Type::TENSOR_FLOAT16, {1, 3, 4});
542   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
543   OperandType type16(Type::TENSOR_FLOAT16, {1, 3});
544   OperandType type5(Type::TENSOR_INT32, {1, 3});
545   OperandType type6(Type::TENSOR_INT32, {1});
546   OperandType type8(Type::BOOL, {});
547   OperandType type9(Type::INT32, {});
548   // Phase 1, operands
549   auto scores1 = model->addOperand(&type15);
550   auto roi1 = model->addOperand(&type13);
551   auto anchors1 = model->addOperand(&type11);
552   auto param11 = model->addOperand(&type12);
553   auto param12 = model->addOperand(&type12);
554   auto param13 = model->addOperand(&type12);
555   auto param14 = model->addOperand(&type12);
556   auto param15 = model->addOperand(&type8);
557   auto param16 = model->addOperand(&type9);
558   auto param17 = model->addOperand(&type9);
559   auto param18 = model->addOperand(&type9);
560   auto param19 = model->addOperand(&type12);
561   auto param20 = model->addOperand(&type12);
562   auto param21 = model->addOperand(&type8);
563   auto scoresOut1 = model->addOperand(&type16);
564   auto roiOut1 = model->addOperand(&type14);
565   auto classesOut1 = model->addOperand(&type5);
566   auto detectionOut1 = model->addOperand(&type6);
567   // Phase 2, operations
568   static _Float16 param11_init[] = {10.0f};
569   model->setOperandValue(param11, param11_init, sizeof(_Float16) * 1);
570   static _Float16 param12_init[] = {10.0f};
571   model->setOperandValue(param12, param12_init, sizeof(_Float16) * 1);
572   static _Float16 param13_init[] = {5.0f};
573   model->setOperandValue(param13, param13_init, sizeof(_Float16) * 1);
574   static _Float16 param14_init[] = {5.0f};
575   model->setOperandValue(param14, param14_init, sizeof(_Float16) * 1);
576   static bool8 param15_init[] = {false};
577   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
578   static int32_t param16_init[] = {3};
579   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
580   static int32_t param17_init[] = {1};
581   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
582   static int32_t param18_init[] = {1};
583   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
584   static _Float16 param19_init[] = {0.0f};
585   model->setOperandValue(param19, param19_init, sizeof(_Float16) * 1);
586   static _Float16 param20_init[] = {0.5f};
587   model->setOperandValue(param20, param20_init, sizeof(_Float16) * 1);
588   static bool8 param21_init[] = {false};
589   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
590   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
591   // Phase 3, inputs and outputs
592   model->identifyInputsAndOutputs(
593     {scores1, roi1, anchors1},
594     {scoresOut1, roiOut1, classesOut1, detectionOut1});
595   assert(model->isValid());
596 }
597 
is_ignored_float16(int i)598 inline bool is_ignored_float16(int i) {
599   static std::set<int> ignore = {};
600   return ignore.find(i) != ignore.end();
601 }
602 
CreateModel_dynamic_output_shape(Model * model)603 void CreateModel_dynamic_output_shape(Model *model) {
604   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
605   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
606   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
607   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
608   OperandType type19(Type::TENSOR_INT32, {0, 0});
609   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
610   OperandType type20(Type::TENSOR_INT32, {0});
611   OperandType type7(Type::FLOAT32, {});
612   OperandType type8(Type::BOOL, {});
613   OperandType type9(Type::INT32, {});
614   // Phase 1, operands
615   auto scores1 = model->addOperand(&type0);
616   auto roi1 = model->addOperand(&type1);
617   auto anchors1 = model->addOperand(&type2);
618   auto param11 = model->addOperand(&type7);
619   auto param12 = model->addOperand(&type7);
620   auto param13 = model->addOperand(&type7);
621   auto param14 = model->addOperand(&type7);
622   auto param15 = model->addOperand(&type8);
623   auto param16 = model->addOperand(&type9);
624   auto param17 = model->addOperand(&type9);
625   auto param18 = model->addOperand(&type9);
626   auto param19 = model->addOperand(&type7);
627   auto param20 = model->addOperand(&type7);
628   auto param21 = model->addOperand(&type8);
629   auto scoresOut1 = model->addOperand(&type17);
630   auto roiOut1 = model->addOperand(&type18);
631   auto classesOut1 = model->addOperand(&type19);
632   auto detectionOut1 = model->addOperand(&type20);
633   // Phase 2, operations
634   static float param11_init[] = {10.0f};
635   model->setOperandValue(param11, param11_init, sizeof(float) * 1);
636   static float param12_init[] = {10.0f};
637   model->setOperandValue(param12, param12_init, sizeof(float) * 1);
638   static float param13_init[] = {5.0f};
639   model->setOperandValue(param13, param13_init, sizeof(float) * 1);
640   static float param14_init[] = {5.0f};
641   model->setOperandValue(param14, param14_init, sizeof(float) * 1);
642   static bool8 param15_init[] = {false};
643   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
644   static int32_t param16_init[] = {3};
645   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
646   static int32_t param17_init[] = {1};
647   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
648   static int32_t param18_init[] = {1};
649   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
650   static float param19_init[] = {0.0f};
651   model->setOperandValue(param19, param19_init, sizeof(float) * 1);
652   static float param20_init[] = {0.5f};
653   model->setOperandValue(param20, param20_init, sizeof(float) * 1);
654   static bool8 param21_init[] = {false};
655   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
656   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
657   // Phase 3, inputs and outputs
658   model->identifyInputsAndOutputs(
659     {scores1, roi1, anchors1},
660     {scoresOut1, roiOut1, classesOut1, detectionOut1});
661   assert(model->isValid());
662 }
663 
is_ignored_dynamic_output_shape(int i)664 inline bool is_ignored_dynamic_output_shape(int i) {
665   static std::set<int> ignore = {};
666   return ignore.find(i) != ignore.end();
667 }
668 
CreateModel_dynamic_output_shape_relaxed(Model * model)669 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
670   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
671   OperandType type1(Type::TENSOR_FLOAT32, {1, 6, 4});
672   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
673   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
674   OperandType type19(Type::TENSOR_INT32, {0, 0});
675   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
676   OperandType type20(Type::TENSOR_INT32, {0});
677   OperandType type7(Type::FLOAT32, {});
678   OperandType type8(Type::BOOL, {});
679   OperandType type9(Type::INT32, {});
680   // Phase 1, operands
681   auto scores1 = model->addOperand(&type0);
682   auto roi1 = model->addOperand(&type1);
683   auto anchors1 = model->addOperand(&type2);
684   auto param11 = model->addOperand(&type7);
685   auto param12 = model->addOperand(&type7);
686   auto param13 = model->addOperand(&type7);
687   auto param14 = model->addOperand(&type7);
688   auto param15 = model->addOperand(&type8);
689   auto param16 = model->addOperand(&type9);
690   auto param17 = model->addOperand(&type9);
691   auto param18 = model->addOperand(&type9);
692   auto param19 = model->addOperand(&type7);
693   auto param20 = model->addOperand(&type7);
694   auto param21 = model->addOperand(&type8);
695   auto scoresOut1 = model->addOperand(&type17);
696   auto roiOut1 = model->addOperand(&type18);
697   auto classesOut1 = model->addOperand(&type19);
698   auto detectionOut1 = model->addOperand(&type20);
699   // Phase 2, operations
700   static float param11_init[] = {10.0f};
701   model->setOperandValue(param11, param11_init, sizeof(float) * 1);
702   static float param12_init[] = {10.0f};
703   model->setOperandValue(param12, param12_init, sizeof(float) * 1);
704   static float param13_init[] = {5.0f};
705   model->setOperandValue(param13, param13_init, sizeof(float) * 1);
706   static float param14_init[] = {5.0f};
707   model->setOperandValue(param14, param14_init, sizeof(float) * 1);
708   static bool8 param15_init[] = {false};
709   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
710   static int32_t param16_init[] = {3};
711   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
712   static int32_t param17_init[] = {1};
713   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
714   static int32_t param18_init[] = {1};
715   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
716   static float param19_init[] = {0.0f};
717   model->setOperandValue(param19, param19_init, sizeof(float) * 1);
718   static float param20_init[] = {0.5f};
719   model->setOperandValue(param20, param20_init, sizeof(float) * 1);
720   static bool8 param21_init[] = {false};
721   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
722   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
723   // Phase 3, inputs and outputs
724   model->identifyInputsAndOutputs(
725     {scores1, roi1, anchors1},
726     {scoresOut1, roiOut1, classesOut1, detectionOut1});
727   // Phase 4: set relaxed execution
728   model->relaxComputationFloat32toFloat16(true);
729   assert(model->isValid());
730 }
731 
is_ignored_dynamic_output_shape_relaxed(int i)732 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
733   static std::set<int> ignore = {};
734   return ignore.find(i) != ignore.end();
735 }
736 
CreateModel_dynamic_output_shape_float16(Model * model)737 void CreateModel_dynamic_output_shape_float16(Model *model) {
738   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
739   OperandType type12(Type::FLOAT16, {});
740   OperandType type13(Type::TENSOR_FLOAT16, {1, 6, 4});
741   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
742   OperandType type19(Type::TENSOR_INT32, {0, 0});
743   OperandType type20(Type::TENSOR_INT32, {0});
744   OperandType type21(Type::TENSOR_FLOAT16, {0, 0});
745   OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
746   OperandType type8(Type::BOOL, {});
747   OperandType type9(Type::INT32, {});
748   // Phase 1, operands
749   auto scores1 = model->addOperand(&type15);
750   auto roi1 = model->addOperand(&type13);
751   auto anchors1 = model->addOperand(&type11);
752   auto param11 = model->addOperand(&type12);
753   auto param12 = model->addOperand(&type12);
754   auto param13 = model->addOperand(&type12);
755   auto param14 = model->addOperand(&type12);
756   auto param15 = model->addOperand(&type8);
757   auto param16 = model->addOperand(&type9);
758   auto param17 = model->addOperand(&type9);
759   auto param18 = model->addOperand(&type9);
760   auto param19 = model->addOperand(&type12);
761   auto param20 = model->addOperand(&type12);
762   auto param21 = model->addOperand(&type8);
763   auto scoresOut1 = model->addOperand(&type21);
764   auto roiOut1 = model->addOperand(&type22);
765   auto classesOut1 = model->addOperand(&type19);
766   auto detectionOut1 = model->addOperand(&type20);
767   // Phase 2, operations
768   static _Float16 param11_init[] = {10.0f};
769   model->setOperandValue(param11, param11_init, sizeof(_Float16) * 1);
770   static _Float16 param12_init[] = {10.0f};
771   model->setOperandValue(param12, param12_init, sizeof(_Float16) * 1);
772   static _Float16 param13_init[] = {5.0f};
773   model->setOperandValue(param13, param13_init, sizeof(_Float16) * 1);
774   static _Float16 param14_init[] = {5.0f};
775   model->setOperandValue(param14, param14_init, sizeof(_Float16) * 1);
776   static bool8 param15_init[] = {false};
777   model->setOperandValue(param15, param15_init, sizeof(bool8) * 1);
778   static int32_t param16_init[] = {3};
779   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
780   static int32_t param17_init[] = {1};
781   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
782   static int32_t param18_init[] = {1};
783   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
784   static _Float16 param19_init[] = {0.0f};
785   model->setOperandValue(param19, param19_init, sizeof(_Float16) * 1);
786   static _Float16 param20_init[] = {0.5f};
787   model->setOperandValue(param20, param20_init, sizeof(_Float16) * 1);
788   static bool8 param21_init[] = {false};
789   model->setOperandValue(param21, param21_init, sizeof(bool8) * 1);
790   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores1, roi1, anchors1, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21}, {scoresOut1, roiOut1, classesOut1, detectionOut1});
791   // Phase 3, inputs and outputs
792   model->identifyInputsAndOutputs(
793     {scores1, roi1, anchors1},
794     {scoresOut1, roiOut1, classesOut1, detectionOut1});
795   assert(model->isValid());
796 }
797 
is_ignored_dynamic_output_shape_float16(int i)798 inline bool is_ignored_dynamic_output_shape_float16(int i) {
799   static std::set<int> ignore = {};
800   return ignore.find(i) != ignore.end();
801 }
802 
CreateModel_2(Model * model)803 void CreateModel_2(Model *model) {
804   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
805   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
806   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
807   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
808   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
809   OperandType type5(Type::TENSOR_INT32, {1, 3});
810   OperandType type6(Type::TENSOR_INT32, {1});
811   OperandType type7(Type::FLOAT32, {});
812   OperandType type8(Type::BOOL, {});
813   OperandType type9(Type::INT32, {});
814   // Phase 1, operands
815   auto scores2 = model->addOperand(&type0);
816   auto roi2 = model->addOperand(&type10);
817   auto anchors2 = model->addOperand(&type2);
818   auto param22 = model->addOperand(&type7);
819   auto param23 = model->addOperand(&type7);
820   auto param24 = model->addOperand(&type7);
821   auto param25 = model->addOperand(&type7);
822   auto param26 = model->addOperand(&type8);
823   auto param27 = model->addOperand(&type9);
824   auto param28 = model->addOperand(&type9);
825   auto param29 = model->addOperand(&type9);
826   auto param30 = model->addOperand(&type7);
827   auto param31 = model->addOperand(&type7);
828   auto param32 = model->addOperand(&type8);
829   auto scoresOut2 = model->addOperand(&type3);
830   auto roiOut2 = model->addOperand(&type4);
831   auto classesOut2 = model->addOperand(&type5);
832   auto detectionOut2 = model->addOperand(&type6);
833   // Phase 2, operations
834   static float param22_init[] = {10.0f};
835   model->setOperandValue(param22, param22_init, sizeof(float) * 1);
836   static float param23_init[] = {10.0f};
837   model->setOperandValue(param23, param23_init, sizeof(float) * 1);
838   static float param24_init[] = {5.0f};
839   model->setOperandValue(param24, param24_init, sizeof(float) * 1);
840   static float param25_init[] = {5.0f};
841   model->setOperandValue(param25, param25_init, sizeof(float) * 1);
842   static bool8 param26_init[] = {false};
843   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
844   static int32_t param27_init[] = {3};
845   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
846   static int32_t param28_init[] = {1};
847   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
848   static int32_t param29_init[] = {1};
849   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
850   static float param30_init[] = {0.0f};
851   model->setOperandValue(param30, param30_init, sizeof(float) * 1);
852   static float param31_init[] = {0.5f};
853   model->setOperandValue(param31, param31_init, sizeof(float) * 1);
854   static bool8 param32_init[] = {false};
855   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
856   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
857   // Phase 3, inputs and outputs
858   model->identifyInputsAndOutputs(
859     {scores2, roi2, anchors2},
860     {scoresOut2, roiOut2, classesOut2, detectionOut2});
861   assert(model->isValid());
862 }
863 
is_ignored_2(int i)864 inline bool is_ignored_2(int i) {
865   static std::set<int> ignore = {};
866   return ignore.find(i) != ignore.end();
867 }
868 
CreateModel_relaxed_2(Model * model)869 void CreateModel_relaxed_2(Model *model) {
870   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
871   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
872   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
873   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
874   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
875   OperandType type5(Type::TENSOR_INT32, {1, 3});
876   OperandType type6(Type::TENSOR_INT32, {1});
877   OperandType type7(Type::FLOAT32, {});
878   OperandType type8(Type::BOOL, {});
879   OperandType type9(Type::INT32, {});
880   // Phase 1, operands
881   auto scores2 = model->addOperand(&type0);
882   auto roi2 = model->addOperand(&type10);
883   auto anchors2 = model->addOperand(&type2);
884   auto param22 = model->addOperand(&type7);
885   auto param23 = model->addOperand(&type7);
886   auto param24 = model->addOperand(&type7);
887   auto param25 = model->addOperand(&type7);
888   auto param26 = model->addOperand(&type8);
889   auto param27 = model->addOperand(&type9);
890   auto param28 = model->addOperand(&type9);
891   auto param29 = model->addOperand(&type9);
892   auto param30 = model->addOperand(&type7);
893   auto param31 = model->addOperand(&type7);
894   auto param32 = model->addOperand(&type8);
895   auto scoresOut2 = model->addOperand(&type3);
896   auto roiOut2 = model->addOperand(&type4);
897   auto classesOut2 = model->addOperand(&type5);
898   auto detectionOut2 = model->addOperand(&type6);
899   // Phase 2, operations
900   static float param22_init[] = {10.0f};
901   model->setOperandValue(param22, param22_init, sizeof(float) * 1);
902   static float param23_init[] = {10.0f};
903   model->setOperandValue(param23, param23_init, sizeof(float) * 1);
904   static float param24_init[] = {5.0f};
905   model->setOperandValue(param24, param24_init, sizeof(float) * 1);
906   static float param25_init[] = {5.0f};
907   model->setOperandValue(param25, param25_init, sizeof(float) * 1);
908   static bool8 param26_init[] = {false};
909   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
910   static int32_t param27_init[] = {3};
911   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
912   static int32_t param28_init[] = {1};
913   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
914   static int32_t param29_init[] = {1};
915   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
916   static float param30_init[] = {0.0f};
917   model->setOperandValue(param30, param30_init, sizeof(float) * 1);
918   static float param31_init[] = {0.5f};
919   model->setOperandValue(param31, param31_init, sizeof(float) * 1);
920   static bool8 param32_init[] = {false};
921   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
922   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
923   // Phase 3, inputs and outputs
924   model->identifyInputsAndOutputs(
925     {scores2, roi2, anchors2},
926     {scoresOut2, roiOut2, classesOut2, detectionOut2});
927   // Phase 4: set relaxed execution
928   model->relaxComputationFloat32toFloat16(true);
929   assert(model->isValid());
930 }
931 
is_ignored_relaxed_2(int i)932 inline bool is_ignored_relaxed_2(int i) {
933   static std::set<int> ignore = {};
934   return ignore.find(i) != ignore.end();
935 }
936 
CreateModel_float16_2(Model * model)937 void CreateModel_float16_2(Model *model) {
938   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
939   OperandType type12(Type::FLOAT16, {});
940   OperandType type14(Type::TENSOR_FLOAT16, {1, 3, 4});
941   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
942   OperandType type16(Type::TENSOR_FLOAT16, {1, 3});
943   OperandType type23(Type::TENSOR_FLOAT16, {1, 6, 7});
944   OperandType type5(Type::TENSOR_INT32, {1, 3});
945   OperandType type6(Type::TENSOR_INT32, {1});
946   OperandType type8(Type::BOOL, {});
947   OperandType type9(Type::INT32, {});
948   // Phase 1, operands
949   auto scores2 = model->addOperand(&type15);
950   auto roi2 = model->addOperand(&type23);
951   auto anchors2 = model->addOperand(&type11);
952   auto param22 = model->addOperand(&type12);
953   auto param23 = model->addOperand(&type12);
954   auto param24 = model->addOperand(&type12);
955   auto param25 = model->addOperand(&type12);
956   auto param26 = model->addOperand(&type8);
957   auto param27 = model->addOperand(&type9);
958   auto param28 = model->addOperand(&type9);
959   auto param29 = model->addOperand(&type9);
960   auto param30 = model->addOperand(&type12);
961   auto param31 = model->addOperand(&type12);
962   auto param32 = model->addOperand(&type8);
963   auto scoresOut2 = model->addOperand(&type16);
964   auto roiOut2 = model->addOperand(&type14);
965   auto classesOut2 = model->addOperand(&type5);
966   auto detectionOut2 = model->addOperand(&type6);
967   // Phase 2, operations
968   static _Float16 param22_init[] = {10.0f};
969   model->setOperandValue(param22, param22_init, sizeof(_Float16) * 1);
970   static _Float16 param23_init[] = {10.0f};
971   model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1);
972   static _Float16 param24_init[] = {5.0f};
973   model->setOperandValue(param24, param24_init, sizeof(_Float16) * 1);
974   static _Float16 param25_init[] = {5.0f};
975   model->setOperandValue(param25, param25_init, sizeof(_Float16) * 1);
976   static bool8 param26_init[] = {false};
977   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
978   static int32_t param27_init[] = {3};
979   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
980   static int32_t param28_init[] = {1};
981   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
982   static int32_t param29_init[] = {1};
983   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
984   static _Float16 param30_init[] = {0.0f};
985   model->setOperandValue(param30, param30_init, sizeof(_Float16) * 1);
986   static _Float16 param31_init[] = {0.5f};
987   model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1);
988   static bool8 param32_init[] = {false};
989   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
990   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
991   // Phase 3, inputs and outputs
992   model->identifyInputsAndOutputs(
993     {scores2, roi2, anchors2},
994     {scoresOut2, roiOut2, classesOut2, detectionOut2});
995   assert(model->isValid());
996 }
997 
is_ignored_float16_2(int i)998 inline bool is_ignored_float16_2(int i) {
999   static std::set<int> ignore = {};
1000   return ignore.find(i) != ignore.end();
1001 }
1002 
CreateModel_dynamic_output_shape_2(Model * model)1003 void CreateModel_dynamic_output_shape_2(Model *model) {
1004   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1005   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1006   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
1007   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
1008   OperandType type19(Type::TENSOR_INT32, {0, 0});
1009   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1010   OperandType type20(Type::TENSOR_INT32, {0});
1011   OperandType type7(Type::FLOAT32, {});
1012   OperandType type8(Type::BOOL, {});
1013   OperandType type9(Type::INT32, {});
1014   // Phase 1, operands
1015   auto scores2 = model->addOperand(&type0);
1016   auto roi2 = model->addOperand(&type10);
1017   auto anchors2 = model->addOperand(&type2);
1018   auto param22 = model->addOperand(&type7);
1019   auto param23 = model->addOperand(&type7);
1020   auto param24 = model->addOperand(&type7);
1021   auto param25 = model->addOperand(&type7);
1022   auto param26 = model->addOperand(&type8);
1023   auto param27 = model->addOperand(&type9);
1024   auto param28 = model->addOperand(&type9);
1025   auto param29 = model->addOperand(&type9);
1026   auto param30 = model->addOperand(&type7);
1027   auto param31 = model->addOperand(&type7);
1028   auto param32 = model->addOperand(&type8);
1029   auto scoresOut2 = model->addOperand(&type17);
1030   auto roiOut2 = model->addOperand(&type18);
1031   auto classesOut2 = model->addOperand(&type19);
1032   auto detectionOut2 = model->addOperand(&type20);
1033   // Phase 2, operations
1034   static float param22_init[] = {10.0f};
1035   model->setOperandValue(param22, param22_init, sizeof(float) * 1);
1036   static float param23_init[] = {10.0f};
1037   model->setOperandValue(param23, param23_init, sizeof(float) * 1);
1038   static float param24_init[] = {5.0f};
1039   model->setOperandValue(param24, param24_init, sizeof(float) * 1);
1040   static float param25_init[] = {5.0f};
1041   model->setOperandValue(param25, param25_init, sizeof(float) * 1);
1042   static bool8 param26_init[] = {false};
1043   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
1044   static int32_t param27_init[] = {3};
1045   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
1046   static int32_t param28_init[] = {1};
1047   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
1048   static int32_t param29_init[] = {1};
1049   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
1050   static float param30_init[] = {0.0f};
1051   model->setOperandValue(param30, param30_init, sizeof(float) * 1);
1052   static float param31_init[] = {0.5f};
1053   model->setOperandValue(param31, param31_init, sizeof(float) * 1);
1054   static bool8 param32_init[] = {false};
1055   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
1056   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
1057   // Phase 3, inputs and outputs
1058   model->identifyInputsAndOutputs(
1059     {scores2, roi2, anchors2},
1060     {scoresOut2, roiOut2, classesOut2, detectionOut2});
1061   assert(model->isValid());
1062 }
1063 
is_ignored_dynamic_output_shape_2(int i)1064 inline bool is_ignored_dynamic_output_shape_2(int i) {
1065   static std::set<int> ignore = {};
1066   return ignore.find(i) != ignore.end();
1067 }
1068 
CreateModel_dynamic_output_shape_relaxed_2(Model * model)1069 void CreateModel_dynamic_output_shape_relaxed_2(Model *model) {
1070   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1071   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1072   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
1073   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
1074   OperandType type19(Type::TENSOR_INT32, {0, 0});
1075   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1076   OperandType type20(Type::TENSOR_INT32, {0});
1077   OperandType type7(Type::FLOAT32, {});
1078   OperandType type8(Type::BOOL, {});
1079   OperandType type9(Type::INT32, {});
1080   // Phase 1, operands
1081   auto scores2 = model->addOperand(&type0);
1082   auto roi2 = model->addOperand(&type10);
1083   auto anchors2 = model->addOperand(&type2);
1084   auto param22 = model->addOperand(&type7);
1085   auto param23 = model->addOperand(&type7);
1086   auto param24 = model->addOperand(&type7);
1087   auto param25 = model->addOperand(&type7);
1088   auto param26 = model->addOperand(&type8);
1089   auto param27 = model->addOperand(&type9);
1090   auto param28 = model->addOperand(&type9);
1091   auto param29 = model->addOperand(&type9);
1092   auto param30 = model->addOperand(&type7);
1093   auto param31 = model->addOperand(&type7);
1094   auto param32 = model->addOperand(&type8);
1095   auto scoresOut2 = model->addOperand(&type17);
1096   auto roiOut2 = model->addOperand(&type18);
1097   auto classesOut2 = model->addOperand(&type19);
1098   auto detectionOut2 = model->addOperand(&type20);
1099   // Phase 2, operations
1100   static float param22_init[] = {10.0f};
1101   model->setOperandValue(param22, param22_init, sizeof(float) * 1);
1102   static float param23_init[] = {10.0f};
1103   model->setOperandValue(param23, param23_init, sizeof(float) * 1);
1104   static float param24_init[] = {5.0f};
1105   model->setOperandValue(param24, param24_init, sizeof(float) * 1);
1106   static float param25_init[] = {5.0f};
1107   model->setOperandValue(param25, param25_init, sizeof(float) * 1);
1108   static bool8 param26_init[] = {false};
1109   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
1110   static int32_t param27_init[] = {3};
1111   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
1112   static int32_t param28_init[] = {1};
1113   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
1114   static int32_t param29_init[] = {1};
1115   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
1116   static float param30_init[] = {0.0f};
1117   model->setOperandValue(param30, param30_init, sizeof(float) * 1);
1118   static float param31_init[] = {0.5f};
1119   model->setOperandValue(param31, param31_init, sizeof(float) * 1);
1120   static bool8 param32_init[] = {false};
1121   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
1122   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
1123   // Phase 3, inputs and outputs
1124   model->identifyInputsAndOutputs(
1125     {scores2, roi2, anchors2},
1126     {scoresOut2, roiOut2, classesOut2, detectionOut2});
1127   // Phase 4: set relaxed execution
1128   model->relaxComputationFloat32toFloat16(true);
1129   assert(model->isValid());
1130 }
1131 
is_ignored_dynamic_output_shape_relaxed_2(int i)1132 inline bool is_ignored_dynamic_output_shape_relaxed_2(int i) {
1133   static std::set<int> ignore = {};
1134   return ignore.find(i) != ignore.end();
1135 }
1136 
CreateModel_dynamic_output_shape_float16_2(Model * model)1137 void CreateModel_dynamic_output_shape_float16_2(Model *model) {
1138   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
1139   OperandType type12(Type::FLOAT16, {});
1140   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
1141   OperandType type19(Type::TENSOR_INT32, {0, 0});
1142   OperandType type20(Type::TENSOR_INT32, {0});
1143   OperandType type21(Type::TENSOR_FLOAT16, {0, 0});
1144   OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
1145   OperandType type23(Type::TENSOR_FLOAT16, {1, 6, 7});
1146   OperandType type8(Type::BOOL, {});
1147   OperandType type9(Type::INT32, {});
1148   // Phase 1, operands
1149   auto scores2 = model->addOperand(&type15);
1150   auto roi2 = model->addOperand(&type23);
1151   auto anchors2 = model->addOperand(&type11);
1152   auto param22 = model->addOperand(&type12);
1153   auto param23 = model->addOperand(&type12);
1154   auto param24 = model->addOperand(&type12);
1155   auto param25 = model->addOperand(&type12);
1156   auto param26 = model->addOperand(&type8);
1157   auto param27 = model->addOperand(&type9);
1158   auto param28 = model->addOperand(&type9);
1159   auto param29 = model->addOperand(&type9);
1160   auto param30 = model->addOperand(&type12);
1161   auto param31 = model->addOperand(&type12);
1162   auto param32 = model->addOperand(&type8);
1163   auto scoresOut2 = model->addOperand(&type21);
1164   auto roiOut2 = model->addOperand(&type22);
1165   auto classesOut2 = model->addOperand(&type19);
1166   auto detectionOut2 = model->addOperand(&type20);
1167   // Phase 2, operations
1168   static _Float16 param22_init[] = {10.0f};
1169   model->setOperandValue(param22, param22_init, sizeof(_Float16) * 1);
1170   static _Float16 param23_init[] = {10.0f};
1171   model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1);
1172   static _Float16 param24_init[] = {5.0f};
1173   model->setOperandValue(param24, param24_init, sizeof(_Float16) * 1);
1174   static _Float16 param25_init[] = {5.0f};
1175   model->setOperandValue(param25, param25_init, sizeof(_Float16) * 1);
1176   static bool8 param26_init[] = {false};
1177   model->setOperandValue(param26, param26_init, sizeof(bool8) * 1);
1178   static int32_t param27_init[] = {3};
1179   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
1180   static int32_t param28_init[] = {1};
1181   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
1182   static int32_t param29_init[] = {1};
1183   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
1184   static _Float16 param30_init[] = {0.0f};
1185   model->setOperandValue(param30, param30_init, sizeof(_Float16) * 1);
1186   static _Float16 param31_init[] = {0.5f};
1187   model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1);
1188   static bool8 param32_init[] = {false};
1189   model->setOperandValue(param32, param32_init, sizeof(bool8) * 1);
1190   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores2, roi2, anchors2, param22, param23, param24, param25, param26, param27, param28, param29, param30, param31, param32}, {scoresOut2, roiOut2, classesOut2, detectionOut2});
1191   // Phase 3, inputs and outputs
1192   model->identifyInputsAndOutputs(
1193     {scores2, roi2, anchors2},
1194     {scoresOut2, roiOut2, classesOut2, detectionOut2});
1195   assert(model->isValid());
1196 }
1197 
is_ignored_dynamic_output_shape_float16_2(int i)1198 inline bool is_ignored_dynamic_output_shape_float16_2(int i) {
1199   static std::set<int> ignore = {};
1200   return ignore.find(i) != ignore.end();
1201 }
1202 
CreateModel_3(Model * model)1203 void CreateModel_3(Model *model) {
1204   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1205   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1206   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1207   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
1208   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
1209   OperandType type5(Type::TENSOR_INT32, {1, 3});
1210   OperandType type6(Type::TENSOR_INT32, {1});
1211   OperandType type7(Type::FLOAT32, {});
1212   OperandType type8(Type::BOOL, {});
1213   OperandType type9(Type::INT32, {});
1214   // Phase 1, operands
1215   auto scores3 = model->addOperand(&type0);
1216   auto roi3 = model->addOperand(&type10);
1217   auto anchors3 = model->addOperand(&type2);
1218   auto param33 = model->addOperand(&type7);
1219   auto param34 = model->addOperand(&type7);
1220   auto param35 = model->addOperand(&type7);
1221   auto param36 = model->addOperand(&type7);
1222   auto param37 = model->addOperand(&type8);
1223   auto param38 = model->addOperand(&type9);
1224   auto param39 = model->addOperand(&type9);
1225   auto param40 = model->addOperand(&type9);
1226   auto param41 = model->addOperand(&type7);
1227   auto param42 = model->addOperand(&type7);
1228   auto param43 = model->addOperand(&type8);
1229   auto scoresOut3 = model->addOperand(&type3);
1230   auto roiOut3 = model->addOperand(&type4);
1231   auto classesOut3 = model->addOperand(&type5);
1232   auto detectionOut3 = model->addOperand(&type6);
1233   // Phase 2, operations
1234   static float param33_init[] = {10.0f};
1235   model->setOperandValue(param33, param33_init, sizeof(float) * 1);
1236   static float param34_init[] = {10.0f};
1237   model->setOperandValue(param34, param34_init, sizeof(float) * 1);
1238   static float param35_init[] = {5.0f};
1239   model->setOperandValue(param35, param35_init, sizeof(float) * 1);
1240   static float param36_init[] = {5.0f};
1241   model->setOperandValue(param36, param36_init, sizeof(float) * 1);
1242   static bool8 param37_init[] = {false};
1243   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1244   static int32_t param38_init[] = {3};
1245   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1246   static int32_t param39_init[] = {1};
1247   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1248   static int32_t param40_init[] = {1};
1249   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1250   static float param41_init[] = {0.0f};
1251   model->setOperandValue(param41, param41_init, sizeof(float) * 1);
1252   static float param42_init[] = {0.5f};
1253   model->setOperandValue(param42, param42_init, sizeof(float) * 1);
1254   static bool8 param43_init[] = {true};
1255   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1256   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1257   // Phase 3, inputs and outputs
1258   model->identifyInputsAndOutputs(
1259     {scores3, roi3, anchors3},
1260     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1261   assert(model->isValid());
1262 }
1263 
is_ignored_3(int i)1264 inline bool is_ignored_3(int i) {
1265   static std::set<int> ignore = {};
1266   return ignore.find(i) != ignore.end();
1267 }
1268 
CreateModel_relaxed_3(Model * model)1269 void CreateModel_relaxed_3(Model *model) {
1270   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1271   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1272   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1273   OperandType type3(Type::TENSOR_FLOAT32, {1, 3});
1274   OperandType type4(Type::TENSOR_FLOAT32, {1, 3, 4});
1275   OperandType type5(Type::TENSOR_INT32, {1, 3});
1276   OperandType type6(Type::TENSOR_INT32, {1});
1277   OperandType type7(Type::FLOAT32, {});
1278   OperandType type8(Type::BOOL, {});
1279   OperandType type9(Type::INT32, {});
1280   // Phase 1, operands
1281   auto scores3 = model->addOperand(&type0);
1282   auto roi3 = model->addOperand(&type10);
1283   auto anchors3 = model->addOperand(&type2);
1284   auto param33 = model->addOperand(&type7);
1285   auto param34 = model->addOperand(&type7);
1286   auto param35 = model->addOperand(&type7);
1287   auto param36 = model->addOperand(&type7);
1288   auto param37 = model->addOperand(&type8);
1289   auto param38 = model->addOperand(&type9);
1290   auto param39 = model->addOperand(&type9);
1291   auto param40 = model->addOperand(&type9);
1292   auto param41 = model->addOperand(&type7);
1293   auto param42 = model->addOperand(&type7);
1294   auto param43 = model->addOperand(&type8);
1295   auto scoresOut3 = model->addOperand(&type3);
1296   auto roiOut3 = model->addOperand(&type4);
1297   auto classesOut3 = model->addOperand(&type5);
1298   auto detectionOut3 = model->addOperand(&type6);
1299   // Phase 2, operations
1300   static float param33_init[] = {10.0f};
1301   model->setOperandValue(param33, param33_init, sizeof(float) * 1);
1302   static float param34_init[] = {10.0f};
1303   model->setOperandValue(param34, param34_init, sizeof(float) * 1);
1304   static float param35_init[] = {5.0f};
1305   model->setOperandValue(param35, param35_init, sizeof(float) * 1);
1306   static float param36_init[] = {5.0f};
1307   model->setOperandValue(param36, param36_init, sizeof(float) * 1);
1308   static bool8 param37_init[] = {false};
1309   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1310   static int32_t param38_init[] = {3};
1311   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1312   static int32_t param39_init[] = {1};
1313   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1314   static int32_t param40_init[] = {1};
1315   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1316   static float param41_init[] = {0.0f};
1317   model->setOperandValue(param41, param41_init, sizeof(float) * 1);
1318   static float param42_init[] = {0.5f};
1319   model->setOperandValue(param42, param42_init, sizeof(float) * 1);
1320   static bool8 param43_init[] = {true};
1321   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1322   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1323   // Phase 3, inputs and outputs
1324   model->identifyInputsAndOutputs(
1325     {scores3, roi3, anchors3},
1326     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1327   // Phase 4: set relaxed execution
1328   model->relaxComputationFloat32toFloat16(true);
1329   assert(model->isValid());
1330 }
1331 
is_ignored_relaxed_3(int i)1332 inline bool is_ignored_relaxed_3(int i) {
1333   static std::set<int> ignore = {};
1334   return ignore.find(i) != ignore.end();
1335 }
1336 
CreateModel_float16_3(Model * model)1337 void CreateModel_float16_3(Model *model) {
1338   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
1339   OperandType type12(Type::FLOAT16, {});
1340   OperandType type14(Type::TENSOR_FLOAT16, {1, 3, 4});
1341   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
1342   OperandType type16(Type::TENSOR_FLOAT16, {1, 3});
1343   OperandType type23(Type::TENSOR_FLOAT16, {1, 6, 7});
1344   OperandType type5(Type::TENSOR_INT32, {1, 3});
1345   OperandType type6(Type::TENSOR_INT32, {1});
1346   OperandType type8(Type::BOOL, {});
1347   OperandType type9(Type::INT32, {});
1348   // Phase 1, operands
1349   auto scores3 = model->addOperand(&type15);
1350   auto roi3 = model->addOperand(&type23);
1351   auto anchors3 = model->addOperand(&type11);
1352   auto param33 = model->addOperand(&type12);
1353   auto param34 = model->addOperand(&type12);
1354   auto param35 = model->addOperand(&type12);
1355   auto param36 = model->addOperand(&type12);
1356   auto param37 = model->addOperand(&type8);
1357   auto param38 = model->addOperand(&type9);
1358   auto param39 = model->addOperand(&type9);
1359   auto param40 = model->addOperand(&type9);
1360   auto param41 = model->addOperand(&type12);
1361   auto param42 = model->addOperand(&type12);
1362   auto param43 = model->addOperand(&type8);
1363   auto scoresOut3 = model->addOperand(&type16);
1364   auto roiOut3 = model->addOperand(&type14);
1365   auto classesOut3 = model->addOperand(&type5);
1366   auto detectionOut3 = model->addOperand(&type6);
1367   // Phase 2, operations
1368   static _Float16 param33_init[] = {10.0f};
1369   model->setOperandValue(param33, param33_init, sizeof(_Float16) * 1);
1370   static _Float16 param34_init[] = {10.0f};
1371   model->setOperandValue(param34, param34_init, sizeof(_Float16) * 1);
1372   static _Float16 param35_init[] = {5.0f};
1373   model->setOperandValue(param35, param35_init, sizeof(_Float16) * 1);
1374   static _Float16 param36_init[] = {5.0f};
1375   model->setOperandValue(param36, param36_init, sizeof(_Float16) * 1);
1376   static bool8 param37_init[] = {false};
1377   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1378   static int32_t param38_init[] = {3};
1379   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1380   static int32_t param39_init[] = {1};
1381   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1382   static int32_t param40_init[] = {1};
1383   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1384   static _Float16 param41_init[] = {0.0f};
1385   model->setOperandValue(param41, param41_init, sizeof(_Float16) * 1);
1386   static _Float16 param42_init[] = {0.5f};
1387   model->setOperandValue(param42, param42_init, sizeof(_Float16) * 1);
1388   static bool8 param43_init[] = {true};
1389   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1390   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1391   // Phase 3, inputs and outputs
1392   model->identifyInputsAndOutputs(
1393     {scores3, roi3, anchors3},
1394     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1395   assert(model->isValid());
1396 }
1397 
is_ignored_float16_3(int i)1398 inline bool is_ignored_float16_3(int i) {
1399   static std::set<int> ignore = {};
1400   return ignore.find(i) != ignore.end();
1401 }
1402 
CreateModel_dynamic_output_shape_3(Model * model)1403 void CreateModel_dynamic_output_shape_3(Model *model) {
1404   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1405   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1406   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
1407   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
1408   OperandType type19(Type::TENSOR_INT32, {0, 0});
1409   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1410   OperandType type20(Type::TENSOR_INT32, {0});
1411   OperandType type7(Type::FLOAT32, {});
1412   OperandType type8(Type::BOOL, {});
1413   OperandType type9(Type::INT32, {});
1414   // Phase 1, operands
1415   auto scores3 = model->addOperand(&type0);
1416   auto roi3 = model->addOperand(&type10);
1417   auto anchors3 = model->addOperand(&type2);
1418   auto param33 = model->addOperand(&type7);
1419   auto param34 = model->addOperand(&type7);
1420   auto param35 = model->addOperand(&type7);
1421   auto param36 = model->addOperand(&type7);
1422   auto param37 = model->addOperand(&type8);
1423   auto param38 = model->addOperand(&type9);
1424   auto param39 = model->addOperand(&type9);
1425   auto param40 = model->addOperand(&type9);
1426   auto param41 = model->addOperand(&type7);
1427   auto param42 = model->addOperand(&type7);
1428   auto param43 = model->addOperand(&type8);
1429   auto scoresOut3 = model->addOperand(&type17);
1430   auto roiOut3 = model->addOperand(&type18);
1431   auto classesOut3 = model->addOperand(&type19);
1432   auto detectionOut3 = model->addOperand(&type20);
1433   // Phase 2, operations
1434   static float param33_init[] = {10.0f};
1435   model->setOperandValue(param33, param33_init, sizeof(float) * 1);
1436   static float param34_init[] = {10.0f};
1437   model->setOperandValue(param34, param34_init, sizeof(float) * 1);
1438   static float param35_init[] = {5.0f};
1439   model->setOperandValue(param35, param35_init, sizeof(float) * 1);
1440   static float param36_init[] = {5.0f};
1441   model->setOperandValue(param36, param36_init, sizeof(float) * 1);
1442   static bool8 param37_init[] = {false};
1443   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1444   static int32_t param38_init[] = {3};
1445   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1446   static int32_t param39_init[] = {1};
1447   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1448   static int32_t param40_init[] = {1};
1449   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1450   static float param41_init[] = {0.0f};
1451   model->setOperandValue(param41, param41_init, sizeof(float) * 1);
1452   static float param42_init[] = {0.5f};
1453   model->setOperandValue(param42, param42_init, sizeof(float) * 1);
1454   static bool8 param43_init[] = {true};
1455   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1456   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1457   // Phase 3, inputs and outputs
1458   model->identifyInputsAndOutputs(
1459     {scores3, roi3, anchors3},
1460     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1461   assert(model->isValid());
1462 }
1463 
is_ignored_dynamic_output_shape_3(int i)1464 inline bool is_ignored_dynamic_output_shape_3(int i) {
1465   static std::set<int> ignore = {};
1466   return ignore.find(i) != ignore.end();
1467 }
1468 
CreateModel_dynamic_output_shape_relaxed_3(Model * model)1469 void CreateModel_dynamic_output_shape_relaxed_3(Model *model) {
1470   OperandType type0(Type::TENSOR_FLOAT32, {1, 6, 3});
1471   OperandType type10(Type::TENSOR_FLOAT32, {1, 6, 7});
1472   OperandType type17(Type::TENSOR_FLOAT32, {0, 0});
1473   OperandType type18(Type::TENSOR_FLOAT32, {0, 0, 0});
1474   OperandType type19(Type::TENSOR_INT32, {0, 0});
1475   OperandType type2(Type::TENSOR_FLOAT32, {6, 4});
1476   OperandType type20(Type::TENSOR_INT32, {0});
1477   OperandType type7(Type::FLOAT32, {});
1478   OperandType type8(Type::BOOL, {});
1479   OperandType type9(Type::INT32, {});
1480   // Phase 1, operands
1481   auto scores3 = model->addOperand(&type0);
1482   auto roi3 = model->addOperand(&type10);
1483   auto anchors3 = model->addOperand(&type2);
1484   auto param33 = model->addOperand(&type7);
1485   auto param34 = model->addOperand(&type7);
1486   auto param35 = model->addOperand(&type7);
1487   auto param36 = model->addOperand(&type7);
1488   auto param37 = model->addOperand(&type8);
1489   auto param38 = model->addOperand(&type9);
1490   auto param39 = model->addOperand(&type9);
1491   auto param40 = model->addOperand(&type9);
1492   auto param41 = model->addOperand(&type7);
1493   auto param42 = model->addOperand(&type7);
1494   auto param43 = model->addOperand(&type8);
1495   auto scoresOut3 = model->addOperand(&type17);
1496   auto roiOut3 = model->addOperand(&type18);
1497   auto classesOut3 = model->addOperand(&type19);
1498   auto detectionOut3 = model->addOperand(&type20);
1499   // Phase 2, operations
1500   static float param33_init[] = {10.0f};
1501   model->setOperandValue(param33, param33_init, sizeof(float) * 1);
1502   static float param34_init[] = {10.0f};
1503   model->setOperandValue(param34, param34_init, sizeof(float) * 1);
1504   static float param35_init[] = {5.0f};
1505   model->setOperandValue(param35, param35_init, sizeof(float) * 1);
1506   static float param36_init[] = {5.0f};
1507   model->setOperandValue(param36, param36_init, sizeof(float) * 1);
1508   static bool8 param37_init[] = {false};
1509   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1510   static int32_t param38_init[] = {3};
1511   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1512   static int32_t param39_init[] = {1};
1513   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1514   static int32_t param40_init[] = {1};
1515   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1516   static float param41_init[] = {0.0f};
1517   model->setOperandValue(param41, param41_init, sizeof(float) * 1);
1518   static float param42_init[] = {0.5f};
1519   model->setOperandValue(param42, param42_init, sizeof(float) * 1);
1520   static bool8 param43_init[] = {true};
1521   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1522   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1523   // Phase 3, inputs and outputs
1524   model->identifyInputsAndOutputs(
1525     {scores3, roi3, anchors3},
1526     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1527   // Phase 4: set relaxed execution
1528   model->relaxComputationFloat32toFloat16(true);
1529   assert(model->isValid());
1530 }
1531 
is_ignored_dynamic_output_shape_relaxed_3(int i)1532 inline bool is_ignored_dynamic_output_shape_relaxed_3(int i) {
1533   static std::set<int> ignore = {};
1534   return ignore.find(i) != ignore.end();
1535 }
1536 
CreateModel_dynamic_output_shape_float16_3(Model * model)1537 void CreateModel_dynamic_output_shape_float16_3(Model *model) {
1538   OperandType type11(Type::TENSOR_FLOAT16, {6, 4});
1539   OperandType type12(Type::FLOAT16, {});
1540   OperandType type15(Type::TENSOR_FLOAT16, {1, 6, 3});
1541   OperandType type19(Type::TENSOR_INT32, {0, 0});
1542   OperandType type20(Type::TENSOR_INT32, {0});
1543   OperandType type21(Type::TENSOR_FLOAT16, {0, 0});
1544   OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
1545   OperandType type23(Type::TENSOR_FLOAT16, {1, 6, 7});
1546   OperandType type8(Type::BOOL, {});
1547   OperandType type9(Type::INT32, {});
1548   // Phase 1, operands
1549   auto scores3 = model->addOperand(&type15);
1550   auto roi3 = model->addOperand(&type23);
1551   auto anchors3 = model->addOperand(&type11);
1552   auto param33 = model->addOperand(&type12);
1553   auto param34 = model->addOperand(&type12);
1554   auto param35 = model->addOperand(&type12);
1555   auto param36 = model->addOperand(&type12);
1556   auto param37 = model->addOperand(&type8);
1557   auto param38 = model->addOperand(&type9);
1558   auto param39 = model->addOperand(&type9);
1559   auto param40 = model->addOperand(&type9);
1560   auto param41 = model->addOperand(&type12);
1561   auto param42 = model->addOperand(&type12);
1562   auto param43 = model->addOperand(&type8);
1563   auto scoresOut3 = model->addOperand(&type21);
1564   auto roiOut3 = model->addOperand(&type22);
1565   auto classesOut3 = model->addOperand(&type19);
1566   auto detectionOut3 = model->addOperand(&type20);
1567   // Phase 2, operations
1568   static _Float16 param33_init[] = {10.0f};
1569   model->setOperandValue(param33, param33_init, sizeof(_Float16) * 1);
1570   static _Float16 param34_init[] = {10.0f};
1571   model->setOperandValue(param34, param34_init, sizeof(_Float16) * 1);
1572   static _Float16 param35_init[] = {5.0f};
1573   model->setOperandValue(param35, param35_init, sizeof(_Float16) * 1);
1574   static _Float16 param36_init[] = {5.0f};
1575   model->setOperandValue(param36, param36_init, sizeof(_Float16) * 1);
1576   static bool8 param37_init[] = {false};
1577   model->setOperandValue(param37, param37_init, sizeof(bool8) * 1);
1578   static int32_t param38_init[] = {3};
1579   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
1580   static int32_t param39_init[] = {1};
1581   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
1582   static int32_t param40_init[] = {1};
1583   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
1584   static _Float16 param41_init[] = {0.0f};
1585   model->setOperandValue(param41, param41_init, sizeof(_Float16) * 1);
1586   static _Float16 param42_init[] = {0.5f};
1587   model->setOperandValue(param42, param42_init, sizeof(_Float16) * 1);
1588   static bool8 param43_init[] = {true};
1589   model->setOperandValue(param43, param43_init, sizeof(bool8) * 1);
1590   model->addOperation(ANEURALNETWORKS_DETECTION_POSTPROCESSING, {scores3, roi3, anchors3, param33, param34, param35, param36, param37, param38, param39, param40, param41, param42, param43}, {scoresOut3, roiOut3, classesOut3, detectionOut3});
1591   // Phase 3, inputs and outputs
1592   model->identifyInputsAndOutputs(
1593     {scores3, roi3, anchors3},
1594     {scoresOut3, roiOut3, classesOut3, detectionOut3});
1595   assert(model->isValid());
1596 }
1597 
is_ignored_dynamic_output_shape_float16_3(int i)1598 inline bool is_ignored_dynamic_output_shape_float16_3(int i) {
1599   static std::set<int> ignore = {};
1600   return ignore.find(i) != ignore.end();
1601 }
1602 
1603