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