1 // clang-format off
2 // Generated file (from: depthwise_conv2d_per_channel.mod.py). Do not edit
CreateModel_same(Model * model)3 void CreateModel_same(Model *model) {
4   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 0);
5   OperandType type1(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.5f},3));
6   OperandType type2(Type::TENSOR_INT32, {2});
7   OperandType type3(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 1.0f, 0);
8   OperandType type4(Type::INT32, {});
9   // Phase 1, operands
10   auto op1 = model->addOperand(&type0);
11   auto op2 = model->addOperand(&type1);
12   auto op3 = model->addOperand(&type2);
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 op4 = model->addOperand(&type3);
22   // Phase 2, operations
23   static int8_t op2_init[] = {2, 4, 2, 0, 2, 2, 2, 0};
24   model->setOperandValue(op2, op2_init, sizeof(int8_t) * 8);
25   static int32_t op3_init[] = {0, 0};
26   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2);
27   static int32_t param_init[] = {0};
28   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
29   static int32_t param1_init[] = {0};
30   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
31   static int32_t param2_init[] = {0};
32   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
33   static int32_t param3_init[] = {0};
34   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
35   static int32_t param4_init[] = {1};
36   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
37   static int32_t param5_init[] = {1};
38   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
39   static int32_t param6_init[] = {1};
40   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
41   static int32_t param7_init[] = {0};
42   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
43   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7}, {op4});
44   // Phase 3, inputs and outputs
45   model->identifyInputsAndOutputs(
46     {op1},
47     {op4});
48   assert(model->isValid());
49 }
50 
is_ignored_same(int i)51 inline bool is_ignored_same(int i) {
52   static std::set<int> ignore = {};
53   return ignore.find(i) != ignore.end();
54 }
55 
CreateModel_same_weight_as_input(Model * model)56 void CreateModel_same_weight_as_input(Model *model) {
57   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 0);
58   OperandType type11(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.5f},3));
59   OperandType type2(Type::TENSOR_INT32, {2});
60   OperandType type3(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 1.0f, 0);
61   OperandType type4(Type::INT32, {});
62   // Phase 1, operands
63   auto op1 = model->addOperand(&type0);
64   auto op2 = model->addOperand(&type11);
65   auto op3 = model->addOperand(&type2);
66   auto param = model->addOperand(&type4);
67   auto param1 = model->addOperand(&type4);
68   auto param2 = model->addOperand(&type4);
69   auto param3 = model->addOperand(&type4);
70   auto param4 = model->addOperand(&type4);
71   auto param5 = model->addOperand(&type4);
72   auto param6 = model->addOperand(&type4);
73   auto param7 = model->addOperand(&type4);
74   auto op4 = model->addOperand(&type3);
75   // Phase 2, operations
76   static int32_t param_init[] = {0};
77   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
78   static int32_t param1_init[] = {0};
79   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
80   static int32_t param2_init[] = {0};
81   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
82   static int32_t param3_init[] = {0};
83   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
84   static int32_t param4_init[] = {1};
85   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
86   static int32_t param5_init[] = {1};
87   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
88   static int32_t param6_init[] = {1};
89   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
90   static int32_t param7_init[] = {0};
91   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
92   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7}, {op4});
93   // Phase 3, inputs and outputs
94   model->identifyInputsAndOutputs(
95     {op1, op2, op3},
96     {op4});
97   assert(model->isValid());
98 }
99 
is_ignored_same_weight_as_input(int i)100 inline bool is_ignored_same_weight_as_input(int i) {
101   static std::set<int> ignore = {};
102   return ignore.find(i) != ignore.end();
103 }
104 
CreateModel_same_dynamic_output_shape(Model * model)105 void CreateModel_same_dynamic_output_shape(Model *model) {
106   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 0);
107   OperandType type1(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.5f},3));
108   OperandType type12(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 0);
109   OperandType type2(Type::TENSOR_INT32, {2});
110   OperandType type4(Type::INT32, {});
111   // Phase 1, operands
112   auto op1 = model->addOperand(&type0);
113   auto op2 = model->addOperand(&type1);
114   auto op3 = model->addOperand(&type2);
115   auto param = model->addOperand(&type4);
116   auto param1 = model->addOperand(&type4);
117   auto param2 = model->addOperand(&type4);
118   auto param3 = model->addOperand(&type4);
119   auto param4 = model->addOperand(&type4);
120   auto param5 = model->addOperand(&type4);
121   auto param6 = model->addOperand(&type4);
122   auto param7 = model->addOperand(&type4);
123   auto op4 = model->addOperand(&type12);
124   // Phase 2, operations
125   static int8_t op2_init[] = {2, 4, 2, 0, 2, 2, 2, 0};
126   model->setOperandValue(op2, op2_init, sizeof(int8_t) * 8);
127   static int32_t op3_init[] = {0, 0};
128   model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2);
129   static int32_t param_init[] = {0};
130   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
131   static int32_t param1_init[] = {0};
132   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
133   static int32_t param2_init[] = {0};
134   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
135   static int32_t param3_init[] = {0};
136   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
137   static int32_t param4_init[] = {1};
138   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
139   static int32_t param5_init[] = {1};
140   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
141   static int32_t param6_init[] = {1};
142   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
143   static int32_t param7_init[] = {0};
144   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
145   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7}, {op4});
146   // Phase 3, inputs and outputs
147   model->identifyInputsAndOutputs(
148     {op1},
149     {op4});
150   assert(model->isValid());
151 }
152 
is_ignored_same_dynamic_output_shape(int i)153 inline bool is_ignored_same_dynamic_output_shape(int i) {
154   static std::set<int> ignore = {};
155   return ignore.find(i) != ignore.end();
156 }
157 
CreateModel_same_dynamic_output_shape_weight_as_input(Model * model)158 void CreateModel_same_dynamic_output_shape_weight_as_input(Model *model) {
159   OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 0);
160   OperandType type12(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 0);
161   OperandType type13(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.5f},3));
162   OperandType type2(Type::TENSOR_INT32, {2});
163   OperandType type4(Type::INT32, {});
164   // Phase 1, operands
165   auto op1 = model->addOperand(&type0);
166   auto op2 = model->addOperand(&type13);
167   auto op3 = model->addOperand(&type2);
168   auto param = model->addOperand(&type4);
169   auto param1 = model->addOperand(&type4);
170   auto param2 = model->addOperand(&type4);
171   auto param3 = model->addOperand(&type4);
172   auto param4 = model->addOperand(&type4);
173   auto param5 = model->addOperand(&type4);
174   auto param6 = model->addOperand(&type4);
175   auto param7 = model->addOperand(&type4);
176   auto op4 = model->addOperand(&type12);
177   // Phase 2, operations
178   static int32_t param_init[] = {0};
179   model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
180   static int32_t param1_init[] = {0};
181   model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
182   static int32_t param2_init[] = {0};
183   model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
184   static int32_t param3_init[] = {0};
185   model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
186   static int32_t param4_init[] = {1};
187   model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
188   static int32_t param5_init[] = {1};
189   model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
190   static int32_t param6_init[] = {1};
191   model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
192   static int32_t param7_init[] = {0};
193   model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
194   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7}, {op4});
195   // Phase 3, inputs and outputs
196   model->identifyInputsAndOutputs(
197     {op1, op2, op3},
198     {op4});
199   assert(model->isValid());
200 }
201 
is_ignored_same_dynamic_output_shape_weight_as_input(int i)202 inline bool is_ignored_same_dynamic_output_shape_weight_as_input(int i) {
203   static std::set<int> ignore = {};
204   return ignore.find(i) != ignore.end();
205 }
206 
CreateModel_different(Model * model)207 void CreateModel_different(Model *model) {
208   OperandType type4(Type::INT32, {});
209   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
210   OperandType type6(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
211   OperandType type7(Type::TENSOR_INT32, {4});
212   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0f, 128);
213   // Phase 1, operands
214   auto op11 = model->addOperand(&type5);
215   auto op21 = model->addOperand(&type6);
216   auto op31 = model->addOperand(&type7);
217   auto param8 = model->addOperand(&type4);
218   auto param9 = model->addOperand(&type4);
219   auto param10 = model->addOperand(&type4);
220   auto param11 = model->addOperand(&type4);
221   auto param12 = model->addOperand(&type4);
222   auto param13 = model->addOperand(&type4);
223   auto param14 = model->addOperand(&type4);
224   auto param15 = model->addOperand(&type4);
225   auto op41 = model->addOperand(&type8);
226   // Phase 2, operations
227   static int8_t op21_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
228   model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
229   static int32_t op31_init[] = {4, 4, 4, 4};
230   model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
231   static int32_t param8_init[] = {0};
232   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
233   static int32_t param9_init[] = {0};
234   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
235   static int32_t param10_init[] = {0};
236   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
237   static int32_t param11_init[] = {0};
238   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
239   static int32_t param12_init[] = {1};
240   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
241   static int32_t param13_init[] = {1};
242   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
243   static int32_t param14_init[] = {2};
244   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
245   static int32_t param15_init[] = {0};
246   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
247   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, param13, param14, param15}, {op41});
248   // Phase 3, inputs and outputs
249   model->identifyInputsAndOutputs(
250     {op11},
251     {op41});
252   assert(model->isValid());
253 }
254 
is_ignored_different(int i)255 inline bool is_ignored_different(int i) {
256   static std::set<int> ignore = {};
257   return ignore.find(i) != ignore.end();
258 }
259 
CreateModel_different_weight_as_input(Model * model)260 void CreateModel_different_weight_as_input(Model *model) {
261   OperandType type14(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
262   OperandType type4(Type::INT32, {});
263   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
264   OperandType type7(Type::TENSOR_INT32, {4});
265   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0f, 128);
266   // Phase 1, operands
267   auto op11 = model->addOperand(&type5);
268   auto op21 = model->addOperand(&type14);
269   auto op31 = model->addOperand(&type7);
270   auto param8 = model->addOperand(&type4);
271   auto param9 = model->addOperand(&type4);
272   auto param10 = model->addOperand(&type4);
273   auto param11 = model->addOperand(&type4);
274   auto param12 = model->addOperand(&type4);
275   auto param13 = model->addOperand(&type4);
276   auto param14 = model->addOperand(&type4);
277   auto param15 = model->addOperand(&type4);
278   auto op41 = model->addOperand(&type8);
279   // Phase 2, operations
280   static int32_t param8_init[] = {0};
281   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
282   static int32_t param9_init[] = {0};
283   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
284   static int32_t param10_init[] = {0};
285   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
286   static int32_t param11_init[] = {0};
287   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
288   static int32_t param12_init[] = {1};
289   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
290   static int32_t param13_init[] = {1};
291   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
292   static int32_t param14_init[] = {2};
293   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
294   static int32_t param15_init[] = {0};
295   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
296   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, param13, param14, param15}, {op41});
297   // Phase 3, inputs and outputs
298   model->identifyInputsAndOutputs(
299     {op11, op21, op31},
300     {op41});
301   assert(model->isValid());
302 }
303 
is_ignored_different_weight_as_input(int i)304 inline bool is_ignored_different_weight_as_input(int i) {
305   static std::set<int> ignore = {};
306   return ignore.find(i) != ignore.end();
307 }
308 
CreateModel_different_dynamic_output_shape(Model * model)309 void CreateModel_different_dynamic_output_shape(Model *model) {
310   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
311   OperandType type4(Type::INT32, {});
312   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
313   OperandType type6(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
314   OperandType type7(Type::TENSOR_INT32, {4});
315   // Phase 1, operands
316   auto op11 = model->addOperand(&type5);
317   auto op21 = model->addOperand(&type6);
318   auto op31 = model->addOperand(&type7);
319   auto param8 = model->addOperand(&type4);
320   auto param9 = model->addOperand(&type4);
321   auto param10 = model->addOperand(&type4);
322   auto param11 = model->addOperand(&type4);
323   auto param12 = model->addOperand(&type4);
324   auto param13 = model->addOperand(&type4);
325   auto param14 = model->addOperand(&type4);
326   auto param15 = model->addOperand(&type4);
327   auto op41 = model->addOperand(&type15);
328   // Phase 2, operations
329   static int8_t op21_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
330   model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
331   static int32_t op31_init[] = {4, 4, 4, 4};
332   model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
333   static int32_t param8_init[] = {0};
334   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
335   static int32_t param9_init[] = {0};
336   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
337   static int32_t param10_init[] = {0};
338   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
339   static int32_t param11_init[] = {0};
340   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
341   static int32_t param12_init[] = {1};
342   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
343   static int32_t param13_init[] = {1};
344   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
345   static int32_t param14_init[] = {2};
346   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
347   static int32_t param15_init[] = {0};
348   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
349   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, param13, param14, param15}, {op41});
350   // Phase 3, inputs and outputs
351   model->identifyInputsAndOutputs(
352     {op11},
353     {op41});
354   assert(model->isValid());
355 }
356 
is_ignored_different_dynamic_output_shape(int i)357 inline bool is_ignored_different_dynamic_output_shape(int i) {
358   static std::set<int> ignore = {};
359   return ignore.find(i) != ignore.end();
360 }
361 
CreateModel_different_dynamic_output_shape_weight_as_input(Model * model)362 void CreateModel_different_dynamic_output_shape_weight_as_input(Model *model) {
363   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
364   OperandType type16(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
365   OperandType type4(Type::INT32, {});
366   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
367   OperandType type7(Type::TENSOR_INT32, {4});
368   // Phase 1, operands
369   auto op11 = model->addOperand(&type5);
370   auto op21 = model->addOperand(&type16);
371   auto op31 = model->addOperand(&type7);
372   auto param8 = model->addOperand(&type4);
373   auto param9 = model->addOperand(&type4);
374   auto param10 = model->addOperand(&type4);
375   auto param11 = model->addOperand(&type4);
376   auto param12 = model->addOperand(&type4);
377   auto param13 = model->addOperand(&type4);
378   auto param14 = model->addOperand(&type4);
379   auto param15 = model->addOperand(&type4);
380   auto op41 = model->addOperand(&type15);
381   // Phase 2, operations
382   static int32_t param8_init[] = {0};
383   model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
384   static int32_t param9_init[] = {0};
385   model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
386   static int32_t param10_init[] = {0};
387   model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
388   static int32_t param11_init[] = {0};
389   model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
390   static int32_t param12_init[] = {1};
391   model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
392   static int32_t param13_init[] = {1};
393   model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
394   static int32_t param14_init[] = {2};
395   model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
396   static int32_t param15_init[] = {0};
397   model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
398   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, param13, param14, param15}, {op41});
399   // Phase 3, inputs and outputs
400   model->identifyInputsAndOutputs(
401     {op11, op21, op31},
402     {op41});
403   assert(model->isValid());
404 }
405 
is_ignored_different_dynamic_output_shape_weight_as_input(int i)406 inline bool is_ignored_different_dynamic_output_shape_weight_as_input(int i) {
407   static std::set<int> ignore = {};
408   return ignore.find(i) != ignore.end();
409 }
410 
CreateModel_layout_nhwc(Model * model)411 void CreateModel_layout_nhwc(Model *model) {
412   OperandType type10(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
413   OperandType type4(Type::INT32, {});
414   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
415   OperandType type7(Type::TENSOR_INT32, {4});
416   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0f, 128);
417   OperandType type9(Type::BOOL, {});
418   // Phase 1, operands
419   auto op12 = model->addOperand(&type5);
420   auto op22 = model->addOperand(&type10);
421   auto op32 = model->addOperand(&type7);
422   auto param16 = model->addOperand(&type4);
423   auto param17 = model->addOperand(&type4);
424   auto param18 = model->addOperand(&type4);
425   auto param19 = model->addOperand(&type4);
426   auto param20 = model->addOperand(&type4);
427   auto param21 = model->addOperand(&type4);
428   auto param22 = model->addOperand(&type4);
429   auto param23 = model->addOperand(&type4);
430   auto layout = model->addOperand(&type9);
431   auto op42 = model->addOperand(&type8);
432   // Phase 2, operations
433   static int8_t op22_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
434   model->setOperandValue(op22, op22_init, sizeof(int8_t) * 16);
435   static int32_t op32_init[] = {4, 4, 4, 4};
436   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
437   static int32_t param16_init[] = {0};
438   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
439   static int32_t param17_init[] = {0};
440   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
441   static int32_t param18_init[] = {0};
442   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
443   static int32_t param19_init[] = {0};
444   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
445   static int32_t param20_init[] = {1};
446   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
447   static int32_t param21_init[] = {1};
448   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
449   static int32_t param22_init[] = {2};
450   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
451   static int32_t param23_init[] = {0};
452   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
453   static bool8 layout_init[] = {false};
454   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
455   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
456   // Phase 3, inputs and outputs
457   model->identifyInputsAndOutputs(
458     {op12},
459     {op42});
460   assert(model->isValid());
461 }
462 
is_ignored_layout_nhwc(int i)463 inline bool is_ignored_layout_nhwc(int i) {
464   static std::set<int> ignore = {};
465   return ignore.find(i) != ignore.end();
466 }
467 
CreateModel_layout_nhwc_weight_as_input(Model * model)468 void CreateModel_layout_nhwc_weight_as_input(Model *model) {
469   OperandType type17(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
470   OperandType type4(Type::INT32, {});
471   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
472   OperandType type7(Type::TENSOR_INT32, {4});
473   OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0f, 128);
474   OperandType type9(Type::BOOL, {});
475   // Phase 1, operands
476   auto op12 = model->addOperand(&type5);
477   auto op22 = model->addOperand(&type17);
478   auto op32 = model->addOperand(&type7);
479   auto param16 = model->addOperand(&type4);
480   auto param17 = model->addOperand(&type4);
481   auto param18 = model->addOperand(&type4);
482   auto param19 = model->addOperand(&type4);
483   auto param20 = model->addOperand(&type4);
484   auto param21 = model->addOperand(&type4);
485   auto param22 = model->addOperand(&type4);
486   auto param23 = model->addOperand(&type4);
487   auto layout = model->addOperand(&type9);
488   auto op42 = model->addOperand(&type8);
489   // Phase 2, operations
490   static int32_t param16_init[] = {0};
491   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
492   static int32_t param17_init[] = {0};
493   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
494   static int32_t param18_init[] = {0};
495   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
496   static int32_t param19_init[] = {0};
497   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
498   static int32_t param20_init[] = {1};
499   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
500   static int32_t param21_init[] = {1};
501   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
502   static int32_t param22_init[] = {2};
503   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
504   static int32_t param23_init[] = {0};
505   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
506   static bool8 layout_init[] = {false};
507   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
508   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
509   // Phase 3, inputs and outputs
510   model->identifyInputsAndOutputs(
511     {op12, op22, op32},
512     {op42});
513   assert(model->isValid());
514 }
515 
is_ignored_layout_nhwc_weight_as_input(int i)516 inline bool is_ignored_layout_nhwc_weight_as_input(int i) {
517   static std::set<int> ignore = {};
518   return ignore.find(i) != ignore.end();
519 }
520 
CreateModel_layout_nchw(Model * model)521 void CreateModel_layout_nchw(Model *model) {
522   OperandType type10(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
523   OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128);
524   OperandType type19(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 1.0f, 128);
525   OperandType type4(Type::INT32, {});
526   OperandType type7(Type::TENSOR_INT32, {4});
527   OperandType type9(Type::BOOL, {});
528   // Phase 1, operands
529   auto op12 = model->addOperand(&type18);
530   auto op22 = model->addOperand(&type10);
531   auto op32 = model->addOperand(&type7);
532   auto param16 = model->addOperand(&type4);
533   auto param17 = model->addOperand(&type4);
534   auto param18 = model->addOperand(&type4);
535   auto param19 = model->addOperand(&type4);
536   auto param20 = model->addOperand(&type4);
537   auto param21 = model->addOperand(&type4);
538   auto param22 = model->addOperand(&type4);
539   auto param23 = model->addOperand(&type4);
540   auto layout = model->addOperand(&type9);
541   auto op42 = model->addOperand(&type19);
542   // Phase 2, operations
543   static int8_t op22_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
544   model->setOperandValue(op22, op22_init, sizeof(int8_t) * 16);
545   static int32_t op32_init[] = {4, 4, 4, 4};
546   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
547   static int32_t param16_init[] = {0};
548   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
549   static int32_t param17_init[] = {0};
550   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
551   static int32_t param18_init[] = {0};
552   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
553   static int32_t param19_init[] = {0};
554   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
555   static int32_t param20_init[] = {1};
556   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
557   static int32_t param21_init[] = {1};
558   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
559   static int32_t param22_init[] = {2};
560   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
561   static int32_t param23_init[] = {0};
562   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
563   static bool8 layout_init[] = {true};
564   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
565   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
566   // Phase 3, inputs and outputs
567   model->identifyInputsAndOutputs(
568     {op12},
569     {op42});
570   assert(model->isValid());
571 }
572 
is_ignored_layout_nchw(int i)573 inline bool is_ignored_layout_nchw(int i) {
574   static std::set<int> ignore = {};
575   return ignore.find(i) != ignore.end();
576 }
577 
CreateModel_layout_nchw_weight_as_input(Model * model)578 void CreateModel_layout_nchw_weight_as_input(Model *model) {
579   OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128);
580   OperandType type19(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 1.0f, 128);
581   OperandType type20(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
582   OperandType type4(Type::INT32, {});
583   OperandType type7(Type::TENSOR_INT32, {4});
584   OperandType type9(Type::BOOL, {});
585   // Phase 1, operands
586   auto op12 = model->addOperand(&type18);
587   auto op22 = model->addOperand(&type20);
588   auto op32 = model->addOperand(&type7);
589   auto param16 = model->addOperand(&type4);
590   auto param17 = model->addOperand(&type4);
591   auto param18 = model->addOperand(&type4);
592   auto param19 = model->addOperand(&type4);
593   auto param20 = model->addOperand(&type4);
594   auto param21 = model->addOperand(&type4);
595   auto param22 = model->addOperand(&type4);
596   auto param23 = model->addOperand(&type4);
597   auto layout = model->addOperand(&type9);
598   auto op42 = model->addOperand(&type19);
599   // Phase 2, operations
600   static int32_t param16_init[] = {0};
601   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
602   static int32_t param17_init[] = {0};
603   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
604   static int32_t param18_init[] = {0};
605   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
606   static int32_t param19_init[] = {0};
607   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
608   static int32_t param20_init[] = {1};
609   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
610   static int32_t param21_init[] = {1};
611   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
612   static int32_t param22_init[] = {2};
613   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
614   static int32_t param23_init[] = {0};
615   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
616   static bool8 layout_init[] = {true};
617   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
618   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
619   // Phase 3, inputs and outputs
620   model->identifyInputsAndOutputs(
621     {op12, op22, op32},
622     {op42});
623   assert(model->isValid());
624 }
625 
is_ignored_layout_nchw_weight_as_input(int i)626 inline bool is_ignored_layout_nchw_weight_as_input(int i) {
627   static std::set<int> ignore = {};
628   return ignore.find(i) != ignore.end();
629 }
630 
CreateModel_layout_dynamic_output_shape_nhwc(Model * model)631 void CreateModel_layout_dynamic_output_shape_nhwc(Model *model) {
632   OperandType type10(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
633   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
634   OperandType type4(Type::INT32, {});
635   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
636   OperandType type7(Type::TENSOR_INT32, {4});
637   OperandType type9(Type::BOOL, {});
638   // Phase 1, operands
639   auto op12 = model->addOperand(&type5);
640   auto op22 = model->addOperand(&type10);
641   auto op32 = model->addOperand(&type7);
642   auto param16 = model->addOperand(&type4);
643   auto param17 = model->addOperand(&type4);
644   auto param18 = model->addOperand(&type4);
645   auto param19 = model->addOperand(&type4);
646   auto param20 = model->addOperand(&type4);
647   auto param21 = model->addOperand(&type4);
648   auto param22 = model->addOperand(&type4);
649   auto param23 = model->addOperand(&type4);
650   auto layout = model->addOperand(&type9);
651   auto op42 = model->addOperand(&type15);
652   // Phase 2, operations
653   static int8_t op22_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
654   model->setOperandValue(op22, op22_init, sizeof(int8_t) * 16);
655   static int32_t op32_init[] = {4, 4, 4, 4};
656   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
657   static int32_t param16_init[] = {0};
658   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
659   static int32_t param17_init[] = {0};
660   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
661   static int32_t param18_init[] = {0};
662   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
663   static int32_t param19_init[] = {0};
664   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
665   static int32_t param20_init[] = {1};
666   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
667   static int32_t param21_init[] = {1};
668   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
669   static int32_t param22_init[] = {2};
670   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
671   static int32_t param23_init[] = {0};
672   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
673   static bool8 layout_init[] = {false};
674   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
675   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
676   // Phase 3, inputs and outputs
677   model->identifyInputsAndOutputs(
678     {op12},
679     {op42});
680   assert(model->isValid());
681 }
682 
is_ignored_layout_dynamic_output_shape_nhwc(int i)683 inline bool is_ignored_layout_dynamic_output_shape_nhwc(int i) {
684   static std::set<int> ignore = {};
685   return ignore.find(i) != ignore.end();
686 }
687 
CreateModel_layout_dynamic_output_shape_nhwc_weight_as_input(Model * model)688 void CreateModel_layout_dynamic_output_shape_nhwc_weight_as_input(Model *model) {
689   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
690   OperandType type21(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
691   OperandType type4(Type::INT32, {});
692   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128);
693   OperandType type7(Type::TENSOR_INT32, {4});
694   OperandType type9(Type::BOOL, {});
695   // Phase 1, operands
696   auto op12 = model->addOperand(&type5);
697   auto op22 = model->addOperand(&type21);
698   auto op32 = model->addOperand(&type7);
699   auto param16 = model->addOperand(&type4);
700   auto param17 = model->addOperand(&type4);
701   auto param18 = model->addOperand(&type4);
702   auto param19 = model->addOperand(&type4);
703   auto param20 = model->addOperand(&type4);
704   auto param21 = model->addOperand(&type4);
705   auto param22 = model->addOperand(&type4);
706   auto param23 = model->addOperand(&type4);
707   auto layout = model->addOperand(&type9);
708   auto op42 = model->addOperand(&type15);
709   // Phase 2, operations
710   static int32_t param16_init[] = {0};
711   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
712   static int32_t param17_init[] = {0};
713   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
714   static int32_t param18_init[] = {0};
715   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
716   static int32_t param19_init[] = {0};
717   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
718   static int32_t param20_init[] = {1};
719   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
720   static int32_t param21_init[] = {1};
721   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
722   static int32_t param22_init[] = {2};
723   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
724   static int32_t param23_init[] = {0};
725   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
726   static bool8 layout_init[] = {false};
727   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
728   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
729   // Phase 3, inputs and outputs
730   model->identifyInputsAndOutputs(
731     {op12, op22, op32},
732     {op42});
733   assert(model->isValid());
734 }
735 
is_ignored_layout_dynamic_output_shape_nhwc_weight_as_input(int i)736 inline bool is_ignored_layout_dynamic_output_shape_nhwc_weight_as_input(int i) {
737   static std::set<int> ignore = {};
738   return ignore.find(i) != ignore.end();
739 }
740 
CreateModel_layout_dynamic_output_shape_nchw(Model * model)741 void CreateModel_layout_dynamic_output_shape_nchw(Model *model) {
742   OperandType type10(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
743   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
744   OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128);
745   OperandType type4(Type::INT32, {});
746   OperandType type7(Type::TENSOR_INT32, {4});
747   OperandType type9(Type::BOOL, {});
748   // Phase 1, operands
749   auto op12 = model->addOperand(&type18);
750   auto op22 = model->addOperand(&type10);
751   auto op32 = model->addOperand(&type7);
752   auto param16 = model->addOperand(&type4);
753   auto param17 = model->addOperand(&type4);
754   auto param18 = model->addOperand(&type4);
755   auto param19 = model->addOperand(&type4);
756   auto param20 = model->addOperand(&type4);
757   auto param21 = model->addOperand(&type4);
758   auto param22 = model->addOperand(&type4);
759   auto param23 = model->addOperand(&type4);
760   auto layout = model->addOperand(&type9);
761   auto op42 = model->addOperand(&type15);
762   // Phase 2, operations
763   static int8_t op22_init[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
764   model->setOperandValue(op22, op22_init, sizeof(int8_t) * 16);
765   static int32_t op32_init[] = {4, 4, 4, 4};
766   model->setOperandValue(op32, op32_init, sizeof(int32_t) * 4);
767   static int32_t param16_init[] = {0};
768   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
769   static int32_t param17_init[] = {0};
770   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
771   static int32_t param18_init[] = {0};
772   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
773   static int32_t param19_init[] = {0};
774   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
775   static int32_t param20_init[] = {1};
776   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
777   static int32_t param21_init[] = {1};
778   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
779   static int32_t param22_init[] = {2};
780   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
781   static int32_t param23_init[] = {0};
782   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
783   static bool8 layout_init[] = {true};
784   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
785   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
786   // Phase 3, inputs and outputs
787   model->identifyInputsAndOutputs(
788     {op12},
789     {op42});
790   assert(model->isValid());
791 }
792 
is_ignored_layout_dynamic_output_shape_nchw(int i)793 inline bool is_ignored_layout_dynamic_output_shape_nchw(int i) {
794   static std::set<int> ignore = {};
795   return ignore.find(i) != ignore.end();
796 }
797 
CreateModel_layout_dynamic_output_shape_nchw_weight_as_input(Model * model)798 void CreateModel_layout_dynamic_output_shape_nchw_weight_as_input(Model *model) {
799   OperandType type15(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 128);
800   OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128);
801   OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 0.5f, 1.0f, 0.5f},3));
802   OperandType type4(Type::INT32, {});
803   OperandType type7(Type::TENSOR_INT32, {4});
804   OperandType type9(Type::BOOL, {});
805   // Phase 1, operands
806   auto op12 = model->addOperand(&type18);
807   auto op22 = model->addOperand(&type22);
808   auto op32 = model->addOperand(&type7);
809   auto param16 = model->addOperand(&type4);
810   auto param17 = model->addOperand(&type4);
811   auto param18 = model->addOperand(&type4);
812   auto param19 = model->addOperand(&type4);
813   auto param20 = model->addOperand(&type4);
814   auto param21 = model->addOperand(&type4);
815   auto param22 = model->addOperand(&type4);
816   auto param23 = model->addOperand(&type4);
817   auto layout = model->addOperand(&type9);
818   auto op42 = model->addOperand(&type15);
819   // Phase 2, operations
820   static int32_t param16_init[] = {0};
821   model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
822   static int32_t param17_init[] = {0};
823   model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
824   static int32_t param18_init[] = {0};
825   model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
826   static int32_t param19_init[] = {0};
827   model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
828   static int32_t param20_init[] = {1};
829   model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
830   static int32_t param21_init[] = {1};
831   model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
832   static int32_t param22_init[] = {2};
833   model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
834   static int32_t param23_init[] = {0};
835   model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
836   static bool8 layout_init[] = {true};
837   model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
838   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param16, param17, param18, param19, param20, param21, param22, param23, layout}, {op42});
839   // Phase 3, inputs and outputs
840   model->identifyInputsAndOutputs(
841     {op12, op22, op32},
842     {op42});
843   assert(model->isValid());
844 }
845 
is_ignored_layout_dynamic_output_shape_nchw_weight_as_input(int i)846 inline bool is_ignored_layout_dynamic_output_shape_nchw_weight_as_input(int i) {
847   static std::set<int> ignore = {};
848   return ignore.find(i) != ignore.end();
849 }
850 
851