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