1 // clang-format off
2 // Generated file (from: depthwise_conv2d_dilation.mod.py). Do not edit
CreateModel_nhwc(Model * model)3 void CreateModel_nhwc(Model *model) {
4   OperandType type0(Type::BOOL, {});
5   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
6   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7   OperandType type3(Type::TENSOR_FLOAT32, {4});
8   OperandType type4(Type::INT32, {});
9   // Phase 1, operands
10   auto op1 = model->addOperand(&type1);
11   auto op2 = model->addOperand(&type2);
12   auto op3 = model->addOperand(&type3);
13   auto param = model->addOperand(&type4);
14   auto param1 = model->addOperand(&type4);
15   auto param2 = model->addOperand(&type4);
16   auto param3 = model->addOperand(&type4);
17   auto param4 = model->addOperand(&type4);
18   auto param5 = model->addOperand(&type4);
19   auto param6 = model->addOperand(&type4);
20   auto param7 = model->addOperand(&type4);
21   auto layout = model->addOperand(&type0);
22   auto param8 = model->addOperand(&type4);
23   auto param9 = model->addOperand(&type4);
24   auto op4 = model->addOperand(&type2);
25   // Phase 2, operations
26   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
27   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
28   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
29   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
30   static int32_t param_init[] = {0};
31   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
32   static int32_t param1_init[] = {0};
33   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
34   static int32_t param2_init[] = {0};
35   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
36   static int32_t param3_init[] = {0};
37   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
38   static int32_t param4_init[] = {1};
39   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
40   static int32_t param5_init[] = {1};
41   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
42   static int32_t param6_init[] = {2};
43   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
44   static int32_t param7_init[] = {0};
45   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
46   static bool8 layout_init[] = {false};
47   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
48   static int32_t param8_init[] = {1};
49   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
50   static int32_t param9_init[] = {1};
51   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
52   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
53   // Phase 3, inputs and outputs
54   model->identifyInputsAndOutputs(
55     {op1},
56     {op4});
57   assert(model->isValid());
58 }
59 
is_ignored_nhwc(int i)60 inline bool is_ignored_nhwc(int i) {
61   static std::set<int> ignore = {};
62   return ignore.find(i) != ignore.end();
63 }
64 
CreateModel_nhwc_relaxed(Model * model)65 void CreateModel_nhwc_relaxed(Model *model) {
66   OperandType type0(Type::BOOL, {});
67   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
68   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
69   OperandType type3(Type::TENSOR_FLOAT32, {4});
70   OperandType type4(Type::INT32, {});
71   // Phase 1, operands
72   auto op1 = model->addOperand(&type1);
73   auto op2 = model->addOperand(&type2);
74   auto op3 = model->addOperand(&type3);
75   auto param = model->addOperand(&type4);
76   auto param1 = model->addOperand(&type4);
77   auto param2 = model->addOperand(&type4);
78   auto param3 = model->addOperand(&type4);
79   auto param4 = model->addOperand(&type4);
80   auto param5 = model->addOperand(&type4);
81   auto param6 = model->addOperand(&type4);
82   auto param7 = model->addOperand(&type4);
83   auto layout = model->addOperand(&type0);
84   auto param8 = model->addOperand(&type4);
85   auto param9 = model->addOperand(&type4);
86   auto op4 = model->addOperand(&type2);
87   // Phase 2, operations
88   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
89   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
90   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
91   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
92   static int32_t param_init[] = {0};
93   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
94   static int32_t param1_init[] = {0};
95   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
96   static int32_t param2_init[] = {0};
97   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
98   static int32_t param3_init[] = {0};
99   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
100   static int32_t param4_init[] = {1};
101   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
102   static int32_t param5_init[] = {1};
103   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
104   static int32_t param6_init[] = {2};
105   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
106   static int32_t param7_init[] = {0};
107   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
108   static bool8 layout_init[] = {false};
109   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
110   static int32_t param8_init[] = {1};
111   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
112   static int32_t param9_init[] = {1};
113   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
114   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
115   // Phase 3, inputs and outputs
116   model->identifyInputsAndOutputs(
117     {op1},
118     {op4});
119   // Phase 4: set relaxed execution
120   model->relaxComputationFloat32toFloat16(true);
121   assert(model->isValid());
122 }
123 
is_ignored_nhwc_relaxed(int i)124 inline bool is_ignored_nhwc_relaxed(int i) {
125   static std::set<int> ignore = {};
126   return ignore.find(i) != ignore.end();
127 }
128 
CreateModel_nhwc_float16(Model * model)129 void CreateModel_nhwc_float16(Model *model) {
130   OperandType type0(Type::BOOL, {});
131   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
132   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
133   OperandType type12(Type::TENSOR_FLOAT16, {4});
134   OperandType type4(Type::INT32, {});
135   // Phase 1, operands
136   auto op1 = model->addOperand(&type10);
137   auto op2 = model->addOperand(&type11);
138   auto op3 = model->addOperand(&type12);
139   auto param = model->addOperand(&type4);
140   auto param1 = model->addOperand(&type4);
141   auto param2 = model->addOperand(&type4);
142   auto param3 = model->addOperand(&type4);
143   auto param4 = model->addOperand(&type4);
144   auto param5 = model->addOperand(&type4);
145   auto param6 = model->addOperand(&type4);
146   auto param7 = model->addOperand(&type4);
147   auto layout = model->addOperand(&type0);
148   auto param8 = model->addOperand(&type4);
149   auto param9 = model->addOperand(&type4);
150   auto op4 = model->addOperand(&type11);
151   // Phase 2, operations
152   static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
153   model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
154   static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
155   model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
156   static int32_t param_init[] = {0};
157   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
158   static int32_t param1_init[] = {0};
159   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
160   static int32_t param2_init[] = {0};
161   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
162   static int32_t param3_init[] = {0};
163   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
164   static int32_t param4_init[] = {1};
165   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
166   static int32_t param5_init[] = {1};
167   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
168   static int32_t param6_init[] = {2};
169   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
170   static int32_t param7_init[] = {0};
171   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
172   static bool8 layout_init[] = {false};
173   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
174   static int32_t param8_init[] = {1};
175   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
176   static int32_t param9_init[] = {1};
177   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
178   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
179   // Phase 3, inputs and outputs
180   model->identifyInputsAndOutputs(
181     {op1},
182     {op4});
183   assert(model->isValid());
184 }
185 
is_ignored_nhwc_float16(int i)186 inline bool is_ignored_nhwc_float16(int i) {
187   static std::set<int> ignore = {};
188   return ignore.find(i) != ignore.end();
189 }
190 
CreateModel_nhwc_quant8(Model * model)191 void CreateModel_nhwc_quant8(Model *model) {
192   OperandType type0(Type::BOOL, {});
193   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
194   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
195   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
196   OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
197   OperandType type4(Type::INT32, {});
198   // Phase 1, operands
199   auto op1 = model->addOperand(&type13);
200   auto op2 = model->addOperand(&type14);
201   auto op3 = model->addOperand(&type15);
202   auto param = model->addOperand(&type4);
203   auto param1 = model->addOperand(&type4);
204   auto param2 = model->addOperand(&type4);
205   auto param3 = model->addOperand(&type4);
206   auto param4 = model->addOperand(&type4);
207   auto param5 = model->addOperand(&type4);
208   auto param6 = model->addOperand(&type4);
209   auto param7 = model->addOperand(&type4);
210   auto layout = model->addOperand(&type0);
211   auto param8 = model->addOperand(&type4);
212   auto param9 = model->addOperand(&type4);
213   auto op4 = model->addOperand(&type16);
214   // Phase 2, operations
215   static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
216   model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
217   static int32_t op3_init[] = {200, 400, 600, 800};
218   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
219   static int32_t param_init[] = {0};
220   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
221   static int32_t param1_init[] = {0};
222   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
223   static int32_t param2_init[] = {0};
224   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
225   static int32_t param3_init[] = {0};
226   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
227   static int32_t param4_init[] = {1};
228   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
229   static int32_t param5_init[] = {1};
230   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
231   static int32_t param6_init[] = {2};
232   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
233   static int32_t param7_init[] = {0};
234   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
235   static bool8 layout_init[] = {false};
236   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
237   static int32_t param8_init[] = {1};
238   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
239   static int32_t param9_init[] = {1};
240   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
241   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
242   // Phase 3, inputs and outputs
243   model->identifyInputsAndOutputs(
244     {op1},
245     {op4});
246   assert(model->isValid());
247 }
248 
is_ignored_nhwc_quant8(int i)249 inline bool is_ignored_nhwc_quant8(int i) {
250   static std::set<int> ignore = {};
251   return ignore.find(i) != ignore.end();
252 }
253 
CreateModel_nhwc_weight_as_input(Model * model)254 void CreateModel_nhwc_weight_as_input(Model *model) {
255   OperandType type0(Type::BOOL, {});
256   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
257   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
258   OperandType type3(Type::TENSOR_FLOAT32, {4});
259   OperandType type4(Type::INT32, {});
260   // Phase 1, operands
261   auto op1 = model->addOperand(&type1);
262   auto op2 = model->addOperand(&type2);
263   auto op3 = model->addOperand(&type3);
264   auto param = model->addOperand(&type4);
265   auto param1 = model->addOperand(&type4);
266   auto param2 = model->addOperand(&type4);
267   auto param3 = model->addOperand(&type4);
268   auto param4 = model->addOperand(&type4);
269   auto param5 = model->addOperand(&type4);
270   auto param6 = model->addOperand(&type4);
271   auto param7 = model->addOperand(&type4);
272   auto layout = model->addOperand(&type0);
273   auto param8 = model->addOperand(&type4);
274   auto param9 = model->addOperand(&type4);
275   auto op4 = model->addOperand(&type2);
276   // Phase 2, operations
277   static int32_t param_init[] = {0};
278   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
279   static int32_t param1_init[] = {0};
280   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
281   static int32_t param2_init[] = {0};
282   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
283   static int32_t param3_init[] = {0};
284   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
285   static int32_t param4_init[] = {1};
286   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
287   static int32_t param5_init[] = {1};
288   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
289   static int32_t param6_init[] = {2};
290   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
291   static int32_t param7_init[] = {0};
292   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
293   static bool8 layout_init[] = {false};
294   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
295   static int32_t param8_init[] = {1};
296   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
297   static int32_t param9_init[] = {1};
298   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
299   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
300   // Phase 3, inputs and outputs
301   model->identifyInputsAndOutputs(
302     {op1, op2, op3},
303     {op4});
304   assert(model->isValid());
305 }
306 
is_ignored_nhwc_weight_as_input(int i)307 inline bool is_ignored_nhwc_weight_as_input(int i) {
308   static std::set<int> ignore = {};
309   return ignore.find(i) != ignore.end();
310 }
311 
CreateModel_nhwc_weight_as_input_relaxed(Model * model)312 void CreateModel_nhwc_weight_as_input_relaxed(Model *model) {
313   OperandType type0(Type::BOOL, {});
314   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
315   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
316   OperandType type3(Type::TENSOR_FLOAT32, {4});
317   OperandType type4(Type::INT32, {});
318   // Phase 1, operands
319   auto op1 = model->addOperand(&type1);
320   auto op2 = model->addOperand(&type2);
321   auto op3 = model->addOperand(&type3);
322   auto param = model->addOperand(&type4);
323   auto param1 = model->addOperand(&type4);
324   auto param2 = model->addOperand(&type4);
325   auto param3 = model->addOperand(&type4);
326   auto param4 = model->addOperand(&type4);
327   auto param5 = model->addOperand(&type4);
328   auto param6 = model->addOperand(&type4);
329   auto param7 = model->addOperand(&type4);
330   auto layout = model->addOperand(&type0);
331   auto param8 = model->addOperand(&type4);
332   auto param9 = model->addOperand(&type4);
333   auto op4 = model->addOperand(&type2);
334   // Phase 2, operations
335   static int32_t param_init[] = {0};
336   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
337   static int32_t param1_init[] = {0};
338   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
339   static int32_t param2_init[] = {0};
340   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
341   static int32_t param3_init[] = {0};
342   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
343   static int32_t param4_init[] = {1};
344   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
345   static int32_t param5_init[] = {1};
346   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
347   static int32_t param6_init[] = {2};
348   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
349   static int32_t param7_init[] = {0};
350   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
351   static bool8 layout_init[] = {false};
352   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
353   static int32_t param8_init[] = {1};
354   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
355   static int32_t param9_init[] = {1};
356   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
357   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
358   // Phase 3, inputs and outputs
359   model->identifyInputsAndOutputs(
360     {op1, op2, op3},
361     {op4});
362   // Phase 4: set relaxed execution
363   model->relaxComputationFloat32toFloat16(true);
364   assert(model->isValid());
365 }
366 
is_ignored_nhwc_weight_as_input_relaxed(int i)367 inline bool is_ignored_nhwc_weight_as_input_relaxed(int i) {
368   static std::set<int> ignore = {};
369   return ignore.find(i) != ignore.end();
370 }
371 
CreateModel_nhwc_weight_as_input_float16(Model * model)372 void CreateModel_nhwc_weight_as_input_float16(Model *model) {
373   OperandType type0(Type::BOOL, {});
374   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
375   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
376   OperandType type12(Type::TENSOR_FLOAT16, {4});
377   OperandType type4(Type::INT32, {});
378   // Phase 1, operands
379   auto op1 = model->addOperand(&type10);
380   auto op2 = model->addOperand(&type11);
381   auto op3 = model->addOperand(&type12);
382   auto param = model->addOperand(&type4);
383   auto param1 = model->addOperand(&type4);
384   auto param2 = model->addOperand(&type4);
385   auto param3 = model->addOperand(&type4);
386   auto param4 = model->addOperand(&type4);
387   auto param5 = model->addOperand(&type4);
388   auto param6 = model->addOperand(&type4);
389   auto param7 = model->addOperand(&type4);
390   auto layout = model->addOperand(&type0);
391   auto param8 = model->addOperand(&type4);
392   auto param9 = model->addOperand(&type4);
393   auto op4 = model->addOperand(&type11);
394   // Phase 2, operations
395   static int32_t param_init[] = {0};
396   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
397   static int32_t param1_init[] = {0};
398   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
399   static int32_t param2_init[] = {0};
400   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
401   static int32_t param3_init[] = {0};
402   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
403   static int32_t param4_init[] = {1};
404   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
405   static int32_t param5_init[] = {1};
406   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
407   static int32_t param6_init[] = {2};
408   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
409   static int32_t param7_init[] = {0};
410   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
411   static bool8 layout_init[] = {false};
412   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
413   static int32_t param8_init[] = {1};
414   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
415   static int32_t param9_init[] = {1};
416   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
417   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
418   // Phase 3, inputs and outputs
419   model->identifyInputsAndOutputs(
420     {op1, op2, op3},
421     {op4});
422   assert(model->isValid());
423 }
424 
is_ignored_nhwc_weight_as_input_float16(int i)425 inline bool is_ignored_nhwc_weight_as_input_float16(int i) {
426   static std::set<int> ignore = {};
427   return ignore.find(i) != ignore.end();
428 }
429 
CreateModel_nhwc_weight_as_input_quant8(Model * model)430 void CreateModel_nhwc_weight_as_input_quant8(Model *model) {
431   OperandType type0(Type::BOOL, {});
432   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
433   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
434   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
435   OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
436   OperandType type4(Type::INT32, {});
437   // Phase 1, operands
438   auto op1 = model->addOperand(&type13);
439   auto op2 = model->addOperand(&type14);
440   auto op3 = model->addOperand(&type15);
441   auto param = model->addOperand(&type4);
442   auto param1 = model->addOperand(&type4);
443   auto param2 = model->addOperand(&type4);
444   auto param3 = model->addOperand(&type4);
445   auto param4 = model->addOperand(&type4);
446   auto param5 = model->addOperand(&type4);
447   auto param6 = model->addOperand(&type4);
448   auto param7 = model->addOperand(&type4);
449   auto layout = model->addOperand(&type0);
450   auto param8 = model->addOperand(&type4);
451   auto param9 = model->addOperand(&type4);
452   auto op4 = model->addOperand(&type16);
453   // Phase 2, operations
454   static int32_t param_init[] = {0};
455   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
456   static int32_t param1_init[] = {0};
457   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
458   static int32_t param2_init[] = {0};
459   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
460   static int32_t param3_init[] = {0};
461   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
462   static int32_t param4_init[] = {1};
463   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
464   static int32_t param5_init[] = {1};
465   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
466   static int32_t param6_init[] = {2};
467   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
468   static int32_t param7_init[] = {0};
469   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
470   static bool8 layout_init[] = {false};
471   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
472   static int32_t param8_init[] = {1};
473   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
474   static int32_t param9_init[] = {1};
475   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
476   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
477   // Phase 3, inputs and outputs
478   model->identifyInputsAndOutputs(
479     {op1, op2, op3},
480     {op4});
481   assert(model->isValid());
482 }
483 
is_ignored_nhwc_weight_as_input_quant8(int i)484 inline bool is_ignored_nhwc_weight_as_input_quant8(int i) {
485   static std::set<int> ignore = {};
486   return ignore.find(i) != ignore.end();
487 }
488 
CreateModel_nchw(Model * model)489 void CreateModel_nchw(Model *model) {
490   OperandType type0(Type::BOOL, {});
491   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
492   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
493   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
494   OperandType type3(Type::TENSOR_FLOAT32, {4});
495   OperandType type4(Type::INT32, {});
496   // Phase 1, operands
497   auto op1 = model->addOperand(&type17);
498   auto op2 = model->addOperand(&type2);
499   auto op3 = model->addOperand(&type3);
500   auto param = model->addOperand(&type4);
501   auto param1 = model->addOperand(&type4);
502   auto param2 = model->addOperand(&type4);
503   auto param3 = model->addOperand(&type4);
504   auto param4 = model->addOperand(&type4);
505   auto param5 = model->addOperand(&type4);
506   auto param6 = model->addOperand(&type4);
507   auto param7 = model->addOperand(&type4);
508   auto layout = model->addOperand(&type0);
509   auto param8 = model->addOperand(&type4);
510   auto param9 = model->addOperand(&type4);
511   auto op4 = model->addOperand(&type18);
512   // Phase 2, operations
513   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
514   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
515   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
516   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
517   static int32_t param_init[] = {0};
518   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
519   static int32_t param1_init[] = {0};
520   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
521   static int32_t param2_init[] = {0};
522   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
523   static int32_t param3_init[] = {0};
524   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
525   static int32_t param4_init[] = {1};
526   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
527   static int32_t param5_init[] = {1};
528   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
529   static int32_t param6_init[] = {2};
530   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
531   static int32_t param7_init[] = {0};
532   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
533   static bool8 layout_init[] = {true};
534   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
535   static int32_t param8_init[] = {1};
536   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
537   static int32_t param9_init[] = {1};
538   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
539   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
540   // Phase 3, inputs and outputs
541   model->identifyInputsAndOutputs(
542     {op1},
543     {op4});
544   assert(model->isValid());
545 }
546 
is_ignored_nchw(int i)547 inline bool is_ignored_nchw(int i) {
548   static std::set<int> ignore = {};
549   return ignore.find(i) != ignore.end();
550 }
551 
CreateModel_nchw_relaxed(Model * model)552 void CreateModel_nchw_relaxed(Model *model) {
553   OperandType type0(Type::BOOL, {});
554   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
555   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
556   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
557   OperandType type3(Type::TENSOR_FLOAT32, {4});
558   OperandType type4(Type::INT32, {});
559   // Phase 1, operands
560   auto op1 = model->addOperand(&type17);
561   auto op2 = model->addOperand(&type2);
562   auto op3 = model->addOperand(&type3);
563   auto param = model->addOperand(&type4);
564   auto param1 = model->addOperand(&type4);
565   auto param2 = model->addOperand(&type4);
566   auto param3 = model->addOperand(&type4);
567   auto param4 = model->addOperand(&type4);
568   auto param5 = model->addOperand(&type4);
569   auto param6 = model->addOperand(&type4);
570   auto param7 = model->addOperand(&type4);
571   auto layout = model->addOperand(&type0);
572   auto param8 = model->addOperand(&type4);
573   auto param9 = model->addOperand(&type4);
574   auto op4 = model->addOperand(&type18);
575   // Phase 2, operations
576   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
577   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
578   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
579   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
580   static int32_t param_init[] = {0};
581   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
582   static int32_t param1_init[] = {0};
583   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
584   static int32_t param2_init[] = {0};
585   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
586   static int32_t param3_init[] = {0};
587   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
588   static int32_t param4_init[] = {1};
589   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
590   static int32_t param5_init[] = {1};
591   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
592   static int32_t param6_init[] = {2};
593   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
594   static int32_t param7_init[] = {0};
595   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
596   static bool8 layout_init[] = {true};
597   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
598   static int32_t param8_init[] = {1};
599   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
600   static int32_t param9_init[] = {1};
601   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
602   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
603   // Phase 3, inputs and outputs
604   model->identifyInputsAndOutputs(
605     {op1},
606     {op4});
607   // Phase 4: set relaxed execution
608   model->relaxComputationFloat32toFloat16(true);
609   assert(model->isValid());
610 }
611 
is_ignored_nchw_relaxed(int i)612 inline bool is_ignored_nchw_relaxed(int i) {
613   static std::set<int> ignore = {};
614   return ignore.find(i) != ignore.end();
615 }
616 
CreateModel_nchw_float16(Model * model)617 void CreateModel_nchw_float16(Model *model) {
618   OperandType type0(Type::BOOL, {});
619   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
620   OperandType type12(Type::TENSOR_FLOAT16, {4});
621   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
622   OperandType type20(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
623   OperandType type4(Type::INT32, {});
624   // Phase 1, operands
625   auto op1 = model->addOperand(&type19);
626   auto op2 = model->addOperand(&type11);
627   auto op3 = model->addOperand(&type12);
628   auto param = model->addOperand(&type4);
629   auto param1 = model->addOperand(&type4);
630   auto param2 = model->addOperand(&type4);
631   auto param3 = model->addOperand(&type4);
632   auto param4 = model->addOperand(&type4);
633   auto param5 = model->addOperand(&type4);
634   auto param6 = model->addOperand(&type4);
635   auto param7 = model->addOperand(&type4);
636   auto layout = model->addOperand(&type0);
637   auto param8 = model->addOperand(&type4);
638   auto param9 = model->addOperand(&type4);
639   auto op4 = model->addOperand(&type20);
640   // Phase 2, operations
641   static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
642   model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
643   static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
644   model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
645   static int32_t param_init[] = {0};
646   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
647   static int32_t param1_init[] = {0};
648   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
649   static int32_t param2_init[] = {0};
650   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
651   static int32_t param3_init[] = {0};
652   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
653   static int32_t param4_init[] = {1};
654   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
655   static int32_t param5_init[] = {1};
656   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
657   static int32_t param6_init[] = {2};
658   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
659   static int32_t param7_init[] = {0};
660   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
661   static bool8 layout_init[] = {true};
662   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
663   static int32_t param8_init[] = {1};
664   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
665   static int32_t param9_init[] = {1};
666   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
667   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
668   // Phase 3, inputs and outputs
669   model->identifyInputsAndOutputs(
670     {op1},
671     {op4});
672   assert(model->isValid());
673 }
674 
is_ignored_nchw_float16(int i)675 inline bool is_ignored_nchw_float16(int i) {
676   static std::set<int> ignore = {};
677   return ignore.find(i) != ignore.end();
678 }
679 
CreateModel_nchw_quant8(Model * model)680 void CreateModel_nchw_quant8(Model *model) {
681   OperandType type0(Type::BOOL, {});
682   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
683   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
684   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
685   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
686   OperandType type4(Type::INT32, {});
687   // Phase 1, operands
688   auto op1 = model->addOperand(&type21);
689   auto op2 = model->addOperand(&type14);
690   auto op3 = model->addOperand(&type15);
691   auto param = model->addOperand(&type4);
692   auto param1 = model->addOperand(&type4);
693   auto param2 = model->addOperand(&type4);
694   auto param3 = model->addOperand(&type4);
695   auto param4 = model->addOperand(&type4);
696   auto param5 = model->addOperand(&type4);
697   auto param6 = model->addOperand(&type4);
698   auto param7 = model->addOperand(&type4);
699   auto layout = model->addOperand(&type0);
700   auto param8 = model->addOperand(&type4);
701   auto param9 = model->addOperand(&type4);
702   auto op4 = model->addOperand(&type22);
703   // Phase 2, operations
704   static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
705   model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
706   static int32_t op3_init[] = {200, 400, 600, 800};
707   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
708   static int32_t param_init[] = {0};
709   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
710   static int32_t param1_init[] = {0};
711   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
712   static int32_t param2_init[] = {0};
713   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
714   static int32_t param3_init[] = {0};
715   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
716   static int32_t param4_init[] = {1};
717   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
718   static int32_t param5_init[] = {1};
719   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
720   static int32_t param6_init[] = {2};
721   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
722   static int32_t param7_init[] = {0};
723   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
724   static bool8 layout_init[] = {true};
725   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
726   static int32_t param8_init[] = {1};
727   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
728   static int32_t param9_init[] = {1};
729   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
730   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
731   // Phase 3, inputs and outputs
732   model->identifyInputsAndOutputs(
733     {op1},
734     {op4});
735   assert(model->isValid());
736 }
737 
is_ignored_nchw_quant8(int i)738 inline bool is_ignored_nchw_quant8(int i) {
739   static std::set<int> ignore = {};
740   return ignore.find(i) != ignore.end();
741 }
742 
CreateModel_nchw_weight_as_input(Model * model)743 void CreateModel_nchw_weight_as_input(Model *model) {
744   OperandType type0(Type::BOOL, {});
745   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
746   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
747   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
748   OperandType type3(Type::TENSOR_FLOAT32, {4});
749   OperandType type4(Type::INT32, {});
750   // Phase 1, operands
751   auto op1 = model->addOperand(&type17);
752   auto op2 = model->addOperand(&type2);
753   auto op3 = model->addOperand(&type3);
754   auto param = model->addOperand(&type4);
755   auto param1 = model->addOperand(&type4);
756   auto param2 = model->addOperand(&type4);
757   auto param3 = model->addOperand(&type4);
758   auto param4 = model->addOperand(&type4);
759   auto param5 = model->addOperand(&type4);
760   auto param6 = model->addOperand(&type4);
761   auto param7 = model->addOperand(&type4);
762   auto layout = model->addOperand(&type0);
763   auto param8 = model->addOperand(&type4);
764   auto param9 = model->addOperand(&type4);
765   auto op4 = model->addOperand(&type18);
766   // Phase 2, operations
767   static int32_t param_init[] = {0};
768   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
769   static int32_t param1_init[] = {0};
770   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
771   static int32_t param2_init[] = {0};
772   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
773   static int32_t param3_init[] = {0};
774   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
775   static int32_t param4_init[] = {1};
776   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
777   static int32_t param5_init[] = {1};
778   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
779   static int32_t param6_init[] = {2};
780   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
781   static int32_t param7_init[] = {0};
782   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
783   static bool8 layout_init[] = {true};
784   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
785   static int32_t param8_init[] = {1};
786   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
787   static int32_t param9_init[] = {1};
788   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
789   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
790   // Phase 3, inputs and outputs
791   model->identifyInputsAndOutputs(
792     {op1, op2, op3},
793     {op4});
794   assert(model->isValid());
795 }
796 
is_ignored_nchw_weight_as_input(int i)797 inline bool is_ignored_nchw_weight_as_input(int i) {
798   static std::set<int> ignore = {};
799   return ignore.find(i) != ignore.end();
800 }
801 
CreateModel_nchw_weight_as_input_relaxed(Model * model)802 void CreateModel_nchw_weight_as_input_relaxed(Model *model) {
803   OperandType type0(Type::BOOL, {});
804   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
805   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
806   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
807   OperandType type3(Type::TENSOR_FLOAT32, {4});
808   OperandType type4(Type::INT32, {});
809   // Phase 1, operands
810   auto op1 = model->addOperand(&type17);
811   auto op2 = model->addOperand(&type2);
812   auto op3 = model->addOperand(&type3);
813   auto param = model->addOperand(&type4);
814   auto param1 = model->addOperand(&type4);
815   auto param2 = model->addOperand(&type4);
816   auto param3 = model->addOperand(&type4);
817   auto param4 = model->addOperand(&type4);
818   auto param5 = model->addOperand(&type4);
819   auto param6 = model->addOperand(&type4);
820   auto param7 = model->addOperand(&type4);
821   auto layout = model->addOperand(&type0);
822   auto param8 = model->addOperand(&type4);
823   auto param9 = model->addOperand(&type4);
824   auto op4 = model->addOperand(&type18);
825   // Phase 2, operations
826   static int32_t param_init[] = {0};
827   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
828   static int32_t param1_init[] = {0};
829   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
830   static int32_t param2_init[] = {0};
831   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
832   static int32_t param3_init[] = {0};
833   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
834   static int32_t param4_init[] = {1};
835   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
836   static int32_t param5_init[] = {1};
837   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
838   static int32_t param6_init[] = {2};
839   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
840   static int32_t param7_init[] = {0};
841   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
842   static bool8 layout_init[] = {true};
843   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
844   static int32_t param8_init[] = {1};
845   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
846   static int32_t param9_init[] = {1};
847   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
848   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
849   // Phase 3, inputs and outputs
850   model->identifyInputsAndOutputs(
851     {op1, op2, op3},
852     {op4});
853   // Phase 4: set relaxed execution
854   model->relaxComputationFloat32toFloat16(true);
855   assert(model->isValid());
856 }
857 
is_ignored_nchw_weight_as_input_relaxed(int i)858 inline bool is_ignored_nchw_weight_as_input_relaxed(int i) {
859   static std::set<int> ignore = {};
860   return ignore.find(i) != ignore.end();
861 }
862 
CreateModel_nchw_weight_as_input_float16(Model * model)863 void CreateModel_nchw_weight_as_input_float16(Model *model) {
864   OperandType type0(Type::BOOL, {});
865   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
866   OperandType type12(Type::TENSOR_FLOAT16, {4});
867   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
868   OperandType type20(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
869   OperandType type4(Type::INT32, {});
870   // Phase 1, operands
871   auto op1 = model->addOperand(&type19);
872   auto op2 = model->addOperand(&type11);
873   auto op3 = model->addOperand(&type12);
874   auto param = model->addOperand(&type4);
875   auto param1 = model->addOperand(&type4);
876   auto param2 = model->addOperand(&type4);
877   auto param3 = model->addOperand(&type4);
878   auto param4 = model->addOperand(&type4);
879   auto param5 = model->addOperand(&type4);
880   auto param6 = model->addOperand(&type4);
881   auto param7 = model->addOperand(&type4);
882   auto layout = model->addOperand(&type0);
883   auto param8 = model->addOperand(&type4);
884   auto param9 = model->addOperand(&type4);
885   auto op4 = model->addOperand(&type20);
886   // Phase 2, operations
887   static int32_t param_init[] = {0};
888   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
889   static int32_t param1_init[] = {0};
890   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
891   static int32_t param2_init[] = {0};
892   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
893   static int32_t param3_init[] = {0};
894   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
895   static int32_t param4_init[] = {1};
896   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
897   static int32_t param5_init[] = {1};
898   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
899   static int32_t param6_init[] = {2};
900   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
901   static int32_t param7_init[] = {0};
902   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
903   static bool8 layout_init[] = {true};
904   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
905   static int32_t param8_init[] = {1};
906   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
907   static int32_t param9_init[] = {1};
908   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
909   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
910   // Phase 3, inputs and outputs
911   model->identifyInputsAndOutputs(
912     {op1, op2, op3},
913     {op4});
914   assert(model->isValid());
915 }
916 
is_ignored_nchw_weight_as_input_float16(int i)917 inline bool is_ignored_nchw_weight_as_input_float16(int i) {
918   static std::set<int> ignore = {};
919   return ignore.find(i) != ignore.end();
920 }
921 
CreateModel_nchw_weight_as_input_quant8(Model * model)922 void CreateModel_nchw_weight_as_input_quant8(Model *model) {
923   OperandType type0(Type::BOOL, {});
924   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
925   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
926   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
927   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
928   OperandType type4(Type::INT32, {});
929   // Phase 1, operands
930   auto op1 = model->addOperand(&type21);
931   auto op2 = model->addOperand(&type14);
932   auto op3 = model->addOperand(&type15);
933   auto param = model->addOperand(&type4);
934   auto param1 = model->addOperand(&type4);
935   auto param2 = model->addOperand(&type4);
936   auto param3 = model->addOperand(&type4);
937   auto param4 = model->addOperand(&type4);
938   auto param5 = model->addOperand(&type4);
939   auto param6 = model->addOperand(&type4);
940   auto param7 = model->addOperand(&type4);
941   auto layout = model->addOperand(&type0);
942   auto param8 = model->addOperand(&type4);
943   auto param9 = model->addOperand(&type4);
944   auto op4 = model->addOperand(&type22);
945   // Phase 2, operations
946   static int32_t param_init[] = {0};
947   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
948   static int32_t param1_init[] = {0};
949   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
950   static int32_t param2_init[] = {0};
951   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
952   static int32_t param3_init[] = {0};
953   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
954   static int32_t param4_init[] = {1};
955   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
956   static int32_t param5_init[] = {1};
957   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
958   static int32_t param6_init[] = {2};
959   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
960   static int32_t param7_init[] = {0};
961   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
962   static bool8 layout_init[] = {true};
963   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
964   static int32_t param8_init[] = {1};
965   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
966   static int32_t param9_init[] = {1};
967   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
968   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
969   // Phase 3, inputs and outputs
970   model->identifyInputsAndOutputs(
971     {op1, op2, op3},
972     {op4});
973   assert(model->isValid());
974 }
975 
is_ignored_nchw_weight_as_input_quant8(int i)976 inline bool is_ignored_nchw_weight_as_input_quant8(int i) {
977   static std::set<int> ignore = {};
978   return ignore.find(i) != ignore.end();
979 }
980 
CreateModel_dynamic_output_shape_nhwc(Model * model)981 void CreateModel_dynamic_output_shape_nhwc(Model *model) {
982   OperandType type0(Type::BOOL, {});
983   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
984   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
985   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
986   OperandType type3(Type::TENSOR_FLOAT32, {4});
987   OperandType type4(Type::INT32, {});
988   // Phase 1, operands
989   auto op1 = model->addOperand(&type1);
990   auto op2 = model->addOperand(&type2);
991   auto op3 = model->addOperand(&type3);
992   auto param = model->addOperand(&type4);
993   auto param1 = model->addOperand(&type4);
994   auto param2 = model->addOperand(&type4);
995   auto param3 = model->addOperand(&type4);
996   auto param4 = model->addOperand(&type4);
997   auto param5 = model->addOperand(&type4);
998   auto param6 = model->addOperand(&type4);
999   auto param7 = model->addOperand(&type4);
1000   auto layout = model->addOperand(&type0);
1001   auto param8 = model->addOperand(&type4);
1002   auto param9 = model->addOperand(&type4);
1003   auto op4 = model->addOperand(&type23);
1004   // Phase 2, operations
1005   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1006   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1007   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1008   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1009   static int32_t param_init[] = {0};
1010   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1011   static int32_t param1_init[] = {0};
1012   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1013   static int32_t param2_init[] = {0};
1014   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1015   static int32_t param3_init[] = {0};
1016   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1017   static int32_t param4_init[] = {1};
1018   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1019   static int32_t param5_init[] = {1};
1020   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1021   static int32_t param6_init[] = {2};
1022   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1023   static int32_t param7_init[] = {0};
1024   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1025   static bool8 layout_init[] = {false};
1026   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1027   static int32_t param8_init[] = {1};
1028   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1029   static int32_t param9_init[] = {1};
1030   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1031   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1032   // Phase 3, inputs and outputs
1033   model->identifyInputsAndOutputs(
1034     {op1},
1035     {op4});
1036   assert(model->isValid());
1037 }
1038 
is_ignored_dynamic_output_shape_nhwc(int i)1039 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
1040   static std::set<int> ignore = {};
1041   return ignore.find(i) != ignore.end();
1042 }
1043 
CreateModel_dynamic_output_shape_nhwc_relaxed(Model * model)1044 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) {
1045   OperandType type0(Type::BOOL, {});
1046   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1047   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1048   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1049   OperandType type3(Type::TENSOR_FLOAT32, {4});
1050   OperandType type4(Type::INT32, {});
1051   // Phase 1, operands
1052   auto op1 = model->addOperand(&type1);
1053   auto op2 = model->addOperand(&type2);
1054   auto op3 = model->addOperand(&type3);
1055   auto param = model->addOperand(&type4);
1056   auto param1 = model->addOperand(&type4);
1057   auto param2 = model->addOperand(&type4);
1058   auto param3 = model->addOperand(&type4);
1059   auto param4 = model->addOperand(&type4);
1060   auto param5 = model->addOperand(&type4);
1061   auto param6 = model->addOperand(&type4);
1062   auto param7 = model->addOperand(&type4);
1063   auto layout = model->addOperand(&type0);
1064   auto param8 = model->addOperand(&type4);
1065   auto param9 = model->addOperand(&type4);
1066   auto op4 = model->addOperand(&type23);
1067   // Phase 2, operations
1068   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1069   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1070   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1071   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1072   static int32_t param_init[] = {0};
1073   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1074   static int32_t param1_init[] = {0};
1075   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1076   static int32_t param2_init[] = {0};
1077   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1078   static int32_t param3_init[] = {0};
1079   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1080   static int32_t param4_init[] = {1};
1081   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1082   static int32_t param5_init[] = {1};
1083   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1084   static int32_t param6_init[] = {2};
1085   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1086   static int32_t param7_init[] = {0};
1087   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1088   static bool8 layout_init[] = {false};
1089   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1090   static int32_t param8_init[] = {1};
1091   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1092   static int32_t param9_init[] = {1};
1093   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1094   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1095   // Phase 3, inputs and outputs
1096   model->identifyInputsAndOutputs(
1097     {op1},
1098     {op4});
1099   // Phase 4: set relaxed execution
1100   model->relaxComputationFloat32toFloat16(true);
1101   assert(model->isValid());
1102 }
1103 
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)1104 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
1105   static std::set<int> ignore = {};
1106   return ignore.find(i) != ignore.end();
1107 }
1108 
CreateModel_dynamic_output_shape_nhwc_float16(Model * model)1109 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) {
1110   OperandType type0(Type::BOOL, {});
1111   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
1112   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1113   OperandType type12(Type::TENSOR_FLOAT16, {4});
1114   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1115   OperandType type4(Type::INT32, {});
1116   // Phase 1, operands
1117   auto op1 = model->addOperand(&type10);
1118   auto op2 = model->addOperand(&type11);
1119   auto op3 = model->addOperand(&type12);
1120   auto param = model->addOperand(&type4);
1121   auto param1 = model->addOperand(&type4);
1122   auto param2 = model->addOperand(&type4);
1123   auto param3 = model->addOperand(&type4);
1124   auto param4 = model->addOperand(&type4);
1125   auto param5 = model->addOperand(&type4);
1126   auto param6 = model->addOperand(&type4);
1127   auto param7 = model->addOperand(&type4);
1128   auto layout = model->addOperand(&type0);
1129   auto param8 = model->addOperand(&type4);
1130   auto param9 = model->addOperand(&type4);
1131   auto op4 = model->addOperand(&type24);
1132   // Phase 2, operations
1133   static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
1134   model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
1135   static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1136   model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
1137   static int32_t param_init[] = {0};
1138   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1139   static int32_t param1_init[] = {0};
1140   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1141   static int32_t param2_init[] = {0};
1142   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1143   static int32_t param3_init[] = {0};
1144   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1145   static int32_t param4_init[] = {1};
1146   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1147   static int32_t param5_init[] = {1};
1148   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1149   static int32_t param6_init[] = {2};
1150   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1151   static int32_t param7_init[] = {0};
1152   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1153   static bool8 layout_init[] = {false};
1154   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1155   static int32_t param8_init[] = {1};
1156   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1157   static int32_t param9_init[] = {1};
1158   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1159   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1160   // Phase 3, inputs and outputs
1161   model->identifyInputsAndOutputs(
1162     {op1},
1163     {op4});
1164   assert(model->isValid());
1165 }
1166 
is_ignored_dynamic_output_shape_nhwc_float16(int i)1167 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
1168   static std::set<int> ignore = {};
1169   return ignore.find(i) != ignore.end();
1170 }
1171 
CreateModel_dynamic_output_shape_nhwc_quant8(Model * model)1172 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) {
1173   OperandType type0(Type::BOOL, {});
1174   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1175   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1176   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
1177   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1178   OperandType type4(Type::INT32, {});
1179   // Phase 1, operands
1180   auto op1 = model->addOperand(&type13);
1181   auto op2 = model->addOperand(&type14);
1182   auto op3 = model->addOperand(&type15);
1183   auto param = model->addOperand(&type4);
1184   auto param1 = model->addOperand(&type4);
1185   auto param2 = model->addOperand(&type4);
1186   auto param3 = model->addOperand(&type4);
1187   auto param4 = model->addOperand(&type4);
1188   auto param5 = model->addOperand(&type4);
1189   auto param6 = model->addOperand(&type4);
1190   auto param7 = model->addOperand(&type4);
1191   auto layout = model->addOperand(&type0);
1192   auto param8 = model->addOperand(&type4);
1193   auto param9 = model->addOperand(&type4);
1194   auto op4 = model->addOperand(&type25);
1195   // Phase 2, operations
1196   static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
1197   model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
1198   static int32_t op3_init[] = {200, 400, 600, 800};
1199   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
1200   static int32_t param_init[] = {0};
1201   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1202   static int32_t param1_init[] = {0};
1203   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1204   static int32_t param2_init[] = {0};
1205   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1206   static int32_t param3_init[] = {0};
1207   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1208   static int32_t param4_init[] = {1};
1209   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1210   static int32_t param5_init[] = {1};
1211   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1212   static int32_t param6_init[] = {2};
1213   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1214   static int32_t param7_init[] = {0};
1215   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1216   static bool8 layout_init[] = {false};
1217   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1218   static int32_t param8_init[] = {1};
1219   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1220   static int32_t param9_init[] = {1};
1221   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1222   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1223   // Phase 3, inputs and outputs
1224   model->identifyInputsAndOutputs(
1225     {op1},
1226     {op4});
1227   assert(model->isValid());
1228 }
1229 
is_ignored_dynamic_output_shape_nhwc_quant8(int i)1230 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
1231   static std::set<int> ignore = {};
1232   return ignore.find(i) != ignore.end();
1233 }
1234 
CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model * model)1235 void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) {
1236   OperandType type0(Type::BOOL, {});
1237   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1238   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1239   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1240   OperandType type3(Type::TENSOR_FLOAT32, {4});
1241   OperandType type4(Type::INT32, {});
1242   // Phase 1, operands
1243   auto op1 = model->addOperand(&type1);
1244   auto op2 = model->addOperand(&type2);
1245   auto op3 = model->addOperand(&type3);
1246   auto param = model->addOperand(&type4);
1247   auto param1 = model->addOperand(&type4);
1248   auto param2 = model->addOperand(&type4);
1249   auto param3 = model->addOperand(&type4);
1250   auto param4 = model->addOperand(&type4);
1251   auto param5 = model->addOperand(&type4);
1252   auto param6 = model->addOperand(&type4);
1253   auto param7 = model->addOperand(&type4);
1254   auto layout = model->addOperand(&type0);
1255   auto param8 = model->addOperand(&type4);
1256   auto param9 = model->addOperand(&type4);
1257   auto op4 = model->addOperand(&type23);
1258   // Phase 2, operations
1259   static int32_t param_init[] = {0};
1260   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1261   static int32_t param1_init[] = {0};
1262   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1263   static int32_t param2_init[] = {0};
1264   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1265   static int32_t param3_init[] = {0};
1266   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1267   static int32_t param4_init[] = {1};
1268   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1269   static int32_t param5_init[] = {1};
1270   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1271   static int32_t param6_init[] = {2};
1272   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1273   static int32_t param7_init[] = {0};
1274   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1275   static bool8 layout_init[] = {false};
1276   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1277   static int32_t param8_init[] = {1};
1278   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1279   static int32_t param9_init[] = {1};
1280   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1281   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1282   // Phase 3, inputs and outputs
1283   model->identifyInputsAndOutputs(
1284     {op1, op2, op3},
1285     {op4});
1286   assert(model->isValid());
1287 }
1288 
is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i)1289 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) {
1290   static std::set<int> ignore = {};
1291   return ignore.find(i) != ignore.end();
1292 }
1293 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model * model)1294 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) {
1295   OperandType type0(Type::BOOL, {});
1296   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1297   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1298   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1299   OperandType type3(Type::TENSOR_FLOAT32, {4});
1300   OperandType type4(Type::INT32, {});
1301   // Phase 1, operands
1302   auto op1 = model->addOperand(&type1);
1303   auto op2 = model->addOperand(&type2);
1304   auto op3 = model->addOperand(&type3);
1305   auto param = model->addOperand(&type4);
1306   auto param1 = model->addOperand(&type4);
1307   auto param2 = model->addOperand(&type4);
1308   auto param3 = model->addOperand(&type4);
1309   auto param4 = model->addOperand(&type4);
1310   auto param5 = model->addOperand(&type4);
1311   auto param6 = model->addOperand(&type4);
1312   auto param7 = model->addOperand(&type4);
1313   auto layout = model->addOperand(&type0);
1314   auto param8 = model->addOperand(&type4);
1315   auto param9 = model->addOperand(&type4);
1316   auto op4 = model->addOperand(&type23);
1317   // Phase 2, operations
1318   static int32_t param_init[] = {0};
1319   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1320   static int32_t param1_init[] = {0};
1321   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1322   static int32_t param2_init[] = {0};
1323   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1324   static int32_t param3_init[] = {0};
1325   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1326   static int32_t param4_init[] = {1};
1327   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1328   static int32_t param5_init[] = {1};
1329   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1330   static int32_t param6_init[] = {2};
1331   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1332   static int32_t param7_init[] = {0};
1333   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1334   static bool8 layout_init[] = {false};
1335   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1336   static int32_t param8_init[] = {1};
1337   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1338   static int32_t param9_init[] = {1};
1339   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1340   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1341   // Phase 3, inputs and outputs
1342   model->identifyInputsAndOutputs(
1343     {op1, op2, op3},
1344     {op4});
1345   // Phase 4: set relaxed execution
1346   model->relaxComputationFloat32toFloat16(true);
1347   assert(model->isValid());
1348 }
1349 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i)1350 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) {
1351   static std::set<int> ignore = {};
1352   return ignore.find(i) != ignore.end();
1353 }
1354 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model * model)1355 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) {
1356   OperandType type0(Type::BOOL, {});
1357   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
1358   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1359   OperandType type12(Type::TENSOR_FLOAT16, {4});
1360   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1361   OperandType type4(Type::INT32, {});
1362   // Phase 1, operands
1363   auto op1 = model->addOperand(&type10);
1364   auto op2 = model->addOperand(&type11);
1365   auto op3 = model->addOperand(&type12);
1366   auto param = model->addOperand(&type4);
1367   auto param1 = model->addOperand(&type4);
1368   auto param2 = model->addOperand(&type4);
1369   auto param3 = model->addOperand(&type4);
1370   auto param4 = model->addOperand(&type4);
1371   auto param5 = model->addOperand(&type4);
1372   auto param6 = model->addOperand(&type4);
1373   auto param7 = model->addOperand(&type4);
1374   auto layout = model->addOperand(&type0);
1375   auto param8 = model->addOperand(&type4);
1376   auto param9 = model->addOperand(&type4);
1377   auto op4 = model->addOperand(&type24);
1378   // Phase 2, operations
1379   static int32_t param_init[] = {0};
1380   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1381   static int32_t param1_init[] = {0};
1382   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1383   static int32_t param2_init[] = {0};
1384   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1385   static int32_t param3_init[] = {0};
1386   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1387   static int32_t param4_init[] = {1};
1388   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1389   static int32_t param5_init[] = {1};
1390   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1391   static int32_t param6_init[] = {2};
1392   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1393   static int32_t param7_init[] = {0};
1394   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1395   static bool8 layout_init[] = {false};
1396   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1397   static int32_t param8_init[] = {1};
1398   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1399   static int32_t param9_init[] = {1};
1400   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1401   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1402   // Phase 3, inputs and outputs
1403   model->identifyInputsAndOutputs(
1404     {op1, op2, op3},
1405     {op4});
1406   assert(model->isValid());
1407 }
1408 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i)1409 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i) {
1410   static std::set<int> ignore = {};
1411   return ignore.find(i) != ignore.end();
1412 }
1413 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model * model)1414 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) {
1415   OperandType type0(Type::BOOL, {});
1416   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1417   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1418   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
1419   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1420   OperandType type4(Type::INT32, {});
1421   // Phase 1, operands
1422   auto op1 = model->addOperand(&type13);
1423   auto op2 = model->addOperand(&type14);
1424   auto op3 = model->addOperand(&type15);
1425   auto param = model->addOperand(&type4);
1426   auto param1 = model->addOperand(&type4);
1427   auto param2 = model->addOperand(&type4);
1428   auto param3 = model->addOperand(&type4);
1429   auto param4 = model->addOperand(&type4);
1430   auto param5 = model->addOperand(&type4);
1431   auto param6 = model->addOperand(&type4);
1432   auto param7 = model->addOperand(&type4);
1433   auto layout = model->addOperand(&type0);
1434   auto param8 = model->addOperand(&type4);
1435   auto param9 = model->addOperand(&type4);
1436   auto op4 = model->addOperand(&type25);
1437   // Phase 2, operations
1438   static int32_t param_init[] = {0};
1439   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1440   static int32_t param1_init[] = {0};
1441   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1442   static int32_t param2_init[] = {0};
1443   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1444   static int32_t param3_init[] = {0};
1445   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1446   static int32_t param4_init[] = {1};
1447   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1448   static int32_t param5_init[] = {1};
1449   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1450   static int32_t param6_init[] = {2};
1451   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1452   static int32_t param7_init[] = {0};
1453   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1454   static bool8 layout_init[] = {false};
1455   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1456   static int32_t param8_init[] = {1};
1457   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1458   static int32_t param9_init[] = {1};
1459   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1460   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1461   // Phase 3, inputs and outputs
1462   model->identifyInputsAndOutputs(
1463     {op1, op2, op3},
1464     {op4});
1465   assert(model->isValid());
1466 }
1467 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i)1468 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) {
1469   static std::set<int> ignore = {};
1470   return ignore.find(i) != ignore.end();
1471 }
1472 
CreateModel_dynamic_output_shape_nchw(Model * model)1473 void CreateModel_dynamic_output_shape_nchw(Model *model) {
1474   OperandType type0(Type::BOOL, {});
1475   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1476   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1477   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1478   OperandType type3(Type::TENSOR_FLOAT32, {4});
1479   OperandType type4(Type::INT32, {});
1480   // Phase 1, operands
1481   auto op1 = model->addOperand(&type17);
1482   auto op2 = model->addOperand(&type2);
1483   auto op3 = model->addOperand(&type3);
1484   auto param = model->addOperand(&type4);
1485   auto param1 = model->addOperand(&type4);
1486   auto param2 = model->addOperand(&type4);
1487   auto param3 = model->addOperand(&type4);
1488   auto param4 = model->addOperand(&type4);
1489   auto param5 = model->addOperand(&type4);
1490   auto param6 = model->addOperand(&type4);
1491   auto param7 = model->addOperand(&type4);
1492   auto layout = model->addOperand(&type0);
1493   auto param8 = model->addOperand(&type4);
1494   auto param9 = model->addOperand(&type4);
1495   auto op4 = model->addOperand(&type23);
1496   // Phase 2, operations
1497   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1498   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1499   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1500   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1501   static int32_t param_init[] = {0};
1502   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1503   static int32_t param1_init[] = {0};
1504   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1505   static int32_t param2_init[] = {0};
1506   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1507   static int32_t param3_init[] = {0};
1508   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1509   static int32_t param4_init[] = {1};
1510   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1511   static int32_t param5_init[] = {1};
1512   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1513   static int32_t param6_init[] = {2};
1514   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1515   static int32_t param7_init[] = {0};
1516   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1517   static bool8 layout_init[] = {true};
1518   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1519   static int32_t param8_init[] = {1};
1520   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1521   static int32_t param9_init[] = {1};
1522   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1523   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1524   // Phase 3, inputs and outputs
1525   model->identifyInputsAndOutputs(
1526     {op1},
1527     {op4});
1528   assert(model->isValid());
1529 }
1530 
is_ignored_dynamic_output_shape_nchw(int i)1531 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
1532   static std::set<int> ignore = {};
1533   return ignore.find(i) != ignore.end();
1534 }
1535 
CreateModel_dynamic_output_shape_nchw_relaxed(Model * model)1536 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) {
1537   OperandType type0(Type::BOOL, {});
1538   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1539   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1540   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1541   OperandType type3(Type::TENSOR_FLOAT32, {4});
1542   OperandType type4(Type::INT32, {});
1543   // Phase 1, operands
1544   auto op1 = model->addOperand(&type17);
1545   auto op2 = model->addOperand(&type2);
1546   auto op3 = model->addOperand(&type3);
1547   auto param = model->addOperand(&type4);
1548   auto param1 = model->addOperand(&type4);
1549   auto param2 = model->addOperand(&type4);
1550   auto param3 = model->addOperand(&type4);
1551   auto param4 = model->addOperand(&type4);
1552   auto param5 = model->addOperand(&type4);
1553   auto param6 = model->addOperand(&type4);
1554   auto param7 = model->addOperand(&type4);
1555   auto layout = model->addOperand(&type0);
1556   auto param8 = model->addOperand(&type4);
1557   auto param9 = model->addOperand(&type4);
1558   auto op4 = model->addOperand(&type23);
1559   // Phase 2, operations
1560   static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1561   model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1562   static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1563   model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1564   static int32_t param_init[] = {0};
1565   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1566   static int32_t param1_init[] = {0};
1567   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1568   static int32_t param2_init[] = {0};
1569   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1570   static int32_t param3_init[] = {0};
1571   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1572   static int32_t param4_init[] = {1};
1573   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1574   static int32_t param5_init[] = {1};
1575   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1576   static int32_t param6_init[] = {2};
1577   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1578   static int32_t param7_init[] = {0};
1579   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1580   static bool8 layout_init[] = {true};
1581   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1582   static int32_t param8_init[] = {1};
1583   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1584   static int32_t param9_init[] = {1};
1585   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1586   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1587   // Phase 3, inputs and outputs
1588   model->identifyInputsAndOutputs(
1589     {op1},
1590     {op4});
1591   // Phase 4: set relaxed execution
1592   model->relaxComputationFloat32toFloat16(true);
1593   assert(model->isValid());
1594 }
1595 
is_ignored_dynamic_output_shape_nchw_relaxed(int i)1596 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
1597   static std::set<int> ignore = {};
1598   return ignore.find(i) != ignore.end();
1599 }
1600 
CreateModel_dynamic_output_shape_nchw_float16(Model * model)1601 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) {
1602   OperandType type0(Type::BOOL, {});
1603   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1604   OperandType type12(Type::TENSOR_FLOAT16, {4});
1605   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
1606   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1607   OperandType type4(Type::INT32, {});
1608   // Phase 1, operands
1609   auto op1 = model->addOperand(&type19);
1610   auto op2 = model->addOperand(&type11);
1611   auto op3 = model->addOperand(&type12);
1612   auto param = model->addOperand(&type4);
1613   auto param1 = model->addOperand(&type4);
1614   auto param2 = model->addOperand(&type4);
1615   auto param3 = model->addOperand(&type4);
1616   auto param4 = model->addOperand(&type4);
1617   auto param5 = model->addOperand(&type4);
1618   auto param6 = model->addOperand(&type4);
1619   auto param7 = model->addOperand(&type4);
1620   auto layout = model->addOperand(&type0);
1621   auto param8 = model->addOperand(&type4);
1622   auto param9 = model->addOperand(&type4);
1623   auto op4 = model->addOperand(&type24);
1624   // Phase 2, operations
1625   static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
1626   model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
1627   static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1628   model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
1629   static int32_t param_init[] = {0};
1630   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1631   static int32_t param1_init[] = {0};
1632   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1633   static int32_t param2_init[] = {0};
1634   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1635   static int32_t param3_init[] = {0};
1636   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1637   static int32_t param4_init[] = {1};
1638   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1639   static int32_t param5_init[] = {1};
1640   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1641   static int32_t param6_init[] = {2};
1642   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1643   static int32_t param7_init[] = {0};
1644   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1645   static bool8 layout_init[] = {true};
1646   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1647   static int32_t param8_init[] = {1};
1648   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1649   static int32_t param9_init[] = {1};
1650   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1651   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1652   // Phase 3, inputs and outputs
1653   model->identifyInputsAndOutputs(
1654     {op1},
1655     {op4});
1656   assert(model->isValid());
1657 }
1658 
is_ignored_dynamic_output_shape_nchw_float16(int i)1659 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
1660   static std::set<int> ignore = {};
1661   return ignore.find(i) != ignore.end();
1662 }
1663 
CreateModel_dynamic_output_shape_nchw_quant8(Model * model)1664 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) {
1665   OperandType type0(Type::BOOL, {});
1666   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1667   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
1668   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
1669   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1670   OperandType type4(Type::INT32, {});
1671   // Phase 1, operands
1672   auto op1 = model->addOperand(&type21);
1673   auto op2 = model->addOperand(&type14);
1674   auto op3 = model->addOperand(&type15);
1675   auto param = model->addOperand(&type4);
1676   auto param1 = model->addOperand(&type4);
1677   auto param2 = model->addOperand(&type4);
1678   auto param3 = model->addOperand(&type4);
1679   auto param4 = model->addOperand(&type4);
1680   auto param5 = model->addOperand(&type4);
1681   auto param6 = model->addOperand(&type4);
1682   auto param7 = model->addOperand(&type4);
1683   auto layout = model->addOperand(&type0);
1684   auto param8 = model->addOperand(&type4);
1685   auto param9 = model->addOperand(&type4);
1686   auto op4 = model->addOperand(&type25);
1687   // Phase 2, operations
1688   static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
1689   model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
1690   static int32_t op3_init[] = {200, 400, 600, 800};
1691   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
1692   static int32_t param_init[] = {0};
1693   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1694   static int32_t param1_init[] = {0};
1695   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1696   static int32_t param2_init[] = {0};
1697   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1698   static int32_t param3_init[] = {0};
1699   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1700   static int32_t param4_init[] = {1};
1701   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1702   static int32_t param5_init[] = {1};
1703   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1704   static int32_t param6_init[] = {2};
1705   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1706   static int32_t param7_init[] = {0};
1707   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1708   static bool8 layout_init[] = {true};
1709   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1710   static int32_t param8_init[] = {1};
1711   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1712   static int32_t param9_init[] = {1};
1713   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1714   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1715   // Phase 3, inputs and outputs
1716   model->identifyInputsAndOutputs(
1717     {op1},
1718     {op4});
1719   assert(model->isValid());
1720 }
1721 
is_ignored_dynamic_output_shape_nchw_quant8(int i)1722 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
1723   static std::set<int> ignore = {};
1724   return ignore.find(i) != ignore.end();
1725 }
1726 
CreateModel_dynamic_output_shape_nchw_weight_as_input(Model * model)1727 void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) {
1728   OperandType type0(Type::BOOL, {});
1729   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1730   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1731   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1732   OperandType type3(Type::TENSOR_FLOAT32, {4});
1733   OperandType type4(Type::INT32, {});
1734   // Phase 1, operands
1735   auto op1 = model->addOperand(&type17);
1736   auto op2 = model->addOperand(&type2);
1737   auto op3 = model->addOperand(&type3);
1738   auto param = model->addOperand(&type4);
1739   auto param1 = model->addOperand(&type4);
1740   auto param2 = model->addOperand(&type4);
1741   auto param3 = model->addOperand(&type4);
1742   auto param4 = model->addOperand(&type4);
1743   auto param5 = model->addOperand(&type4);
1744   auto param6 = model->addOperand(&type4);
1745   auto param7 = model->addOperand(&type4);
1746   auto layout = model->addOperand(&type0);
1747   auto param8 = model->addOperand(&type4);
1748   auto param9 = model->addOperand(&type4);
1749   auto op4 = model->addOperand(&type23);
1750   // Phase 2, operations
1751   static int32_t param_init[] = {0};
1752   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1753   static int32_t param1_init[] = {0};
1754   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1755   static int32_t param2_init[] = {0};
1756   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1757   static int32_t param3_init[] = {0};
1758   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1759   static int32_t param4_init[] = {1};
1760   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1761   static int32_t param5_init[] = {1};
1762   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1763   static int32_t param6_init[] = {2};
1764   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1765   static int32_t param7_init[] = {0};
1766   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1767   static bool8 layout_init[] = {true};
1768   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1769   static int32_t param8_init[] = {1};
1770   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1771   static int32_t param9_init[] = {1};
1772   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1773   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1774   // Phase 3, inputs and outputs
1775   model->identifyInputsAndOutputs(
1776     {op1, op2, op3},
1777     {op4});
1778   assert(model->isValid());
1779 }
1780 
is_ignored_dynamic_output_shape_nchw_weight_as_input(int i)1781 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) {
1782   static std::set<int> ignore = {};
1783   return ignore.find(i) != ignore.end();
1784 }
1785 
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model * model)1786 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) {
1787   OperandType type0(Type::BOOL, {});
1788   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1789   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1790   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1791   OperandType type3(Type::TENSOR_FLOAT32, {4});
1792   OperandType type4(Type::INT32, {});
1793   // Phase 1, operands
1794   auto op1 = model->addOperand(&type17);
1795   auto op2 = model->addOperand(&type2);
1796   auto op3 = model->addOperand(&type3);
1797   auto param = model->addOperand(&type4);
1798   auto param1 = model->addOperand(&type4);
1799   auto param2 = model->addOperand(&type4);
1800   auto param3 = model->addOperand(&type4);
1801   auto param4 = model->addOperand(&type4);
1802   auto param5 = model->addOperand(&type4);
1803   auto param6 = model->addOperand(&type4);
1804   auto param7 = model->addOperand(&type4);
1805   auto layout = model->addOperand(&type0);
1806   auto param8 = model->addOperand(&type4);
1807   auto param9 = model->addOperand(&type4);
1808   auto op4 = model->addOperand(&type23);
1809   // Phase 2, operations
1810   static int32_t param_init[] = {0};
1811   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1812   static int32_t param1_init[] = {0};
1813   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1814   static int32_t param2_init[] = {0};
1815   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1816   static int32_t param3_init[] = {0};
1817   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1818   static int32_t param4_init[] = {1};
1819   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1820   static int32_t param5_init[] = {1};
1821   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1822   static int32_t param6_init[] = {2};
1823   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1824   static int32_t param7_init[] = {0};
1825   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1826   static bool8 layout_init[] = {true};
1827   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1828   static int32_t param8_init[] = {1};
1829   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1830   static int32_t param9_init[] = {1};
1831   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1832   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1833   // Phase 3, inputs and outputs
1834   model->identifyInputsAndOutputs(
1835     {op1, op2, op3},
1836     {op4});
1837   // Phase 4: set relaxed execution
1838   model->relaxComputationFloat32toFloat16(true);
1839   assert(model->isValid());
1840 }
1841 
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i)1842 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) {
1843   static std::set<int> ignore = {};
1844   return ignore.find(i) != ignore.end();
1845 }
1846 
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model * model)1847 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) {
1848   OperandType type0(Type::BOOL, {});
1849   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1850   OperandType type12(Type::TENSOR_FLOAT16, {4});
1851   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
1852   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1853   OperandType type4(Type::INT32, {});
1854   // Phase 1, operands
1855   auto op1 = model->addOperand(&type19);
1856   auto op2 = model->addOperand(&type11);
1857   auto op3 = model->addOperand(&type12);
1858   auto param = model->addOperand(&type4);
1859   auto param1 = model->addOperand(&type4);
1860   auto param2 = model->addOperand(&type4);
1861   auto param3 = model->addOperand(&type4);
1862   auto param4 = model->addOperand(&type4);
1863   auto param5 = model->addOperand(&type4);
1864   auto param6 = model->addOperand(&type4);
1865   auto param7 = model->addOperand(&type4);
1866   auto layout = model->addOperand(&type0);
1867   auto param8 = model->addOperand(&type4);
1868   auto param9 = model->addOperand(&type4);
1869   auto op4 = model->addOperand(&type24);
1870   // Phase 2, operations
1871   static int32_t param_init[] = {0};
1872   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1873   static int32_t param1_init[] = {0};
1874   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1875   static int32_t param2_init[] = {0};
1876   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1877   static int32_t param3_init[] = {0};
1878   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1879   static int32_t param4_init[] = {1};
1880   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1881   static int32_t param5_init[] = {1};
1882   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1883   static int32_t param6_init[] = {2};
1884   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1885   static int32_t param7_init[] = {0};
1886   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1887   static bool8 layout_init[] = {true};
1888   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1889   static int32_t param8_init[] = {1};
1890   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1891   static int32_t param9_init[] = {1};
1892   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1893   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1894   // Phase 3, inputs and outputs
1895   model->identifyInputsAndOutputs(
1896     {op1, op2, op3},
1897     {op4});
1898   assert(model->isValid());
1899 }
1900 
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i)1901 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i) {
1902   static std::set<int> ignore = {};
1903   return ignore.find(i) != ignore.end();
1904 }
1905 
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model * model)1906 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) {
1907   OperandType type0(Type::BOOL, {});
1908   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1909   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
1910   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
1911   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1912   OperandType type4(Type::INT32, {});
1913   // Phase 1, operands
1914   auto op1 = model->addOperand(&type21);
1915   auto op2 = model->addOperand(&type14);
1916   auto op3 = model->addOperand(&type15);
1917   auto param = model->addOperand(&type4);
1918   auto param1 = model->addOperand(&type4);
1919   auto param2 = model->addOperand(&type4);
1920   auto param3 = model->addOperand(&type4);
1921   auto param4 = model->addOperand(&type4);
1922   auto param5 = model->addOperand(&type4);
1923   auto param6 = model->addOperand(&type4);
1924   auto param7 = model->addOperand(&type4);
1925   auto layout = model->addOperand(&type0);
1926   auto param8 = model->addOperand(&type4);
1927   auto param9 = model->addOperand(&type4);
1928   auto op4 = model->addOperand(&type25);
1929   // Phase 2, operations
1930   static int32_t param_init[] = {0};
1931   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1932   static int32_t param1_init[] = {0};
1933   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1934   static int32_t param2_init[] = {0};
1935   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1936   static int32_t param3_init[] = {0};
1937   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1938   static int32_t param4_init[] = {1};
1939   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1940   static int32_t param5_init[] = {1};
1941   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1942   static int32_t param6_init[] = {2};
1943   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1944   static int32_t param7_init[] = {0};
1945   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1946   static bool8 layout_init[] = {true};
1947   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1948   static int32_t param8_init[] = {1};
1949   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1950   static int32_t param9_init[] = {1};
1951   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1952   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout, param8, param9}, {op4});
1953   // Phase 3, inputs and outputs
1954   model->identifyInputsAndOutputs(
1955     {op1, op2, op3},
1956     {op4});
1957   assert(model->isValid());
1958 }
1959 
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i)1960 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i) {
1961   static std::set<int> ignore = {};
1962   return ignore.find(i) != ignore.end();
1963 }
1964 
CreateModel_nhwc_2(Model * model)1965 void CreateModel_nhwc_2(Model *model) {
1966   OperandType type0(Type::BOOL, {});
1967   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1968   OperandType type3(Type::TENSOR_FLOAT32, {4});
1969   OperandType type4(Type::INT32, {});
1970   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
1971   // Phase 1, operands
1972   auto op11 = model->addOperand(&type5);
1973   auto op21 = model->addOperand(&type2);
1974   auto op31 = model->addOperand(&type3);
1975   auto param10 = model->addOperand(&type4);
1976   auto param11 = model->addOperand(&type4);
1977   auto param12 = model->addOperand(&type4);
1978   auto param13 = model->addOperand(&type4);
1979   auto param14 = model->addOperand(&type4);
1980   auto param15 = model->addOperand(&type4);
1981   auto param16 = model->addOperand(&type4);
1982   auto param17 = model->addOperand(&type4);
1983   auto layout = model->addOperand(&type0);
1984   auto param18 = model->addOperand(&type4);
1985   auto param19 = model->addOperand(&type4);
1986   auto op41 = model->addOperand(&type2);
1987   // Phase 2, operations
1988   static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
1989   model->setOperandValue(op21, op21_init, sizeof(float) * 16);
1990   static float op31_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
1991   model->setOperandValue(op31, op31_init, sizeof(float) * 4);
1992   static int32_t param10_init[] = {0};
1993   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
1994   static int32_t param11_init[] = {0};
1995   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1996   static int32_t param12_init[] = {0};
1997   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1998   static int32_t param13_init[] = {0};
1999   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2000   static int32_t param14_init[] = {1};
2001   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2002   static int32_t param15_init[] = {1};
2003   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2004   static int32_t param16_init[] = {2};
2005   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2006   static int32_t param17_init[] = {0};
2007   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2008   static bool8 layout_init[] = {false};
2009   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2010   static int32_t param18_init[] = {2};
2011   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2012   static int32_t param19_init[] = {2};
2013   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2014   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2015   // Phase 3, inputs and outputs
2016   model->identifyInputsAndOutputs(
2017     {op11},
2018     {op41});
2019   assert(model->isValid());
2020 }
2021 
is_ignored_nhwc_2(int i)2022 inline bool is_ignored_nhwc_2(int i) {
2023   static std::set<int> ignore = {};
2024   return ignore.find(i) != ignore.end();
2025 }
2026 
CreateModel_nhwc_weight_as_input_2(Model * model)2027 void CreateModel_nhwc_weight_as_input_2(Model *model) {
2028   OperandType type0(Type::BOOL, {});
2029   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2030   OperandType type3(Type::TENSOR_FLOAT32, {4});
2031   OperandType type4(Type::INT32, {});
2032   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
2033   // Phase 1, operands
2034   auto op11 = model->addOperand(&type5);
2035   auto op21 = model->addOperand(&type2);
2036   auto op31 = model->addOperand(&type3);
2037   auto param10 = model->addOperand(&type4);
2038   auto param11 = model->addOperand(&type4);
2039   auto param12 = model->addOperand(&type4);
2040   auto param13 = model->addOperand(&type4);
2041   auto param14 = model->addOperand(&type4);
2042   auto param15 = model->addOperand(&type4);
2043   auto param16 = model->addOperand(&type4);
2044   auto param17 = model->addOperand(&type4);
2045   auto layout = model->addOperand(&type0);
2046   auto param18 = model->addOperand(&type4);
2047   auto param19 = model->addOperand(&type4);
2048   auto op41 = model->addOperand(&type2);
2049   // Phase 2, operations
2050   static int32_t param10_init[] = {0};
2051   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2052   static int32_t param11_init[] = {0};
2053   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2054   static int32_t param12_init[] = {0};
2055   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2056   static int32_t param13_init[] = {0};
2057   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2058   static int32_t param14_init[] = {1};
2059   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2060   static int32_t param15_init[] = {1};
2061   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2062   static int32_t param16_init[] = {2};
2063   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2064   static int32_t param17_init[] = {0};
2065   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2066   static bool8 layout_init[] = {false};
2067   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2068   static int32_t param18_init[] = {2};
2069   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2070   static int32_t param19_init[] = {2};
2071   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2072   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2073   // Phase 3, inputs and outputs
2074   model->identifyInputsAndOutputs(
2075     {op11, op21, op31},
2076     {op41});
2077   assert(model->isValid());
2078 }
2079 
is_ignored_nhwc_weight_as_input_2(int i)2080 inline bool is_ignored_nhwc_weight_as_input_2(int i) {
2081   static std::set<int> ignore = {};
2082   return ignore.find(i) != ignore.end();
2083 }
2084 
CreateModel_nchw_2(Model * model)2085 void CreateModel_nchw_2(Model *model) {
2086   OperandType type0(Type::BOOL, {});
2087   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
2088   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2089   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
2090   OperandType type3(Type::TENSOR_FLOAT32, {4});
2091   OperandType type4(Type::INT32, {});
2092   // Phase 1, operands
2093   auto op11 = model->addOperand(&type26);
2094   auto op21 = model->addOperand(&type2);
2095   auto op31 = model->addOperand(&type3);
2096   auto param10 = model->addOperand(&type4);
2097   auto param11 = model->addOperand(&type4);
2098   auto param12 = model->addOperand(&type4);
2099   auto param13 = model->addOperand(&type4);
2100   auto param14 = model->addOperand(&type4);
2101   auto param15 = model->addOperand(&type4);
2102   auto param16 = model->addOperand(&type4);
2103   auto param17 = model->addOperand(&type4);
2104   auto layout = model->addOperand(&type0);
2105   auto param18 = model->addOperand(&type4);
2106   auto param19 = model->addOperand(&type4);
2107   auto op41 = model->addOperand(&type18);
2108   // Phase 2, operations
2109   static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
2110   model->setOperandValue(op21, op21_init, sizeof(float) * 16);
2111   static float op31_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
2112   model->setOperandValue(op31, op31_init, sizeof(float) * 4);
2113   static int32_t param10_init[] = {0};
2114   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2115   static int32_t param11_init[] = {0};
2116   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2117   static int32_t param12_init[] = {0};
2118   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2119   static int32_t param13_init[] = {0};
2120   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2121   static int32_t param14_init[] = {1};
2122   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2123   static int32_t param15_init[] = {1};
2124   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2125   static int32_t param16_init[] = {2};
2126   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2127   static int32_t param17_init[] = {0};
2128   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2129   static bool8 layout_init[] = {true};
2130   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2131   static int32_t param18_init[] = {2};
2132   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2133   static int32_t param19_init[] = {2};
2134   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2135   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2136   // Phase 3, inputs and outputs
2137   model->identifyInputsAndOutputs(
2138     {op11},
2139     {op41});
2140   assert(model->isValid());
2141 }
2142 
is_ignored_nchw_2(int i)2143 inline bool is_ignored_nchw_2(int i) {
2144   static std::set<int> ignore = {};
2145   return ignore.find(i) != ignore.end();
2146 }
2147 
CreateModel_nchw_weight_as_input_2(Model * model)2148 void CreateModel_nchw_weight_as_input_2(Model *model) {
2149   OperandType type0(Type::BOOL, {});
2150   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
2151   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2152   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
2153   OperandType type3(Type::TENSOR_FLOAT32, {4});
2154   OperandType type4(Type::INT32, {});
2155   // Phase 1, operands
2156   auto op11 = model->addOperand(&type26);
2157   auto op21 = model->addOperand(&type2);
2158   auto op31 = model->addOperand(&type3);
2159   auto param10 = model->addOperand(&type4);
2160   auto param11 = model->addOperand(&type4);
2161   auto param12 = model->addOperand(&type4);
2162   auto param13 = model->addOperand(&type4);
2163   auto param14 = model->addOperand(&type4);
2164   auto param15 = model->addOperand(&type4);
2165   auto param16 = model->addOperand(&type4);
2166   auto param17 = model->addOperand(&type4);
2167   auto layout = model->addOperand(&type0);
2168   auto param18 = model->addOperand(&type4);
2169   auto param19 = model->addOperand(&type4);
2170   auto op41 = model->addOperand(&type18);
2171   // Phase 2, operations
2172   static int32_t param10_init[] = {0};
2173   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2174   static int32_t param11_init[] = {0};
2175   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2176   static int32_t param12_init[] = {0};
2177   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2178   static int32_t param13_init[] = {0};
2179   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2180   static int32_t param14_init[] = {1};
2181   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2182   static int32_t param15_init[] = {1};
2183   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2184   static int32_t param16_init[] = {2};
2185   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2186   static int32_t param17_init[] = {0};
2187   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2188   static bool8 layout_init[] = {true};
2189   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2190   static int32_t param18_init[] = {2};
2191   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2192   static int32_t param19_init[] = {2};
2193   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2194   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2195   // Phase 3, inputs and outputs
2196   model->identifyInputsAndOutputs(
2197     {op11, op21, op31},
2198     {op41});
2199   assert(model->isValid());
2200 }
2201 
is_ignored_nchw_weight_as_input_2(int i)2202 inline bool is_ignored_nchw_weight_as_input_2(int i) {
2203   static std::set<int> ignore = {};
2204   return ignore.find(i) != ignore.end();
2205 }
2206 
CreateModel_dynamic_output_shape_nhwc_2(Model * model)2207 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) {
2208   OperandType type0(Type::BOOL, {});
2209   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2210   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2211   OperandType type3(Type::TENSOR_FLOAT32, {4});
2212   OperandType type4(Type::INT32, {});
2213   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
2214   // Phase 1, operands
2215   auto op11 = model->addOperand(&type5);
2216   auto op21 = model->addOperand(&type2);
2217   auto op31 = model->addOperand(&type3);
2218   auto param10 = model->addOperand(&type4);
2219   auto param11 = model->addOperand(&type4);
2220   auto param12 = model->addOperand(&type4);
2221   auto param13 = model->addOperand(&type4);
2222   auto param14 = model->addOperand(&type4);
2223   auto param15 = model->addOperand(&type4);
2224   auto param16 = model->addOperand(&type4);
2225   auto param17 = model->addOperand(&type4);
2226   auto layout = model->addOperand(&type0);
2227   auto param18 = model->addOperand(&type4);
2228   auto param19 = model->addOperand(&type4);
2229   auto op41 = model->addOperand(&type23);
2230   // Phase 2, operations
2231   static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
2232   model->setOperandValue(op21, op21_init, sizeof(float) * 16);
2233   static float op31_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
2234   model->setOperandValue(op31, op31_init, sizeof(float) * 4);
2235   static int32_t param10_init[] = {0};
2236   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2237   static int32_t param11_init[] = {0};
2238   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2239   static int32_t param12_init[] = {0};
2240   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2241   static int32_t param13_init[] = {0};
2242   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2243   static int32_t param14_init[] = {1};
2244   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2245   static int32_t param15_init[] = {1};
2246   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2247   static int32_t param16_init[] = {2};
2248   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2249   static int32_t param17_init[] = {0};
2250   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2251   static bool8 layout_init[] = {false};
2252   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2253   static int32_t param18_init[] = {2};
2254   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2255   static int32_t param19_init[] = {2};
2256   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2257   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2258   // Phase 3, inputs and outputs
2259   model->identifyInputsAndOutputs(
2260     {op11},
2261     {op41});
2262   assert(model->isValid());
2263 }
2264 
is_ignored_dynamic_output_shape_nhwc_2(int i)2265 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
2266   static std::set<int> ignore = {};
2267   return ignore.find(i) != ignore.end();
2268 }
2269 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model * model)2270 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) {
2271   OperandType type0(Type::BOOL, {});
2272   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2273   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2274   OperandType type3(Type::TENSOR_FLOAT32, {4});
2275   OperandType type4(Type::INT32, {});
2276   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
2277   // Phase 1, operands
2278   auto op11 = model->addOperand(&type5);
2279   auto op21 = model->addOperand(&type2);
2280   auto op31 = model->addOperand(&type3);
2281   auto param10 = model->addOperand(&type4);
2282   auto param11 = model->addOperand(&type4);
2283   auto param12 = model->addOperand(&type4);
2284   auto param13 = model->addOperand(&type4);
2285   auto param14 = model->addOperand(&type4);
2286   auto param15 = model->addOperand(&type4);
2287   auto param16 = model->addOperand(&type4);
2288   auto param17 = model->addOperand(&type4);
2289   auto layout = model->addOperand(&type0);
2290   auto param18 = model->addOperand(&type4);
2291   auto param19 = model->addOperand(&type4);
2292   auto op41 = model->addOperand(&type23);
2293   // Phase 2, operations
2294   static int32_t param10_init[] = {0};
2295   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2296   static int32_t param11_init[] = {0};
2297   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2298   static int32_t param12_init[] = {0};
2299   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2300   static int32_t param13_init[] = {0};
2301   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2302   static int32_t param14_init[] = {1};
2303   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2304   static int32_t param15_init[] = {1};
2305   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2306   static int32_t param16_init[] = {2};
2307   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2308   static int32_t param17_init[] = {0};
2309   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2310   static bool8 layout_init[] = {false};
2311   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2312   static int32_t param18_init[] = {2};
2313   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2314   static int32_t param19_init[] = {2};
2315   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2316   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2317   // Phase 3, inputs and outputs
2318   model->identifyInputsAndOutputs(
2319     {op11, op21, op31},
2320     {op41});
2321   assert(model->isValid());
2322 }
2323 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i)2324 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) {
2325   static std::set<int> ignore = {};
2326   return ignore.find(i) != ignore.end();
2327 }
2328 
CreateModel_dynamic_output_shape_nchw_2(Model * model)2329 void CreateModel_dynamic_output_shape_nchw_2(Model *model) {
2330   OperandType type0(Type::BOOL, {});
2331   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2332   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2333   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
2334   OperandType type3(Type::TENSOR_FLOAT32, {4});
2335   OperandType type4(Type::INT32, {});
2336   // Phase 1, operands
2337   auto op11 = model->addOperand(&type26);
2338   auto op21 = model->addOperand(&type2);
2339   auto op31 = model->addOperand(&type3);
2340   auto param10 = model->addOperand(&type4);
2341   auto param11 = model->addOperand(&type4);
2342   auto param12 = model->addOperand(&type4);
2343   auto param13 = model->addOperand(&type4);
2344   auto param14 = model->addOperand(&type4);
2345   auto param15 = model->addOperand(&type4);
2346   auto param16 = model->addOperand(&type4);
2347   auto param17 = model->addOperand(&type4);
2348   auto layout = model->addOperand(&type0);
2349   auto param18 = model->addOperand(&type4);
2350   auto param19 = model->addOperand(&type4);
2351   auto op41 = model->addOperand(&type23);
2352   // Phase 2, operations
2353   static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
2354   model->setOperandValue(op21, op21_init, sizeof(float) * 16);
2355   static float op31_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
2356   model->setOperandValue(op31, op31_init, sizeof(float) * 4);
2357   static int32_t param10_init[] = {0};
2358   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2359   static int32_t param11_init[] = {0};
2360   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2361   static int32_t param12_init[] = {0};
2362   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2363   static int32_t param13_init[] = {0};
2364   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2365   static int32_t param14_init[] = {1};
2366   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2367   static int32_t param15_init[] = {1};
2368   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2369   static int32_t param16_init[] = {2};
2370   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2371   static int32_t param17_init[] = {0};
2372   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2373   static bool8 layout_init[] = {true};
2374   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2375   static int32_t param18_init[] = {2};
2376   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2377   static int32_t param19_init[] = {2};
2378   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2379   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2380   // Phase 3, inputs and outputs
2381   model->identifyInputsAndOutputs(
2382     {op11},
2383     {op41});
2384   assert(model->isValid());
2385 }
2386 
is_ignored_dynamic_output_shape_nchw_2(int i)2387 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
2388   static std::set<int> ignore = {};
2389   return ignore.find(i) != ignore.end();
2390 }
2391 
CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model * model)2392 void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) {
2393   OperandType type0(Type::BOOL, {});
2394   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2395   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2396   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
2397   OperandType type3(Type::TENSOR_FLOAT32, {4});
2398   OperandType type4(Type::INT32, {});
2399   // Phase 1, operands
2400   auto op11 = model->addOperand(&type26);
2401   auto op21 = model->addOperand(&type2);
2402   auto op31 = model->addOperand(&type3);
2403   auto param10 = model->addOperand(&type4);
2404   auto param11 = model->addOperand(&type4);
2405   auto param12 = model->addOperand(&type4);
2406   auto param13 = model->addOperand(&type4);
2407   auto param14 = model->addOperand(&type4);
2408   auto param15 = model->addOperand(&type4);
2409   auto param16 = model->addOperand(&type4);
2410   auto param17 = model->addOperand(&type4);
2411   auto layout = model->addOperand(&type0);
2412   auto param18 = model->addOperand(&type4);
2413   auto param19 = model->addOperand(&type4);
2414   auto op41 = model->addOperand(&type23);
2415   // Phase 2, operations
2416   static int32_t param10_init[] = {0};
2417   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2418   static int32_t param11_init[] = {0};
2419   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2420   static int32_t param12_init[] = {0};
2421   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2422   static int32_t param13_init[] = {0};
2423   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2424   static int32_t param14_init[] = {1};
2425   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2426   static int32_t param15_init[] = {1};
2427   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2428   static int32_t param16_init[] = {2};
2429   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2430   static int32_t param17_init[] = {0};
2431   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2432   static bool8 layout_init[] = {true};
2433   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2434   static int32_t param18_init[] = {2};
2435   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
2436   static int32_t param19_init[] = {2};
2437   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
2438   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param10, param11, param12, param13, param14, param15, param16, param17, layout, param18, param19}, {op41});
2439   // Phase 3, inputs and outputs
2440   model->identifyInputsAndOutputs(
2441     {op11, op21, op31},
2442     {op41});
2443   assert(model->isValid());
2444 }
2445 
is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i)2446 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) {
2447   static std::set<int> ignore = {};
2448   return ignore.find(i) != ignore.end();
2449 }
2450 
CreateModel_nhwc_3(Model * model)2451 void CreateModel_nhwc_3(Model *model) {
2452   OperandType type0(Type::BOOL, {});
2453   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
2454   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2455   OperandType type3(Type::TENSOR_FLOAT32, {4});
2456   OperandType type4(Type::INT32, {});
2457   // Phase 1, operands
2458   auto op12 = model->addOperand(&type1);
2459   auto op22 = model->addOperand(&type2);
2460   auto op32 = model->addOperand(&type3);
2461   auto param20 = model->addOperand(&type4);
2462   auto param21 = model->addOperand(&type4);
2463   auto param22 = model->addOperand(&type4);
2464   auto param23 = model->addOperand(&type4);
2465   auto param24 = model->addOperand(&type4);
2466   auto layout = model->addOperand(&type0);
2467   auto param25 = model->addOperand(&type4);
2468   auto param26 = model->addOperand(&type4);
2469   auto op42 = model->addOperand(&type2);
2470   // Phase 2, operations
2471   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2472   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
2473   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2474   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
2475   static int32_t param20_init[] = {2};
2476   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2477   static int32_t param21_init[] = {1};
2478   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2479   static int32_t param22_init[] = {1};
2480   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2481   static int32_t param23_init[] = {2};
2482   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2483   static int32_t param24_init[] = {0};
2484   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2485   static bool8 layout_init[] = {false};
2486   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2487   static int32_t param25_init[] = {1};
2488   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2489   static int32_t param26_init[] = {1};
2490   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2491   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2492   // Phase 3, inputs and outputs
2493   model->identifyInputsAndOutputs(
2494     {op12},
2495     {op42});
2496   assert(model->isValid());
2497 }
2498 
is_ignored_nhwc_3(int i)2499 inline bool is_ignored_nhwc_3(int i) {
2500   static std::set<int> ignore = {};
2501   return ignore.find(i) != ignore.end();
2502 }
2503 
CreateModel_nhwc_relaxed_2(Model * model)2504 void CreateModel_nhwc_relaxed_2(Model *model) {
2505   OperandType type0(Type::BOOL, {});
2506   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
2507   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2508   OperandType type3(Type::TENSOR_FLOAT32, {4});
2509   OperandType type4(Type::INT32, {});
2510   // Phase 1, operands
2511   auto op12 = model->addOperand(&type1);
2512   auto op22 = model->addOperand(&type2);
2513   auto op32 = model->addOperand(&type3);
2514   auto param20 = model->addOperand(&type4);
2515   auto param21 = model->addOperand(&type4);
2516   auto param22 = model->addOperand(&type4);
2517   auto param23 = model->addOperand(&type4);
2518   auto param24 = model->addOperand(&type4);
2519   auto layout = model->addOperand(&type0);
2520   auto param25 = model->addOperand(&type4);
2521   auto param26 = model->addOperand(&type4);
2522   auto op42 = model->addOperand(&type2);
2523   // Phase 2, operations
2524   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2525   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
2526   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2527   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
2528   static int32_t param20_init[] = {2};
2529   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2530   static int32_t param21_init[] = {1};
2531   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2532   static int32_t param22_init[] = {1};
2533   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2534   static int32_t param23_init[] = {2};
2535   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2536   static int32_t param24_init[] = {0};
2537   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2538   static bool8 layout_init[] = {false};
2539   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2540   static int32_t param25_init[] = {1};
2541   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2542   static int32_t param26_init[] = {1};
2543   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2544   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2545   // Phase 3, inputs and outputs
2546   model->identifyInputsAndOutputs(
2547     {op12},
2548     {op42});
2549   // Phase 4: set relaxed execution
2550   model->relaxComputationFloat32toFloat16(true);
2551   assert(model->isValid());
2552 }
2553 
is_ignored_nhwc_relaxed_2(int i)2554 inline bool is_ignored_nhwc_relaxed_2(int i) {
2555   static std::set<int> ignore = {};
2556   return ignore.find(i) != ignore.end();
2557 }
2558 
CreateModel_nhwc_float16_2(Model * model)2559 void CreateModel_nhwc_float16_2(Model *model) {
2560   OperandType type0(Type::BOOL, {});
2561   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
2562   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2563   OperandType type12(Type::TENSOR_FLOAT16, {4});
2564   OperandType type4(Type::INT32, {});
2565   // Phase 1, operands
2566   auto op12 = model->addOperand(&type10);
2567   auto op22 = model->addOperand(&type11);
2568   auto op32 = model->addOperand(&type12);
2569   auto param20 = model->addOperand(&type4);
2570   auto param21 = model->addOperand(&type4);
2571   auto param22 = model->addOperand(&type4);
2572   auto param23 = model->addOperand(&type4);
2573   auto param24 = model->addOperand(&type4);
2574   auto layout = model->addOperand(&type0);
2575   auto param25 = model->addOperand(&type4);
2576   auto param26 = model->addOperand(&type4);
2577   auto op42 = model->addOperand(&type11);
2578   // Phase 2, operations
2579   static _Float16 op22_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
2580   model->setOperandValue(op22, op22_init, sizeof(_Float16) * 16);
2581   static _Float16 op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2582   model->setOperandValue(op32, op32_init, sizeof(_Float16) * 4);
2583   static int32_t param20_init[] = {2};
2584   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2585   static int32_t param21_init[] = {1};
2586   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2587   static int32_t param22_init[] = {1};
2588   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2589   static int32_t param23_init[] = {2};
2590   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2591   static int32_t param24_init[] = {0};
2592   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2593   static bool8 layout_init[] = {false};
2594   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2595   static int32_t param25_init[] = {1};
2596   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2597   static int32_t param26_init[] = {1};
2598   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2599   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2600   // Phase 3, inputs and outputs
2601   model->identifyInputsAndOutputs(
2602     {op12},
2603     {op42});
2604   assert(model->isValid());
2605 }
2606 
is_ignored_nhwc_float16_2(int i)2607 inline bool is_ignored_nhwc_float16_2(int i) {
2608   static std::set<int> ignore = {};
2609   return ignore.find(i) != ignore.end();
2610 }
2611 
CreateModel_nhwc_quant8_2(Model * model)2612 void CreateModel_nhwc_quant8_2(Model *model) {
2613   OperandType type0(Type::BOOL, {});
2614   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
2615   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
2616   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
2617   OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
2618   OperandType type4(Type::INT32, {});
2619   // Phase 1, operands
2620   auto op12 = model->addOperand(&type13);
2621   auto op22 = model->addOperand(&type14);
2622   auto op32 = model->addOperand(&type15);
2623   auto param20 = model->addOperand(&type4);
2624   auto param21 = model->addOperand(&type4);
2625   auto param22 = model->addOperand(&type4);
2626   auto param23 = model->addOperand(&type4);
2627   auto param24 = model->addOperand(&type4);
2628   auto layout = model->addOperand(&type0);
2629   auto param25 = model->addOperand(&type4);
2630   auto param26 = model->addOperand(&type4);
2631   auto op42 = model->addOperand(&type16);
2632   // Phase 2, operations
2633   static uint8_t op22_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
2634   model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 16);
2635   static int32_t op32_init[] = {200, 400, 600, 800};
2636   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
2637   static int32_t param20_init[] = {2};
2638   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2639   static int32_t param21_init[] = {1};
2640   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2641   static int32_t param22_init[] = {1};
2642   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2643   static int32_t param23_init[] = {2};
2644   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2645   static int32_t param24_init[] = {0};
2646   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2647   static bool8 layout_init[] = {false};
2648   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2649   static int32_t param25_init[] = {1};
2650   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2651   static int32_t param26_init[] = {1};
2652   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2653   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2654   // Phase 3, inputs and outputs
2655   model->identifyInputsAndOutputs(
2656     {op12},
2657     {op42});
2658   assert(model->isValid());
2659 }
2660 
is_ignored_nhwc_quant8_2(int i)2661 inline bool is_ignored_nhwc_quant8_2(int i) {
2662   static std::set<int> ignore = {};
2663   return ignore.find(i) != ignore.end();
2664 }
2665 
CreateModel_nhwc_weight_as_input_3(Model * model)2666 void CreateModel_nhwc_weight_as_input_3(Model *model) {
2667   OperandType type0(Type::BOOL, {});
2668   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
2669   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2670   OperandType type3(Type::TENSOR_FLOAT32, {4});
2671   OperandType type4(Type::INT32, {});
2672   // Phase 1, operands
2673   auto op12 = model->addOperand(&type1);
2674   auto op22 = model->addOperand(&type2);
2675   auto op32 = model->addOperand(&type3);
2676   auto param20 = model->addOperand(&type4);
2677   auto param21 = model->addOperand(&type4);
2678   auto param22 = model->addOperand(&type4);
2679   auto param23 = model->addOperand(&type4);
2680   auto param24 = model->addOperand(&type4);
2681   auto layout = model->addOperand(&type0);
2682   auto param25 = model->addOperand(&type4);
2683   auto param26 = model->addOperand(&type4);
2684   auto op42 = model->addOperand(&type2);
2685   // Phase 2, operations
2686   static int32_t param20_init[] = {2};
2687   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2688   static int32_t param21_init[] = {1};
2689   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2690   static int32_t param22_init[] = {1};
2691   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2692   static int32_t param23_init[] = {2};
2693   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2694   static int32_t param24_init[] = {0};
2695   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2696   static bool8 layout_init[] = {false};
2697   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2698   static int32_t param25_init[] = {1};
2699   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2700   static int32_t param26_init[] = {1};
2701   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2702   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2703   // Phase 3, inputs and outputs
2704   model->identifyInputsAndOutputs(
2705     {op12, op22, op32},
2706     {op42});
2707   assert(model->isValid());
2708 }
2709 
is_ignored_nhwc_weight_as_input_3(int i)2710 inline bool is_ignored_nhwc_weight_as_input_3(int i) {
2711   static std::set<int> ignore = {};
2712   return ignore.find(i) != ignore.end();
2713 }
2714 
CreateModel_nhwc_weight_as_input_relaxed_2(Model * model)2715 void CreateModel_nhwc_weight_as_input_relaxed_2(Model *model) {
2716   OperandType type0(Type::BOOL, {});
2717   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
2718   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2719   OperandType type3(Type::TENSOR_FLOAT32, {4});
2720   OperandType type4(Type::INT32, {});
2721   // Phase 1, operands
2722   auto op12 = model->addOperand(&type1);
2723   auto op22 = model->addOperand(&type2);
2724   auto op32 = model->addOperand(&type3);
2725   auto param20 = model->addOperand(&type4);
2726   auto param21 = model->addOperand(&type4);
2727   auto param22 = model->addOperand(&type4);
2728   auto param23 = model->addOperand(&type4);
2729   auto param24 = model->addOperand(&type4);
2730   auto layout = model->addOperand(&type0);
2731   auto param25 = model->addOperand(&type4);
2732   auto param26 = model->addOperand(&type4);
2733   auto op42 = model->addOperand(&type2);
2734   // Phase 2, operations
2735   static int32_t param20_init[] = {2};
2736   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2737   static int32_t param21_init[] = {1};
2738   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2739   static int32_t param22_init[] = {1};
2740   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2741   static int32_t param23_init[] = {2};
2742   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2743   static int32_t param24_init[] = {0};
2744   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2745   static bool8 layout_init[] = {false};
2746   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2747   static int32_t param25_init[] = {1};
2748   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2749   static int32_t param26_init[] = {1};
2750   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2751   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2752   // Phase 3, inputs and outputs
2753   model->identifyInputsAndOutputs(
2754     {op12, op22, op32},
2755     {op42});
2756   // Phase 4: set relaxed execution
2757   model->relaxComputationFloat32toFloat16(true);
2758   assert(model->isValid());
2759 }
2760 
is_ignored_nhwc_weight_as_input_relaxed_2(int i)2761 inline bool is_ignored_nhwc_weight_as_input_relaxed_2(int i) {
2762   static std::set<int> ignore = {};
2763   return ignore.find(i) != ignore.end();
2764 }
2765 
CreateModel_nhwc_weight_as_input_float16_2(Model * model)2766 void CreateModel_nhwc_weight_as_input_float16_2(Model *model) {
2767   OperandType type0(Type::BOOL, {});
2768   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
2769   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2770   OperandType type12(Type::TENSOR_FLOAT16, {4});
2771   OperandType type4(Type::INT32, {});
2772   // Phase 1, operands
2773   auto op12 = model->addOperand(&type10);
2774   auto op22 = model->addOperand(&type11);
2775   auto op32 = model->addOperand(&type12);
2776   auto param20 = model->addOperand(&type4);
2777   auto param21 = model->addOperand(&type4);
2778   auto param22 = model->addOperand(&type4);
2779   auto param23 = model->addOperand(&type4);
2780   auto param24 = model->addOperand(&type4);
2781   auto layout = model->addOperand(&type0);
2782   auto param25 = model->addOperand(&type4);
2783   auto param26 = model->addOperand(&type4);
2784   auto op42 = model->addOperand(&type11);
2785   // Phase 2, operations
2786   static int32_t param20_init[] = {2};
2787   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2788   static int32_t param21_init[] = {1};
2789   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2790   static int32_t param22_init[] = {1};
2791   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2792   static int32_t param23_init[] = {2};
2793   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2794   static int32_t param24_init[] = {0};
2795   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2796   static bool8 layout_init[] = {false};
2797   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2798   static int32_t param25_init[] = {1};
2799   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2800   static int32_t param26_init[] = {1};
2801   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2802   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2803   // Phase 3, inputs and outputs
2804   model->identifyInputsAndOutputs(
2805     {op12, op22, op32},
2806     {op42});
2807   assert(model->isValid());
2808 }
2809 
is_ignored_nhwc_weight_as_input_float16_2(int i)2810 inline bool is_ignored_nhwc_weight_as_input_float16_2(int i) {
2811   static std::set<int> ignore = {};
2812   return ignore.find(i) != ignore.end();
2813 }
2814 
CreateModel_nhwc_weight_as_input_quant8_2(Model * model)2815 void CreateModel_nhwc_weight_as_input_quant8_2(Model *model) {
2816   OperandType type0(Type::BOOL, {});
2817   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
2818   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
2819   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
2820   OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
2821   OperandType type4(Type::INT32, {});
2822   // Phase 1, operands
2823   auto op12 = model->addOperand(&type13);
2824   auto op22 = model->addOperand(&type14);
2825   auto op32 = model->addOperand(&type15);
2826   auto param20 = model->addOperand(&type4);
2827   auto param21 = model->addOperand(&type4);
2828   auto param22 = model->addOperand(&type4);
2829   auto param23 = model->addOperand(&type4);
2830   auto param24 = model->addOperand(&type4);
2831   auto layout = model->addOperand(&type0);
2832   auto param25 = model->addOperand(&type4);
2833   auto param26 = model->addOperand(&type4);
2834   auto op42 = model->addOperand(&type16);
2835   // Phase 2, operations
2836   static int32_t param20_init[] = {2};
2837   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2838   static int32_t param21_init[] = {1};
2839   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2840   static int32_t param22_init[] = {1};
2841   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2842   static int32_t param23_init[] = {2};
2843   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2844   static int32_t param24_init[] = {0};
2845   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2846   static bool8 layout_init[] = {false};
2847   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2848   static int32_t param25_init[] = {1};
2849   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2850   static int32_t param26_init[] = {1};
2851   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2852   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2853   // Phase 3, inputs and outputs
2854   model->identifyInputsAndOutputs(
2855     {op12, op22, op32},
2856     {op42});
2857   assert(model->isValid());
2858 }
2859 
is_ignored_nhwc_weight_as_input_quant8_2(int i)2860 inline bool is_ignored_nhwc_weight_as_input_quant8_2(int i) {
2861   static std::set<int> ignore = {};
2862   return ignore.find(i) != ignore.end();
2863 }
2864 
CreateModel_nchw_3(Model * model)2865 void CreateModel_nchw_3(Model *model) {
2866   OperandType type0(Type::BOOL, {});
2867   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
2868   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
2869   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2870   OperandType type3(Type::TENSOR_FLOAT32, {4});
2871   OperandType type4(Type::INT32, {});
2872   // Phase 1, operands
2873   auto op12 = model->addOperand(&type17);
2874   auto op22 = model->addOperand(&type2);
2875   auto op32 = model->addOperand(&type3);
2876   auto param20 = model->addOperand(&type4);
2877   auto param21 = model->addOperand(&type4);
2878   auto param22 = model->addOperand(&type4);
2879   auto param23 = model->addOperand(&type4);
2880   auto param24 = model->addOperand(&type4);
2881   auto layout = model->addOperand(&type0);
2882   auto param25 = model->addOperand(&type4);
2883   auto param26 = model->addOperand(&type4);
2884   auto op42 = model->addOperand(&type18);
2885   // Phase 2, operations
2886   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2887   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
2888   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2889   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
2890   static int32_t param20_init[] = {2};
2891   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2892   static int32_t param21_init[] = {1};
2893   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2894   static int32_t param22_init[] = {1};
2895   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2896   static int32_t param23_init[] = {2};
2897   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2898   static int32_t param24_init[] = {0};
2899   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2900   static bool8 layout_init[] = {true};
2901   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2902   static int32_t param25_init[] = {1};
2903   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2904   static int32_t param26_init[] = {1};
2905   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2906   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2907   // Phase 3, inputs and outputs
2908   model->identifyInputsAndOutputs(
2909     {op12},
2910     {op42});
2911   assert(model->isValid());
2912 }
2913 
is_ignored_nchw_3(int i)2914 inline bool is_ignored_nchw_3(int i) {
2915   static std::set<int> ignore = {};
2916   return ignore.find(i) != ignore.end();
2917 }
2918 
CreateModel_nchw_relaxed_2(Model * model)2919 void CreateModel_nchw_relaxed_2(Model *model) {
2920   OperandType type0(Type::BOOL, {});
2921   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
2922   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
2923   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2924   OperandType type3(Type::TENSOR_FLOAT32, {4});
2925   OperandType type4(Type::INT32, {});
2926   // Phase 1, operands
2927   auto op12 = model->addOperand(&type17);
2928   auto op22 = model->addOperand(&type2);
2929   auto op32 = model->addOperand(&type3);
2930   auto param20 = model->addOperand(&type4);
2931   auto param21 = model->addOperand(&type4);
2932   auto param22 = model->addOperand(&type4);
2933   auto param23 = model->addOperand(&type4);
2934   auto param24 = model->addOperand(&type4);
2935   auto layout = model->addOperand(&type0);
2936   auto param25 = model->addOperand(&type4);
2937   auto param26 = model->addOperand(&type4);
2938   auto op42 = model->addOperand(&type18);
2939   // Phase 2, operations
2940   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2941   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
2942   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2943   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
2944   static int32_t param20_init[] = {2};
2945   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
2946   static int32_t param21_init[] = {1};
2947   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
2948   static int32_t param22_init[] = {1};
2949   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
2950   static int32_t param23_init[] = {2};
2951   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
2952   static int32_t param24_init[] = {0};
2953   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
2954   static bool8 layout_init[] = {true};
2955   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2956   static int32_t param25_init[] = {1};
2957   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
2958   static int32_t param26_init[] = {1};
2959   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
2960   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
2961   // Phase 3, inputs and outputs
2962   model->identifyInputsAndOutputs(
2963     {op12},
2964     {op42});
2965   // Phase 4: set relaxed execution
2966   model->relaxComputationFloat32toFloat16(true);
2967   assert(model->isValid());
2968 }
2969 
is_ignored_nchw_relaxed_2(int i)2970 inline bool is_ignored_nchw_relaxed_2(int i) {
2971   static std::set<int> ignore = {};
2972   return ignore.find(i) != ignore.end();
2973 }
2974 
CreateModel_nchw_float16_2(Model * model)2975 void CreateModel_nchw_float16_2(Model *model) {
2976   OperandType type0(Type::BOOL, {});
2977   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2978   OperandType type12(Type::TENSOR_FLOAT16, {4});
2979   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
2980   OperandType type20(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
2981   OperandType type4(Type::INT32, {});
2982   // Phase 1, operands
2983   auto op12 = model->addOperand(&type19);
2984   auto op22 = model->addOperand(&type11);
2985   auto op32 = model->addOperand(&type12);
2986   auto param20 = model->addOperand(&type4);
2987   auto param21 = model->addOperand(&type4);
2988   auto param22 = model->addOperand(&type4);
2989   auto param23 = model->addOperand(&type4);
2990   auto param24 = model->addOperand(&type4);
2991   auto layout = model->addOperand(&type0);
2992   auto param25 = model->addOperand(&type4);
2993   auto param26 = model->addOperand(&type4);
2994   auto op42 = model->addOperand(&type20);
2995   // Phase 2, operations
2996   static _Float16 op22_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
2997   model->setOperandValue(op22, op22_init, sizeof(_Float16) * 16);
2998   static _Float16 op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2999   model->setOperandValue(op32, op32_init, sizeof(_Float16) * 4);
3000   static int32_t param20_init[] = {2};
3001   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3002   static int32_t param21_init[] = {1};
3003   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3004   static int32_t param22_init[] = {1};
3005   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3006   static int32_t param23_init[] = {2};
3007   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3008   static int32_t param24_init[] = {0};
3009   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3010   static bool8 layout_init[] = {true};
3011   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3012   static int32_t param25_init[] = {1};
3013   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3014   static int32_t param26_init[] = {1};
3015   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3016   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3017   // Phase 3, inputs and outputs
3018   model->identifyInputsAndOutputs(
3019     {op12},
3020     {op42});
3021   assert(model->isValid());
3022 }
3023 
is_ignored_nchw_float16_2(int i)3024 inline bool is_ignored_nchw_float16_2(int i) {
3025   static std::set<int> ignore = {};
3026   return ignore.find(i) != ignore.end();
3027 }
3028 
CreateModel_nchw_quant8_2(Model * model)3029 void CreateModel_nchw_quant8_2(Model *model) {
3030   OperandType type0(Type::BOOL, {});
3031   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
3032   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
3033   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
3034   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
3035   OperandType type4(Type::INT32, {});
3036   // Phase 1, operands
3037   auto op12 = model->addOperand(&type21);
3038   auto op22 = model->addOperand(&type14);
3039   auto op32 = model->addOperand(&type15);
3040   auto param20 = model->addOperand(&type4);
3041   auto param21 = model->addOperand(&type4);
3042   auto param22 = model->addOperand(&type4);
3043   auto param23 = model->addOperand(&type4);
3044   auto param24 = model->addOperand(&type4);
3045   auto layout = model->addOperand(&type0);
3046   auto param25 = model->addOperand(&type4);
3047   auto param26 = model->addOperand(&type4);
3048   auto op42 = model->addOperand(&type22);
3049   // Phase 2, operations
3050   static uint8_t op22_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
3051   model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 16);
3052   static int32_t op32_init[] = {200, 400, 600, 800};
3053   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
3054   static int32_t param20_init[] = {2};
3055   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3056   static int32_t param21_init[] = {1};
3057   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3058   static int32_t param22_init[] = {1};
3059   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3060   static int32_t param23_init[] = {2};
3061   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3062   static int32_t param24_init[] = {0};
3063   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3064   static bool8 layout_init[] = {true};
3065   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3066   static int32_t param25_init[] = {1};
3067   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3068   static int32_t param26_init[] = {1};
3069   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3070   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3071   // Phase 3, inputs and outputs
3072   model->identifyInputsAndOutputs(
3073     {op12},
3074     {op42});
3075   assert(model->isValid());
3076 }
3077 
is_ignored_nchw_quant8_2(int i)3078 inline bool is_ignored_nchw_quant8_2(int i) {
3079   static std::set<int> ignore = {};
3080   return ignore.find(i) != ignore.end();
3081 }
3082 
CreateModel_nchw_weight_as_input_3(Model * model)3083 void CreateModel_nchw_weight_as_input_3(Model *model) {
3084   OperandType type0(Type::BOOL, {});
3085   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3086   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
3087   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3088   OperandType type3(Type::TENSOR_FLOAT32, {4});
3089   OperandType type4(Type::INT32, {});
3090   // Phase 1, operands
3091   auto op12 = model->addOperand(&type17);
3092   auto op22 = model->addOperand(&type2);
3093   auto op32 = model->addOperand(&type3);
3094   auto param20 = model->addOperand(&type4);
3095   auto param21 = model->addOperand(&type4);
3096   auto param22 = model->addOperand(&type4);
3097   auto param23 = model->addOperand(&type4);
3098   auto param24 = model->addOperand(&type4);
3099   auto layout = model->addOperand(&type0);
3100   auto param25 = model->addOperand(&type4);
3101   auto param26 = model->addOperand(&type4);
3102   auto op42 = model->addOperand(&type18);
3103   // Phase 2, operations
3104   static int32_t param20_init[] = {2};
3105   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3106   static int32_t param21_init[] = {1};
3107   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3108   static int32_t param22_init[] = {1};
3109   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3110   static int32_t param23_init[] = {2};
3111   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3112   static int32_t param24_init[] = {0};
3113   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3114   static bool8 layout_init[] = {true};
3115   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3116   static int32_t param25_init[] = {1};
3117   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3118   static int32_t param26_init[] = {1};
3119   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3120   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3121   // Phase 3, inputs and outputs
3122   model->identifyInputsAndOutputs(
3123     {op12, op22, op32},
3124     {op42});
3125   assert(model->isValid());
3126 }
3127 
is_ignored_nchw_weight_as_input_3(int i)3128 inline bool is_ignored_nchw_weight_as_input_3(int i) {
3129   static std::set<int> ignore = {};
3130   return ignore.find(i) != ignore.end();
3131 }
3132 
CreateModel_nchw_weight_as_input_relaxed_2(Model * model)3133 void CreateModel_nchw_weight_as_input_relaxed_2(Model *model) {
3134   OperandType type0(Type::BOOL, {});
3135   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3136   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
3137   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3138   OperandType type3(Type::TENSOR_FLOAT32, {4});
3139   OperandType type4(Type::INT32, {});
3140   // Phase 1, operands
3141   auto op12 = model->addOperand(&type17);
3142   auto op22 = model->addOperand(&type2);
3143   auto op32 = model->addOperand(&type3);
3144   auto param20 = model->addOperand(&type4);
3145   auto param21 = model->addOperand(&type4);
3146   auto param22 = model->addOperand(&type4);
3147   auto param23 = model->addOperand(&type4);
3148   auto param24 = model->addOperand(&type4);
3149   auto layout = model->addOperand(&type0);
3150   auto param25 = model->addOperand(&type4);
3151   auto param26 = model->addOperand(&type4);
3152   auto op42 = model->addOperand(&type18);
3153   // Phase 2, operations
3154   static int32_t param20_init[] = {2};
3155   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3156   static int32_t param21_init[] = {1};
3157   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3158   static int32_t param22_init[] = {1};
3159   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3160   static int32_t param23_init[] = {2};
3161   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3162   static int32_t param24_init[] = {0};
3163   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3164   static bool8 layout_init[] = {true};
3165   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3166   static int32_t param25_init[] = {1};
3167   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3168   static int32_t param26_init[] = {1};
3169   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3170   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3171   // Phase 3, inputs and outputs
3172   model->identifyInputsAndOutputs(
3173     {op12, op22, op32},
3174     {op42});
3175   // Phase 4: set relaxed execution
3176   model->relaxComputationFloat32toFloat16(true);
3177   assert(model->isValid());
3178 }
3179 
is_ignored_nchw_weight_as_input_relaxed_2(int i)3180 inline bool is_ignored_nchw_weight_as_input_relaxed_2(int i) {
3181   static std::set<int> ignore = {};
3182   return ignore.find(i) != ignore.end();
3183 }
3184 
CreateModel_nchw_weight_as_input_float16_2(Model * model)3185 void CreateModel_nchw_weight_as_input_float16_2(Model *model) {
3186   OperandType type0(Type::BOOL, {});
3187   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3188   OperandType type12(Type::TENSOR_FLOAT16, {4});
3189   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
3190   OperandType type20(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
3191   OperandType type4(Type::INT32, {});
3192   // Phase 1, operands
3193   auto op12 = model->addOperand(&type19);
3194   auto op22 = model->addOperand(&type11);
3195   auto op32 = model->addOperand(&type12);
3196   auto param20 = model->addOperand(&type4);
3197   auto param21 = model->addOperand(&type4);
3198   auto param22 = model->addOperand(&type4);
3199   auto param23 = model->addOperand(&type4);
3200   auto param24 = model->addOperand(&type4);
3201   auto layout = model->addOperand(&type0);
3202   auto param25 = model->addOperand(&type4);
3203   auto param26 = model->addOperand(&type4);
3204   auto op42 = model->addOperand(&type20);
3205   // Phase 2, operations
3206   static int32_t param20_init[] = {2};
3207   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3208   static int32_t param21_init[] = {1};
3209   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3210   static int32_t param22_init[] = {1};
3211   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3212   static int32_t param23_init[] = {2};
3213   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3214   static int32_t param24_init[] = {0};
3215   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3216   static bool8 layout_init[] = {true};
3217   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3218   static int32_t param25_init[] = {1};
3219   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3220   static int32_t param26_init[] = {1};
3221   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3222   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3223   // Phase 3, inputs and outputs
3224   model->identifyInputsAndOutputs(
3225     {op12, op22, op32},
3226     {op42});
3227   assert(model->isValid());
3228 }
3229 
is_ignored_nchw_weight_as_input_float16_2(int i)3230 inline bool is_ignored_nchw_weight_as_input_float16_2(int i) {
3231   static std::set<int> ignore = {};
3232   return ignore.find(i) != ignore.end();
3233 }
3234 
CreateModel_nchw_weight_as_input_quant8_2(Model * model)3235 void CreateModel_nchw_weight_as_input_quant8_2(Model *model) {
3236   OperandType type0(Type::BOOL, {});
3237   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
3238   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
3239   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
3240   OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
3241   OperandType type4(Type::INT32, {});
3242   // Phase 1, operands
3243   auto op12 = model->addOperand(&type21);
3244   auto op22 = model->addOperand(&type14);
3245   auto op32 = model->addOperand(&type15);
3246   auto param20 = model->addOperand(&type4);
3247   auto param21 = model->addOperand(&type4);
3248   auto param22 = model->addOperand(&type4);
3249   auto param23 = model->addOperand(&type4);
3250   auto param24 = model->addOperand(&type4);
3251   auto layout = model->addOperand(&type0);
3252   auto param25 = model->addOperand(&type4);
3253   auto param26 = model->addOperand(&type4);
3254   auto op42 = model->addOperand(&type22);
3255   // Phase 2, operations
3256   static int32_t param20_init[] = {2};
3257   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3258   static int32_t param21_init[] = {1};
3259   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3260   static int32_t param22_init[] = {1};
3261   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3262   static int32_t param23_init[] = {2};
3263   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3264   static int32_t param24_init[] = {0};
3265   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3266   static bool8 layout_init[] = {true};
3267   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3268   static int32_t param25_init[] = {1};
3269   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3270   static int32_t param26_init[] = {1};
3271   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3272   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3273   // Phase 3, inputs and outputs
3274   model->identifyInputsAndOutputs(
3275     {op12, op22, op32},
3276     {op42});
3277   assert(model->isValid());
3278 }
3279 
is_ignored_nchw_weight_as_input_quant8_2(int i)3280 inline bool is_ignored_nchw_weight_as_input_quant8_2(int i) {
3281   static std::set<int> ignore = {};
3282   return ignore.find(i) != ignore.end();
3283 }
3284 
CreateModel_dynamic_output_shape_nhwc_3(Model * model)3285 void CreateModel_dynamic_output_shape_nhwc_3(Model *model) {
3286   OperandType type0(Type::BOOL, {});
3287   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
3288   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3289   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3290   OperandType type3(Type::TENSOR_FLOAT32, {4});
3291   OperandType type4(Type::INT32, {});
3292   // Phase 1, operands
3293   auto op12 = model->addOperand(&type1);
3294   auto op22 = model->addOperand(&type2);
3295   auto op32 = model->addOperand(&type3);
3296   auto param20 = model->addOperand(&type4);
3297   auto param21 = model->addOperand(&type4);
3298   auto param22 = model->addOperand(&type4);
3299   auto param23 = model->addOperand(&type4);
3300   auto param24 = model->addOperand(&type4);
3301   auto layout = model->addOperand(&type0);
3302   auto param25 = model->addOperand(&type4);
3303   auto param26 = model->addOperand(&type4);
3304   auto op42 = model->addOperand(&type23);
3305   // Phase 2, operations
3306   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
3307   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
3308   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3309   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
3310   static int32_t param20_init[] = {2};
3311   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3312   static int32_t param21_init[] = {1};
3313   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3314   static int32_t param22_init[] = {1};
3315   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3316   static int32_t param23_init[] = {2};
3317   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3318   static int32_t param24_init[] = {0};
3319   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3320   static bool8 layout_init[] = {false};
3321   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3322   static int32_t param25_init[] = {1};
3323   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3324   static int32_t param26_init[] = {1};
3325   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3326   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3327   // Phase 3, inputs and outputs
3328   model->identifyInputsAndOutputs(
3329     {op12},
3330     {op42});
3331   assert(model->isValid());
3332 }
3333 
is_ignored_dynamic_output_shape_nhwc_3(int i)3334 inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) {
3335   static std::set<int> ignore = {};
3336   return ignore.find(i) != ignore.end();
3337 }
3338 
CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model * model)3339 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) {
3340   OperandType type0(Type::BOOL, {});
3341   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
3342   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3343   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3344   OperandType type3(Type::TENSOR_FLOAT32, {4});
3345   OperandType type4(Type::INT32, {});
3346   // Phase 1, operands
3347   auto op12 = model->addOperand(&type1);
3348   auto op22 = model->addOperand(&type2);
3349   auto op32 = model->addOperand(&type3);
3350   auto param20 = model->addOperand(&type4);
3351   auto param21 = model->addOperand(&type4);
3352   auto param22 = model->addOperand(&type4);
3353   auto param23 = model->addOperand(&type4);
3354   auto param24 = model->addOperand(&type4);
3355   auto layout = model->addOperand(&type0);
3356   auto param25 = model->addOperand(&type4);
3357   auto param26 = model->addOperand(&type4);
3358   auto op42 = model->addOperand(&type23);
3359   // Phase 2, operations
3360   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
3361   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
3362   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3363   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
3364   static int32_t param20_init[] = {2};
3365   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3366   static int32_t param21_init[] = {1};
3367   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3368   static int32_t param22_init[] = {1};
3369   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3370   static int32_t param23_init[] = {2};
3371   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3372   static int32_t param24_init[] = {0};
3373   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3374   static bool8 layout_init[] = {false};
3375   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3376   static int32_t param25_init[] = {1};
3377   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3378   static int32_t param26_init[] = {1};
3379   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3380   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3381   // Phase 3, inputs and outputs
3382   model->identifyInputsAndOutputs(
3383     {op12},
3384     {op42});
3385   // Phase 4: set relaxed execution
3386   model->relaxComputationFloat32toFloat16(true);
3387   assert(model->isValid());
3388 }
3389 
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)3390 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
3391   static std::set<int> ignore = {};
3392   return ignore.find(i) != ignore.end();
3393 }
3394 
CreateModel_dynamic_output_shape_nhwc_float16_2(Model * model)3395 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) {
3396   OperandType type0(Type::BOOL, {});
3397   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
3398   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3399   OperandType type12(Type::TENSOR_FLOAT16, {4});
3400   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3401   OperandType type4(Type::INT32, {});
3402   // Phase 1, operands
3403   auto op12 = model->addOperand(&type10);
3404   auto op22 = model->addOperand(&type11);
3405   auto op32 = model->addOperand(&type12);
3406   auto param20 = model->addOperand(&type4);
3407   auto param21 = model->addOperand(&type4);
3408   auto param22 = model->addOperand(&type4);
3409   auto param23 = model->addOperand(&type4);
3410   auto param24 = model->addOperand(&type4);
3411   auto layout = model->addOperand(&type0);
3412   auto param25 = model->addOperand(&type4);
3413   auto param26 = model->addOperand(&type4);
3414   auto op42 = model->addOperand(&type24);
3415   // Phase 2, operations
3416   static _Float16 op22_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
3417   model->setOperandValue(op22, op22_init, sizeof(_Float16) * 16);
3418   static _Float16 op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3419   model->setOperandValue(op32, op32_init, sizeof(_Float16) * 4);
3420   static int32_t param20_init[] = {2};
3421   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3422   static int32_t param21_init[] = {1};
3423   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3424   static int32_t param22_init[] = {1};
3425   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3426   static int32_t param23_init[] = {2};
3427   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3428   static int32_t param24_init[] = {0};
3429   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3430   static bool8 layout_init[] = {false};
3431   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3432   static int32_t param25_init[] = {1};
3433   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3434   static int32_t param26_init[] = {1};
3435   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3436   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3437   // Phase 3, inputs and outputs
3438   model->identifyInputsAndOutputs(
3439     {op12},
3440     {op42});
3441   assert(model->isValid());
3442 }
3443 
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)3444 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
3445   static std::set<int> ignore = {};
3446   return ignore.find(i) != ignore.end();
3447 }
3448 
CreateModel_dynamic_output_shape_nhwc_quant8_2(Model * model)3449 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) {
3450   OperandType type0(Type::BOOL, {});
3451   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
3452   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
3453   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
3454   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
3455   OperandType type4(Type::INT32, {});
3456   // Phase 1, operands
3457   auto op12 = model->addOperand(&type13);
3458   auto op22 = model->addOperand(&type14);
3459   auto op32 = model->addOperand(&type15);
3460   auto param20 = model->addOperand(&type4);
3461   auto param21 = model->addOperand(&type4);
3462   auto param22 = model->addOperand(&type4);
3463   auto param23 = model->addOperand(&type4);
3464   auto param24 = model->addOperand(&type4);
3465   auto layout = model->addOperand(&type0);
3466   auto param25 = model->addOperand(&type4);
3467   auto param26 = model->addOperand(&type4);
3468   auto op42 = model->addOperand(&type25);
3469   // Phase 2, operations
3470   static uint8_t op22_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
3471   model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 16);
3472   static int32_t op32_init[] = {200, 400, 600, 800};
3473   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
3474   static int32_t param20_init[] = {2};
3475   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3476   static int32_t param21_init[] = {1};
3477   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3478   static int32_t param22_init[] = {1};
3479   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3480   static int32_t param23_init[] = {2};
3481   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3482   static int32_t param24_init[] = {0};
3483   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3484   static bool8 layout_init[] = {false};
3485   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3486   static int32_t param25_init[] = {1};
3487   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3488   static int32_t param26_init[] = {1};
3489   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3490   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3491   // Phase 3, inputs and outputs
3492   model->identifyInputsAndOutputs(
3493     {op12},
3494     {op42});
3495   assert(model->isValid());
3496 }
3497 
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)3498 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
3499   static std::set<int> ignore = {};
3500   return ignore.find(i) != ignore.end();
3501 }
3502 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model * model)3503 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model *model) {
3504   OperandType type0(Type::BOOL, {});
3505   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
3506   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3507   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3508   OperandType type3(Type::TENSOR_FLOAT32, {4});
3509   OperandType type4(Type::INT32, {});
3510   // Phase 1, operands
3511   auto op12 = model->addOperand(&type1);
3512   auto op22 = model->addOperand(&type2);
3513   auto op32 = model->addOperand(&type3);
3514   auto param20 = model->addOperand(&type4);
3515   auto param21 = model->addOperand(&type4);
3516   auto param22 = model->addOperand(&type4);
3517   auto param23 = model->addOperand(&type4);
3518   auto param24 = model->addOperand(&type4);
3519   auto layout = model->addOperand(&type0);
3520   auto param25 = model->addOperand(&type4);
3521   auto param26 = model->addOperand(&type4);
3522   auto op42 = model->addOperand(&type23);
3523   // Phase 2, operations
3524   static int32_t param20_init[] = {2};
3525   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3526   static int32_t param21_init[] = {1};
3527   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3528   static int32_t param22_init[] = {1};
3529   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3530   static int32_t param23_init[] = {2};
3531   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3532   static int32_t param24_init[] = {0};
3533   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3534   static bool8 layout_init[] = {false};
3535   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3536   static int32_t param25_init[] = {1};
3537   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3538   static int32_t param26_init[] = {1};
3539   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3540   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3541   // Phase 3, inputs and outputs
3542   model->identifyInputsAndOutputs(
3543     {op12, op22, op32},
3544     {op42});
3545   assert(model->isValid());
3546 }
3547 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i)3548 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i) {
3549   static std::set<int> ignore = {};
3550   return ignore.find(i) != ignore.end();
3551 }
3552 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model * model)3553 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model *model) {
3554   OperandType type0(Type::BOOL, {});
3555   OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
3556   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3557   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3558   OperandType type3(Type::TENSOR_FLOAT32, {4});
3559   OperandType type4(Type::INT32, {});
3560   // Phase 1, operands
3561   auto op12 = model->addOperand(&type1);
3562   auto op22 = model->addOperand(&type2);
3563   auto op32 = model->addOperand(&type3);
3564   auto param20 = model->addOperand(&type4);
3565   auto param21 = model->addOperand(&type4);
3566   auto param22 = model->addOperand(&type4);
3567   auto param23 = model->addOperand(&type4);
3568   auto param24 = model->addOperand(&type4);
3569   auto layout = model->addOperand(&type0);
3570   auto param25 = model->addOperand(&type4);
3571   auto param26 = model->addOperand(&type4);
3572   auto op42 = model->addOperand(&type23);
3573   // Phase 2, operations
3574   static int32_t param20_init[] = {2};
3575   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3576   static int32_t param21_init[] = {1};
3577   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3578   static int32_t param22_init[] = {1};
3579   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3580   static int32_t param23_init[] = {2};
3581   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3582   static int32_t param24_init[] = {0};
3583   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3584   static bool8 layout_init[] = {false};
3585   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3586   static int32_t param25_init[] = {1};
3587   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3588   static int32_t param26_init[] = {1};
3589   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3590   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3591   // Phase 3, inputs and outputs
3592   model->identifyInputsAndOutputs(
3593     {op12, op22, op32},
3594     {op42});
3595   // Phase 4: set relaxed execution
3596   model->relaxComputationFloat32toFloat16(true);
3597   assert(model->isValid());
3598 }
3599 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i)3600 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i) {
3601   static std::set<int> ignore = {};
3602   return ignore.find(i) != ignore.end();
3603 }
3604 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model * model)3605 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model *model) {
3606   OperandType type0(Type::BOOL, {});
3607   OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
3608   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3609   OperandType type12(Type::TENSOR_FLOAT16, {4});
3610   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3611   OperandType type4(Type::INT32, {});
3612   // Phase 1, operands
3613   auto op12 = model->addOperand(&type10);
3614   auto op22 = model->addOperand(&type11);
3615   auto op32 = model->addOperand(&type12);
3616   auto param20 = model->addOperand(&type4);
3617   auto param21 = model->addOperand(&type4);
3618   auto param22 = model->addOperand(&type4);
3619   auto param23 = model->addOperand(&type4);
3620   auto param24 = model->addOperand(&type4);
3621   auto layout = model->addOperand(&type0);
3622   auto param25 = model->addOperand(&type4);
3623   auto param26 = model->addOperand(&type4);
3624   auto op42 = model->addOperand(&type24);
3625   // Phase 2, operations
3626   static int32_t param20_init[] = {2};
3627   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3628   static int32_t param21_init[] = {1};
3629   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3630   static int32_t param22_init[] = {1};
3631   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3632   static int32_t param23_init[] = {2};
3633   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3634   static int32_t param24_init[] = {0};
3635   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3636   static bool8 layout_init[] = {false};
3637   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3638   static int32_t param25_init[] = {1};
3639   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3640   static int32_t param26_init[] = {1};
3641   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3642   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3643   // Phase 3, inputs and outputs
3644   model->identifyInputsAndOutputs(
3645     {op12, op22, op32},
3646     {op42});
3647   assert(model->isValid());
3648 }
3649 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i)3650 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i) {
3651   static std::set<int> ignore = {};
3652   return ignore.find(i) != ignore.end();
3653 }
3654 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model * model)3655 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model *model) {
3656   OperandType type0(Type::BOOL, {});
3657   OperandType type13(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
3658   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
3659   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
3660   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
3661   OperandType type4(Type::INT32, {});
3662   // Phase 1, operands
3663   auto op12 = model->addOperand(&type13);
3664   auto op22 = model->addOperand(&type14);
3665   auto op32 = model->addOperand(&type15);
3666   auto param20 = model->addOperand(&type4);
3667   auto param21 = model->addOperand(&type4);
3668   auto param22 = model->addOperand(&type4);
3669   auto param23 = model->addOperand(&type4);
3670   auto param24 = model->addOperand(&type4);
3671   auto layout = model->addOperand(&type0);
3672   auto param25 = model->addOperand(&type4);
3673   auto param26 = model->addOperand(&type4);
3674   auto op42 = model->addOperand(&type25);
3675   // Phase 2, operations
3676   static int32_t param20_init[] = {2};
3677   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3678   static int32_t param21_init[] = {1};
3679   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3680   static int32_t param22_init[] = {1};
3681   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3682   static int32_t param23_init[] = {2};
3683   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3684   static int32_t param24_init[] = {0};
3685   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3686   static bool8 layout_init[] = {false};
3687   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3688   static int32_t param25_init[] = {1};
3689   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3690   static int32_t param26_init[] = {1};
3691   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3692   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3693   // Phase 3, inputs and outputs
3694   model->identifyInputsAndOutputs(
3695     {op12, op22, op32},
3696     {op42});
3697   assert(model->isValid());
3698 }
3699 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i)3700 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i) {
3701   static std::set<int> ignore = {};
3702   return ignore.find(i) != ignore.end();
3703 }
3704 
CreateModel_dynamic_output_shape_nchw_3(Model * model)3705 void CreateModel_dynamic_output_shape_nchw_3(Model *model) {
3706   OperandType type0(Type::BOOL, {});
3707   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3708   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3709   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3710   OperandType type3(Type::TENSOR_FLOAT32, {4});
3711   OperandType type4(Type::INT32, {});
3712   // Phase 1, operands
3713   auto op12 = model->addOperand(&type17);
3714   auto op22 = model->addOperand(&type2);
3715   auto op32 = model->addOperand(&type3);
3716   auto param20 = model->addOperand(&type4);
3717   auto param21 = model->addOperand(&type4);
3718   auto param22 = model->addOperand(&type4);
3719   auto param23 = model->addOperand(&type4);
3720   auto param24 = model->addOperand(&type4);
3721   auto layout = model->addOperand(&type0);
3722   auto param25 = model->addOperand(&type4);
3723   auto param26 = model->addOperand(&type4);
3724   auto op42 = model->addOperand(&type23);
3725   // Phase 2, operations
3726   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
3727   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
3728   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3729   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
3730   static int32_t param20_init[] = {2};
3731   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3732   static int32_t param21_init[] = {1};
3733   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3734   static int32_t param22_init[] = {1};
3735   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3736   static int32_t param23_init[] = {2};
3737   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3738   static int32_t param24_init[] = {0};
3739   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3740   static bool8 layout_init[] = {true};
3741   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3742   static int32_t param25_init[] = {1};
3743   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3744   static int32_t param26_init[] = {1};
3745   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3746   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3747   // Phase 3, inputs and outputs
3748   model->identifyInputsAndOutputs(
3749     {op12},
3750     {op42});
3751   assert(model->isValid());
3752 }
3753 
is_ignored_dynamic_output_shape_nchw_3(int i)3754 inline bool is_ignored_dynamic_output_shape_nchw_3(int i) {
3755   static std::set<int> ignore = {};
3756   return ignore.find(i) != ignore.end();
3757 }
3758 
CreateModel_dynamic_output_shape_nchw_relaxed_2(Model * model)3759 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) {
3760   OperandType type0(Type::BOOL, {});
3761   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3762   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3763   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3764   OperandType type3(Type::TENSOR_FLOAT32, {4});
3765   OperandType type4(Type::INT32, {});
3766   // Phase 1, operands
3767   auto op12 = model->addOperand(&type17);
3768   auto op22 = model->addOperand(&type2);
3769   auto op32 = model->addOperand(&type3);
3770   auto param20 = model->addOperand(&type4);
3771   auto param21 = model->addOperand(&type4);
3772   auto param22 = model->addOperand(&type4);
3773   auto param23 = model->addOperand(&type4);
3774   auto param24 = model->addOperand(&type4);
3775   auto layout = model->addOperand(&type0);
3776   auto param25 = model->addOperand(&type4);
3777   auto param26 = model->addOperand(&type4);
3778   auto op42 = model->addOperand(&type23);
3779   // Phase 2, operations
3780   static float op22_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
3781   model->setOperandValue(op22, op22_init, sizeof(float) * 16);
3782   static float op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3783   model->setOperandValue(op32, op32_init, sizeof(float) * 4);
3784   static int32_t param20_init[] = {2};
3785   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3786   static int32_t param21_init[] = {1};
3787   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3788   static int32_t param22_init[] = {1};
3789   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3790   static int32_t param23_init[] = {2};
3791   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3792   static int32_t param24_init[] = {0};
3793   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3794   static bool8 layout_init[] = {true};
3795   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3796   static int32_t param25_init[] = {1};
3797   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3798   static int32_t param26_init[] = {1};
3799   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3800   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3801   // Phase 3, inputs and outputs
3802   model->identifyInputsAndOutputs(
3803     {op12},
3804     {op42});
3805   // Phase 4: set relaxed execution
3806   model->relaxComputationFloat32toFloat16(true);
3807   assert(model->isValid());
3808 }
3809 
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)3810 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
3811   static std::set<int> ignore = {};
3812   return ignore.find(i) != ignore.end();
3813 }
3814 
CreateModel_dynamic_output_shape_nchw_float16_2(Model * model)3815 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) {
3816   OperandType type0(Type::BOOL, {});
3817   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3818   OperandType type12(Type::TENSOR_FLOAT16, {4});
3819   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
3820   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3821   OperandType type4(Type::INT32, {});
3822   // Phase 1, operands
3823   auto op12 = model->addOperand(&type19);
3824   auto op22 = model->addOperand(&type11);
3825   auto op32 = model->addOperand(&type12);
3826   auto param20 = model->addOperand(&type4);
3827   auto param21 = model->addOperand(&type4);
3828   auto param22 = model->addOperand(&type4);
3829   auto param23 = model->addOperand(&type4);
3830   auto param24 = model->addOperand(&type4);
3831   auto layout = model->addOperand(&type0);
3832   auto param25 = model->addOperand(&type4);
3833   auto param26 = model->addOperand(&type4);
3834   auto op42 = model->addOperand(&type24);
3835   // Phase 2, operations
3836   static _Float16 op22_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
3837   model->setOperandValue(op22, op22_init, sizeof(_Float16) * 16);
3838   static _Float16 op32_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3839   model->setOperandValue(op32, op32_init, sizeof(_Float16) * 4);
3840   static int32_t param20_init[] = {2};
3841   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3842   static int32_t param21_init[] = {1};
3843   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3844   static int32_t param22_init[] = {1};
3845   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3846   static int32_t param23_init[] = {2};
3847   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3848   static int32_t param24_init[] = {0};
3849   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3850   static bool8 layout_init[] = {true};
3851   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3852   static int32_t param25_init[] = {1};
3853   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3854   static int32_t param26_init[] = {1};
3855   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3856   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3857   // Phase 3, inputs and outputs
3858   model->identifyInputsAndOutputs(
3859     {op12},
3860     {op42});
3861   assert(model->isValid());
3862 }
3863 
is_ignored_dynamic_output_shape_nchw_float16_2(int i)3864 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
3865   static std::set<int> ignore = {};
3866   return ignore.find(i) != ignore.end();
3867 }
3868 
CreateModel_dynamic_output_shape_nchw_quant8_2(Model * model)3869 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) {
3870   OperandType type0(Type::BOOL, {});
3871   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
3872   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
3873   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
3874   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
3875   OperandType type4(Type::INT32, {});
3876   // Phase 1, operands
3877   auto op12 = model->addOperand(&type21);
3878   auto op22 = model->addOperand(&type14);
3879   auto op32 = model->addOperand(&type15);
3880   auto param20 = model->addOperand(&type4);
3881   auto param21 = model->addOperand(&type4);
3882   auto param22 = model->addOperand(&type4);
3883   auto param23 = model->addOperand(&type4);
3884   auto param24 = model->addOperand(&type4);
3885   auto layout = model->addOperand(&type0);
3886   auto param25 = model->addOperand(&type4);
3887   auto param26 = model->addOperand(&type4);
3888   auto op42 = model->addOperand(&type25);
3889   // Phase 2, operations
3890   static uint8_t op22_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
3891   model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 16);
3892   static int32_t op32_init[] = {200, 400, 600, 800};
3893   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
3894   static int32_t param20_init[] = {2};
3895   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3896   static int32_t param21_init[] = {1};
3897   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3898   static int32_t param22_init[] = {1};
3899   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3900   static int32_t param23_init[] = {2};
3901   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3902   static int32_t param24_init[] = {0};
3903   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3904   static bool8 layout_init[] = {true};
3905   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3906   static int32_t param25_init[] = {1};
3907   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3908   static int32_t param26_init[] = {1};
3909   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3910   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3911   // Phase 3, inputs and outputs
3912   model->identifyInputsAndOutputs(
3913     {op12},
3914     {op42});
3915   assert(model->isValid());
3916 }
3917 
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)3918 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
3919   static std::set<int> ignore = {};
3920   return ignore.find(i) != ignore.end();
3921 }
3922 
CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model * model)3923 void CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model *model) {
3924   OperandType type0(Type::BOOL, {});
3925   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3926   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3927   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3928   OperandType type3(Type::TENSOR_FLOAT32, {4});
3929   OperandType type4(Type::INT32, {});
3930   // Phase 1, operands
3931   auto op12 = model->addOperand(&type17);
3932   auto op22 = model->addOperand(&type2);
3933   auto op32 = model->addOperand(&type3);
3934   auto param20 = model->addOperand(&type4);
3935   auto param21 = model->addOperand(&type4);
3936   auto param22 = model->addOperand(&type4);
3937   auto param23 = model->addOperand(&type4);
3938   auto param24 = model->addOperand(&type4);
3939   auto layout = model->addOperand(&type0);
3940   auto param25 = model->addOperand(&type4);
3941   auto param26 = model->addOperand(&type4);
3942   auto op42 = model->addOperand(&type23);
3943   // Phase 2, operations
3944   static int32_t param20_init[] = {2};
3945   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3946   static int32_t param21_init[] = {1};
3947   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3948   static int32_t param22_init[] = {1};
3949   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3950   static int32_t param23_init[] = {2};
3951   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3952   static int32_t param24_init[] = {0};
3953   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
3954   static bool8 layout_init[] = {true};
3955   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3956   static int32_t param25_init[] = {1};
3957   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
3958   static int32_t param26_init[] = {1};
3959   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
3960   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
3961   // Phase 3, inputs and outputs
3962   model->identifyInputsAndOutputs(
3963     {op12, op22, op32},
3964     {op42});
3965   assert(model->isValid());
3966 }
3967 
is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i)3968 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i) {
3969   static std::set<int> ignore = {};
3970   return ignore.find(i) != ignore.end();
3971 }
3972 
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model * model)3973 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model *model) {
3974   OperandType type0(Type::BOOL, {});
3975   OperandType type17(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
3976   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3977   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3978   OperandType type3(Type::TENSOR_FLOAT32, {4});
3979   OperandType type4(Type::INT32, {});
3980   // Phase 1, operands
3981   auto op12 = model->addOperand(&type17);
3982   auto op22 = model->addOperand(&type2);
3983   auto op32 = model->addOperand(&type3);
3984   auto param20 = model->addOperand(&type4);
3985   auto param21 = model->addOperand(&type4);
3986   auto param22 = model->addOperand(&type4);
3987   auto param23 = model->addOperand(&type4);
3988   auto param24 = model->addOperand(&type4);
3989   auto layout = model->addOperand(&type0);
3990   auto param25 = model->addOperand(&type4);
3991   auto param26 = model->addOperand(&type4);
3992   auto op42 = model->addOperand(&type23);
3993   // Phase 2, operations
3994   static int32_t param20_init[] = {2};
3995   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3996   static int32_t param21_init[] = {1};
3997   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3998   static int32_t param22_init[] = {1};
3999   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4000   static int32_t param23_init[] = {2};
4001   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4002   static int32_t param24_init[] = {0};
4003   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
4004   static bool8 layout_init[] = {true};
4005   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4006   static int32_t param25_init[] = {1};
4007   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
4008   static int32_t param26_init[] = {1};
4009   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
4010   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
4011   // Phase 3, inputs and outputs
4012   model->identifyInputsAndOutputs(
4013     {op12, op22, op32},
4014     {op42});
4015   // Phase 4: set relaxed execution
4016   model->relaxComputationFloat32toFloat16(true);
4017   assert(model->isValid());
4018 }
4019 
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i)4020 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i) {
4021   static std::set<int> ignore = {};
4022   return ignore.find(i) != ignore.end();
4023 }
4024 
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model * model)4025 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model *model) {
4026   OperandType type0(Type::BOOL, {});
4027   OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
4028   OperandType type12(Type::TENSOR_FLOAT16, {4});
4029   OperandType type19(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
4030   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
4031   OperandType type4(Type::INT32, {});
4032   // Phase 1, operands
4033   auto op12 = model->addOperand(&type19);
4034   auto op22 = model->addOperand(&type11);
4035   auto op32 = model->addOperand(&type12);
4036   auto param20 = model->addOperand(&type4);
4037   auto param21 = model->addOperand(&type4);
4038   auto param22 = model->addOperand(&type4);
4039   auto param23 = model->addOperand(&type4);
4040   auto param24 = model->addOperand(&type4);
4041   auto layout = model->addOperand(&type0);
4042   auto param25 = model->addOperand(&type4);
4043   auto param26 = model->addOperand(&type4);
4044   auto op42 = model->addOperand(&type24);
4045   // Phase 2, operations
4046   static int32_t param20_init[] = {2};
4047   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4048   static int32_t param21_init[] = {1};
4049   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4050   static int32_t param22_init[] = {1};
4051   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4052   static int32_t param23_init[] = {2};
4053   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4054   static int32_t param24_init[] = {0};
4055   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
4056   static bool8 layout_init[] = {true};
4057   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4058   static int32_t param25_init[] = {1};
4059   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
4060   static int32_t param26_init[] = {1};
4061   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
4062   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
4063   // Phase 3, inputs and outputs
4064   model->identifyInputsAndOutputs(
4065     {op12, op22, op32},
4066     {op42});
4067   assert(model->isValid());
4068 }
4069 
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i)4070 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i) {
4071   static std::set<int> ignore = {};
4072   return ignore.find(i) != ignore.end();
4073 }
4074 
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model * model)4075 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model *model) {
4076   OperandType type0(Type::BOOL, {});
4077   OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
4078   OperandType type15(Type::TENSOR_INT32, {4}, 0.005f, 0);
4079   OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
4080   OperandType type25(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
4081   OperandType type4(Type::INT32, {});
4082   // Phase 1, operands
4083   auto op12 = model->addOperand(&type21);
4084   auto op22 = model->addOperand(&type14);
4085   auto op32 = model->addOperand(&type15);
4086   auto param20 = model->addOperand(&type4);
4087   auto param21 = model->addOperand(&type4);
4088   auto param22 = model->addOperand(&type4);
4089   auto param23 = model->addOperand(&type4);
4090   auto param24 = model->addOperand(&type4);
4091   auto layout = model->addOperand(&type0);
4092   auto param25 = model->addOperand(&type4);
4093   auto param26 = model->addOperand(&type4);
4094   auto op42 = model->addOperand(&type25);
4095   // Phase 2, operations
4096   static int32_t param20_init[] = {2};
4097   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4098   static int32_t param21_init[] = {1};
4099   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4100   static int32_t param22_init[] = {1};
4101   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4102   static int32_t param23_init[] = {2};
4103   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4104   static int32_t param24_init[] = {0};
4105   model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
4106   static bool8 layout_init[] = {true};
4107   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4108   static int32_t param25_init[] = {1};
4109   model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
4110   static int32_t param26_init[] = {1};
4111   model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
4112   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param20, param21, param22, param23, param24, layout, param25, param26}, {op42});
4113   // Phase 3, inputs and outputs
4114   model->identifyInputsAndOutputs(
4115     {op12, op22, op32},
4116     {op42});
4117   assert(model->isValid());
4118 }
4119 
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i)4120 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i) {
4121   static std::set<int> ignore = {};
4122   return ignore.find(i) != ignore.end();
4123 }
4124 
CreateModel_nhwc_4(Model * model)4125 void CreateModel_nhwc_4(Model *model) {
4126   OperandType type0(Type::BOOL, {});
4127   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4128   OperandType type3(Type::TENSOR_FLOAT32, {4});
4129   OperandType type4(Type::INT32, {});
4130   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
4131   // Phase 1, operands
4132   auto op13 = model->addOperand(&type5);
4133   auto op23 = model->addOperand(&type2);
4134   auto op33 = model->addOperand(&type3);
4135   auto param27 = model->addOperand(&type4);
4136   auto param28 = model->addOperand(&type4);
4137   auto param29 = model->addOperand(&type4);
4138   auto param30 = model->addOperand(&type4);
4139   auto param31 = model->addOperand(&type4);
4140   auto layout = model->addOperand(&type0);
4141   auto param32 = model->addOperand(&type4);
4142   auto param33 = model->addOperand(&type4);
4143   auto op43 = model->addOperand(&type2);
4144   // Phase 2, operations
4145   static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
4146   model->setOperandValue(op23, op23_init, sizeof(float) * 16);
4147   static float op33_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
4148   model->setOperandValue(op33, op33_init, sizeof(float) * 4);
4149   static int32_t param27_init[] = {2};
4150   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4151   static int32_t param28_init[] = {1};
4152   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4153   static int32_t param29_init[] = {1};
4154   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4155   static int32_t param30_init[] = {2};
4156   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4157   static int32_t param31_init[] = {0};
4158   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4159   static bool8 layout_init[] = {false};
4160   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4161   static int32_t param32_init[] = {2};
4162   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4163   static int32_t param33_init[] = {2};
4164   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4165   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4166   // Phase 3, inputs and outputs
4167   model->identifyInputsAndOutputs(
4168     {op13},
4169     {op43});
4170   assert(model->isValid());
4171 }
4172 
is_ignored_nhwc_4(int i)4173 inline bool is_ignored_nhwc_4(int i) {
4174   static std::set<int> ignore = {};
4175   return ignore.find(i) != ignore.end();
4176 }
4177 
CreateModel_nhwc_weight_as_input_4(Model * model)4178 void CreateModel_nhwc_weight_as_input_4(Model *model) {
4179   OperandType type0(Type::BOOL, {});
4180   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4181   OperandType type3(Type::TENSOR_FLOAT32, {4});
4182   OperandType type4(Type::INT32, {});
4183   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
4184   // Phase 1, operands
4185   auto op13 = model->addOperand(&type5);
4186   auto op23 = model->addOperand(&type2);
4187   auto op33 = model->addOperand(&type3);
4188   auto param27 = model->addOperand(&type4);
4189   auto param28 = model->addOperand(&type4);
4190   auto param29 = model->addOperand(&type4);
4191   auto param30 = model->addOperand(&type4);
4192   auto param31 = model->addOperand(&type4);
4193   auto layout = model->addOperand(&type0);
4194   auto param32 = model->addOperand(&type4);
4195   auto param33 = model->addOperand(&type4);
4196   auto op43 = model->addOperand(&type2);
4197   // Phase 2, operations
4198   static int32_t param27_init[] = {2};
4199   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4200   static int32_t param28_init[] = {1};
4201   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4202   static int32_t param29_init[] = {1};
4203   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4204   static int32_t param30_init[] = {2};
4205   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4206   static int32_t param31_init[] = {0};
4207   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4208   static bool8 layout_init[] = {false};
4209   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4210   static int32_t param32_init[] = {2};
4211   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4212   static int32_t param33_init[] = {2};
4213   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4214   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4215   // Phase 3, inputs and outputs
4216   model->identifyInputsAndOutputs(
4217     {op13, op23, op33},
4218     {op43});
4219   assert(model->isValid());
4220 }
4221 
is_ignored_nhwc_weight_as_input_4(int i)4222 inline bool is_ignored_nhwc_weight_as_input_4(int i) {
4223   static std::set<int> ignore = {};
4224   return ignore.find(i) != ignore.end();
4225 }
4226 
CreateModel_nchw_4(Model * model)4227 void CreateModel_nchw_4(Model *model) {
4228   OperandType type0(Type::BOOL, {});
4229   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
4230   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4231   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
4232   OperandType type3(Type::TENSOR_FLOAT32, {4});
4233   OperandType type4(Type::INT32, {});
4234   // Phase 1, operands
4235   auto op13 = model->addOperand(&type26);
4236   auto op23 = model->addOperand(&type2);
4237   auto op33 = model->addOperand(&type3);
4238   auto param27 = model->addOperand(&type4);
4239   auto param28 = model->addOperand(&type4);
4240   auto param29 = model->addOperand(&type4);
4241   auto param30 = model->addOperand(&type4);
4242   auto param31 = model->addOperand(&type4);
4243   auto layout = model->addOperand(&type0);
4244   auto param32 = model->addOperand(&type4);
4245   auto param33 = model->addOperand(&type4);
4246   auto op43 = model->addOperand(&type18);
4247   // Phase 2, operations
4248   static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
4249   model->setOperandValue(op23, op23_init, sizeof(float) * 16);
4250   static float op33_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
4251   model->setOperandValue(op33, op33_init, sizeof(float) * 4);
4252   static int32_t param27_init[] = {2};
4253   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4254   static int32_t param28_init[] = {1};
4255   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4256   static int32_t param29_init[] = {1};
4257   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4258   static int32_t param30_init[] = {2};
4259   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4260   static int32_t param31_init[] = {0};
4261   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4262   static bool8 layout_init[] = {true};
4263   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4264   static int32_t param32_init[] = {2};
4265   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4266   static int32_t param33_init[] = {2};
4267   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4268   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4269   // Phase 3, inputs and outputs
4270   model->identifyInputsAndOutputs(
4271     {op13},
4272     {op43});
4273   assert(model->isValid());
4274 }
4275 
is_ignored_nchw_4(int i)4276 inline bool is_ignored_nchw_4(int i) {
4277   static std::set<int> ignore = {};
4278   return ignore.find(i) != ignore.end();
4279 }
4280 
CreateModel_nchw_weight_as_input_4(Model * model)4281 void CreateModel_nchw_weight_as_input_4(Model *model) {
4282   OperandType type0(Type::BOOL, {});
4283   OperandType type18(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
4284   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4285   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
4286   OperandType type3(Type::TENSOR_FLOAT32, {4});
4287   OperandType type4(Type::INT32, {});
4288   // Phase 1, operands
4289   auto op13 = model->addOperand(&type26);
4290   auto op23 = model->addOperand(&type2);
4291   auto op33 = model->addOperand(&type3);
4292   auto param27 = model->addOperand(&type4);
4293   auto param28 = model->addOperand(&type4);
4294   auto param29 = model->addOperand(&type4);
4295   auto param30 = model->addOperand(&type4);
4296   auto param31 = model->addOperand(&type4);
4297   auto layout = model->addOperand(&type0);
4298   auto param32 = model->addOperand(&type4);
4299   auto param33 = model->addOperand(&type4);
4300   auto op43 = model->addOperand(&type18);
4301   // Phase 2, operations
4302   static int32_t param27_init[] = {2};
4303   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4304   static int32_t param28_init[] = {1};
4305   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4306   static int32_t param29_init[] = {1};
4307   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4308   static int32_t param30_init[] = {2};
4309   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4310   static int32_t param31_init[] = {0};
4311   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4312   static bool8 layout_init[] = {true};
4313   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4314   static int32_t param32_init[] = {2};
4315   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4316   static int32_t param33_init[] = {2};
4317   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4318   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4319   // Phase 3, inputs and outputs
4320   model->identifyInputsAndOutputs(
4321     {op13, op23, op33},
4322     {op43});
4323   assert(model->isValid());
4324 }
4325 
is_ignored_nchw_weight_as_input_4(int i)4326 inline bool is_ignored_nchw_weight_as_input_4(int i) {
4327   static std::set<int> ignore = {};
4328   return ignore.find(i) != ignore.end();
4329 }
4330 
CreateModel_dynamic_output_shape_nhwc_4(Model * model)4331 void CreateModel_dynamic_output_shape_nhwc_4(Model *model) {
4332   OperandType type0(Type::BOOL, {});
4333   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4334   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4335   OperandType type3(Type::TENSOR_FLOAT32, {4});
4336   OperandType type4(Type::INT32, {});
4337   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
4338   // Phase 1, operands
4339   auto op13 = model->addOperand(&type5);
4340   auto op23 = model->addOperand(&type2);
4341   auto op33 = model->addOperand(&type3);
4342   auto param27 = model->addOperand(&type4);
4343   auto param28 = model->addOperand(&type4);
4344   auto param29 = model->addOperand(&type4);
4345   auto param30 = model->addOperand(&type4);
4346   auto param31 = model->addOperand(&type4);
4347   auto layout = model->addOperand(&type0);
4348   auto param32 = model->addOperand(&type4);
4349   auto param33 = model->addOperand(&type4);
4350   auto op43 = model->addOperand(&type23);
4351   // Phase 2, operations
4352   static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
4353   model->setOperandValue(op23, op23_init, sizeof(float) * 16);
4354   static float op33_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
4355   model->setOperandValue(op33, op33_init, sizeof(float) * 4);
4356   static int32_t param27_init[] = {2};
4357   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4358   static int32_t param28_init[] = {1};
4359   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4360   static int32_t param29_init[] = {1};
4361   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4362   static int32_t param30_init[] = {2};
4363   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4364   static int32_t param31_init[] = {0};
4365   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4366   static bool8 layout_init[] = {false};
4367   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4368   static int32_t param32_init[] = {2};
4369   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4370   static int32_t param33_init[] = {2};
4371   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4372   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4373   // Phase 3, inputs and outputs
4374   model->identifyInputsAndOutputs(
4375     {op13},
4376     {op43});
4377   assert(model->isValid());
4378 }
4379 
is_ignored_dynamic_output_shape_nhwc_4(int i)4380 inline bool is_ignored_dynamic_output_shape_nhwc_4(int i) {
4381   static std::set<int> ignore = {};
4382   return ignore.find(i) != ignore.end();
4383 }
4384 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model * model)4385 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model *model) {
4386   OperandType type0(Type::BOOL, {});
4387   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4388   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4389   OperandType type3(Type::TENSOR_FLOAT32, {4});
4390   OperandType type4(Type::INT32, {});
4391   OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
4392   // Phase 1, operands
4393   auto op13 = model->addOperand(&type5);
4394   auto op23 = model->addOperand(&type2);
4395   auto op33 = model->addOperand(&type3);
4396   auto param27 = model->addOperand(&type4);
4397   auto param28 = model->addOperand(&type4);
4398   auto param29 = model->addOperand(&type4);
4399   auto param30 = model->addOperand(&type4);
4400   auto param31 = model->addOperand(&type4);
4401   auto layout = model->addOperand(&type0);
4402   auto param32 = model->addOperand(&type4);
4403   auto param33 = model->addOperand(&type4);
4404   auto op43 = model->addOperand(&type23);
4405   // Phase 2, operations
4406   static int32_t param27_init[] = {2};
4407   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4408   static int32_t param28_init[] = {1};
4409   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4410   static int32_t param29_init[] = {1};
4411   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4412   static int32_t param30_init[] = {2};
4413   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4414   static int32_t param31_init[] = {0};
4415   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4416   static bool8 layout_init[] = {false};
4417   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4418   static int32_t param32_init[] = {2};
4419   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4420   static int32_t param33_init[] = {2};
4421   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4422   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4423   // Phase 3, inputs and outputs
4424   model->identifyInputsAndOutputs(
4425     {op13, op23, op33},
4426     {op43});
4427   assert(model->isValid());
4428 }
4429 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i)4430 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i) {
4431   static std::set<int> ignore = {};
4432   return ignore.find(i) != ignore.end();
4433 }
4434 
CreateModel_dynamic_output_shape_nchw_4(Model * model)4435 void CreateModel_dynamic_output_shape_nchw_4(Model *model) {
4436   OperandType type0(Type::BOOL, {});
4437   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4438   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4439   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
4440   OperandType type3(Type::TENSOR_FLOAT32, {4});
4441   OperandType type4(Type::INT32, {});
4442   // Phase 1, operands
4443   auto op13 = model->addOperand(&type26);
4444   auto op23 = model->addOperand(&type2);
4445   auto op33 = model->addOperand(&type3);
4446   auto param27 = model->addOperand(&type4);
4447   auto param28 = model->addOperand(&type4);
4448   auto param29 = model->addOperand(&type4);
4449   auto param30 = model->addOperand(&type4);
4450   auto param31 = model->addOperand(&type4);
4451   auto layout = model->addOperand(&type0);
4452   auto param32 = model->addOperand(&type4);
4453   auto param33 = model->addOperand(&type4);
4454   auto op43 = model->addOperand(&type23);
4455   // Phase 2, operations
4456   static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f};
4457   model->setOperandValue(op23, op23_init, sizeof(float) * 16);
4458   static float op33_init[] = {0.0f, 0.0f, 0.0f, 0.0f};
4459   model->setOperandValue(op33, op33_init, sizeof(float) * 4);
4460   static int32_t param27_init[] = {2};
4461   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4462   static int32_t param28_init[] = {1};
4463   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4464   static int32_t param29_init[] = {1};
4465   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4466   static int32_t param30_init[] = {2};
4467   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4468   static int32_t param31_init[] = {0};
4469   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4470   static bool8 layout_init[] = {true};
4471   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4472   static int32_t param32_init[] = {2};
4473   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4474   static int32_t param33_init[] = {2};
4475   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4476   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4477   // Phase 3, inputs and outputs
4478   model->identifyInputsAndOutputs(
4479     {op13},
4480     {op43});
4481   assert(model->isValid());
4482 }
4483 
is_ignored_dynamic_output_shape_nchw_4(int i)4484 inline bool is_ignored_dynamic_output_shape_nchw_4(int i) {
4485   static std::set<int> ignore = {};
4486   return ignore.find(i) != ignore.end();
4487 }
4488 
CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model * model)4489 void CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model *model) {
4490   OperandType type0(Type::BOOL, {});
4491   OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4492   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4493   OperandType type26(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
4494   OperandType type3(Type::TENSOR_FLOAT32, {4});
4495   OperandType type4(Type::INT32, {});
4496   // Phase 1, operands
4497   auto op13 = model->addOperand(&type26);
4498   auto op23 = model->addOperand(&type2);
4499   auto op33 = model->addOperand(&type3);
4500   auto param27 = model->addOperand(&type4);
4501   auto param28 = model->addOperand(&type4);
4502   auto param29 = model->addOperand(&type4);
4503   auto param30 = model->addOperand(&type4);
4504   auto param31 = model->addOperand(&type4);
4505   auto layout = model->addOperand(&type0);
4506   auto param32 = model->addOperand(&type4);
4507   auto param33 = model->addOperand(&type4);
4508   auto op43 = model->addOperand(&type23);
4509   // Phase 2, operations
4510   static int32_t param27_init[] = {2};
4511   model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
4512   static int32_t param28_init[] = {1};
4513   model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
4514   static int32_t param29_init[] = {1};
4515   model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
4516   static int32_t param30_init[] = {2};
4517   model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
4518   static int32_t param31_init[] = {0};
4519   model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
4520   static bool8 layout_init[] = {true};
4521   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4522   static int32_t param32_init[] = {2};
4523   model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
4524   static int32_t param33_init[] = {2};
4525   model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
4526   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param27, param28, param29, param30, param31, layout, param32, param33}, {op43});
4527   // Phase 3, inputs and outputs
4528   model->identifyInputsAndOutputs(
4529     {op13, op23, op33},
4530     {op43});
4531   assert(model->isValid());
4532 }
4533 
is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i)4534 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i) {
4535   static std::set<int> ignore = {};
4536   return ignore.find(i) != ignore.end();
4537 }
4538 
CreateModel_nhwc_5(Model * model)4539 void CreateModel_nhwc_5(Model *model) {
4540   OperandType type0(Type::BOOL, {});
4541   OperandType type4(Type::INT32, {});
4542   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
4543   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4544   OperandType type8(Type::TENSOR_FLOAT32, {1});
4545   OperandType type9(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4546   // Phase 1, operands
4547   auto op14 = model->addOperand(&type6);
4548   auto op24 = model->addOperand(&type7);
4549   auto op34 = model->addOperand(&type8);
4550   auto param34 = model->addOperand(&type4);
4551   auto param35 = model->addOperand(&type4);
4552   auto param36 = model->addOperand(&type4);
4553   auto param37 = model->addOperand(&type4);
4554   auto param38 = model->addOperand(&type4);
4555   auto layout = model->addOperand(&type0);
4556   auto param39 = model->addOperand(&type4);
4557   auto param40 = model->addOperand(&type4);
4558   auto op44 = model->addOperand(&type9);
4559   // Phase 2, operations
4560   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4561   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
4562   static float op34_init[] = {0.0f};
4563   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
4564   static int32_t param34_init[] = {1};
4565   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4566   static int32_t param35_init[] = {2};
4567   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4568   static int32_t param36_init[] = {2};
4569   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4570   static int32_t param37_init[] = {1};
4571   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4572   static int32_t param38_init[] = {0};
4573   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4574   static bool8 layout_init[] = {false};
4575   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4576   static int32_t param39_init[] = {3};
4577   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4578   static int32_t param40_init[] = {3};
4579   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4580   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4581   // Phase 3, inputs and outputs
4582   model->identifyInputsAndOutputs(
4583     {op14},
4584     {op44});
4585   assert(model->isValid());
4586 }
4587 
is_ignored_nhwc_5(int i)4588 inline bool is_ignored_nhwc_5(int i) {
4589   static std::set<int> ignore = {};
4590   return ignore.find(i) != ignore.end();
4591 }
4592 
CreateModel_nhwc_relaxed_3(Model * model)4593 void CreateModel_nhwc_relaxed_3(Model *model) {
4594   OperandType type0(Type::BOOL, {});
4595   OperandType type4(Type::INT32, {});
4596   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
4597   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4598   OperandType type8(Type::TENSOR_FLOAT32, {1});
4599   OperandType type9(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4600   // Phase 1, operands
4601   auto op14 = model->addOperand(&type6);
4602   auto op24 = model->addOperand(&type7);
4603   auto op34 = model->addOperand(&type8);
4604   auto param34 = model->addOperand(&type4);
4605   auto param35 = model->addOperand(&type4);
4606   auto param36 = model->addOperand(&type4);
4607   auto param37 = model->addOperand(&type4);
4608   auto param38 = model->addOperand(&type4);
4609   auto layout = model->addOperand(&type0);
4610   auto param39 = model->addOperand(&type4);
4611   auto param40 = model->addOperand(&type4);
4612   auto op44 = model->addOperand(&type9);
4613   // Phase 2, operations
4614   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4615   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
4616   static float op34_init[] = {0.0f};
4617   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
4618   static int32_t param34_init[] = {1};
4619   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4620   static int32_t param35_init[] = {2};
4621   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4622   static int32_t param36_init[] = {2};
4623   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4624   static int32_t param37_init[] = {1};
4625   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4626   static int32_t param38_init[] = {0};
4627   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4628   static bool8 layout_init[] = {false};
4629   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4630   static int32_t param39_init[] = {3};
4631   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4632   static int32_t param40_init[] = {3};
4633   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4634   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4635   // Phase 3, inputs and outputs
4636   model->identifyInputsAndOutputs(
4637     {op14},
4638     {op44});
4639   // Phase 4: set relaxed execution
4640   model->relaxComputationFloat32toFloat16(true);
4641   assert(model->isValid());
4642 }
4643 
is_ignored_nhwc_relaxed_3(int i)4644 inline bool is_ignored_nhwc_relaxed_3(int i) {
4645   static std::set<int> ignore = {};
4646   return ignore.find(i) != ignore.end();
4647 }
4648 
CreateModel_nhwc_quant8_3(Model * model)4649 void CreateModel_nhwc_quant8_3(Model *model) {
4650   OperandType type0(Type::BOOL, {});
4651   OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
4652   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4653   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4654   OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
4655   OperandType type4(Type::INT32, {});
4656   // Phase 1, operands
4657   auto op14 = model->addOperand(&type27);
4658   auto op24 = model->addOperand(&type28);
4659   auto op34 = model->addOperand(&type29);
4660   auto param34 = model->addOperand(&type4);
4661   auto param35 = model->addOperand(&type4);
4662   auto param36 = model->addOperand(&type4);
4663   auto param37 = model->addOperand(&type4);
4664   auto param38 = model->addOperand(&type4);
4665   auto layout = model->addOperand(&type0);
4666   auto param39 = model->addOperand(&type4);
4667   auto param40 = model->addOperand(&type4);
4668   auto op44 = model->addOperand(&type30);
4669   // Phase 2, operations
4670   static uint8_t op24_init[] = {8, 16, 24, 32};
4671   model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
4672   static int32_t op34_init[] = {0};
4673   model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
4674   static int32_t param34_init[] = {1};
4675   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4676   static int32_t param35_init[] = {2};
4677   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4678   static int32_t param36_init[] = {2};
4679   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4680   static int32_t param37_init[] = {1};
4681   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4682   static int32_t param38_init[] = {0};
4683   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4684   static bool8 layout_init[] = {false};
4685   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4686   static int32_t param39_init[] = {3};
4687   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4688   static int32_t param40_init[] = {3};
4689   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4690   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4691   // Phase 3, inputs and outputs
4692   model->identifyInputsAndOutputs(
4693     {op14},
4694     {op44});
4695   assert(model->isValid());
4696 }
4697 
is_ignored_nhwc_quant8_3(int i)4698 inline bool is_ignored_nhwc_quant8_3(int i) {
4699   static std::set<int> ignore = {};
4700   return ignore.find(i) != ignore.end();
4701 }
4702 
CreateModel_nhwc_float16_3(Model * model)4703 void CreateModel_nhwc_float16_3(Model *model) {
4704   OperandType type0(Type::BOOL, {});
4705   OperandType type31(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
4706   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4707   OperandType type33(Type::TENSOR_FLOAT16, {1});
4708   OperandType type34(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
4709   OperandType type4(Type::INT32, {});
4710   // Phase 1, operands
4711   auto op14 = model->addOperand(&type31);
4712   auto op24 = model->addOperand(&type32);
4713   auto op34 = model->addOperand(&type33);
4714   auto param34 = model->addOperand(&type4);
4715   auto param35 = model->addOperand(&type4);
4716   auto param36 = model->addOperand(&type4);
4717   auto param37 = model->addOperand(&type4);
4718   auto param38 = model->addOperand(&type4);
4719   auto layout = model->addOperand(&type0);
4720   auto param39 = model->addOperand(&type4);
4721   auto param40 = model->addOperand(&type4);
4722   auto op44 = model->addOperand(&type34);
4723   // Phase 2, operations
4724   static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4725   model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
4726   static _Float16 op34_init[] = {0.0f};
4727   model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
4728   static int32_t param34_init[] = {1};
4729   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4730   static int32_t param35_init[] = {2};
4731   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4732   static int32_t param36_init[] = {2};
4733   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4734   static int32_t param37_init[] = {1};
4735   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4736   static int32_t param38_init[] = {0};
4737   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4738   static bool8 layout_init[] = {false};
4739   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4740   static int32_t param39_init[] = {3};
4741   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4742   static int32_t param40_init[] = {3};
4743   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4744   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4745   // Phase 3, inputs and outputs
4746   model->identifyInputsAndOutputs(
4747     {op14},
4748     {op44});
4749   assert(model->isValid());
4750 }
4751 
is_ignored_nhwc_float16_3(int i)4752 inline bool is_ignored_nhwc_float16_3(int i) {
4753   static std::set<int> ignore = {};
4754   return ignore.find(i) != ignore.end();
4755 }
4756 
CreateModel_nhwc_weight_as_input_5(Model * model)4757 void CreateModel_nhwc_weight_as_input_5(Model *model) {
4758   OperandType type0(Type::BOOL, {});
4759   OperandType type4(Type::INT32, {});
4760   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
4761   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4762   OperandType type8(Type::TENSOR_FLOAT32, {1});
4763   OperandType type9(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4764   // Phase 1, operands
4765   auto op14 = model->addOperand(&type6);
4766   auto op24 = model->addOperand(&type7);
4767   auto op34 = model->addOperand(&type8);
4768   auto param34 = model->addOperand(&type4);
4769   auto param35 = model->addOperand(&type4);
4770   auto param36 = model->addOperand(&type4);
4771   auto param37 = model->addOperand(&type4);
4772   auto param38 = model->addOperand(&type4);
4773   auto layout = model->addOperand(&type0);
4774   auto param39 = model->addOperand(&type4);
4775   auto param40 = model->addOperand(&type4);
4776   auto op44 = model->addOperand(&type9);
4777   // Phase 2, operations
4778   static int32_t param34_init[] = {1};
4779   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4780   static int32_t param35_init[] = {2};
4781   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4782   static int32_t param36_init[] = {2};
4783   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4784   static int32_t param37_init[] = {1};
4785   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4786   static int32_t param38_init[] = {0};
4787   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4788   static bool8 layout_init[] = {false};
4789   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4790   static int32_t param39_init[] = {3};
4791   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4792   static int32_t param40_init[] = {3};
4793   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4794   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4795   // Phase 3, inputs and outputs
4796   model->identifyInputsAndOutputs(
4797     {op14, op24, op34},
4798     {op44});
4799   assert(model->isValid());
4800 }
4801 
is_ignored_nhwc_weight_as_input_5(int i)4802 inline bool is_ignored_nhwc_weight_as_input_5(int i) {
4803   static std::set<int> ignore = {};
4804   return ignore.find(i) != ignore.end();
4805 }
4806 
CreateModel_nhwc_weight_as_input_relaxed_3(Model * model)4807 void CreateModel_nhwc_weight_as_input_relaxed_3(Model *model) {
4808   OperandType type0(Type::BOOL, {});
4809   OperandType type4(Type::INT32, {});
4810   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
4811   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4812   OperandType type8(Type::TENSOR_FLOAT32, {1});
4813   OperandType type9(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4814   // Phase 1, operands
4815   auto op14 = model->addOperand(&type6);
4816   auto op24 = model->addOperand(&type7);
4817   auto op34 = model->addOperand(&type8);
4818   auto param34 = model->addOperand(&type4);
4819   auto param35 = model->addOperand(&type4);
4820   auto param36 = model->addOperand(&type4);
4821   auto param37 = model->addOperand(&type4);
4822   auto param38 = model->addOperand(&type4);
4823   auto layout = model->addOperand(&type0);
4824   auto param39 = model->addOperand(&type4);
4825   auto param40 = model->addOperand(&type4);
4826   auto op44 = model->addOperand(&type9);
4827   // Phase 2, operations
4828   static int32_t param34_init[] = {1};
4829   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4830   static int32_t param35_init[] = {2};
4831   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4832   static int32_t param36_init[] = {2};
4833   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4834   static int32_t param37_init[] = {1};
4835   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4836   static int32_t param38_init[] = {0};
4837   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4838   static bool8 layout_init[] = {false};
4839   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4840   static int32_t param39_init[] = {3};
4841   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4842   static int32_t param40_init[] = {3};
4843   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4844   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4845   // Phase 3, inputs and outputs
4846   model->identifyInputsAndOutputs(
4847     {op14, op24, op34},
4848     {op44});
4849   // Phase 4: set relaxed execution
4850   model->relaxComputationFloat32toFloat16(true);
4851   assert(model->isValid());
4852 }
4853 
is_ignored_nhwc_weight_as_input_relaxed_3(int i)4854 inline bool is_ignored_nhwc_weight_as_input_relaxed_3(int i) {
4855   static std::set<int> ignore = {};
4856   return ignore.find(i) != ignore.end();
4857 }
4858 
CreateModel_nhwc_weight_as_input_quant8_3(Model * model)4859 void CreateModel_nhwc_weight_as_input_quant8_3(Model *model) {
4860   OperandType type0(Type::BOOL, {});
4861   OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
4862   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4863   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4864   OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
4865   OperandType type4(Type::INT32, {});
4866   // Phase 1, operands
4867   auto op14 = model->addOperand(&type27);
4868   auto op24 = model->addOperand(&type28);
4869   auto op34 = model->addOperand(&type29);
4870   auto param34 = model->addOperand(&type4);
4871   auto param35 = model->addOperand(&type4);
4872   auto param36 = model->addOperand(&type4);
4873   auto param37 = model->addOperand(&type4);
4874   auto param38 = model->addOperand(&type4);
4875   auto layout = model->addOperand(&type0);
4876   auto param39 = model->addOperand(&type4);
4877   auto param40 = model->addOperand(&type4);
4878   auto op44 = model->addOperand(&type30);
4879   // Phase 2, operations
4880   static int32_t param34_init[] = {1};
4881   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4882   static int32_t param35_init[] = {2};
4883   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4884   static int32_t param36_init[] = {2};
4885   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4886   static int32_t param37_init[] = {1};
4887   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4888   static int32_t param38_init[] = {0};
4889   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4890   static bool8 layout_init[] = {false};
4891   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4892   static int32_t param39_init[] = {3};
4893   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4894   static int32_t param40_init[] = {3};
4895   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4896   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4897   // Phase 3, inputs and outputs
4898   model->identifyInputsAndOutputs(
4899     {op14, op24, op34},
4900     {op44});
4901   assert(model->isValid());
4902 }
4903 
is_ignored_nhwc_weight_as_input_quant8_3(int i)4904 inline bool is_ignored_nhwc_weight_as_input_quant8_3(int i) {
4905   static std::set<int> ignore = {};
4906   return ignore.find(i) != ignore.end();
4907 }
4908 
CreateModel_nhwc_weight_as_input_float16_3(Model * model)4909 void CreateModel_nhwc_weight_as_input_float16_3(Model *model) {
4910   OperandType type0(Type::BOOL, {});
4911   OperandType type31(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
4912   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4913   OperandType type33(Type::TENSOR_FLOAT16, {1});
4914   OperandType type34(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
4915   OperandType type4(Type::INT32, {});
4916   // Phase 1, operands
4917   auto op14 = model->addOperand(&type31);
4918   auto op24 = model->addOperand(&type32);
4919   auto op34 = model->addOperand(&type33);
4920   auto param34 = model->addOperand(&type4);
4921   auto param35 = model->addOperand(&type4);
4922   auto param36 = model->addOperand(&type4);
4923   auto param37 = model->addOperand(&type4);
4924   auto param38 = model->addOperand(&type4);
4925   auto layout = model->addOperand(&type0);
4926   auto param39 = model->addOperand(&type4);
4927   auto param40 = model->addOperand(&type4);
4928   auto op44 = model->addOperand(&type34);
4929   // Phase 2, operations
4930   static int32_t param34_init[] = {1};
4931   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4932   static int32_t param35_init[] = {2};
4933   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4934   static int32_t param36_init[] = {2};
4935   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4936   static int32_t param37_init[] = {1};
4937   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4938   static int32_t param38_init[] = {0};
4939   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4940   static bool8 layout_init[] = {false};
4941   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4942   static int32_t param39_init[] = {3};
4943   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4944   static int32_t param40_init[] = {3};
4945   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
4946   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
4947   // Phase 3, inputs and outputs
4948   model->identifyInputsAndOutputs(
4949     {op14, op24, op34},
4950     {op44});
4951   assert(model->isValid());
4952 }
4953 
is_ignored_nhwc_weight_as_input_float16_3(int i)4954 inline bool is_ignored_nhwc_weight_as_input_float16_3(int i) {
4955   static std::set<int> ignore = {};
4956   return ignore.find(i) != ignore.end();
4957 }
4958 
CreateModel_nchw_5(Model * model)4959 void CreateModel_nchw_5(Model *model) {
4960   OperandType type0(Type::BOOL, {});
4961   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
4962   OperandType type36(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4963   OperandType type4(Type::INT32, {});
4964   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4965   OperandType type8(Type::TENSOR_FLOAT32, {1});
4966   // Phase 1, operands
4967   auto op14 = model->addOperand(&type35);
4968   auto op24 = model->addOperand(&type7);
4969   auto op34 = model->addOperand(&type8);
4970   auto param34 = model->addOperand(&type4);
4971   auto param35 = model->addOperand(&type4);
4972   auto param36 = model->addOperand(&type4);
4973   auto param37 = model->addOperand(&type4);
4974   auto param38 = model->addOperand(&type4);
4975   auto layout = model->addOperand(&type0);
4976   auto param39 = model->addOperand(&type4);
4977   auto param40 = model->addOperand(&type4);
4978   auto op44 = model->addOperand(&type36);
4979   // Phase 2, operations
4980   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4981   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
4982   static float op34_init[] = {0.0f};
4983   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
4984   static int32_t param34_init[] = {1};
4985   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
4986   static int32_t param35_init[] = {2};
4987   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
4988   static int32_t param36_init[] = {2};
4989   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
4990   static int32_t param37_init[] = {1};
4991   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
4992   static int32_t param38_init[] = {0};
4993   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
4994   static bool8 layout_init[] = {true};
4995   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4996   static int32_t param39_init[] = {3};
4997   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
4998   static int32_t param40_init[] = {3};
4999   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5000   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5001   // Phase 3, inputs and outputs
5002   model->identifyInputsAndOutputs(
5003     {op14},
5004     {op44});
5005   assert(model->isValid());
5006 }
5007 
is_ignored_nchw_5(int i)5008 inline bool is_ignored_nchw_5(int i) {
5009   static std::set<int> ignore = {};
5010   return ignore.find(i) != ignore.end();
5011 }
5012 
CreateModel_nchw_relaxed_3(Model * model)5013 void CreateModel_nchw_relaxed_3(Model *model) {
5014   OperandType type0(Type::BOOL, {});
5015   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
5016   OperandType type36(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5017   OperandType type4(Type::INT32, {});
5018   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5019   OperandType type8(Type::TENSOR_FLOAT32, {1});
5020   // Phase 1, operands
5021   auto op14 = model->addOperand(&type35);
5022   auto op24 = model->addOperand(&type7);
5023   auto op34 = model->addOperand(&type8);
5024   auto param34 = model->addOperand(&type4);
5025   auto param35 = model->addOperand(&type4);
5026   auto param36 = model->addOperand(&type4);
5027   auto param37 = model->addOperand(&type4);
5028   auto param38 = model->addOperand(&type4);
5029   auto layout = model->addOperand(&type0);
5030   auto param39 = model->addOperand(&type4);
5031   auto param40 = model->addOperand(&type4);
5032   auto op44 = model->addOperand(&type36);
5033   // Phase 2, operations
5034   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5035   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
5036   static float op34_init[] = {0.0f};
5037   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
5038   static int32_t param34_init[] = {1};
5039   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5040   static int32_t param35_init[] = {2};
5041   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5042   static int32_t param36_init[] = {2};
5043   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5044   static int32_t param37_init[] = {1};
5045   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5046   static int32_t param38_init[] = {0};
5047   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5048   static bool8 layout_init[] = {true};
5049   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5050   static int32_t param39_init[] = {3};
5051   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5052   static int32_t param40_init[] = {3};
5053   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5054   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5055   // Phase 3, inputs and outputs
5056   model->identifyInputsAndOutputs(
5057     {op14},
5058     {op44});
5059   // Phase 4: set relaxed execution
5060   model->relaxComputationFloat32toFloat16(true);
5061   assert(model->isValid());
5062 }
5063 
is_ignored_nchw_relaxed_3(int i)5064 inline bool is_ignored_nchw_relaxed_3(int i) {
5065   static std::set<int> ignore = {};
5066   return ignore.find(i) != ignore.end();
5067 }
5068 
CreateModel_nchw_quant8_3(Model * model)5069 void CreateModel_nchw_quant8_3(Model *model) {
5070   OperandType type0(Type::BOOL, {});
5071   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5072   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5073   OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
5074   OperandType type38(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
5075   OperandType type4(Type::INT32, {});
5076   // Phase 1, operands
5077   auto op14 = model->addOperand(&type37);
5078   auto op24 = model->addOperand(&type28);
5079   auto op34 = model->addOperand(&type29);
5080   auto param34 = model->addOperand(&type4);
5081   auto param35 = model->addOperand(&type4);
5082   auto param36 = model->addOperand(&type4);
5083   auto param37 = model->addOperand(&type4);
5084   auto param38 = model->addOperand(&type4);
5085   auto layout = model->addOperand(&type0);
5086   auto param39 = model->addOperand(&type4);
5087   auto param40 = model->addOperand(&type4);
5088   auto op44 = model->addOperand(&type38);
5089   // Phase 2, operations
5090   static uint8_t op24_init[] = {8, 16, 24, 32};
5091   model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
5092   static int32_t op34_init[] = {0};
5093   model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
5094   static int32_t param34_init[] = {1};
5095   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5096   static int32_t param35_init[] = {2};
5097   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5098   static int32_t param36_init[] = {2};
5099   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5100   static int32_t param37_init[] = {1};
5101   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5102   static int32_t param38_init[] = {0};
5103   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5104   static bool8 layout_init[] = {true};
5105   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5106   static int32_t param39_init[] = {3};
5107   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5108   static int32_t param40_init[] = {3};
5109   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5110   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5111   // Phase 3, inputs and outputs
5112   model->identifyInputsAndOutputs(
5113     {op14},
5114     {op44});
5115   assert(model->isValid());
5116 }
5117 
is_ignored_nchw_quant8_3(int i)5118 inline bool is_ignored_nchw_quant8_3(int i) {
5119   static std::set<int> ignore = {};
5120   return ignore.find(i) != ignore.end();
5121 }
5122 
CreateModel_nchw_float16_3(Model * model)5123 void CreateModel_nchw_float16_3(Model *model) {
5124   OperandType type0(Type::BOOL, {});
5125   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5126   OperandType type33(Type::TENSOR_FLOAT16, {1});
5127   OperandType type39(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
5128   OperandType type4(Type::INT32, {});
5129   OperandType type40(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
5130   // Phase 1, operands
5131   auto op14 = model->addOperand(&type39);
5132   auto op24 = model->addOperand(&type32);
5133   auto op34 = model->addOperand(&type33);
5134   auto param34 = model->addOperand(&type4);
5135   auto param35 = model->addOperand(&type4);
5136   auto param36 = model->addOperand(&type4);
5137   auto param37 = model->addOperand(&type4);
5138   auto param38 = model->addOperand(&type4);
5139   auto layout = model->addOperand(&type0);
5140   auto param39 = model->addOperand(&type4);
5141   auto param40 = model->addOperand(&type4);
5142   auto op44 = model->addOperand(&type40);
5143   // Phase 2, operations
5144   static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5145   model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
5146   static _Float16 op34_init[] = {0.0f};
5147   model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
5148   static int32_t param34_init[] = {1};
5149   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5150   static int32_t param35_init[] = {2};
5151   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5152   static int32_t param36_init[] = {2};
5153   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5154   static int32_t param37_init[] = {1};
5155   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5156   static int32_t param38_init[] = {0};
5157   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5158   static bool8 layout_init[] = {true};
5159   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5160   static int32_t param39_init[] = {3};
5161   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5162   static int32_t param40_init[] = {3};
5163   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5164   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5165   // Phase 3, inputs and outputs
5166   model->identifyInputsAndOutputs(
5167     {op14},
5168     {op44});
5169   assert(model->isValid());
5170 }
5171 
is_ignored_nchw_float16_3(int i)5172 inline bool is_ignored_nchw_float16_3(int i) {
5173   static std::set<int> ignore = {};
5174   return ignore.find(i) != ignore.end();
5175 }
5176 
CreateModel_nchw_weight_as_input_5(Model * model)5177 void CreateModel_nchw_weight_as_input_5(Model *model) {
5178   OperandType type0(Type::BOOL, {});
5179   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
5180   OperandType type36(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5181   OperandType type4(Type::INT32, {});
5182   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5183   OperandType type8(Type::TENSOR_FLOAT32, {1});
5184   // Phase 1, operands
5185   auto op14 = model->addOperand(&type35);
5186   auto op24 = model->addOperand(&type7);
5187   auto op34 = model->addOperand(&type8);
5188   auto param34 = model->addOperand(&type4);
5189   auto param35 = model->addOperand(&type4);
5190   auto param36 = model->addOperand(&type4);
5191   auto param37 = model->addOperand(&type4);
5192   auto param38 = model->addOperand(&type4);
5193   auto layout = model->addOperand(&type0);
5194   auto param39 = model->addOperand(&type4);
5195   auto param40 = model->addOperand(&type4);
5196   auto op44 = model->addOperand(&type36);
5197   // Phase 2, operations
5198   static int32_t param34_init[] = {1};
5199   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5200   static int32_t param35_init[] = {2};
5201   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5202   static int32_t param36_init[] = {2};
5203   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5204   static int32_t param37_init[] = {1};
5205   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5206   static int32_t param38_init[] = {0};
5207   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5208   static bool8 layout_init[] = {true};
5209   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5210   static int32_t param39_init[] = {3};
5211   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5212   static int32_t param40_init[] = {3};
5213   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5214   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5215   // Phase 3, inputs and outputs
5216   model->identifyInputsAndOutputs(
5217     {op14, op24, op34},
5218     {op44});
5219   assert(model->isValid());
5220 }
5221 
is_ignored_nchw_weight_as_input_5(int i)5222 inline bool is_ignored_nchw_weight_as_input_5(int i) {
5223   static std::set<int> ignore = {};
5224   return ignore.find(i) != ignore.end();
5225 }
5226 
CreateModel_nchw_weight_as_input_relaxed_3(Model * model)5227 void CreateModel_nchw_weight_as_input_relaxed_3(Model *model) {
5228   OperandType type0(Type::BOOL, {});
5229   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
5230   OperandType type36(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5231   OperandType type4(Type::INT32, {});
5232   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5233   OperandType type8(Type::TENSOR_FLOAT32, {1});
5234   // Phase 1, operands
5235   auto op14 = model->addOperand(&type35);
5236   auto op24 = model->addOperand(&type7);
5237   auto op34 = model->addOperand(&type8);
5238   auto param34 = model->addOperand(&type4);
5239   auto param35 = model->addOperand(&type4);
5240   auto param36 = model->addOperand(&type4);
5241   auto param37 = model->addOperand(&type4);
5242   auto param38 = model->addOperand(&type4);
5243   auto layout = model->addOperand(&type0);
5244   auto param39 = model->addOperand(&type4);
5245   auto param40 = model->addOperand(&type4);
5246   auto op44 = model->addOperand(&type36);
5247   // Phase 2, operations
5248   static int32_t param34_init[] = {1};
5249   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5250   static int32_t param35_init[] = {2};
5251   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5252   static int32_t param36_init[] = {2};
5253   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5254   static int32_t param37_init[] = {1};
5255   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5256   static int32_t param38_init[] = {0};
5257   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5258   static bool8 layout_init[] = {true};
5259   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5260   static int32_t param39_init[] = {3};
5261   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5262   static int32_t param40_init[] = {3};
5263   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5264   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5265   // Phase 3, inputs and outputs
5266   model->identifyInputsAndOutputs(
5267     {op14, op24, op34},
5268     {op44});
5269   // Phase 4: set relaxed execution
5270   model->relaxComputationFloat32toFloat16(true);
5271   assert(model->isValid());
5272 }
5273 
is_ignored_nchw_weight_as_input_relaxed_3(int i)5274 inline bool is_ignored_nchw_weight_as_input_relaxed_3(int i) {
5275   static std::set<int> ignore = {};
5276   return ignore.find(i) != ignore.end();
5277 }
5278 
CreateModel_nchw_weight_as_input_quant8_3(Model * model)5279 void CreateModel_nchw_weight_as_input_quant8_3(Model *model) {
5280   OperandType type0(Type::BOOL, {});
5281   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5282   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5283   OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
5284   OperandType type38(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
5285   OperandType type4(Type::INT32, {});
5286   // Phase 1, operands
5287   auto op14 = model->addOperand(&type37);
5288   auto op24 = model->addOperand(&type28);
5289   auto op34 = model->addOperand(&type29);
5290   auto param34 = model->addOperand(&type4);
5291   auto param35 = model->addOperand(&type4);
5292   auto param36 = model->addOperand(&type4);
5293   auto param37 = model->addOperand(&type4);
5294   auto param38 = model->addOperand(&type4);
5295   auto layout = model->addOperand(&type0);
5296   auto param39 = model->addOperand(&type4);
5297   auto param40 = model->addOperand(&type4);
5298   auto op44 = model->addOperand(&type38);
5299   // Phase 2, operations
5300   static int32_t param34_init[] = {1};
5301   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5302   static int32_t param35_init[] = {2};
5303   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5304   static int32_t param36_init[] = {2};
5305   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5306   static int32_t param37_init[] = {1};
5307   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5308   static int32_t param38_init[] = {0};
5309   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5310   static bool8 layout_init[] = {true};
5311   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5312   static int32_t param39_init[] = {3};
5313   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5314   static int32_t param40_init[] = {3};
5315   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5316   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5317   // Phase 3, inputs and outputs
5318   model->identifyInputsAndOutputs(
5319     {op14, op24, op34},
5320     {op44});
5321   assert(model->isValid());
5322 }
5323 
is_ignored_nchw_weight_as_input_quant8_3(int i)5324 inline bool is_ignored_nchw_weight_as_input_quant8_3(int i) {
5325   static std::set<int> ignore = {};
5326   return ignore.find(i) != ignore.end();
5327 }
5328 
CreateModel_nchw_weight_as_input_float16_3(Model * model)5329 void CreateModel_nchw_weight_as_input_float16_3(Model *model) {
5330   OperandType type0(Type::BOOL, {});
5331   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5332   OperandType type33(Type::TENSOR_FLOAT16, {1});
5333   OperandType type39(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
5334   OperandType type4(Type::INT32, {});
5335   OperandType type40(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
5336   // Phase 1, operands
5337   auto op14 = model->addOperand(&type39);
5338   auto op24 = model->addOperand(&type32);
5339   auto op34 = model->addOperand(&type33);
5340   auto param34 = model->addOperand(&type4);
5341   auto param35 = model->addOperand(&type4);
5342   auto param36 = model->addOperand(&type4);
5343   auto param37 = model->addOperand(&type4);
5344   auto param38 = model->addOperand(&type4);
5345   auto layout = model->addOperand(&type0);
5346   auto param39 = model->addOperand(&type4);
5347   auto param40 = model->addOperand(&type4);
5348   auto op44 = model->addOperand(&type40);
5349   // Phase 2, operations
5350   static int32_t param34_init[] = {1};
5351   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5352   static int32_t param35_init[] = {2};
5353   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5354   static int32_t param36_init[] = {2};
5355   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5356   static int32_t param37_init[] = {1};
5357   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5358   static int32_t param38_init[] = {0};
5359   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5360   static bool8 layout_init[] = {true};
5361   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5362   static int32_t param39_init[] = {3};
5363   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5364   static int32_t param40_init[] = {3};
5365   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5366   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5367   // Phase 3, inputs and outputs
5368   model->identifyInputsAndOutputs(
5369     {op14, op24, op34},
5370     {op44});
5371   assert(model->isValid());
5372 }
5373 
is_ignored_nchw_weight_as_input_float16_3(int i)5374 inline bool is_ignored_nchw_weight_as_input_float16_3(int i) {
5375   static std::set<int> ignore = {};
5376   return ignore.find(i) != ignore.end();
5377 }
5378 
CreateModel_dynamic_output_shape_nhwc_5(Model * model)5379 void CreateModel_dynamic_output_shape_nhwc_5(Model *model) {
5380   OperandType type0(Type::BOOL, {});
5381   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5382   OperandType type4(Type::INT32, {});
5383   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
5384   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5385   OperandType type8(Type::TENSOR_FLOAT32, {1});
5386   // Phase 1, operands
5387   auto op14 = model->addOperand(&type6);
5388   auto op24 = model->addOperand(&type7);
5389   auto op34 = model->addOperand(&type8);
5390   auto param34 = model->addOperand(&type4);
5391   auto param35 = model->addOperand(&type4);
5392   auto param36 = model->addOperand(&type4);
5393   auto param37 = model->addOperand(&type4);
5394   auto param38 = model->addOperand(&type4);
5395   auto layout = model->addOperand(&type0);
5396   auto param39 = model->addOperand(&type4);
5397   auto param40 = model->addOperand(&type4);
5398   auto op44 = model->addOperand(&type23);
5399   // Phase 2, operations
5400   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5401   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
5402   static float op34_init[] = {0.0f};
5403   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
5404   static int32_t param34_init[] = {1};
5405   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5406   static int32_t param35_init[] = {2};
5407   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5408   static int32_t param36_init[] = {2};
5409   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5410   static int32_t param37_init[] = {1};
5411   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5412   static int32_t param38_init[] = {0};
5413   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5414   static bool8 layout_init[] = {false};
5415   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5416   static int32_t param39_init[] = {3};
5417   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5418   static int32_t param40_init[] = {3};
5419   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5420   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5421   // Phase 3, inputs and outputs
5422   model->identifyInputsAndOutputs(
5423     {op14},
5424     {op44});
5425   assert(model->isValid());
5426 }
5427 
is_ignored_dynamic_output_shape_nhwc_5(int i)5428 inline bool is_ignored_dynamic_output_shape_nhwc_5(int i) {
5429   static std::set<int> ignore = {};
5430   return ignore.find(i) != ignore.end();
5431 }
5432 
CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model * model)5433 void CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model *model) {
5434   OperandType type0(Type::BOOL, {});
5435   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5436   OperandType type4(Type::INT32, {});
5437   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
5438   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5439   OperandType type8(Type::TENSOR_FLOAT32, {1});
5440   // Phase 1, operands
5441   auto op14 = model->addOperand(&type6);
5442   auto op24 = model->addOperand(&type7);
5443   auto op34 = model->addOperand(&type8);
5444   auto param34 = model->addOperand(&type4);
5445   auto param35 = model->addOperand(&type4);
5446   auto param36 = model->addOperand(&type4);
5447   auto param37 = model->addOperand(&type4);
5448   auto param38 = model->addOperand(&type4);
5449   auto layout = model->addOperand(&type0);
5450   auto param39 = model->addOperand(&type4);
5451   auto param40 = model->addOperand(&type4);
5452   auto op44 = model->addOperand(&type23);
5453   // Phase 2, operations
5454   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5455   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
5456   static float op34_init[] = {0.0f};
5457   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
5458   static int32_t param34_init[] = {1};
5459   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5460   static int32_t param35_init[] = {2};
5461   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5462   static int32_t param36_init[] = {2};
5463   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5464   static int32_t param37_init[] = {1};
5465   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5466   static int32_t param38_init[] = {0};
5467   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5468   static bool8 layout_init[] = {false};
5469   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5470   static int32_t param39_init[] = {3};
5471   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5472   static int32_t param40_init[] = {3};
5473   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5474   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5475   // Phase 3, inputs and outputs
5476   model->identifyInputsAndOutputs(
5477     {op14},
5478     {op44});
5479   // Phase 4: set relaxed execution
5480   model->relaxComputationFloat32toFloat16(true);
5481   assert(model->isValid());
5482 }
5483 
is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i)5484 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) {
5485   static std::set<int> ignore = {};
5486   return ignore.find(i) != ignore.end();
5487 }
5488 
CreateModel_dynamic_output_shape_nhwc_quant8_3(Model * model)5489 void CreateModel_dynamic_output_shape_nhwc_quant8_3(Model *model) {
5490   OperandType type0(Type::BOOL, {});
5491   OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
5492   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5493   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5494   OperandType type4(Type::INT32, {});
5495   OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
5496   // Phase 1, operands
5497   auto op14 = model->addOperand(&type27);
5498   auto op24 = model->addOperand(&type28);
5499   auto op34 = model->addOperand(&type29);
5500   auto param34 = model->addOperand(&type4);
5501   auto param35 = model->addOperand(&type4);
5502   auto param36 = model->addOperand(&type4);
5503   auto param37 = model->addOperand(&type4);
5504   auto param38 = model->addOperand(&type4);
5505   auto layout = model->addOperand(&type0);
5506   auto param39 = model->addOperand(&type4);
5507   auto param40 = model->addOperand(&type4);
5508   auto op44 = model->addOperand(&type41);
5509   // Phase 2, operations
5510   static uint8_t op24_init[] = {8, 16, 24, 32};
5511   model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
5512   static int32_t op34_init[] = {0};
5513   model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
5514   static int32_t param34_init[] = {1};
5515   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5516   static int32_t param35_init[] = {2};
5517   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5518   static int32_t param36_init[] = {2};
5519   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5520   static int32_t param37_init[] = {1};
5521   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5522   static int32_t param38_init[] = {0};
5523   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5524   static bool8 layout_init[] = {false};
5525   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5526   static int32_t param39_init[] = {3};
5527   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5528   static int32_t param40_init[] = {3};
5529   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5530   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5531   // Phase 3, inputs and outputs
5532   model->identifyInputsAndOutputs(
5533     {op14},
5534     {op44});
5535   assert(model->isValid());
5536 }
5537 
is_ignored_dynamic_output_shape_nhwc_quant8_3(int i)5538 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) {
5539   static std::set<int> ignore = {};
5540   return ignore.find(i) != ignore.end();
5541 }
5542 
CreateModel_dynamic_output_shape_nhwc_float16_3(Model * model)5543 void CreateModel_dynamic_output_shape_nhwc_float16_3(Model *model) {
5544   OperandType type0(Type::BOOL, {});
5545   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5546   OperandType type31(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
5547   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5548   OperandType type33(Type::TENSOR_FLOAT16, {1});
5549   OperandType type4(Type::INT32, {});
5550   // Phase 1, operands
5551   auto op14 = model->addOperand(&type31);
5552   auto op24 = model->addOperand(&type32);
5553   auto op34 = model->addOperand(&type33);
5554   auto param34 = model->addOperand(&type4);
5555   auto param35 = model->addOperand(&type4);
5556   auto param36 = model->addOperand(&type4);
5557   auto param37 = model->addOperand(&type4);
5558   auto param38 = model->addOperand(&type4);
5559   auto layout = model->addOperand(&type0);
5560   auto param39 = model->addOperand(&type4);
5561   auto param40 = model->addOperand(&type4);
5562   auto op44 = model->addOperand(&type24);
5563   // Phase 2, operations
5564   static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5565   model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
5566   static _Float16 op34_init[] = {0.0f};
5567   model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
5568   static int32_t param34_init[] = {1};
5569   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5570   static int32_t param35_init[] = {2};
5571   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5572   static int32_t param36_init[] = {2};
5573   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5574   static int32_t param37_init[] = {1};
5575   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5576   static int32_t param38_init[] = {0};
5577   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5578   static bool8 layout_init[] = {false};
5579   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5580   static int32_t param39_init[] = {3};
5581   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5582   static int32_t param40_init[] = {3};
5583   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5584   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5585   // Phase 3, inputs and outputs
5586   model->identifyInputsAndOutputs(
5587     {op14},
5588     {op44});
5589   assert(model->isValid());
5590 }
5591 
is_ignored_dynamic_output_shape_nhwc_float16_3(int i)5592 inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) {
5593   static std::set<int> ignore = {};
5594   return ignore.find(i) != ignore.end();
5595 }
5596 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model * model)5597 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model *model) {
5598   OperandType type0(Type::BOOL, {});
5599   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5600   OperandType type4(Type::INT32, {});
5601   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
5602   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5603   OperandType type8(Type::TENSOR_FLOAT32, {1});
5604   // Phase 1, operands
5605   auto op14 = model->addOperand(&type6);
5606   auto op24 = model->addOperand(&type7);
5607   auto op34 = model->addOperand(&type8);
5608   auto param34 = model->addOperand(&type4);
5609   auto param35 = model->addOperand(&type4);
5610   auto param36 = model->addOperand(&type4);
5611   auto param37 = model->addOperand(&type4);
5612   auto param38 = model->addOperand(&type4);
5613   auto layout = model->addOperand(&type0);
5614   auto param39 = model->addOperand(&type4);
5615   auto param40 = model->addOperand(&type4);
5616   auto op44 = model->addOperand(&type23);
5617   // Phase 2, operations
5618   static int32_t param34_init[] = {1};
5619   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5620   static int32_t param35_init[] = {2};
5621   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5622   static int32_t param36_init[] = {2};
5623   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5624   static int32_t param37_init[] = {1};
5625   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5626   static int32_t param38_init[] = {0};
5627   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5628   static bool8 layout_init[] = {false};
5629   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5630   static int32_t param39_init[] = {3};
5631   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5632   static int32_t param40_init[] = {3};
5633   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5634   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5635   // Phase 3, inputs and outputs
5636   model->identifyInputsAndOutputs(
5637     {op14, op24, op34},
5638     {op44});
5639   assert(model->isValid());
5640 }
5641 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i)5642 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i) {
5643   static std::set<int> ignore = {};
5644   return ignore.find(i) != ignore.end();
5645 }
5646 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(Model * model)5647 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(Model *model) {
5648   OperandType type0(Type::BOOL, {});
5649   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5650   OperandType type4(Type::INT32, {});
5651   OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
5652   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5653   OperandType type8(Type::TENSOR_FLOAT32, {1});
5654   // Phase 1, operands
5655   auto op14 = model->addOperand(&type6);
5656   auto op24 = model->addOperand(&type7);
5657   auto op34 = model->addOperand(&type8);
5658   auto param34 = model->addOperand(&type4);
5659   auto param35 = model->addOperand(&type4);
5660   auto param36 = model->addOperand(&type4);
5661   auto param37 = model->addOperand(&type4);
5662   auto param38 = model->addOperand(&type4);
5663   auto layout = model->addOperand(&type0);
5664   auto param39 = model->addOperand(&type4);
5665   auto param40 = model->addOperand(&type4);
5666   auto op44 = model->addOperand(&type23);
5667   // Phase 2, operations
5668   static int32_t param34_init[] = {1};
5669   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5670   static int32_t param35_init[] = {2};
5671   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5672   static int32_t param36_init[] = {2};
5673   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5674   static int32_t param37_init[] = {1};
5675   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5676   static int32_t param38_init[] = {0};
5677   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5678   static bool8 layout_init[] = {false};
5679   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5680   static int32_t param39_init[] = {3};
5681   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5682   static int32_t param40_init[] = {3};
5683   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5684   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5685   // Phase 3, inputs and outputs
5686   model->identifyInputsAndOutputs(
5687     {op14, op24, op34},
5688     {op44});
5689   // Phase 4: set relaxed execution
5690   model->relaxComputationFloat32toFloat16(true);
5691   assert(model->isValid());
5692 }
5693 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(int i)5694 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(int i) {
5695   static std::set<int> ignore = {};
5696   return ignore.find(i) != ignore.end();
5697 }
5698 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_3(Model * model)5699 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_3(Model *model) {
5700   OperandType type0(Type::BOOL, {});
5701   OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
5702   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5703   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5704   OperandType type4(Type::INT32, {});
5705   OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
5706   // Phase 1, operands
5707   auto op14 = model->addOperand(&type27);
5708   auto op24 = model->addOperand(&type28);
5709   auto op34 = model->addOperand(&type29);
5710   auto param34 = model->addOperand(&type4);
5711   auto param35 = model->addOperand(&type4);
5712   auto param36 = model->addOperand(&type4);
5713   auto param37 = model->addOperand(&type4);
5714   auto param38 = model->addOperand(&type4);
5715   auto layout = model->addOperand(&type0);
5716   auto param39 = model->addOperand(&type4);
5717   auto param40 = model->addOperand(&type4);
5718   auto op44 = model->addOperand(&type41);
5719   // Phase 2, operations
5720   static int32_t param34_init[] = {1};
5721   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5722   static int32_t param35_init[] = {2};
5723   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5724   static int32_t param36_init[] = {2};
5725   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5726   static int32_t param37_init[] = {1};
5727   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5728   static int32_t param38_init[] = {0};
5729   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5730   static bool8 layout_init[] = {false};
5731   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5732   static int32_t param39_init[] = {3};
5733   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5734   static int32_t param40_init[] = {3};
5735   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5736   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5737   // Phase 3, inputs and outputs
5738   model->identifyInputsAndOutputs(
5739     {op14, op24, op34},
5740     {op44});
5741   assert(model->isValid());
5742 }
5743 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_3(int i)5744 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_3(int i) {
5745   static std::set<int> ignore = {};
5746   return ignore.find(i) != ignore.end();
5747 }
5748 
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_3(Model * model)5749 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_3(Model *model) {
5750   OperandType type0(Type::BOOL, {});
5751   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5752   OperandType type31(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
5753   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5754   OperandType type33(Type::TENSOR_FLOAT16, {1});
5755   OperandType type4(Type::INT32, {});
5756   // Phase 1, operands
5757   auto op14 = model->addOperand(&type31);
5758   auto op24 = model->addOperand(&type32);
5759   auto op34 = model->addOperand(&type33);
5760   auto param34 = model->addOperand(&type4);
5761   auto param35 = model->addOperand(&type4);
5762   auto param36 = model->addOperand(&type4);
5763   auto param37 = model->addOperand(&type4);
5764   auto param38 = model->addOperand(&type4);
5765   auto layout = model->addOperand(&type0);
5766   auto param39 = model->addOperand(&type4);
5767   auto param40 = model->addOperand(&type4);
5768   auto op44 = model->addOperand(&type24);
5769   // Phase 2, operations
5770   static int32_t param34_init[] = {1};
5771   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5772   static int32_t param35_init[] = {2};
5773   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5774   static int32_t param36_init[] = {2};
5775   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5776   static int32_t param37_init[] = {1};
5777   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5778   static int32_t param38_init[] = {0};
5779   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5780   static bool8 layout_init[] = {false};
5781   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5782   static int32_t param39_init[] = {3};
5783   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5784   static int32_t param40_init[] = {3};
5785   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5786   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5787   // Phase 3, inputs and outputs
5788   model->identifyInputsAndOutputs(
5789     {op14, op24, op34},
5790     {op44});
5791   assert(model->isValid());
5792 }
5793 
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_3(int i)5794 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_3(int i) {
5795   static std::set<int> ignore = {};
5796   return ignore.find(i) != ignore.end();
5797 }
5798 
CreateModel_dynamic_output_shape_nchw_5(Model * model)5799 void CreateModel_dynamic_output_shape_nchw_5(Model *model) {
5800   OperandType type0(Type::BOOL, {});
5801   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5802   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
5803   OperandType type4(Type::INT32, {});
5804   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5805   OperandType type8(Type::TENSOR_FLOAT32, {1});
5806   // Phase 1, operands
5807   auto op14 = model->addOperand(&type35);
5808   auto op24 = model->addOperand(&type7);
5809   auto op34 = model->addOperand(&type8);
5810   auto param34 = model->addOperand(&type4);
5811   auto param35 = model->addOperand(&type4);
5812   auto param36 = model->addOperand(&type4);
5813   auto param37 = model->addOperand(&type4);
5814   auto param38 = model->addOperand(&type4);
5815   auto layout = model->addOperand(&type0);
5816   auto param39 = model->addOperand(&type4);
5817   auto param40 = model->addOperand(&type4);
5818   auto op44 = model->addOperand(&type23);
5819   // Phase 2, operations
5820   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5821   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
5822   static float op34_init[] = {0.0f};
5823   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
5824   static int32_t param34_init[] = {1};
5825   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5826   static int32_t param35_init[] = {2};
5827   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5828   static int32_t param36_init[] = {2};
5829   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5830   static int32_t param37_init[] = {1};
5831   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5832   static int32_t param38_init[] = {0};
5833   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5834   static bool8 layout_init[] = {true};
5835   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5836   static int32_t param39_init[] = {3};
5837   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5838   static int32_t param40_init[] = {3};
5839   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5840   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5841   // Phase 3, inputs and outputs
5842   model->identifyInputsAndOutputs(
5843     {op14},
5844     {op44});
5845   assert(model->isValid());
5846 }
5847 
is_ignored_dynamic_output_shape_nchw_5(int i)5848 inline bool is_ignored_dynamic_output_shape_nchw_5(int i) {
5849   static std::set<int> ignore = {};
5850   return ignore.find(i) != ignore.end();
5851 }
5852 
CreateModel_dynamic_output_shape_nchw_relaxed_3(Model * model)5853 void CreateModel_dynamic_output_shape_nchw_relaxed_3(Model *model) {
5854   OperandType type0(Type::BOOL, {});
5855   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5856   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
5857   OperandType type4(Type::INT32, {});
5858   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5859   OperandType type8(Type::TENSOR_FLOAT32, {1});
5860   // Phase 1, operands
5861   auto op14 = model->addOperand(&type35);
5862   auto op24 = model->addOperand(&type7);
5863   auto op34 = model->addOperand(&type8);
5864   auto param34 = model->addOperand(&type4);
5865   auto param35 = model->addOperand(&type4);
5866   auto param36 = model->addOperand(&type4);
5867   auto param37 = model->addOperand(&type4);
5868   auto param38 = model->addOperand(&type4);
5869   auto layout = model->addOperand(&type0);
5870   auto param39 = model->addOperand(&type4);
5871   auto param40 = model->addOperand(&type4);
5872   auto op44 = model->addOperand(&type23);
5873   // Phase 2, operations
5874   static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5875   model->setOperandValue(op24, op24_init, sizeof(float) * 4);
5876   static float op34_init[] = {0.0f};
5877   model->setOperandValue(op34, op34_init, sizeof(float) * 1);
5878   static int32_t param34_init[] = {1};
5879   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5880   static int32_t param35_init[] = {2};
5881   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5882   static int32_t param36_init[] = {2};
5883   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5884   static int32_t param37_init[] = {1};
5885   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5886   static int32_t param38_init[] = {0};
5887   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5888   static bool8 layout_init[] = {true};
5889   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5890   static int32_t param39_init[] = {3};
5891   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5892   static int32_t param40_init[] = {3};
5893   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5894   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5895   // Phase 3, inputs and outputs
5896   model->identifyInputsAndOutputs(
5897     {op14},
5898     {op44});
5899   // Phase 4: set relaxed execution
5900   model->relaxComputationFloat32toFloat16(true);
5901   assert(model->isValid());
5902 }
5903 
is_ignored_dynamic_output_shape_nchw_relaxed_3(int i)5904 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) {
5905   static std::set<int> ignore = {};
5906   return ignore.find(i) != ignore.end();
5907 }
5908 
CreateModel_dynamic_output_shape_nchw_quant8_3(Model * model)5909 void CreateModel_dynamic_output_shape_nchw_quant8_3(Model *model) {
5910   OperandType type0(Type::BOOL, {});
5911   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5912   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5913   OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
5914   OperandType type4(Type::INT32, {});
5915   OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
5916   // Phase 1, operands
5917   auto op14 = model->addOperand(&type37);
5918   auto op24 = model->addOperand(&type28);
5919   auto op34 = model->addOperand(&type29);
5920   auto param34 = model->addOperand(&type4);
5921   auto param35 = model->addOperand(&type4);
5922   auto param36 = model->addOperand(&type4);
5923   auto param37 = model->addOperand(&type4);
5924   auto param38 = model->addOperand(&type4);
5925   auto layout = model->addOperand(&type0);
5926   auto param39 = model->addOperand(&type4);
5927   auto param40 = model->addOperand(&type4);
5928   auto op44 = model->addOperand(&type41);
5929   // Phase 2, operations
5930   static uint8_t op24_init[] = {8, 16, 24, 32};
5931   model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
5932   static int32_t op34_init[] = {0};
5933   model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
5934   static int32_t param34_init[] = {1};
5935   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5936   static int32_t param35_init[] = {2};
5937   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5938   static int32_t param36_init[] = {2};
5939   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5940   static int32_t param37_init[] = {1};
5941   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5942   static int32_t param38_init[] = {0};
5943   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5944   static bool8 layout_init[] = {true};
5945   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5946   static int32_t param39_init[] = {3};
5947   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
5948   static int32_t param40_init[] = {3};
5949   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
5950   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
5951   // Phase 3, inputs and outputs
5952   model->identifyInputsAndOutputs(
5953     {op14},
5954     {op44});
5955   assert(model->isValid());
5956 }
5957 
is_ignored_dynamic_output_shape_nchw_quant8_3(int i)5958 inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) {
5959   static std::set<int> ignore = {};
5960   return ignore.find(i) != ignore.end();
5961 }
5962 
CreateModel_dynamic_output_shape_nchw_float16_3(Model * model)5963 void CreateModel_dynamic_output_shape_nchw_float16_3(Model *model) {
5964   OperandType type0(Type::BOOL, {});
5965   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5966   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5967   OperandType type33(Type::TENSOR_FLOAT16, {1});
5968   OperandType type39(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
5969   OperandType type4(Type::INT32, {});
5970   // Phase 1, operands
5971   auto op14 = model->addOperand(&type39);
5972   auto op24 = model->addOperand(&type32);
5973   auto op34 = model->addOperand(&type33);
5974   auto param34 = model->addOperand(&type4);
5975   auto param35 = model->addOperand(&type4);
5976   auto param36 = model->addOperand(&type4);
5977   auto param37 = model->addOperand(&type4);
5978   auto param38 = model->addOperand(&type4);
5979   auto layout = model->addOperand(&type0);
5980   auto param39 = model->addOperand(&type4);
5981   auto param40 = model->addOperand(&type4);
5982   auto op44 = model->addOperand(&type24);
5983   // Phase 2, operations
5984   static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
5985   model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
5986   static _Float16 op34_init[] = {0.0f};
5987   model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
5988   static int32_t param34_init[] = {1};
5989   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
5990   static int32_t param35_init[] = {2};
5991   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
5992   static int32_t param36_init[] = {2};
5993   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
5994   static int32_t param37_init[] = {1};
5995   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
5996   static int32_t param38_init[] = {0};
5997   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
5998   static bool8 layout_init[] = {true};
5999   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6000   static int32_t param39_init[] = {3};
6001   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
6002   static int32_t param40_init[] = {3};
6003   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
6004   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
6005   // Phase 3, inputs and outputs
6006   model->identifyInputsAndOutputs(
6007     {op14},
6008     {op44});
6009   assert(model->isValid());
6010 }
6011 
is_ignored_dynamic_output_shape_nchw_float16_3(int i)6012 inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) {
6013   static std::set<int> ignore = {};
6014   return ignore.find(i) != ignore.end();
6015 }
6016 
CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model * model)6017 void CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model *model) {
6018   OperandType type0(Type::BOOL, {});
6019   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6020   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
6021   OperandType type4(Type::INT32, {});
6022   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
6023   OperandType type8(Type::TENSOR_FLOAT32, {1});
6024   // Phase 1, operands
6025   auto op14 = model->addOperand(&type35);
6026   auto op24 = model->addOperand(&type7);
6027   auto op34 = model->addOperand(&type8);
6028   auto param34 = model->addOperand(&type4);
6029   auto param35 = model->addOperand(&type4);
6030   auto param36 = model->addOperand(&type4);
6031   auto param37 = model->addOperand(&type4);
6032   auto param38 = model->addOperand(&type4);
6033   auto layout = model->addOperand(&type0);
6034   auto param39 = model->addOperand(&type4);
6035   auto param40 = model->addOperand(&type4);
6036   auto op44 = model->addOperand(&type23);
6037   // Phase 2, operations
6038   static int32_t param34_init[] = {1};
6039   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6040   static int32_t param35_init[] = {2};
6041   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6042   static int32_t param36_init[] = {2};
6043   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
6044   static int32_t param37_init[] = {1};
6045   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
6046   static int32_t param38_init[] = {0};
6047   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
6048   static bool8 layout_init[] = {true};
6049   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6050   static int32_t param39_init[] = {3};
6051   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
6052   static int32_t param40_init[] = {3};
6053   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
6054   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
6055   // Phase 3, inputs and outputs
6056   model->identifyInputsAndOutputs(
6057     {op14, op24, op34},
6058     {op44});
6059   assert(model->isValid());
6060 }
6061 
is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i)6062 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i) {
6063   static std::set<int> ignore = {};
6064   return ignore.find(i) != ignore.end();
6065 }
6066 
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_3(Model * model)6067 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_3(Model *model) {
6068   OperandType type0(Type::BOOL, {});
6069   OperandType type23(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6070   OperandType type35(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
6071   OperandType type4(Type::INT32, {});
6072   OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
6073   OperandType type8(Type::TENSOR_FLOAT32, {1});
6074   // Phase 1, operands
6075   auto op14 = model->addOperand(&type35);
6076   auto op24 = model->addOperand(&type7);
6077   auto op34 = model->addOperand(&type8);
6078   auto param34 = model->addOperand(&type4);
6079   auto param35 = model->addOperand(&type4);
6080   auto param36 = model->addOperand(&type4);
6081   auto param37 = model->addOperand(&type4);
6082   auto param38 = model->addOperand(&type4);
6083   auto layout = model->addOperand(&type0);
6084   auto param39 = model->addOperand(&type4);
6085   auto param40 = model->addOperand(&type4);
6086   auto op44 = model->addOperand(&type23);
6087   // Phase 2, operations
6088   static int32_t param34_init[] = {1};
6089   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6090   static int32_t param35_init[] = {2};
6091   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6092   static int32_t param36_init[] = {2};
6093   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
6094   static int32_t param37_init[] = {1};
6095   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
6096   static int32_t param38_init[] = {0};
6097   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
6098   static bool8 layout_init[] = {true};
6099   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6100   static int32_t param39_init[] = {3};
6101   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
6102   static int32_t param40_init[] = {3};
6103   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
6104   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
6105   // Phase 3, inputs and outputs
6106   model->identifyInputsAndOutputs(
6107     {op14, op24, op34},
6108     {op44});
6109   // Phase 4: set relaxed execution
6110   model->relaxComputationFloat32toFloat16(true);
6111   assert(model->isValid());
6112 }
6113 
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_3(int i)6114 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_3(int i) {
6115   static std::set<int> ignore = {};
6116   return ignore.find(i) != ignore.end();
6117 }
6118 
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_3(Model * model)6119 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_3(Model *model) {
6120   OperandType type0(Type::BOOL, {});
6121   OperandType type28(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
6122   OperandType type29(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6123   OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
6124   OperandType type4(Type::INT32, {});
6125   OperandType type41(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
6126   // Phase 1, operands
6127   auto op14 = model->addOperand(&type37);
6128   auto op24 = model->addOperand(&type28);
6129   auto op34 = model->addOperand(&type29);
6130   auto param34 = model->addOperand(&type4);
6131   auto param35 = model->addOperand(&type4);
6132   auto param36 = model->addOperand(&type4);
6133   auto param37 = model->addOperand(&type4);
6134   auto param38 = model->addOperand(&type4);
6135   auto layout = model->addOperand(&type0);
6136   auto param39 = model->addOperand(&type4);
6137   auto param40 = model->addOperand(&type4);
6138   auto op44 = model->addOperand(&type41);
6139   // Phase 2, operations
6140   static int32_t param34_init[] = {1};
6141   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6142   static int32_t param35_init[] = {2};
6143   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6144   static int32_t param36_init[] = {2};
6145   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
6146   static int32_t param37_init[] = {1};
6147   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
6148   static int32_t param38_init[] = {0};
6149   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
6150   static bool8 layout_init[] = {true};
6151   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6152   static int32_t param39_init[] = {3};
6153   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
6154   static int32_t param40_init[] = {3};
6155   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
6156   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
6157   // Phase 3, inputs and outputs
6158   model->identifyInputsAndOutputs(
6159     {op14, op24, op34},
6160     {op44});
6161   assert(model->isValid());
6162 }
6163 
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_3(int i)6164 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_3(int i) {
6165   static std::set<int> ignore = {};
6166   return ignore.find(i) != ignore.end();
6167 }
6168 
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_3(Model * model)6169 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_3(Model *model) {
6170   OperandType type0(Type::BOOL, {});
6171   OperandType type24(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6172   OperandType type32(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
6173   OperandType type33(Type::TENSOR_FLOAT16, {1});
6174   OperandType type39(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
6175   OperandType type4(Type::INT32, {});
6176   // Phase 1, operands
6177   auto op14 = model->addOperand(&type39);
6178   auto op24 = model->addOperand(&type32);
6179   auto op34 = model->addOperand(&type33);
6180   auto param34 = model->addOperand(&type4);
6181   auto param35 = model->addOperand(&type4);
6182   auto param36 = model->addOperand(&type4);
6183   auto param37 = model->addOperand(&type4);
6184   auto param38 = model->addOperand(&type4);
6185   auto layout = model->addOperand(&type0);
6186   auto param39 = model->addOperand(&type4);
6187   auto param40 = model->addOperand(&type4);
6188   auto op44 = model->addOperand(&type24);
6189   // Phase 2, operations
6190   static int32_t param34_init[] = {1};
6191   model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6192   static int32_t param35_init[] = {2};
6193   model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6194   static int32_t param36_init[] = {2};
6195   model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1);
6196   static int32_t param37_init[] = {1};
6197   model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1);
6198   static int32_t param38_init[] = {0};
6199   model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1);
6200   static bool8 layout_init[] = {true};
6201   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6202   static int32_t param39_init[] = {3};
6203   model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1);
6204   static int32_t param40_init[] = {3};
6205   model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1);
6206   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param34, param35, param36, param37, param38, layout, param39, param40}, {op44});
6207   // Phase 3, inputs and outputs
6208   model->identifyInputsAndOutputs(
6209     {op14, op24, op34},
6210     {op44});
6211   assert(model->isValid());
6212 }
6213 
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_3(int i)6214 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_3(int i) {
6215   static std::set<int> ignore = {};
6216   return ignore.find(i) != ignore.end();
6217 }
6218 
6219