1 // clang-format off
2 // Generated file (from: 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, 1});
6 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7 OperandType type3(Type::TENSOR_FLOAT32, {1});
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 layout = model->addOperand(&type0);
21 auto param7 = model->addOperand(&type4);
22 auto param8 = model->addOperand(&type4);
23 auto op4 = model->addOperand(&type2);
24 // Phase 2, operations
25 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
26 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
27 static float op3_init[] = {0.0f};
28 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
29 static int32_t param_init[] = {0};
30 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
31 static int32_t param1_init[] = {0};
32 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
33 static int32_t param2_init[] = {0};
34 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
35 static int32_t param3_init[] = {0};
36 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
37 static int32_t param4_init[] = {1};
38 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
39 static int32_t param5_init[] = {1};
40 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
41 static int32_t param6_init[] = {0};
42 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
43 static bool8 layout_init[] = {false};
44 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
45 static int32_t param7_init[] = {1};
46 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
47 static int32_t param8_init[] = {1};
48 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
49 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
50 // Phase 3, inputs and outputs
51 model->identifyInputsAndOutputs(
52 {op1},
53 {op4});
54 assert(model->isValid());
55 }
56
is_ignored_nhwc(int i)57 inline bool is_ignored_nhwc(int i) {
58 static std::set<int> ignore = {};
59 return ignore.find(i) != ignore.end();
60 }
61
CreateModel_nhwc_relaxed(Model * model)62 void CreateModel_nhwc_relaxed(Model *model) {
63 OperandType type0(Type::BOOL, {});
64 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
65 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
66 OperandType type3(Type::TENSOR_FLOAT32, {1});
67 OperandType type4(Type::INT32, {});
68 // Phase 1, operands
69 auto op1 = model->addOperand(&type1);
70 auto op2 = model->addOperand(&type2);
71 auto op3 = model->addOperand(&type3);
72 auto param = model->addOperand(&type4);
73 auto param1 = model->addOperand(&type4);
74 auto param2 = model->addOperand(&type4);
75 auto param3 = model->addOperand(&type4);
76 auto param4 = model->addOperand(&type4);
77 auto param5 = model->addOperand(&type4);
78 auto param6 = model->addOperand(&type4);
79 auto layout = model->addOperand(&type0);
80 auto param7 = model->addOperand(&type4);
81 auto param8 = model->addOperand(&type4);
82 auto op4 = model->addOperand(&type2);
83 // Phase 2, operations
84 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
85 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
86 static float op3_init[] = {0.0f};
87 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
88 static int32_t param_init[] = {0};
89 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
90 static int32_t param1_init[] = {0};
91 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
92 static int32_t param2_init[] = {0};
93 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
94 static int32_t param3_init[] = {0};
95 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
96 static int32_t param4_init[] = {1};
97 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
98 static int32_t param5_init[] = {1};
99 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
100 static int32_t param6_init[] = {0};
101 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
102 static bool8 layout_init[] = {false};
103 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
104 static int32_t param7_init[] = {1};
105 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
106 static int32_t param8_init[] = {1};
107 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
108 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
109 // Phase 3, inputs and outputs
110 model->identifyInputsAndOutputs(
111 {op1},
112 {op4});
113 // Phase 4: set relaxed execution
114 model->relaxComputationFloat32toFloat16(true);
115 assert(model->isValid());
116 }
117
is_ignored_nhwc_relaxed(int i)118 inline bool is_ignored_nhwc_relaxed(int i) {
119 static std::set<int> ignore = {};
120 return ignore.find(i) != ignore.end();
121 }
122
CreateModel_nhwc_quant8(Model * model)123 void CreateModel_nhwc_quant8(Model *model) {
124 OperandType type0(Type::BOOL, {});
125 OperandType type4(Type::INT32, {});
126 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
127 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
128 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
129 // Phase 1, operands
130 auto op1 = model->addOperand(&type7);
131 auto op2 = model->addOperand(&type8);
132 auto op3 = model->addOperand(&type9);
133 auto param = model->addOperand(&type4);
134 auto param1 = model->addOperand(&type4);
135 auto param2 = model->addOperand(&type4);
136 auto param3 = model->addOperand(&type4);
137 auto param4 = model->addOperand(&type4);
138 auto param5 = model->addOperand(&type4);
139 auto param6 = model->addOperand(&type4);
140 auto layout = model->addOperand(&type0);
141 auto param7 = model->addOperand(&type4);
142 auto param8 = model->addOperand(&type4);
143 auto op4 = model->addOperand(&type8);
144 // Phase 2, operations
145 static uint8_t op2_init[] = {2, 2, 2, 2};
146 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4);
147 static int32_t op3_init[] = {0};
148 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1);
149 static int32_t param_init[] = {0};
150 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
151 static int32_t param1_init[] = {0};
152 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
153 static int32_t param2_init[] = {0};
154 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
155 static int32_t param3_init[] = {0};
156 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
157 static int32_t param4_init[] = {1};
158 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
159 static int32_t param5_init[] = {1};
160 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
161 static int32_t param6_init[] = {0};
162 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
163 static bool8 layout_init[] = {false};
164 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
165 static int32_t param7_init[] = {1};
166 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
167 static int32_t param8_init[] = {1};
168 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
169 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
170 // Phase 3, inputs and outputs
171 model->identifyInputsAndOutputs(
172 {op1},
173 {op4});
174 assert(model->isValid());
175 }
176
is_ignored_nhwc_quant8(int i)177 inline bool is_ignored_nhwc_quant8(int i) {
178 static std::set<int> ignore = {};
179 return ignore.find(i) != ignore.end();
180 }
181
CreateModel_nhwc_float16(Model * model)182 void CreateModel_nhwc_float16(Model *model) {
183 OperandType type0(Type::BOOL, {});
184 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
185 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
186 OperandType type12(Type::TENSOR_FLOAT16, {1});
187 OperandType type4(Type::INT32, {});
188 // Phase 1, operands
189 auto op1 = model->addOperand(&type10);
190 auto op2 = model->addOperand(&type11);
191 auto op3 = model->addOperand(&type12);
192 auto param = model->addOperand(&type4);
193 auto param1 = model->addOperand(&type4);
194 auto param2 = model->addOperand(&type4);
195 auto param3 = model->addOperand(&type4);
196 auto param4 = model->addOperand(&type4);
197 auto param5 = model->addOperand(&type4);
198 auto param6 = model->addOperand(&type4);
199 auto layout = model->addOperand(&type0);
200 auto param7 = model->addOperand(&type4);
201 auto param8 = model->addOperand(&type4);
202 auto op4 = model->addOperand(&type11);
203 // Phase 2, operations
204 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
205 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4);
206 static _Float16 op3_init[] = {0.0f};
207 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1);
208 static int32_t param_init[] = {0};
209 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
210 static int32_t param1_init[] = {0};
211 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
212 static int32_t param2_init[] = {0};
213 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
214 static int32_t param3_init[] = {0};
215 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
216 static int32_t param4_init[] = {1};
217 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
218 static int32_t param5_init[] = {1};
219 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
220 static int32_t param6_init[] = {0};
221 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
222 static bool8 layout_init[] = {false};
223 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
224 static int32_t param7_init[] = {1};
225 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
226 static int32_t param8_init[] = {1};
227 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
228 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
229 // Phase 3, inputs and outputs
230 model->identifyInputsAndOutputs(
231 {op1},
232 {op4});
233 assert(model->isValid());
234 }
235
is_ignored_nhwc_float16(int i)236 inline bool is_ignored_nhwc_float16(int i) {
237 static std::set<int> ignore = {};
238 return ignore.find(i) != ignore.end();
239 }
240
CreateModel_nhwc_weight_as_input(Model * model)241 void CreateModel_nhwc_weight_as_input(Model *model) {
242 OperandType type0(Type::BOOL, {});
243 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
244 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
245 OperandType type3(Type::TENSOR_FLOAT32, {1});
246 OperandType type4(Type::INT32, {});
247 // Phase 1, operands
248 auto op1 = model->addOperand(&type1);
249 auto op2 = model->addOperand(&type2);
250 auto op3 = model->addOperand(&type3);
251 auto param = model->addOperand(&type4);
252 auto param1 = model->addOperand(&type4);
253 auto param2 = model->addOperand(&type4);
254 auto param3 = model->addOperand(&type4);
255 auto param4 = model->addOperand(&type4);
256 auto param5 = model->addOperand(&type4);
257 auto param6 = model->addOperand(&type4);
258 auto layout = model->addOperand(&type0);
259 auto param7 = model->addOperand(&type4);
260 auto param8 = model->addOperand(&type4);
261 auto op4 = model->addOperand(&type2);
262 // Phase 2, operations
263 static int32_t param_init[] = {0};
264 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
265 static int32_t param1_init[] = {0};
266 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
267 static int32_t param2_init[] = {0};
268 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
269 static int32_t param3_init[] = {0};
270 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
271 static int32_t param4_init[] = {1};
272 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
273 static int32_t param5_init[] = {1};
274 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
275 static int32_t param6_init[] = {0};
276 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
277 static bool8 layout_init[] = {false};
278 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
279 static int32_t param7_init[] = {1};
280 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
281 static int32_t param8_init[] = {1};
282 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
283 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
284 // Phase 3, inputs and outputs
285 model->identifyInputsAndOutputs(
286 {op1, op2, op3},
287 {op4});
288 assert(model->isValid());
289 }
290
is_ignored_nhwc_weight_as_input(int i)291 inline bool is_ignored_nhwc_weight_as_input(int i) {
292 static std::set<int> ignore = {};
293 return ignore.find(i) != ignore.end();
294 }
295
CreateModel_nhwc_weight_as_input_relaxed(Model * model)296 void CreateModel_nhwc_weight_as_input_relaxed(Model *model) {
297 OperandType type0(Type::BOOL, {});
298 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
299 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
300 OperandType type3(Type::TENSOR_FLOAT32, {1});
301 OperandType type4(Type::INT32, {});
302 // Phase 1, operands
303 auto op1 = model->addOperand(&type1);
304 auto op2 = model->addOperand(&type2);
305 auto op3 = model->addOperand(&type3);
306 auto param = model->addOperand(&type4);
307 auto param1 = model->addOperand(&type4);
308 auto param2 = model->addOperand(&type4);
309 auto param3 = model->addOperand(&type4);
310 auto param4 = model->addOperand(&type4);
311 auto param5 = model->addOperand(&type4);
312 auto param6 = model->addOperand(&type4);
313 auto layout = model->addOperand(&type0);
314 auto param7 = model->addOperand(&type4);
315 auto param8 = model->addOperand(&type4);
316 auto op4 = model->addOperand(&type2);
317 // Phase 2, operations
318 static int32_t param_init[] = {0};
319 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
320 static int32_t param1_init[] = {0};
321 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
322 static int32_t param2_init[] = {0};
323 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
324 static int32_t param3_init[] = {0};
325 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
326 static int32_t param4_init[] = {1};
327 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
328 static int32_t param5_init[] = {1};
329 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
330 static int32_t param6_init[] = {0};
331 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
332 static bool8 layout_init[] = {false};
333 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
334 static int32_t param7_init[] = {1};
335 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
336 static int32_t param8_init[] = {1};
337 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
338 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
339 // Phase 3, inputs and outputs
340 model->identifyInputsAndOutputs(
341 {op1, op2, op3},
342 {op4});
343 // Phase 4: set relaxed execution
344 model->relaxComputationFloat32toFloat16(true);
345 assert(model->isValid());
346 }
347
is_ignored_nhwc_weight_as_input_relaxed(int i)348 inline bool is_ignored_nhwc_weight_as_input_relaxed(int i) {
349 static std::set<int> ignore = {};
350 return ignore.find(i) != ignore.end();
351 }
352
CreateModel_nhwc_weight_as_input_quant8(Model * model)353 void CreateModel_nhwc_weight_as_input_quant8(Model *model) {
354 OperandType type0(Type::BOOL, {});
355 OperandType type4(Type::INT32, {});
356 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
357 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
358 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
359 // Phase 1, operands
360 auto op1 = model->addOperand(&type7);
361 auto op2 = model->addOperand(&type8);
362 auto op3 = model->addOperand(&type9);
363 auto param = model->addOperand(&type4);
364 auto param1 = model->addOperand(&type4);
365 auto param2 = model->addOperand(&type4);
366 auto param3 = model->addOperand(&type4);
367 auto param4 = model->addOperand(&type4);
368 auto param5 = model->addOperand(&type4);
369 auto param6 = model->addOperand(&type4);
370 auto layout = model->addOperand(&type0);
371 auto param7 = model->addOperand(&type4);
372 auto param8 = model->addOperand(&type4);
373 auto op4 = model->addOperand(&type8);
374 // Phase 2, operations
375 static int32_t param_init[] = {0};
376 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
377 static int32_t param1_init[] = {0};
378 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
379 static int32_t param2_init[] = {0};
380 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
381 static int32_t param3_init[] = {0};
382 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
383 static int32_t param4_init[] = {1};
384 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
385 static int32_t param5_init[] = {1};
386 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
387 static int32_t param6_init[] = {0};
388 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
389 static bool8 layout_init[] = {false};
390 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
391 static int32_t param7_init[] = {1};
392 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
393 static int32_t param8_init[] = {1};
394 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
395 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
396 // Phase 3, inputs and outputs
397 model->identifyInputsAndOutputs(
398 {op1, op2, op3},
399 {op4});
400 assert(model->isValid());
401 }
402
is_ignored_nhwc_weight_as_input_quant8(int i)403 inline bool is_ignored_nhwc_weight_as_input_quant8(int i) {
404 static std::set<int> ignore = {};
405 return ignore.find(i) != ignore.end();
406 }
407
CreateModel_nhwc_weight_as_input_float16(Model * model)408 void CreateModel_nhwc_weight_as_input_float16(Model *model) {
409 OperandType type0(Type::BOOL, {});
410 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
411 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
412 OperandType type12(Type::TENSOR_FLOAT16, {1});
413 OperandType type4(Type::INT32, {});
414 // Phase 1, operands
415 auto op1 = model->addOperand(&type10);
416 auto op2 = model->addOperand(&type11);
417 auto op3 = model->addOperand(&type12);
418 auto param = model->addOperand(&type4);
419 auto param1 = model->addOperand(&type4);
420 auto param2 = model->addOperand(&type4);
421 auto param3 = model->addOperand(&type4);
422 auto param4 = model->addOperand(&type4);
423 auto param5 = model->addOperand(&type4);
424 auto param6 = model->addOperand(&type4);
425 auto layout = model->addOperand(&type0);
426 auto param7 = model->addOperand(&type4);
427 auto param8 = model->addOperand(&type4);
428 auto op4 = model->addOperand(&type11);
429 // Phase 2, operations
430 static int32_t param_init[] = {0};
431 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
432 static int32_t param1_init[] = {0};
433 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
434 static int32_t param2_init[] = {0};
435 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
436 static int32_t param3_init[] = {0};
437 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
438 static int32_t param4_init[] = {1};
439 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
440 static int32_t param5_init[] = {1};
441 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
442 static int32_t param6_init[] = {0};
443 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
444 static bool8 layout_init[] = {false};
445 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
446 static int32_t param7_init[] = {1};
447 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
448 static int32_t param8_init[] = {1};
449 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
450 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
451 // Phase 3, inputs and outputs
452 model->identifyInputsAndOutputs(
453 {op1, op2, op3},
454 {op4});
455 assert(model->isValid());
456 }
457
is_ignored_nhwc_weight_as_input_float16(int i)458 inline bool is_ignored_nhwc_weight_as_input_float16(int i) {
459 static std::set<int> ignore = {};
460 return ignore.find(i) != ignore.end();
461 }
462
CreateModel_nchw(Model * model)463 void CreateModel_nchw(Model *model) {
464 OperandType type0(Type::BOOL, {});
465 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
466 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
467 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
468 OperandType type3(Type::TENSOR_FLOAT32, {1});
469 OperandType type4(Type::INT32, {});
470 // Phase 1, operands
471 auto op1 = model->addOperand(&type13);
472 auto op2 = model->addOperand(&type2);
473 auto op3 = model->addOperand(&type3);
474 auto param = model->addOperand(&type4);
475 auto param1 = model->addOperand(&type4);
476 auto param2 = model->addOperand(&type4);
477 auto param3 = model->addOperand(&type4);
478 auto param4 = model->addOperand(&type4);
479 auto param5 = model->addOperand(&type4);
480 auto param6 = model->addOperand(&type4);
481 auto layout = model->addOperand(&type0);
482 auto param7 = model->addOperand(&type4);
483 auto param8 = model->addOperand(&type4);
484 auto op4 = model->addOperand(&type14);
485 // Phase 2, operations
486 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
487 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
488 static float op3_init[] = {0.0f};
489 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
490 static int32_t param_init[] = {0};
491 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
492 static int32_t param1_init[] = {0};
493 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
494 static int32_t param2_init[] = {0};
495 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
496 static int32_t param3_init[] = {0};
497 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
498 static int32_t param4_init[] = {1};
499 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
500 static int32_t param5_init[] = {1};
501 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
502 static int32_t param6_init[] = {0};
503 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
504 static bool8 layout_init[] = {true};
505 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
506 static int32_t param7_init[] = {1};
507 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
508 static int32_t param8_init[] = {1};
509 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
510 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
511 // Phase 3, inputs and outputs
512 model->identifyInputsAndOutputs(
513 {op1},
514 {op4});
515 assert(model->isValid());
516 }
517
is_ignored_nchw(int i)518 inline bool is_ignored_nchw(int i) {
519 static std::set<int> ignore = {};
520 return ignore.find(i) != ignore.end();
521 }
522
CreateModel_nchw_relaxed(Model * model)523 void CreateModel_nchw_relaxed(Model *model) {
524 OperandType type0(Type::BOOL, {});
525 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
526 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
527 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
528 OperandType type3(Type::TENSOR_FLOAT32, {1});
529 OperandType type4(Type::INT32, {});
530 // Phase 1, operands
531 auto op1 = model->addOperand(&type13);
532 auto op2 = model->addOperand(&type2);
533 auto op3 = model->addOperand(&type3);
534 auto param = model->addOperand(&type4);
535 auto param1 = model->addOperand(&type4);
536 auto param2 = model->addOperand(&type4);
537 auto param3 = model->addOperand(&type4);
538 auto param4 = model->addOperand(&type4);
539 auto param5 = model->addOperand(&type4);
540 auto param6 = model->addOperand(&type4);
541 auto layout = model->addOperand(&type0);
542 auto param7 = model->addOperand(&type4);
543 auto param8 = model->addOperand(&type4);
544 auto op4 = model->addOperand(&type14);
545 // Phase 2, operations
546 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
547 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
548 static float op3_init[] = {0.0f};
549 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
550 static int32_t param_init[] = {0};
551 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
552 static int32_t param1_init[] = {0};
553 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
554 static int32_t param2_init[] = {0};
555 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
556 static int32_t param3_init[] = {0};
557 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
558 static int32_t param4_init[] = {1};
559 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
560 static int32_t param5_init[] = {1};
561 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
562 static int32_t param6_init[] = {0};
563 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
564 static bool8 layout_init[] = {true};
565 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
566 static int32_t param7_init[] = {1};
567 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
568 static int32_t param8_init[] = {1};
569 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
570 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
571 // Phase 3, inputs and outputs
572 model->identifyInputsAndOutputs(
573 {op1},
574 {op4});
575 // Phase 4: set relaxed execution
576 model->relaxComputationFloat32toFloat16(true);
577 assert(model->isValid());
578 }
579
is_ignored_nchw_relaxed(int i)580 inline bool is_ignored_nchw_relaxed(int i) {
581 static std::set<int> ignore = {};
582 return ignore.find(i) != ignore.end();
583 }
584
CreateModel_nchw_quant8(Model * model)585 void CreateModel_nchw_quant8(Model *model) {
586 OperandType type0(Type::BOOL, {});
587 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
588 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0);
589 OperandType type4(Type::INT32, {});
590 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
591 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
592 // Phase 1, operands
593 auto op1 = model->addOperand(&type15);
594 auto op2 = model->addOperand(&type8);
595 auto op3 = model->addOperand(&type9);
596 auto param = model->addOperand(&type4);
597 auto param1 = model->addOperand(&type4);
598 auto param2 = model->addOperand(&type4);
599 auto param3 = model->addOperand(&type4);
600 auto param4 = model->addOperand(&type4);
601 auto param5 = model->addOperand(&type4);
602 auto param6 = model->addOperand(&type4);
603 auto layout = model->addOperand(&type0);
604 auto param7 = model->addOperand(&type4);
605 auto param8 = model->addOperand(&type4);
606 auto op4 = model->addOperand(&type16);
607 // Phase 2, operations
608 static uint8_t op2_init[] = {2, 2, 2, 2};
609 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4);
610 static int32_t op3_init[] = {0};
611 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1);
612 static int32_t param_init[] = {0};
613 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
614 static int32_t param1_init[] = {0};
615 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
616 static int32_t param2_init[] = {0};
617 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
618 static int32_t param3_init[] = {0};
619 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
620 static int32_t param4_init[] = {1};
621 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
622 static int32_t param5_init[] = {1};
623 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
624 static int32_t param6_init[] = {0};
625 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
626 static bool8 layout_init[] = {true};
627 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
628 static int32_t param7_init[] = {1};
629 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
630 static int32_t param8_init[] = {1};
631 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
632 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
633 // Phase 3, inputs and outputs
634 model->identifyInputsAndOutputs(
635 {op1},
636 {op4});
637 assert(model->isValid());
638 }
639
is_ignored_nchw_quant8(int i)640 inline bool is_ignored_nchw_quant8(int i) {
641 static std::set<int> ignore = {};
642 return ignore.find(i) != ignore.end();
643 }
644
CreateModel_nchw_float16(Model * model)645 void CreateModel_nchw_float16(Model *model) {
646 OperandType type0(Type::BOOL, {});
647 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
648 OperandType type12(Type::TENSOR_FLOAT16, {1});
649 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
650 OperandType type18(Type::TENSOR_FLOAT16, {1, 1, 2, 2});
651 OperandType type4(Type::INT32, {});
652 // Phase 1, operands
653 auto op1 = model->addOperand(&type17);
654 auto op2 = model->addOperand(&type11);
655 auto op3 = model->addOperand(&type12);
656 auto param = model->addOperand(&type4);
657 auto param1 = model->addOperand(&type4);
658 auto param2 = model->addOperand(&type4);
659 auto param3 = model->addOperand(&type4);
660 auto param4 = model->addOperand(&type4);
661 auto param5 = model->addOperand(&type4);
662 auto param6 = model->addOperand(&type4);
663 auto layout = model->addOperand(&type0);
664 auto param7 = model->addOperand(&type4);
665 auto param8 = model->addOperand(&type4);
666 auto op4 = model->addOperand(&type18);
667 // Phase 2, operations
668 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
669 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4);
670 static _Float16 op3_init[] = {0.0f};
671 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1);
672 static int32_t param_init[] = {0};
673 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
674 static int32_t param1_init[] = {0};
675 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
676 static int32_t param2_init[] = {0};
677 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
678 static int32_t param3_init[] = {0};
679 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
680 static int32_t param4_init[] = {1};
681 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
682 static int32_t param5_init[] = {1};
683 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
684 static int32_t param6_init[] = {0};
685 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
686 static bool8 layout_init[] = {true};
687 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
688 static int32_t param7_init[] = {1};
689 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
690 static int32_t param8_init[] = {1};
691 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
692 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
693 // Phase 3, inputs and outputs
694 model->identifyInputsAndOutputs(
695 {op1},
696 {op4});
697 assert(model->isValid());
698 }
699
is_ignored_nchw_float16(int i)700 inline bool is_ignored_nchw_float16(int i) {
701 static std::set<int> ignore = {};
702 return ignore.find(i) != ignore.end();
703 }
704
CreateModel_nchw_weight_as_input(Model * model)705 void CreateModel_nchw_weight_as_input(Model *model) {
706 OperandType type0(Type::BOOL, {});
707 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
708 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
709 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
710 OperandType type3(Type::TENSOR_FLOAT32, {1});
711 OperandType type4(Type::INT32, {});
712 // Phase 1, operands
713 auto op1 = model->addOperand(&type13);
714 auto op2 = model->addOperand(&type2);
715 auto op3 = model->addOperand(&type3);
716 auto param = model->addOperand(&type4);
717 auto param1 = model->addOperand(&type4);
718 auto param2 = model->addOperand(&type4);
719 auto param3 = model->addOperand(&type4);
720 auto param4 = model->addOperand(&type4);
721 auto param5 = model->addOperand(&type4);
722 auto param6 = model->addOperand(&type4);
723 auto layout = model->addOperand(&type0);
724 auto param7 = model->addOperand(&type4);
725 auto param8 = model->addOperand(&type4);
726 auto op4 = model->addOperand(&type14);
727 // Phase 2, operations
728 static int32_t param_init[] = {0};
729 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
730 static int32_t param1_init[] = {0};
731 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
732 static int32_t param2_init[] = {0};
733 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
734 static int32_t param3_init[] = {0};
735 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
736 static int32_t param4_init[] = {1};
737 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
738 static int32_t param5_init[] = {1};
739 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
740 static int32_t param6_init[] = {0};
741 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
742 static bool8 layout_init[] = {true};
743 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
744 static int32_t param7_init[] = {1};
745 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
746 static int32_t param8_init[] = {1};
747 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
748 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
749 // Phase 3, inputs and outputs
750 model->identifyInputsAndOutputs(
751 {op1, op2, op3},
752 {op4});
753 assert(model->isValid());
754 }
755
is_ignored_nchw_weight_as_input(int i)756 inline bool is_ignored_nchw_weight_as_input(int i) {
757 static std::set<int> ignore = {};
758 return ignore.find(i) != ignore.end();
759 }
760
CreateModel_nchw_weight_as_input_relaxed(Model * model)761 void CreateModel_nchw_weight_as_input_relaxed(Model *model) {
762 OperandType type0(Type::BOOL, {});
763 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
764 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
765 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
766 OperandType type3(Type::TENSOR_FLOAT32, {1});
767 OperandType type4(Type::INT32, {});
768 // Phase 1, operands
769 auto op1 = model->addOperand(&type13);
770 auto op2 = model->addOperand(&type2);
771 auto op3 = model->addOperand(&type3);
772 auto param = model->addOperand(&type4);
773 auto param1 = model->addOperand(&type4);
774 auto param2 = model->addOperand(&type4);
775 auto param3 = model->addOperand(&type4);
776 auto param4 = model->addOperand(&type4);
777 auto param5 = model->addOperand(&type4);
778 auto param6 = model->addOperand(&type4);
779 auto layout = model->addOperand(&type0);
780 auto param7 = model->addOperand(&type4);
781 auto param8 = model->addOperand(&type4);
782 auto op4 = model->addOperand(&type14);
783 // Phase 2, operations
784 static int32_t param_init[] = {0};
785 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
786 static int32_t param1_init[] = {0};
787 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
788 static int32_t param2_init[] = {0};
789 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
790 static int32_t param3_init[] = {0};
791 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
792 static int32_t param4_init[] = {1};
793 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
794 static int32_t param5_init[] = {1};
795 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
796 static int32_t param6_init[] = {0};
797 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
798 static bool8 layout_init[] = {true};
799 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
800 static int32_t param7_init[] = {1};
801 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
802 static int32_t param8_init[] = {1};
803 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
804 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
805 // Phase 3, inputs and outputs
806 model->identifyInputsAndOutputs(
807 {op1, op2, op3},
808 {op4});
809 // Phase 4: set relaxed execution
810 model->relaxComputationFloat32toFloat16(true);
811 assert(model->isValid());
812 }
813
is_ignored_nchw_weight_as_input_relaxed(int i)814 inline bool is_ignored_nchw_weight_as_input_relaxed(int i) {
815 static std::set<int> ignore = {};
816 return ignore.find(i) != ignore.end();
817 }
818
CreateModel_nchw_weight_as_input_quant8(Model * model)819 void CreateModel_nchw_weight_as_input_quant8(Model *model) {
820 OperandType type0(Type::BOOL, {});
821 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
822 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0);
823 OperandType type4(Type::INT32, {});
824 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
825 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
826 // Phase 1, operands
827 auto op1 = model->addOperand(&type15);
828 auto op2 = model->addOperand(&type8);
829 auto op3 = model->addOperand(&type9);
830 auto param = model->addOperand(&type4);
831 auto param1 = model->addOperand(&type4);
832 auto param2 = model->addOperand(&type4);
833 auto param3 = model->addOperand(&type4);
834 auto param4 = model->addOperand(&type4);
835 auto param5 = model->addOperand(&type4);
836 auto param6 = model->addOperand(&type4);
837 auto layout = model->addOperand(&type0);
838 auto param7 = model->addOperand(&type4);
839 auto param8 = model->addOperand(&type4);
840 auto op4 = model->addOperand(&type16);
841 // Phase 2, operations
842 static int32_t param_init[] = {0};
843 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
844 static int32_t param1_init[] = {0};
845 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
846 static int32_t param2_init[] = {0};
847 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
848 static int32_t param3_init[] = {0};
849 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
850 static int32_t param4_init[] = {1};
851 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
852 static int32_t param5_init[] = {1};
853 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
854 static int32_t param6_init[] = {0};
855 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
856 static bool8 layout_init[] = {true};
857 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
858 static int32_t param7_init[] = {1};
859 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
860 static int32_t param8_init[] = {1};
861 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
862 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
863 // Phase 3, inputs and outputs
864 model->identifyInputsAndOutputs(
865 {op1, op2, op3},
866 {op4});
867 assert(model->isValid());
868 }
869
is_ignored_nchw_weight_as_input_quant8(int i)870 inline bool is_ignored_nchw_weight_as_input_quant8(int i) {
871 static std::set<int> ignore = {};
872 return ignore.find(i) != ignore.end();
873 }
874
CreateModel_nchw_weight_as_input_float16(Model * model)875 void CreateModel_nchw_weight_as_input_float16(Model *model) {
876 OperandType type0(Type::BOOL, {});
877 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
878 OperandType type12(Type::TENSOR_FLOAT16, {1});
879 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
880 OperandType type18(Type::TENSOR_FLOAT16, {1, 1, 2, 2});
881 OperandType type4(Type::INT32, {});
882 // Phase 1, operands
883 auto op1 = model->addOperand(&type17);
884 auto op2 = model->addOperand(&type11);
885 auto op3 = model->addOperand(&type12);
886 auto param = model->addOperand(&type4);
887 auto param1 = model->addOperand(&type4);
888 auto param2 = model->addOperand(&type4);
889 auto param3 = model->addOperand(&type4);
890 auto param4 = model->addOperand(&type4);
891 auto param5 = model->addOperand(&type4);
892 auto param6 = model->addOperand(&type4);
893 auto layout = model->addOperand(&type0);
894 auto param7 = model->addOperand(&type4);
895 auto param8 = model->addOperand(&type4);
896 auto op4 = model->addOperand(&type18);
897 // Phase 2, operations
898 static int32_t param_init[] = {0};
899 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
900 static int32_t param1_init[] = {0};
901 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
902 static int32_t param2_init[] = {0};
903 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
904 static int32_t param3_init[] = {0};
905 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
906 static int32_t param4_init[] = {1};
907 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
908 static int32_t param5_init[] = {1};
909 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
910 static int32_t param6_init[] = {0};
911 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
912 static bool8 layout_init[] = {true};
913 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
914 static int32_t param7_init[] = {1};
915 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
916 static int32_t param8_init[] = {1};
917 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
918 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
919 // Phase 3, inputs and outputs
920 model->identifyInputsAndOutputs(
921 {op1, op2, op3},
922 {op4});
923 assert(model->isValid());
924 }
925
is_ignored_nchw_weight_as_input_float16(int i)926 inline bool is_ignored_nchw_weight_as_input_float16(int i) {
927 static std::set<int> ignore = {};
928 return ignore.find(i) != ignore.end();
929 }
930
CreateModel_dynamic_output_shape_nhwc(Model * model)931 void CreateModel_dynamic_output_shape_nhwc(Model *model) {
932 OperandType type0(Type::BOOL, {});
933 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
934 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
935 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
936 OperandType type3(Type::TENSOR_FLOAT32, {1});
937 OperandType type4(Type::INT32, {});
938 // Phase 1, operands
939 auto op1 = model->addOperand(&type1);
940 auto op2 = model->addOperand(&type2);
941 auto op3 = model->addOperand(&type3);
942 auto param = model->addOperand(&type4);
943 auto param1 = model->addOperand(&type4);
944 auto param2 = model->addOperand(&type4);
945 auto param3 = model->addOperand(&type4);
946 auto param4 = model->addOperand(&type4);
947 auto param5 = model->addOperand(&type4);
948 auto param6 = model->addOperand(&type4);
949 auto layout = model->addOperand(&type0);
950 auto param7 = model->addOperand(&type4);
951 auto param8 = model->addOperand(&type4);
952 auto op4 = model->addOperand(&type19);
953 // Phase 2, operations
954 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
955 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
956 static float op3_init[] = {0.0f};
957 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
958 static int32_t param_init[] = {0};
959 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
960 static int32_t param1_init[] = {0};
961 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
962 static int32_t param2_init[] = {0};
963 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
964 static int32_t param3_init[] = {0};
965 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
966 static int32_t param4_init[] = {1};
967 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
968 static int32_t param5_init[] = {1};
969 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
970 static int32_t param6_init[] = {0};
971 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
972 static bool8 layout_init[] = {false};
973 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
974 static int32_t param7_init[] = {1};
975 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
976 static int32_t param8_init[] = {1};
977 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
978 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
979 // Phase 3, inputs and outputs
980 model->identifyInputsAndOutputs(
981 {op1},
982 {op4});
983 assert(model->isValid());
984 }
985
is_ignored_dynamic_output_shape_nhwc(int i)986 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
987 static std::set<int> ignore = {};
988 return ignore.find(i) != ignore.end();
989 }
990
CreateModel_dynamic_output_shape_nhwc_relaxed(Model * model)991 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) {
992 OperandType type0(Type::BOOL, {});
993 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
994 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
995 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
996 OperandType type3(Type::TENSOR_FLOAT32, {1});
997 OperandType type4(Type::INT32, {});
998 // Phase 1, operands
999 auto op1 = model->addOperand(&type1);
1000 auto op2 = model->addOperand(&type2);
1001 auto op3 = model->addOperand(&type3);
1002 auto param = model->addOperand(&type4);
1003 auto param1 = model->addOperand(&type4);
1004 auto param2 = model->addOperand(&type4);
1005 auto param3 = model->addOperand(&type4);
1006 auto param4 = model->addOperand(&type4);
1007 auto param5 = model->addOperand(&type4);
1008 auto param6 = model->addOperand(&type4);
1009 auto layout = model->addOperand(&type0);
1010 auto param7 = model->addOperand(&type4);
1011 auto param8 = model->addOperand(&type4);
1012 auto op4 = model->addOperand(&type19);
1013 // Phase 2, operations
1014 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
1015 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
1016 static float op3_init[] = {0.0f};
1017 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
1018 static int32_t param_init[] = {0};
1019 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1020 static int32_t param1_init[] = {0};
1021 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1022 static int32_t param2_init[] = {0};
1023 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1024 static int32_t param3_init[] = {0};
1025 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1026 static int32_t param4_init[] = {1};
1027 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1028 static int32_t param5_init[] = {1};
1029 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1030 static int32_t param6_init[] = {0};
1031 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1032 static bool8 layout_init[] = {false};
1033 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1034 static int32_t param7_init[] = {1};
1035 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1036 static int32_t param8_init[] = {1};
1037 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1038 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1039 // Phase 3, inputs and outputs
1040 model->identifyInputsAndOutputs(
1041 {op1},
1042 {op4});
1043 // Phase 4: set relaxed execution
1044 model->relaxComputationFloat32toFloat16(true);
1045 assert(model->isValid());
1046 }
1047
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)1048 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
1049 static std::set<int> ignore = {};
1050 return ignore.find(i) != ignore.end();
1051 }
1052
CreateModel_dynamic_output_shape_nhwc_quant8(Model * model)1053 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) {
1054 OperandType type0(Type::BOOL, {});
1055 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
1056 OperandType type4(Type::INT32, {});
1057 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
1058 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
1059 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
1060 // Phase 1, operands
1061 auto op1 = model->addOperand(&type7);
1062 auto op2 = model->addOperand(&type8);
1063 auto op3 = model->addOperand(&type9);
1064 auto param = model->addOperand(&type4);
1065 auto param1 = model->addOperand(&type4);
1066 auto param2 = model->addOperand(&type4);
1067 auto param3 = model->addOperand(&type4);
1068 auto param4 = model->addOperand(&type4);
1069 auto param5 = model->addOperand(&type4);
1070 auto param6 = model->addOperand(&type4);
1071 auto layout = model->addOperand(&type0);
1072 auto param7 = model->addOperand(&type4);
1073 auto param8 = model->addOperand(&type4);
1074 auto op4 = model->addOperand(&type20);
1075 // Phase 2, operations
1076 static uint8_t op2_init[] = {2, 2, 2, 2};
1077 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4);
1078 static int32_t op3_init[] = {0};
1079 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1);
1080 static int32_t param_init[] = {0};
1081 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1082 static int32_t param1_init[] = {0};
1083 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1084 static int32_t param2_init[] = {0};
1085 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1086 static int32_t param3_init[] = {0};
1087 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1088 static int32_t param4_init[] = {1};
1089 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1090 static int32_t param5_init[] = {1};
1091 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1092 static int32_t param6_init[] = {0};
1093 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1094 static bool8 layout_init[] = {false};
1095 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1096 static int32_t param7_init[] = {1};
1097 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1098 static int32_t param8_init[] = {1};
1099 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1100 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1101 // Phase 3, inputs and outputs
1102 model->identifyInputsAndOutputs(
1103 {op1},
1104 {op4});
1105 assert(model->isValid());
1106 }
1107
is_ignored_dynamic_output_shape_nhwc_quant8(int i)1108 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
1109 static std::set<int> ignore = {};
1110 return ignore.find(i) != ignore.end();
1111 }
1112
CreateModel_dynamic_output_shape_nhwc_float16(Model * model)1113 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) {
1114 OperandType type0(Type::BOOL, {});
1115 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
1116 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
1117 OperandType type12(Type::TENSOR_FLOAT16, {1});
1118 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1119 OperandType type4(Type::INT32, {});
1120 // Phase 1, operands
1121 auto op1 = model->addOperand(&type10);
1122 auto op2 = model->addOperand(&type11);
1123 auto op3 = model->addOperand(&type12);
1124 auto param = model->addOperand(&type4);
1125 auto param1 = model->addOperand(&type4);
1126 auto param2 = model->addOperand(&type4);
1127 auto param3 = model->addOperand(&type4);
1128 auto param4 = model->addOperand(&type4);
1129 auto param5 = model->addOperand(&type4);
1130 auto param6 = model->addOperand(&type4);
1131 auto layout = model->addOperand(&type0);
1132 auto param7 = model->addOperand(&type4);
1133 auto param8 = model->addOperand(&type4);
1134 auto op4 = model->addOperand(&type21);
1135 // Phase 2, operations
1136 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
1137 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4);
1138 static _Float16 op3_init[] = {0.0f};
1139 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1);
1140 static int32_t param_init[] = {0};
1141 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1142 static int32_t param1_init[] = {0};
1143 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1144 static int32_t param2_init[] = {0};
1145 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1146 static int32_t param3_init[] = {0};
1147 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1148 static int32_t param4_init[] = {1};
1149 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1150 static int32_t param5_init[] = {1};
1151 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1152 static int32_t param6_init[] = {0};
1153 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1154 static bool8 layout_init[] = {false};
1155 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1156 static int32_t param7_init[] = {1};
1157 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1158 static int32_t param8_init[] = {1};
1159 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1160 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1161 // Phase 3, inputs and outputs
1162 model->identifyInputsAndOutputs(
1163 {op1},
1164 {op4});
1165 assert(model->isValid());
1166 }
1167
is_ignored_dynamic_output_shape_nhwc_float16(int i)1168 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
1169 static std::set<int> ignore = {};
1170 return ignore.find(i) != ignore.end();
1171 }
1172
CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model * model)1173 void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) {
1174 OperandType type0(Type::BOOL, {});
1175 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
1176 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1177 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1178 OperandType type3(Type::TENSOR_FLOAT32, {1});
1179 OperandType type4(Type::INT32, {});
1180 // Phase 1, operands
1181 auto op1 = model->addOperand(&type1);
1182 auto op2 = model->addOperand(&type2);
1183 auto op3 = model->addOperand(&type3);
1184 auto param = model->addOperand(&type4);
1185 auto param1 = model->addOperand(&type4);
1186 auto param2 = model->addOperand(&type4);
1187 auto param3 = model->addOperand(&type4);
1188 auto param4 = model->addOperand(&type4);
1189 auto param5 = model->addOperand(&type4);
1190 auto param6 = model->addOperand(&type4);
1191 auto layout = model->addOperand(&type0);
1192 auto param7 = model->addOperand(&type4);
1193 auto param8 = model->addOperand(&type4);
1194 auto op4 = model->addOperand(&type19);
1195 // Phase 2, operations
1196 static int32_t param_init[] = {0};
1197 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1198 static int32_t param1_init[] = {0};
1199 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1200 static int32_t param2_init[] = {0};
1201 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1202 static int32_t param3_init[] = {0};
1203 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1204 static int32_t param4_init[] = {1};
1205 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1206 static int32_t param5_init[] = {1};
1207 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1208 static int32_t param6_init[] = {0};
1209 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1210 static bool8 layout_init[] = {false};
1211 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1212 static int32_t param7_init[] = {1};
1213 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1214 static int32_t param8_init[] = {1};
1215 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1216 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1217 // Phase 3, inputs and outputs
1218 model->identifyInputsAndOutputs(
1219 {op1, op2, op3},
1220 {op4});
1221 assert(model->isValid());
1222 }
1223
is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i)1224 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) {
1225 static std::set<int> ignore = {};
1226 return ignore.find(i) != ignore.end();
1227 }
1228
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model * model)1229 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) {
1230 OperandType type0(Type::BOOL, {});
1231 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
1232 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1233 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1234 OperandType type3(Type::TENSOR_FLOAT32, {1});
1235 OperandType type4(Type::INT32, {});
1236 // Phase 1, operands
1237 auto op1 = model->addOperand(&type1);
1238 auto op2 = model->addOperand(&type2);
1239 auto op3 = model->addOperand(&type3);
1240 auto param = model->addOperand(&type4);
1241 auto param1 = model->addOperand(&type4);
1242 auto param2 = model->addOperand(&type4);
1243 auto param3 = model->addOperand(&type4);
1244 auto param4 = model->addOperand(&type4);
1245 auto param5 = model->addOperand(&type4);
1246 auto param6 = model->addOperand(&type4);
1247 auto layout = model->addOperand(&type0);
1248 auto param7 = model->addOperand(&type4);
1249 auto param8 = model->addOperand(&type4);
1250 auto op4 = model->addOperand(&type19);
1251 // Phase 2, operations
1252 static int32_t param_init[] = {0};
1253 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1254 static int32_t param1_init[] = {0};
1255 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1256 static int32_t param2_init[] = {0};
1257 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1258 static int32_t param3_init[] = {0};
1259 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1260 static int32_t param4_init[] = {1};
1261 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1262 static int32_t param5_init[] = {1};
1263 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1264 static int32_t param6_init[] = {0};
1265 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1266 static bool8 layout_init[] = {false};
1267 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1268 static int32_t param7_init[] = {1};
1269 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1270 static int32_t param8_init[] = {1};
1271 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1272 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1273 // Phase 3, inputs and outputs
1274 model->identifyInputsAndOutputs(
1275 {op1, op2, op3},
1276 {op4});
1277 // Phase 4: set relaxed execution
1278 model->relaxComputationFloat32toFloat16(true);
1279 assert(model->isValid());
1280 }
1281
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i)1282 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) {
1283 static std::set<int> ignore = {};
1284 return ignore.find(i) != ignore.end();
1285 }
1286
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model * model)1287 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) {
1288 OperandType type0(Type::BOOL, {});
1289 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
1290 OperandType type4(Type::INT32, {});
1291 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
1292 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
1293 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
1294 // Phase 1, operands
1295 auto op1 = model->addOperand(&type7);
1296 auto op2 = model->addOperand(&type8);
1297 auto op3 = model->addOperand(&type9);
1298 auto param = model->addOperand(&type4);
1299 auto param1 = model->addOperand(&type4);
1300 auto param2 = model->addOperand(&type4);
1301 auto param3 = model->addOperand(&type4);
1302 auto param4 = model->addOperand(&type4);
1303 auto param5 = model->addOperand(&type4);
1304 auto param6 = model->addOperand(&type4);
1305 auto layout = model->addOperand(&type0);
1306 auto param7 = model->addOperand(&type4);
1307 auto param8 = model->addOperand(&type4);
1308 auto op4 = model->addOperand(&type20);
1309 // Phase 2, operations
1310 static int32_t param_init[] = {0};
1311 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1312 static int32_t param1_init[] = {0};
1313 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1314 static int32_t param2_init[] = {0};
1315 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1316 static int32_t param3_init[] = {0};
1317 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1318 static int32_t param4_init[] = {1};
1319 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1320 static int32_t param5_init[] = {1};
1321 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1322 static int32_t param6_init[] = {0};
1323 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1324 static bool8 layout_init[] = {false};
1325 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1326 static int32_t param7_init[] = {1};
1327 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1328 static int32_t param8_init[] = {1};
1329 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1330 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1331 // Phase 3, inputs and outputs
1332 model->identifyInputsAndOutputs(
1333 {op1, op2, op3},
1334 {op4});
1335 assert(model->isValid());
1336 }
1337
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i)1338 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) {
1339 static std::set<int> ignore = {};
1340 return ignore.find(i) != ignore.end();
1341 }
1342
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model * model)1343 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) {
1344 OperandType type0(Type::BOOL, {});
1345 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
1346 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
1347 OperandType type12(Type::TENSOR_FLOAT16, {1});
1348 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1349 OperandType type4(Type::INT32, {});
1350 // Phase 1, operands
1351 auto op1 = model->addOperand(&type10);
1352 auto op2 = model->addOperand(&type11);
1353 auto op3 = model->addOperand(&type12);
1354 auto param = model->addOperand(&type4);
1355 auto param1 = model->addOperand(&type4);
1356 auto param2 = model->addOperand(&type4);
1357 auto param3 = model->addOperand(&type4);
1358 auto param4 = model->addOperand(&type4);
1359 auto param5 = model->addOperand(&type4);
1360 auto param6 = model->addOperand(&type4);
1361 auto layout = model->addOperand(&type0);
1362 auto param7 = model->addOperand(&type4);
1363 auto param8 = model->addOperand(&type4);
1364 auto op4 = model->addOperand(&type21);
1365 // Phase 2, operations
1366 static int32_t param_init[] = {0};
1367 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1368 static int32_t param1_init[] = {0};
1369 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1370 static int32_t param2_init[] = {0};
1371 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1372 static int32_t param3_init[] = {0};
1373 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1374 static int32_t param4_init[] = {1};
1375 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1376 static int32_t param5_init[] = {1};
1377 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1378 static int32_t param6_init[] = {0};
1379 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1380 static bool8 layout_init[] = {false};
1381 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1382 static int32_t param7_init[] = {1};
1383 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1384 static int32_t param8_init[] = {1};
1385 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1386 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1387 // Phase 3, inputs and outputs
1388 model->identifyInputsAndOutputs(
1389 {op1, op2, op3},
1390 {op4});
1391 assert(model->isValid());
1392 }
1393
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i)1394 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i) {
1395 static std::set<int> ignore = {};
1396 return ignore.find(i) != ignore.end();
1397 }
1398
CreateModel_dynamic_output_shape_nchw(Model * model)1399 void CreateModel_dynamic_output_shape_nchw(Model *model) {
1400 OperandType type0(Type::BOOL, {});
1401 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
1402 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1403 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1404 OperandType type3(Type::TENSOR_FLOAT32, {1});
1405 OperandType type4(Type::INT32, {});
1406 // Phase 1, operands
1407 auto op1 = model->addOperand(&type13);
1408 auto op2 = model->addOperand(&type2);
1409 auto op3 = model->addOperand(&type3);
1410 auto param = model->addOperand(&type4);
1411 auto param1 = model->addOperand(&type4);
1412 auto param2 = model->addOperand(&type4);
1413 auto param3 = model->addOperand(&type4);
1414 auto param4 = model->addOperand(&type4);
1415 auto param5 = model->addOperand(&type4);
1416 auto param6 = model->addOperand(&type4);
1417 auto layout = model->addOperand(&type0);
1418 auto param7 = model->addOperand(&type4);
1419 auto param8 = model->addOperand(&type4);
1420 auto op4 = model->addOperand(&type19);
1421 // Phase 2, operations
1422 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
1423 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
1424 static float op3_init[] = {0.0f};
1425 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
1426 static int32_t param_init[] = {0};
1427 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1428 static int32_t param1_init[] = {0};
1429 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1430 static int32_t param2_init[] = {0};
1431 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1432 static int32_t param3_init[] = {0};
1433 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1434 static int32_t param4_init[] = {1};
1435 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1436 static int32_t param5_init[] = {1};
1437 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1438 static int32_t param6_init[] = {0};
1439 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1440 static bool8 layout_init[] = {true};
1441 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1442 static int32_t param7_init[] = {1};
1443 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1444 static int32_t param8_init[] = {1};
1445 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1446 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1447 // Phase 3, inputs and outputs
1448 model->identifyInputsAndOutputs(
1449 {op1},
1450 {op4});
1451 assert(model->isValid());
1452 }
1453
is_ignored_dynamic_output_shape_nchw(int i)1454 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
1455 static std::set<int> ignore = {};
1456 return ignore.find(i) != ignore.end();
1457 }
1458
CreateModel_dynamic_output_shape_nchw_relaxed(Model * model)1459 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) {
1460 OperandType type0(Type::BOOL, {});
1461 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
1462 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1463 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1464 OperandType type3(Type::TENSOR_FLOAT32, {1});
1465 OperandType type4(Type::INT32, {});
1466 // Phase 1, operands
1467 auto op1 = model->addOperand(&type13);
1468 auto op2 = model->addOperand(&type2);
1469 auto op3 = model->addOperand(&type3);
1470 auto param = model->addOperand(&type4);
1471 auto param1 = model->addOperand(&type4);
1472 auto param2 = model->addOperand(&type4);
1473 auto param3 = model->addOperand(&type4);
1474 auto param4 = model->addOperand(&type4);
1475 auto param5 = model->addOperand(&type4);
1476 auto param6 = model->addOperand(&type4);
1477 auto layout = model->addOperand(&type0);
1478 auto param7 = model->addOperand(&type4);
1479 auto param8 = model->addOperand(&type4);
1480 auto op4 = model->addOperand(&type19);
1481 // Phase 2, operations
1482 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
1483 model->setOperandValue(op2, op2_init, sizeof(float) * 4);
1484 static float op3_init[] = {0.0f};
1485 model->setOperandValue(op3, op3_init, sizeof(float) * 1);
1486 static int32_t param_init[] = {0};
1487 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1488 static int32_t param1_init[] = {0};
1489 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1490 static int32_t param2_init[] = {0};
1491 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1492 static int32_t param3_init[] = {0};
1493 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1494 static int32_t param4_init[] = {1};
1495 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1496 static int32_t param5_init[] = {1};
1497 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1498 static int32_t param6_init[] = {0};
1499 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1500 static bool8 layout_init[] = {true};
1501 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1502 static int32_t param7_init[] = {1};
1503 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1504 static int32_t param8_init[] = {1};
1505 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1506 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1507 // Phase 3, inputs and outputs
1508 model->identifyInputsAndOutputs(
1509 {op1},
1510 {op4});
1511 // Phase 4: set relaxed execution
1512 model->relaxComputationFloat32toFloat16(true);
1513 assert(model->isValid());
1514 }
1515
is_ignored_dynamic_output_shape_nchw_relaxed(int i)1516 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
1517 static std::set<int> ignore = {};
1518 return ignore.find(i) != ignore.end();
1519 }
1520
CreateModel_dynamic_output_shape_nchw_quant8(Model * model)1521 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) {
1522 OperandType type0(Type::BOOL, {});
1523 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
1524 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
1525 OperandType type4(Type::INT32, {});
1526 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
1527 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
1528 // Phase 1, operands
1529 auto op1 = model->addOperand(&type15);
1530 auto op2 = model->addOperand(&type8);
1531 auto op3 = model->addOperand(&type9);
1532 auto param = model->addOperand(&type4);
1533 auto param1 = model->addOperand(&type4);
1534 auto param2 = model->addOperand(&type4);
1535 auto param3 = model->addOperand(&type4);
1536 auto param4 = model->addOperand(&type4);
1537 auto param5 = model->addOperand(&type4);
1538 auto param6 = model->addOperand(&type4);
1539 auto layout = model->addOperand(&type0);
1540 auto param7 = model->addOperand(&type4);
1541 auto param8 = model->addOperand(&type4);
1542 auto op4 = model->addOperand(&type20);
1543 // Phase 2, operations
1544 static uint8_t op2_init[] = {2, 2, 2, 2};
1545 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4);
1546 static int32_t op3_init[] = {0};
1547 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1);
1548 static int32_t param_init[] = {0};
1549 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1550 static int32_t param1_init[] = {0};
1551 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1552 static int32_t param2_init[] = {0};
1553 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1554 static int32_t param3_init[] = {0};
1555 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1556 static int32_t param4_init[] = {1};
1557 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1558 static int32_t param5_init[] = {1};
1559 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1560 static int32_t param6_init[] = {0};
1561 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1562 static bool8 layout_init[] = {true};
1563 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1564 static int32_t param7_init[] = {1};
1565 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1566 static int32_t param8_init[] = {1};
1567 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1568 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1569 // Phase 3, inputs and outputs
1570 model->identifyInputsAndOutputs(
1571 {op1},
1572 {op4});
1573 assert(model->isValid());
1574 }
1575
is_ignored_dynamic_output_shape_nchw_quant8(int i)1576 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
1577 static std::set<int> ignore = {};
1578 return ignore.find(i) != ignore.end();
1579 }
1580
CreateModel_dynamic_output_shape_nchw_float16(Model * model)1581 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) {
1582 OperandType type0(Type::BOOL, {});
1583 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
1584 OperandType type12(Type::TENSOR_FLOAT16, {1});
1585 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
1586 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1587 OperandType type4(Type::INT32, {});
1588 // Phase 1, operands
1589 auto op1 = model->addOperand(&type17);
1590 auto op2 = model->addOperand(&type11);
1591 auto op3 = model->addOperand(&type12);
1592 auto param = model->addOperand(&type4);
1593 auto param1 = model->addOperand(&type4);
1594 auto param2 = model->addOperand(&type4);
1595 auto param3 = model->addOperand(&type4);
1596 auto param4 = model->addOperand(&type4);
1597 auto param5 = model->addOperand(&type4);
1598 auto param6 = model->addOperand(&type4);
1599 auto layout = model->addOperand(&type0);
1600 auto param7 = model->addOperand(&type4);
1601 auto param8 = model->addOperand(&type4);
1602 auto op4 = model->addOperand(&type21);
1603 // Phase 2, operations
1604 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
1605 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4);
1606 static _Float16 op3_init[] = {0.0f};
1607 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1);
1608 static int32_t param_init[] = {0};
1609 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1610 static int32_t param1_init[] = {0};
1611 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1612 static int32_t param2_init[] = {0};
1613 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1614 static int32_t param3_init[] = {0};
1615 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1616 static int32_t param4_init[] = {1};
1617 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1618 static int32_t param5_init[] = {1};
1619 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1620 static int32_t param6_init[] = {0};
1621 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1622 static bool8 layout_init[] = {true};
1623 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1624 static int32_t param7_init[] = {1};
1625 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1626 static int32_t param8_init[] = {1};
1627 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1628 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1629 // Phase 3, inputs and outputs
1630 model->identifyInputsAndOutputs(
1631 {op1},
1632 {op4});
1633 assert(model->isValid());
1634 }
1635
is_ignored_dynamic_output_shape_nchw_float16(int i)1636 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
1637 static std::set<int> ignore = {};
1638 return ignore.find(i) != ignore.end();
1639 }
1640
CreateModel_dynamic_output_shape_nchw_weight_as_input(Model * model)1641 void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) {
1642 OperandType type0(Type::BOOL, {});
1643 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
1644 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1645 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1646 OperandType type3(Type::TENSOR_FLOAT32, {1});
1647 OperandType type4(Type::INT32, {});
1648 // Phase 1, operands
1649 auto op1 = model->addOperand(&type13);
1650 auto op2 = model->addOperand(&type2);
1651 auto op3 = model->addOperand(&type3);
1652 auto param = model->addOperand(&type4);
1653 auto param1 = model->addOperand(&type4);
1654 auto param2 = model->addOperand(&type4);
1655 auto param3 = model->addOperand(&type4);
1656 auto param4 = model->addOperand(&type4);
1657 auto param5 = model->addOperand(&type4);
1658 auto param6 = model->addOperand(&type4);
1659 auto layout = model->addOperand(&type0);
1660 auto param7 = model->addOperand(&type4);
1661 auto param8 = model->addOperand(&type4);
1662 auto op4 = model->addOperand(&type19);
1663 // Phase 2, operations
1664 static int32_t param_init[] = {0};
1665 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1666 static int32_t param1_init[] = {0};
1667 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1668 static int32_t param2_init[] = {0};
1669 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1670 static int32_t param3_init[] = {0};
1671 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1672 static int32_t param4_init[] = {1};
1673 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1674 static int32_t param5_init[] = {1};
1675 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1676 static int32_t param6_init[] = {0};
1677 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1678 static bool8 layout_init[] = {true};
1679 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1680 static int32_t param7_init[] = {1};
1681 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1682 static int32_t param8_init[] = {1};
1683 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1684 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1685 // Phase 3, inputs and outputs
1686 model->identifyInputsAndOutputs(
1687 {op1, op2, op3},
1688 {op4});
1689 assert(model->isValid());
1690 }
1691
is_ignored_dynamic_output_shape_nchw_weight_as_input(int i)1692 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) {
1693 static std::set<int> ignore = {};
1694 return ignore.find(i) != ignore.end();
1695 }
1696
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model * model)1697 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) {
1698 OperandType type0(Type::BOOL, {});
1699 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
1700 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1701 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
1702 OperandType type3(Type::TENSOR_FLOAT32, {1});
1703 OperandType type4(Type::INT32, {});
1704 // Phase 1, operands
1705 auto op1 = model->addOperand(&type13);
1706 auto op2 = model->addOperand(&type2);
1707 auto op3 = model->addOperand(&type3);
1708 auto param = model->addOperand(&type4);
1709 auto param1 = model->addOperand(&type4);
1710 auto param2 = model->addOperand(&type4);
1711 auto param3 = model->addOperand(&type4);
1712 auto param4 = model->addOperand(&type4);
1713 auto param5 = model->addOperand(&type4);
1714 auto param6 = model->addOperand(&type4);
1715 auto layout = model->addOperand(&type0);
1716 auto param7 = model->addOperand(&type4);
1717 auto param8 = model->addOperand(&type4);
1718 auto op4 = model->addOperand(&type19);
1719 // Phase 2, operations
1720 static int32_t param_init[] = {0};
1721 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1722 static int32_t param1_init[] = {0};
1723 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1724 static int32_t param2_init[] = {0};
1725 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1726 static int32_t param3_init[] = {0};
1727 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1728 static int32_t param4_init[] = {1};
1729 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1730 static int32_t param5_init[] = {1};
1731 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1732 static int32_t param6_init[] = {0};
1733 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1734 static bool8 layout_init[] = {true};
1735 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1736 static int32_t param7_init[] = {1};
1737 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1738 static int32_t param8_init[] = {1};
1739 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1740 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1741 // Phase 3, inputs and outputs
1742 model->identifyInputsAndOutputs(
1743 {op1, op2, op3},
1744 {op4});
1745 // Phase 4: set relaxed execution
1746 model->relaxComputationFloat32toFloat16(true);
1747 assert(model->isValid());
1748 }
1749
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i)1750 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) {
1751 static std::set<int> ignore = {};
1752 return ignore.find(i) != ignore.end();
1753 }
1754
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model * model)1755 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) {
1756 OperandType type0(Type::BOOL, {});
1757 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
1758 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
1759 OperandType type4(Type::INT32, {});
1760 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
1761 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
1762 // Phase 1, operands
1763 auto op1 = model->addOperand(&type15);
1764 auto op2 = model->addOperand(&type8);
1765 auto op3 = model->addOperand(&type9);
1766 auto param = model->addOperand(&type4);
1767 auto param1 = model->addOperand(&type4);
1768 auto param2 = model->addOperand(&type4);
1769 auto param3 = model->addOperand(&type4);
1770 auto param4 = model->addOperand(&type4);
1771 auto param5 = model->addOperand(&type4);
1772 auto param6 = model->addOperand(&type4);
1773 auto layout = model->addOperand(&type0);
1774 auto param7 = model->addOperand(&type4);
1775 auto param8 = model->addOperand(&type4);
1776 auto op4 = model->addOperand(&type20);
1777 // Phase 2, operations
1778 static int32_t param_init[] = {0};
1779 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1780 static int32_t param1_init[] = {0};
1781 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1782 static int32_t param2_init[] = {0};
1783 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1784 static int32_t param3_init[] = {0};
1785 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1786 static int32_t param4_init[] = {1};
1787 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1788 static int32_t param5_init[] = {1};
1789 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1790 static int32_t param6_init[] = {0};
1791 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1792 static bool8 layout_init[] = {true};
1793 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1794 static int32_t param7_init[] = {1};
1795 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1796 static int32_t param8_init[] = {1};
1797 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1798 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1799 // Phase 3, inputs and outputs
1800 model->identifyInputsAndOutputs(
1801 {op1, op2, op3},
1802 {op4});
1803 assert(model->isValid());
1804 }
1805
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i)1806 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i) {
1807 static std::set<int> ignore = {};
1808 return ignore.find(i) != ignore.end();
1809 }
1810
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model * model)1811 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) {
1812 OperandType type0(Type::BOOL, {});
1813 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
1814 OperandType type12(Type::TENSOR_FLOAT16, {1});
1815 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
1816 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1817 OperandType type4(Type::INT32, {});
1818 // Phase 1, operands
1819 auto op1 = model->addOperand(&type17);
1820 auto op2 = model->addOperand(&type11);
1821 auto op3 = model->addOperand(&type12);
1822 auto param = model->addOperand(&type4);
1823 auto param1 = model->addOperand(&type4);
1824 auto param2 = model->addOperand(&type4);
1825 auto param3 = model->addOperand(&type4);
1826 auto param4 = model->addOperand(&type4);
1827 auto param5 = model->addOperand(&type4);
1828 auto param6 = model->addOperand(&type4);
1829 auto layout = model->addOperand(&type0);
1830 auto param7 = model->addOperand(&type4);
1831 auto param8 = model->addOperand(&type4);
1832 auto op4 = model->addOperand(&type21);
1833 // Phase 2, operations
1834 static int32_t param_init[] = {0};
1835 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1836 static int32_t param1_init[] = {0};
1837 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1838 static int32_t param2_init[] = {0};
1839 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1840 static int32_t param3_init[] = {0};
1841 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1842 static int32_t param4_init[] = {1};
1843 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1844 static int32_t param5_init[] = {1};
1845 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1846 static int32_t param6_init[] = {0};
1847 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1848 static bool8 layout_init[] = {true};
1849 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1850 static int32_t param7_init[] = {1};
1851 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1852 static int32_t param8_init[] = {1};
1853 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
1854 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout, param7, param8}, {op4});
1855 // Phase 3, inputs and outputs
1856 model->identifyInputsAndOutputs(
1857 {op1, op2, op3},
1858 {op4});
1859 assert(model->isValid());
1860 }
1861
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i)1862 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i) {
1863 static std::set<int> ignore = {};
1864 return ignore.find(i) != ignore.end();
1865 }
1866
CreateModel_nhwc_2(Model * model)1867 void CreateModel_nhwc_2(Model *model) {
1868 OperandType type0(Type::BOOL, {});
1869 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
1870 OperandType type3(Type::TENSOR_FLOAT32, {1});
1871 OperandType type4(Type::INT32, {});
1872 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
1873 // Phase 1, operands
1874 auto op11 = model->addOperand(&type5);
1875 auto op21 = model->addOperand(&type1);
1876 auto op31 = model->addOperand(&type3);
1877 auto param9 = model->addOperand(&type4);
1878 auto param10 = model->addOperand(&type4);
1879 auto param11 = model->addOperand(&type4);
1880 auto param12 = model->addOperand(&type4);
1881 auto param13 = model->addOperand(&type4);
1882 auto param14 = model->addOperand(&type4);
1883 auto param15 = model->addOperand(&type4);
1884 auto layout = model->addOperand(&type0);
1885 auto param16 = model->addOperand(&type4);
1886 auto param17 = model->addOperand(&type4);
1887 auto op41 = model->addOperand(&type1);
1888 // Phase 2, operations
1889 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
1890 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
1891 static float op31_init[] = {0.0f};
1892 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
1893 static int32_t param9_init[] = {0};
1894 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1895 static int32_t param10_init[] = {0};
1896 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
1897 static int32_t param11_init[] = {0};
1898 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1899 static int32_t param12_init[] = {0};
1900 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1901 static int32_t param13_init[] = {1};
1902 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
1903 static int32_t param14_init[] = {1};
1904 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
1905 static int32_t param15_init[] = {0};
1906 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
1907 static bool8 layout_init[] = {false};
1908 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1909 static int32_t param16_init[] = {3};
1910 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
1911 static int32_t param17_init[] = {3};
1912 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
1913 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
1914 // Phase 3, inputs and outputs
1915 model->identifyInputsAndOutputs(
1916 {op11},
1917 {op41});
1918 assert(model->isValid());
1919 }
1920
is_ignored_nhwc_2(int i)1921 inline bool is_ignored_nhwc_2(int i) {
1922 static std::set<int> ignore = {};
1923 return ignore.find(i) != ignore.end();
1924 }
1925
CreateModel_nhwc_relaxed_2(Model * model)1926 void CreateModel_nhwc_relaxed_2(Model *model) {
1927 OperandType type0(Type::BOOL, {});
1928 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
1929 OperandType type3(Type::TENSOR_FLOAT32, {1});
1930 OperandType type4(Type::INT32, {});
1931 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
1932 // Phase 1, operands
1933 auto op11 = model->addOperand(&type5);
1934 auto op21 = model->addOperand(&type1);
1935 auto op31 = model->addOperand(&type3);
1936 auto param9 = model->addOperand(&type4);
1937 auto param10 = model->addOperand(&type4);
1938 auto param11 = model->addOperand(&type4);
1939 auto param12 = model->addOperand(&type4);
1940 auto param13 = model->addOperand(&type4);
1941 auto param14 = model->addOperand(&type4);
1942 auto param15 = model->addOperand(&type4);
1943 auto layout = model->addOperand(&type0);
1944 auto param16 = model->addOperand(&type4);
1945 auto param17 = model->addOperand(&type4);
1946 auto op41 = model->addOperand(&type1);
1947 // Phase 2, operations
1948 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
1949 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
1950 static float op31_init[] = {0.0f};
1951 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
1952 static int32_t param9_init[] = {0};
1953 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
1954 static int32_t param10_init[] = {0};
1955 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
1956 static int32_t param11_init[] = {0};
1957 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
1958 static int32_t param12_init[] = {0};
1959 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
1960 static int32_t param13_init[] = {1};
1961 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
1962 static int32_t param14_init[] = {1};
1963 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
1964 static int32_t param15_init[] = {0};
1965 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
1966 static bool8 layout_init[] = {false};
1967 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1968 static int32_t param16_init[] = {3};
1969 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
1970 static int32_t param17_init[] = {3};
1971 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
1972 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
1973 // Phase 3, inputs and outputs
1974 model->identifyInputsAndOutputs(
1975 {op11},
1976 {op41});
1977 // Phase 4: set relaxed execution
1978 model->relaxComputationFloat32toFloat16(true);
1979 assert(model->isValid());
1980 }
1981
is_ignored_nhwc_relaxed_2(int i)1982 inline bool is_ignored_nhwc_relaxed_2(int i) {
1983 static std::set<int> ignore = {};
1984 return ignore.find(i) != ignore.end();
1985 }
1986
CreateModel_nhwc_quant8_2(Model * model)1987 void CreateModel_nhwc_quant8_2(Model *model) {
1988 OperandType type0(Type::BOOL, {});
1989 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
1990 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
1991 OperandType type4(Type::INT32, {});
1992 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
1993 // Phase 1, operands
1994 auto op11 = model->addOperand(&type22);
1995 auto op21 = model->addOperand(&type23);
1996 auto op31 = model->addOperand(&type9);
1997 auto param9 = model->addOperand(&type4);
1998 auto param10 = model->addOperand(&type4);
1999 auto param11 = model->addOperand(&type4);
2000 auto param12 = model->addOperand(&type4);
2001 auto param13 = model->addOperand(&type4);
2002 auto param14 = model->addOperand(&type4);
2003 auto param15 = model->addOperand(&type4);
2004 auto layout = model->addOperand(&type0);
2005 auto param16 = model->addOperand(&type4);
2006 auto param17 = model->addOperand(&type4);
2007 auto op41 = model->addOperand(&type23);
2008 // Phase 2, operations
2009 static uint8_t op21_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
2010 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9);
2011 static int32_t op31_init[] = {0};
2012 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1);
2013 static int32_t param9_init[] = {0};
2014 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2015 static int32_t param10_init[] = {0};
2016 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2017 static int32_t param11_init[] = {0};
2018 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2019 static int32_t param12_init[] = {0};
2020 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2021 static int32_t param13_init[] = {1};
2022 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2023 static int32_t param14_init[] = {1};
2024 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2025 static int32_t param15_init[] = {0};
2026 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2027 static bool8 layout_init[] = {false};
2028 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2029 static int32_t param16_init[] = {3};
2030 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2031 static int32_t param17_init[] = {3};
2032 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2033 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2034 // Phase 3, inputs and outputs
2035 model->identifyInputsAndOutputs(
2036 {op11},
2037 {op41});
2038 assert(model->isValid());
2039 }
2040
is_ignored_nhwc_quant8_2(int i)2041 inline bool is_ignored_nhwc_quant8_2(int i) {
2042 static std::set<int> ignore = {};
2043 return ignore.find(i) != ignore.end();
2044 }
2045
CreateModel_nhwc_float16_2(Model * model)2046 void CreateModel_nhwc_float16_2(Model *model) {
2047 OperandType type0(Type::BOOL, {});
2048 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
2049 OperandType type12(Type::TENSOR_FLOAT16, {1});
2050 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
2051 OperandType type4(Type::INT32, {});
2052 // Phase 1, operands
2053 auto op11 = model->addOperand(&type24);
2054 auto op21 = model->addOperand(&type10);
2055 auto op31 = model->addOperand(&type12);
2056 auto param9 = model->addOperand(&type4);
2057 auto param10 = model->addOperand(&type4);
2058 auto param11 = model->addOperand(&type4);
2059 auto param12 = model->addOperand(&type4);
2060 auto param13 = model->addOperand(&type4);
2061 auto param14 = model->addOperand(&type4);
2062 auto param15 = model->addOperand(&type4);
2063 auto layout = model->addOperand(&type0);
2064 auto param16 = model->addOperand(&type4);
2065 auto param17 = model->addOperand(&type4);
2066 auto op41 = model->addOperand(&type10);
2067 // Phase 2, operations
2068 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2069 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9);
2070 static _Float16 op31_init[] = {0.0f};
2071 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1);
2072 static int32_t param9_init[] = {0};
2073 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2074 static int32_t param10_init[] = {0};
2075 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2076 static int32_t param11_init[] = {0};
2077 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2078 static int32_t param12_init[] = {0};
2079 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2080 static int32_t param13_init[] = {1};
2081 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2082 static int32_t param14_init[] = {1};
2083 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2084 static int32_t param15_init[] = {0};
2085 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2086 static bool8 layout_init[] = {false};
2087 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2088 static int32_t param16_init[] = {3};
2089 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2090 static int32_t param17_init[] = {3};
2091 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2092 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2093 // Phase 3, inputs and outputs
2094 model->identifyInputsAndOutputs(
2095 {op11},
2096 {op41});
2097 assert(model->isValid());
2098 }
2099
is_ignored_nhwc_float16_2(int i)2100 inline bool is_ignored_nhwc_float16_2(int i) {
2101 static std::set<int> ignore = {};
2102 return ignore.find(i) != ignore.end();
2103 }
2104
CreateModel_nhwc_weight_as_input_2(Model * model)2105 void CreateModel_nhwc_weight_as_input_2(Model *model) {
2106 OperandType type0(Type::BOOL, {});
2107 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2108 OperandType type3(Type::TENSOR_FLOAT32, {1});
2109 OperandType type4(Type::INT32, {});
2110 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
2111 // Phase 1, operands
2112 auto op11 = model->addOperand(&type5);
2113 auto op21 = model->addOperand(&type1);
2114 auto op31 = model->addOperand(&type3);
2115 auto param9 = model->addOperand(&type4);
2116 auto param10 = model->addOperand(&type4);
2117 auto param11 = model->addOperand(&type4);
2118 auto param12 = model->addOperand(&type4);
2119 auto param13 = model->addOperand(&type4);
2120 auto param14 = model->addOperand(&type4);
2121 auto param15 = model->addOperand(&type4);
2122 auto layout = model->addOperand(&type0);
2123 auto param16 = model->addOperand(&type4);
2124 auto param17 = model->addOperand(&type4);
2125 auto op41 = model->addOperand(&type1);
2126 // Phase 2, operations
2127 static int32_t param9_init[] = {0};
2128 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2129 static int32_t param10_init[] = {0};
2130 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2131 static int32_t param11_init[] = {0};
2132 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2133 static int32_t param12_init[] = {0};
2134 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2135 static int32_t param13_init[] = {1};
2136 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2137 static int32_t param14_init[] = {1};
2138 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2139 static int32_t param15_init[] = {0};
2140 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2141 static bool8 layout_init[] = {false};
2142 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2143 static int32_t param16_init[] = {3};
2144 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2145 static int32_t param17_init[] = {3};
2146 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2147 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2148 // Phase 3, inputs and outputs
2149 model->identifyInputsAndOutputs(
2150 {op11, op21, op31},
2151 {op41});
2152 assert(model->isValid());
2153 }
2154
is_ignored_nhwc_weight_as_input_2(int i)2155 inline bool is_ignored_nhwc_weight_as_input_2(int i) {
2156 static std::set<int> ignore = {};
2157 return ignore.find(i) != ignore.end();
2158 }
2159
CreateModel_nhwc_weight_as_input_relaxed_2(Model * model)2160 void CreateModel_nhwc_weight_as_input_relaxed_2(Model *model) {
2161 OperandType type0(Type::BOOL, {});
2162 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2163 OperandType type3(Type::TENSOR_FLOAT32, {1});
2164 OperandType type4(Type::INT32, {});
2165 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
2166 // Phase 1, operands
2167 auto op11 = model->addOperand(&type5);
2168 auto op21 = model->addOperand(&type1);
2169 auto op31 = model->addOperand(&type3);
2170 auto param9 = model->addOperand(&type4);
2171 auto param10 = model->addOperand(&type4);
2172 auto param11 = model->addOperand(&type4);
2173 auto param12 = model->addOperand(&type4);
2174 auto param13 = model->addOperand(&type4);
2175 auto param14 = model->addOperand(&type4);
2176 auto param15 = model->addOperand(&type4);
2177 auto layout = model->addOperand(&type0);
2178 auto param16 = model->addOperand(&type4);
2179 auto param17 = model->addOperand(&type4);
2180 auto op41 = model->addOperand(&type1);
2181 // Phase 2, operations
2182 static int32_t param9_init[] = {0};
2183 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2184 static int32_t param10_init[] = {0};
2185 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2186 static int32_t param11_init[] = {0};
2187 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2188 static int32_t param12_init[] = {0};
2189 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2190 static int32_t param13_init[] = {1};
2191 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2192 static int32_t param14_init[] = {1};
2193 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2194 static int32_t param15_init[] = {0};
2195 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2196 static bool8 layout_init[] = {false};
2197 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2198 static int32_t param16_init[] = {3};
2199 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2200 static int32_t param17_init[] = {3};
2201 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2202 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2203 // Phase 3, inputs and outputs
2204 model->identifyInputsAndOutputs(
2205 {op11, op21, op31},
2206 {op41});
2207 // Phase 4: set relaxed execution
2208 model->relaxComputationFloat32toFloat16(true);
2209 assert(model->isValid());
2210 }
2211
is_ignored_nhwc_weight_as_input_relaxed_2(int i)2212 inline bool is_ignored_nhwc_weight_as_input_relaxed_2(int i) {
2213 static std::set<int> ignore = {};
2214 return ignore.find(i) != ignore.end();
2215 }
2216
CreateModel_nhwc_weight_as_input_quant8_2(Model * model)2217 void CreateModel_nhwc_weight_as_input_quant8_2(Model *model) {
2218 OperandType type0(Type::BOOL, {});
2219 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
2220 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
2221 OperandType type4(Type::INT32, {});
2222 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
2223 // Phase 1, operands
2224 auto op11 = model->addOperand(&type22);
2225 auto op21 = model->addOperand(&type23);
2226 auto op31 = model->addOperand(&type9);
2227 auto param9 = model->addOperand(&type4);
2228 auto param10 = model->addOperand(&type4);
2229 auto param11 = model->addOperand(&type4);
2230 auto param12 = model->addOperand(&type4);
2231 auto param13 = model->addOperand(&type4);
2232 auto param14 = model->addOperand(&type4);
2233 auto param15 = model->addOperand(&type4);
2234 auto layout = model->addOperand(&type0);
2235 auto param16 = model->addOperand(&type4);
2236 auto param17 = model->addOperand(&type4);
2237 auto op41 = model->addOperand(&type23);
2238 // Phase 2, operations
2239 static int32_t param9_init[] = {0};
2240 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2241 static int32_t param10_init[] = {0};
2242 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2243 static int32_t param11_init[] = {0};
2244 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2245 static int32_t param12_init[] = {0};
2246 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2247 static int32_t param13_init[] = {1};
2248 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2249 static int32_t param14_init[] = {1};
2250 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2251 static int32_t param15_init[] = {0};
2252 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2253 static bool8 layout_init[] = {false};
2254 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2255 static int32_t param16_init[] = {3};
2256 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2257 static int32_t param17_init[] = {3};
2258 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2259 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2260 // Phase 3, inputs and outputs
2261 model->identifyInputsAndOutputs(
2262 {op11, op21, op31},
2263 {op41});
2264 assert(model->isValid());
2265 }
2266
is_ignored_nhwc_weight_as_input_quant8_2(int i)2267 inline bool is_ignored_nhwc_weight_as_input_quant8_2(int i) {
2268 static std::set<int> ignore = {};
2269 return ignore.find(i) != ignore.end();
2270 }
2271
CreateModel_nhwc_weight_as_input_float16_2(Model * model)2272 void CreateModel_nhwc_weight_as_input_float16_2(Model *model) {
2273 OperandType type0(Type::BOOL, {});
2274 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
2275 OperandType type12(Type::TENSOR_FLOAT16, {1});
2276 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
2277 OperandType type4(Type::INT32, {});
2278 // Phase 1, operands
2279 auto op11 = model->addOperand(&type24);
2280 auto op21 = model->addOperand(&type10);
2281 auto op31 = model->addOperand(&type12);
2282 auto param9 = model->addOperand(&type4);
2283 auto param10 = model->addOperand(&type4);
2284 auto param11 = model->addOperand(&type4);
2285 auto param12 = model->addOperand(&type4);
2286 auto param13 = model->addOperand(&type4);
2287 auto param14 = model->addOperand(&type4);
2288 auto param15 = model->addOperand(&type4);
2289 auto layout = model->addOperand(&type0);
2290 auto param16 = model->addOperand(&type4);
2291 auto param17 = model->addOperand(&type4);
2292 auto op41 = model->addOperand(&type10);
2293 // Phase 2, operations
2294 static int32_t param9_init[] = {0};
2295 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2296 static int32_t param10_init[] = {0};
2297 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2298 static int32_t param11_init[] = {0};
2299 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2300 static int32_t param12_init[] = {0};
2301 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2302 static int32_t param13_init[] = {1};
2303 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2304 static int32_t param14_init[] = {1};
2305 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2306 static int32_t param15_init[] = {0};
2307 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2308 static bool8 layout_init[] = {false};
2309 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2310 static int32_t param16_init[] = {3};
2311 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2312 static int32_t param17_init[] = {3};
2313 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2314 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2315 // Phase 3, inputs and outputs
2316 model->identifyInputsAndOutputs(
2317 {op11, op21, op31},
2318 {op41});
2319 assert(model->isValid());
2320 }
2321
is_ignored_nhwc_weight_as_input_float16_2(int i)2322 inline bool is_ignored_nhwc_weight_as_input_float16_2(int i) {
2323 static std::set<int> ignore = {};
2324 return ignore.find(i) != ignore.end();
2325 }
2326
CreateModel_nchw_2(Model * model)2327 void CreateModel_nchw_2(Model *model) {
2328 OperandType type0(Type::BOOL, {});
2329 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2330 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
2331 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
2332 OperandType type3(Type::TENSOR_FLOAT32, {1});
2333 OperandType type4(Type::INT32, {});
2334 // Phase 1, operands
2335 auto op11 = model->addOperand(&type25);
2336 auto op21 = model->addOperand(&type1);
2337 auto op31 = model->addOperand(&type3);
2338 auto param9 = model->addOperand(&type4);
2339 auto param10 = model->addOperand(&type4);
2340 auto param11 = model->addOperand(&type4);
2341 auto param12 = model->addOperand(&type4);
2342 auto param13 = model->addOperand(&type4);
2343 auto param14 = model->addOperand(&type4);
2344 auto param15 = model->addOperand(&type4);
2345 auto layout = model->addOperand(&type0);
2346 auto param16 = model->addOperand(&type4);
2347 auto param17 = model->addOperand(&type4);
2348 auto op41 = model->addOperand(&type13);
2349 // Phase 2, operations
2350 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2351 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
2352 static float op31_init[] = {0.0f};
2353 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
2354 static int32_t param9_init[] = {0};
2355 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2356 static int32_t param10_init[] = {0};
2357 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2358 static int32_t param11_init[] = {0};
2359 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2360 static int32_t param12_init[] = {0};
2361 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2362 static int32_t param13_init[] = {1};
2363 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2364 static int32_t param14_init[] = {1};
2365 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2366 static int32_t param15_init[] = {0};
2367 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2368 static bool8 layout_init[] = {true};
2369 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2370 static int32_t param16_init[] = {3};
2371 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2372 static int32_t param17_init[] = {3};
2373 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2374 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2375 // Phase 3, inputs and outputs
2376 model->identifyInputsAndOutputs(
2377 {op11},
2378 {op41});
2379 assert(model->isValid());
2380 }
2381
is_ignored_nchw_2(int i)2382 inline bool is_ignored_nchw_2(int i) {
2383 static std::set<int> ignore = {};
2384 return ignore.find(i) != ignore.end();
2385 }
2386
CreateModel_nchw_relaxed_2(Model * model)2387 void CreateModel_nchw_relaxed_2(Model *model) {
2388 OperandType type0(Type::BOOL, {});
2389 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2390 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
2391 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
2392 OperandType type3(Type::TENSOR_FLOAT32, {1});
2393 OperandType type4(Type::INT32, {});
2394 // Phase 1, operands
2395 auto op11 = model->addOperand(&type25);
2396 auto op21 = model->addOperand(&type1);
2397 auto op31 = model->addOperand(&type3);
2398 auto param9 = model->addOperand(&type4);
2399 auto param10 = model->addOperand(&type4);
2400 auto param11 = model->addOperand(&type4);
2401 auto param12 = model->addOperand(&type4);
2402 auto param13 = model->addOperand(&type4);
2403 auto param14 = model->addOperand(&type4);
2404 auto param15 = model->addOperand(&type4);
2405 auto layout = model->addOperand(&type0);
2406 auto param16 = model->addOperand(&type4);
2407 auto param17 = model->addOperand(&type4);
2408 auto op41 = model->addOperand(&type13);
2409 // Phase 2, operations
2410 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2411 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
2412 static float op31_init[] = {0.0f};
2413 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
2414 static int32_t param9_init[] = {0};
2415 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
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[] = {1};
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[] = {0};
2427 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2428 static bool8 layout_init[] = {true};
2429 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2430 static int32_t param16_init[] = {3};
2431 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2432 static int32_t param17_init[] = {3};
2433 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2434 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2435 // Phase 3, inputs and outputs
2436 model->identifyInputsAndOutputs(
2437 {op11},
2438 {op41});
2439 // Phase 4: set relaxed execution
2440 model->relaxComputationFloat32toFloat16(true);
2441 assert(model->isValid());
2442 }
2443
is_ignored_nchw_relaxed_2(int i)2444 inline bool is_ignored_nchw_relaxed_2(int i) {
2445 static std::set<int> ignore = {};
2446 return ignore.find(i) != ignore.end();
2447 }
2448
CreateModel_nchw_quant8_2(Model * model)2449 void CreateModel_nchw_quant8_2(Model *model) {
2450 OperandType type0(Type::BOOL, {});
2451 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
2452 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
2453 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
2454 OperandType type4(Type::INT32, {});
2455 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
2456 // Phase 1, operands
2457 auto op11 = model->addOperand(&type26);
2458 auto op21 = model->addOperand(&type23);
2459 auto op31 = model->addOperand(&type9);
2460 auto param9 = model->addOperand(&type4);
2461 auto param10 = model->addOperand(&type4);
2462 auto param11 = model->addOperand(&type4);
2463 auto param12 = model->addOperand(&type4);
2464 auto param13 = model->addOperand(&type4);
2465 auto param14 = model->addOperand(&type4);
2466 auto param15 = model->addOperand(&type4);
2467 auto layout = model->addOperand(&type0);
2468 auto param16 = model->addOperand(&type4);
2469 auto param17 = model->addOperand(&type4);
2470 auto op41 = model->addOperand(&type27);
2471 // Phase 2, operations
2472 static uint8_t op21_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
2473 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9);
2474 static int32_t op31_init[] = {0};
2475 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1);
2476 static int32_t param9_init[] = {0};
2477 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2478 static int32_t param10_init[] = {0};
2479 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2480 static int32_t param11_init[] = {0};
2481 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2482 static int32_t param12_init[] = {0};
2483 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2484 static int32_t param13_init[] = {1};
2485 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2486 static int32_t param14_init[] = {1};
2487 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2488 static int32_t param15_init[] = {0};
2489 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2490 static bool8 layout_init[] = {true};
2491 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2492 static int32_t param16_init[] = {3};
2493 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2494 static int32_t param17_init[] = {3};
2495 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2496 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2497 // Phase 3, inputs and outputs
2498 model->identifyInputsAndOutputs(
2499 {op11},
2500 {op41});
2501 assert(model->isValid());
2502 }
2503
is_ignored_nchw_quant8_2(int i)2504 inline bool is_ignored_nchw_quant8_2(int i) {
2505 static std::set<int> ignore = {};
2506 return ignore.find(i) != ignore.end();
2507 }
2508
CreateModel_nchw_float16_2(Model * model)2509 void CreateModel_nchw_float16_2(Model *model) {
2510 OperandType type0(Type::BOOL, {});
2511 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
2512 OperandType type12(Type::TENSOR_FLOAT16, {1});
2513 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
2514 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
2515 OperandType type4(Type::INT32, {});
2516 // Phase 1, operands
2517 auto op11 = model->addOperand(&type28);
2518 auto op21 = model->addOperand(&type10);
2519 auto op31 = model->addOperand(&type12);
2520 auto param9 = model->addOperand(&type4);
2521 auto param10 = model->addOperand(&type4);
2522 auto param11 = model->addOperand(&type4);
2523 auto param12 = model->addOperand(&type4);
2524 auto param13 = model->addOperand(&type4);
2525 auto param14 = model->addOperand(&type4);
2526 auto param15 = model->addOperand(&type4);
2527 auto layout = model->addOperand(&type0);
2528 auto param16 = model->addOperand(&type4);
2529 auto param17 = model->addOperand(&type4);
2530 auto op41 = model->addOperand(&type17);
2531 // Phase 2, operations
2532 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2533 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9);
2534 static _Float16 op31_init[] = {0.0f};
2535 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1);
2536 static int32_t param9_init[] = {0};
2537 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2538 static int32_t param10_init[] = {0};
2539 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2540 static int32_t param11_init[] = {0};
2541 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2542 static int32_t param12_init[] = {0};
2543 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2544 static int32_t param13_init[] = {1};
2545 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2546 static int32_t param14_init[] = {1};
2547 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2548 static int32_t param15_init[] = {0};
2549 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2550 static bool8 layout_init[] = {true};
2551 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2552 static int32_t param16_init[] = {3};
2553 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2554 static int32_t param17_init[] = {3};
2555 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2556 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2557 // Phase 3, inputs and outputs
2558 model->identifyInputsAndOutputs(
2559 {op11},
2560 {op41});
2561 assert(model->isValid());
2562 }
2563
is_ignored_nchw_float16_2(int i)2564 inline bool is_ignored_nchw_float16_2(int i) {
2565 static std::set<int> ignore = {};
2566 return ignore.find(i) != ignore.end();
2567 }
2568
CreateModel_nchw_weight_as_input_2(Model * model)2569 void CreateModel_nchw_weight_as_input_2(Model *model) {
2570 OperandType type0(Type::BOOL, {});
2571 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2572 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
2573 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
2574 OperandType type3(Type::TENSOR_FLOAT32, {1});
2575 OperandType type4(Type::INT32, {});
2576 // Phase 1, operands
2577 auto op11 = model->addOperand(&type25);
2578 auto op21 = model->addOperand(&type1);
2579 auto op31 = model->addOperand(&type3);
2580 auto param9 = model->addOperand(&type4);
2581 auto param10 = model->addOperand(&type4);
2582 auto param11 = model->addOperand(&type4);
2583 auto param12 = model->addOperand(&type4);
2584 auto param13 = model->addOperand(&type4);
2585 auto param14 = model->addOperand(&type4);
2586 auto param15 = model->addOperand(&type4);
2587 auto layout = model->addOperand(&type0);
2588 auto param16 = model->addOperand(&type4);
2589 auto param17 = model->addOperand(&type4);
2590 auto op41 = model->addOperand(&type13);
2591 // Phase 2, operations
2592 static int32_t param9_init[] = {0};
2593 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2594 static int32_t param10_init[] = {0};
2595 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2596 static int32_t param11_init[] = {0};
2597 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2598 static int32_t param12_init[] = {0};
2599 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2600 static int32_t param13_init[] = {1};
2601 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2602 static int32_t param14_init[] = {1};
2603 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2604 static int32_t param15_init[] = {0};
2605 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2606 static bool8 layout_init[] = {true};
2607 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2608 static int32_t param16_init[] = {3};
2609 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2610 static int32_t param17_init[] = {3};
2611 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2612 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2613 // Phase 3, inputs and outputs
2614 model->identifyInputsAndOutputs(
2615 {op11, op21, op31},
2616 {op41});
2617 assert(model->isValid());
2618 }
2619
is_ignored_nchw_weight_as_input_2(int i)2620 inline bool is_ignored_nchw_weight_as_input_2(int i) {
2621 static std::set<int> ignore = {};
2622 return ignore.find(i) != ignore.end();
2623 }
2624
CreateModel_nchw_weight_as_input_relaxed_2(Model * model)2625 void CreateModel_nchw_weight_as_input_relaxed_2(Model *model) {
2626 OperandType type0(Type::BOOL, {});
2627 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2628 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
2629 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
2630 OperandType type3(Type::TENSOR_FLOAT32, {1});
2631 OperandType type4(Type::INT32, {});
2632 // Phase 1, operands
2633 auto op11 = model->addOperand(&type25);
2634 auto op21 = model->addOperand(&type1);
2635 auto op31 = model->addOperand(&type3);
2636 auto param9 = model->addOperand(&type4);
2637 auto param10 = model->addOperand(&type4);
2638 auto param11 = model->addOperand(&type4);
2639 auto param12 = model->addOperand(&type4);
2640 auto param13 = model->addOperand(&type4);
2641 auto param14 = model->addOperand(&type4);
2642 auto param15 = model->addOperand(&type4);
2643 auto layout = model->addOperand(&type0);
2644 auto param16 = model->addOperand(&type4);
2645 auto param17 = model->addOperand(&type4);
2646 auto op41 = model->addOperand(&type13);
2647 // Phase 2, operations
2648 static int32_t param9_init[] = {0};
2649 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2650 static int32_t param10_init[] = {0};
2651 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2652 static int32_t param11_init[] = {0};
2653 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2654 static int32_t param12_init[] = {0};
2655 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2656 static int32_t param13_init[] = {1};
2657 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2658 static int32_t param14_init[] = {1};
2659 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2660 static int32_t param15_init[] = {0};
2661 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2662 static bool8 layout_init[] = {true};
2663 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2664 static int32_t param16_init[] = {3};
2665 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2666 static int32_t param17_init[] = {3};
2667 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2668 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2669 // Phase 3, inputs and outputs
2670 model->identifyInputsAndOutputs(
2671 {op11, op21, op31},
2672 {op41});
2673 // Phase 4: set relaxed execution
2674 model->relaxComputationFloat32toFloat16(true);
2675 assert(model->isValid());
2676 }
2677
is_ignored_nchw_weight_as_input_relaxed_2(int i)2678 inline bool is_ignored_nchw_weight_as_input_relaxed_2(int i) {
2679 static std::set<int> ignore = {};
2680 return ignore.find(i) != ignore.end();
2681 }
2682
CreateModel_nchw_weight_as_input_quant8_2(Model * model)2683 void CreateModel_nchw_weight_as_input_quant8_2(Model *model) {
2684 OperandType type0(Type::BOOL, {});
2685 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
2686 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
2687 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
2688 OperandType type4(Type::INT32, {});
2689 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
2690 // Phase 1, operands
2691 auto op11 = model->addOperand(&type26);
2692 auto op21 = model->addOperand(&type23);
2693 auto op31 = model->addOperand(&type9);
2694 auto param9 = model->addOperand(&type4);
2695 auto param10 = model->addOperand(&type4);
2696 auto param11 = model->addOperand(&type4);
2697 auto param12 = model->addOperand(&type4);
2698 auto param13 = model->addOperand(&type4);
2699 auto param14 = model->addOperand(&type4);
2700 auto param15 = model->addOperand(&type4);
2701 auto layout = model->addOperand(&type0);
2702 auto param16 = model->addOperand(&type4);
2703 auto param17 = model->addOperand(&type4);
2704 auto op41 = model->addOperand(&type27);
2705 // Phase 2, operations
2706 static int32_t param9_init[] = {0};
2707 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2708 static int32_t param10_init[] = {0};
2709 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2710 static int32_t param11_init[] = {0};
2711 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2712 static int32_t param12_init[] = {0};
2713 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2714 static int32_t param13_init[] = {1};
2715 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2716 static int32_t param14_init[] = {1};
2717 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2718 static int32_t param15_init[] = {0};
2719 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2720 static bool8 layout_init[] = {true};
2721 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2722 static int32_t param16_init[] = {3};
2723 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2724 static int32_t param17_init[] = {3};
2725 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2726 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2727 // Phase 3, inputs and outputs
2728 model->identifyInputsAndOutputs(
2729 {op11, op21, op31},
2730 {op41});
2731 assert(model->isValid());
2732 }
2733
is_ignored_nchw_weight_as_input_quant8_2(int i)2734 inline bool is_ignored_nchw_weight_as_input_quant8_2(int i) {
2735 static std::set<int> ignore = {};
2736 return ignore.find(i) != ignore.end();
2737 }
2738
CreateModel_nchw_weight_as_input_float16_2(Model * model)2739 void CreateModel_nchw_weight_as_input_float16_2(Model *model) {
2740 OperandType type0(Type::BOOL, {});
2741 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
2742 OperandType type12(Type::TENSOR_FLOAT16, {1});
2743 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
2744 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
2745 OperandType type4(Type::INT32, {});
2746 // Phase 1, operands
2747 auto op11 = model->addOperand(&type28);
2748 auto op21 = model->addOperand(&type10);
2749 auto op31 = model->addOperand(&type12);
2750 auto param9 = model->addOperand(&type4);
2751 auto param10 = model->addOperand(&type4);
2752 auto param11 = model->addOperand(&type4);
2753 auto param12 = model->addOperand(&type4);
2754 auto param13 = model->addOperand(&type4);
2755 auto param14 = model->addOperand(&type4);
2756 auto param15 = model->addOperand(&type4);
2757 auto layout = model->addOperand(&type0);
2758 auto param16 = model->addOperand(&type4);
2759 auto param17 = model->addOperand(&type4);
2760 auto op41 = model->addOperand(&type17);
2761 // Phase 2, operations
2762 static int32_t param9_init[] = {0};
2763 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2764 static int32_t param10_init[] = {0};
2765 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2766 static int32_t param11_init[] = {0};
2767 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2768 static int32_t param12_init[] = {0};
2769 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2770 static int32_t param13_init[] = {1};
2771 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2772 static int32_t param14_init[] = {1};
2773 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2774 static int32_t param15_init[] = {0};
2775 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2776 static bool8 layout_init[] = {true};
2777 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2778 static int32_t param16_init[] = {3};
2779 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2780 static int32_t param17_init[] = {3};
2781 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2782 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2783 // Phase 3, inputs and outputs
2784 model->identifyInputsAndOutputs(
2785 {op11, op21, op31},
2786 {op41});
2787 assert(model->isValid());
2788 }
2789
is_ignored_nchw_weight_as_input_float16_2(int i)2790 inline bool is_ignored_nchw_weight_as_input_float16_2(int i) {
2791 static std::set<int> ignore = {};
2792 return ignore.find(i) != ignore.end();
2793 }
2794
CreateModel_dynamic_output_shape_nhwc_2(Model * model)2795 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) {
2796 OperandType type0(Type::BOOL, {});
2797 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2798 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2799 OperandType type3(Type::TENSOR_FLOAT32, {1});
2800 OperandType type4(Type::INT32, {});
2801 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
2802 // Phase 1, operands
2803 auto op11 = model->addOperand(&type5);
2804 auto op21 = model->addOperand(&type1);
2805 auto op31 = model->addOperand(&type3);
2806 auto param9 = model->addOperand(&type4);
2807 auto param10 = model->addOperand(&type4);
2808 auto param11 = model->addOperand(&type4);
2809 auto param12 = model->addOperand(&type4);
2810 auto param13 = model->addOperand(&type4);
2811 auto param14 = model->addOperand(&type4);
2812 auto param15 = model->addOperand(&type4);
2813 auto layout = model->addOperand(&type0);
2814 auto param16 = model->addOperand(&type4);
2815 auto param17 = model->addOperand(&type4);
2816 auto op41 = model->addOperand(&type19);
2817 // Phase 2, operations
2818 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2819 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
2820 static float op31_init[] = {0.0f};
2821 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
2822 static int32_t param9_init[] = {0};
2823 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2824 static int32_t param10_init[] = {0};
2825 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2826 static int32_t param11_init[] = {0};
2827 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2828 static int32_t param12_init[] = {0};
2829 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2830 static int32_t param13_init[] = {1};
2831 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2832 static int32_t param14_init[] = {1};
2833 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2834 static int32_t param15_init[] = {0};
2835 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2836 static bool8 layout_init[] = {false};
2837 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2838 static int32_t param16_init[] = {3};
2839 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2840 static int32_t param17_init[] = {3};
2841 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2842 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2843 // Phase 3, inputs and outputs
2844 model->identifyInputsAndOutputs(
2845 {op11},
2846 {op41});
2847 assert(model->isValid());
2848 }
2849
is_ignored_dynamic_output_shape_nhwc_2(int i)2850 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
2851 static std::set<int> ignore = {};
2852 return ignore.find(i) != ignore.end();
2853 }
2854
CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model * model)2855 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) {
2856 OperandType type0(Type::BOOL, {});
2857 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
2858 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2859 OperandType type3(Type::TENSOR_FLOAT32, {1});
2860 OperandType type4(Type::INT32, {});
2861 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
2862 // Phase 1, operands
2863 auto op11 = model->addOperand(&type5);
2864 auto op21 = model->addOperand(&type1);
2865 auto op31 = model->addOperand(&type3);
2866 auto param9 = model->addOperand(&type4);
2867 auto param10 = model->addOperand(&type4);
2868 auto param11 = model->addOperand(&type4);
2869 auto param12 = model->addOperand(&type4);
2870 auto param13 = model->addOperand(&type4);
2871 auto param14 = model->addOperand(&type4);
2872 auto param15 = model->addOperand(&type4);
2873 auto layout = model->addOperand(&type0);
2874 auto param16 = model->addOperand(&type4);
2875 auto param17 = model->addOperand(&type4);
2876 auto op41 = model->addOperand(&type19);
2877 // Phase 2, operations
2878 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
2879 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
2880 static float op31_init[] = {0.0f};
2881 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
2882 static int32_t param9_init[] = {0};
2883 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2884 static int32_t param10_init[] = {0};
2885 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2886 static int32_t param11_init[] = {0};
2887 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2888 static int32_t param12_init[] = {0};
2889 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2890 static int32_t param13_init[] = {1};
2891 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2892 static int32_t param14_init[] = {1};
2893 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2894 static int32_t param15_init[] = {0};
2895 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2896 static bool8 layout_init[] = {false};
2897 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2898 static int32_t param16_init[] = {3};
2899 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2900 static int32_t param17_init[] = {3};
2901 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2902 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2903 // Phase 3, inputs and outputs
2904 model->identifyInputsAndOutputs(
2905 {op11},
2906 {op41});
2907 // Phase 4: set relaxed execution
2908 model->relaxComputationFloat32toFloat16(true);
2909 assert(model->isValid());
2910 }
2911
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)2912 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
2913 static std::set<int> ignore = {};
2914 return ignore.find(i) != ignore.end();
2915 }
2916
CreateModel_dynamic_output_shape_nhwc_quant8_2(Model * model)2917 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) {
2918 OperandType type0(Type::BOOL, {});
2919 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
2920 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
2921 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
2922 OperandType type4(Type::INT32, {});
2923 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
2924 // Phase 1, operands
2925 auto op11 = model->addOperand(&type22);
2926 auto op21 = model->addOperand(&type23);
2927 auto op31 = model->addOperand(&type9);
2928 auto param9 = model->addOperand(&type4);
2929 auto param10 = model->addOperand(&type4);
2930 auto param11 = model->addOperand(&type4);
2931 auto param12 = model->addOperand(&type4);
2932 auto param13 = model->addOperand(&type4);
2933 auto param14 = model->addOperand(&type4);
2934 auto param15 = model->addOperand(&type4);
2935 auto layout = model->addOperand(&type0);
2936 auto param16 = model->addOperand(&type4);
2937 auto param17 = model->addOperand(&type4);
2938 auto op41 = model->addOperand(&type20);
2939 // Phase 2, operations
2940 static uint8_t op21_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
2941 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9);
2942 static int32_t op31_init[] = {0};
2943 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1);
2944 static int32_t param9_init[] = {0};
2945 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2946 static int32_t param10_init[] = {0};
2947 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2948 static int32_t param11_init[] = {0};
2949 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2950 static int32_t param12_init[] = {0};
2951 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2952 static int32_t param13_init[] = {1};
2953 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
2954 static int32_t param14_init[] = {1};
2955 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
2956 static int32_t param15_init[] = {0};
2957 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
2958 static bool8 layout_init[] = {false};
2959 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2960 static int32_t param16_init[] = {3};
2961 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
2962 static int32_t param17_init[] = {3};
2963 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
2964 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
2965 // Phase 3, inputs and outputs
2966 model->identifyInputsAndOutputs(
2967 {op11},
2968 {op41});
2969 assert(model->isValid());
2970 }
2971
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)2972 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
2973 static std::set<int> ignore = {};
2974 return ignore.find(i) != ignore.end();
2975 }
2976
CreateModel_dynamic_output_shape_nhwc_float16_2(Model * model)2977 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) {
2978 OperandType type0(Type::BOOL, {});
2979 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
2980 OperandType type12(Type::TENSOR_FLOAT16, {1});
2981 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
2982 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
2983 OperandType type4(Type::INT32, {});
2984 // Phase 1, operands
2985 auto op11 = model->addOperand(&type24);
2986 auto op21 = model->addOperand(&type10);
2987 auto op31 = model->addOperand(&type12);
2988 auto param9 = model->addOperand(&type4);
2989 auto param10 = model->addOperand(&type4);
2990 auto param11 = model->addOperand(&type4);
2991 auto param12 = model->addOperand(&type4);
2992 auto param13 = model->addOperand(&type4);
2993 auto param14 = model->addOperand(&type4);
2994 auto param15 = model->addOperand(&type4);
2995 auto layout = model->addOperand(&type0);
2996 auto param16 = model->addOperand(&type4);
2997 auto param17 = model->addOperand(&type4);
2998 auto op41 = model->addOperand(&type21);
2999 // Phase 2, operations
3000 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
3001 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9);
3002 static _Float16 op31_init[] = {0.0f};
3003 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1);
3004 static int32_t param9_init[] = {0};
3005 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3006 static int32_t param10_init[] = {0};
3007 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3008 static int32_t param11_init[] = {0};
3009 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3010 static int32_t param12_init[] = {0};
3011 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3012 static int32_t param13_init[] = {1};
3013 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3014 static int32_t param14_init[] = {1};
3015 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3016 static int32_t param15_init[] = {0};
3017 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3018 static bool8 layout_init[] = {false};
3019 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3020 static int32_t param16_init[] = {3};
3021 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3022 static int32_t param17_init[] = {3};
3023 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3024 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3025 // Phase 3, inputs and outputs
3026 model->identifyInputsAndOutputs(
3027 {op11},
3028 {op41});
3029 assert(model->isValid());
3030 }
3031
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)3032 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
3033 static std::set<int> ignore = {};
3034 return ignore.find(i) != ignore.end();
3035 }
3036
CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model * model)3037 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) {
3038 OperandType type0(Type::BOOL, {});
3039 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3040 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3041 OperandType type3(Type::TENSOR_FLOAT32, {1});
3042 OperandType type4(Type::INT32, {});
3043 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
3044 // Phase 1, operands
3045 auto op11 = model->addOperand(&type5);
3046 auto op21 = model->addOperand(&type1);
3047 auto op31 = model->addOperand(&type3);
3048 auto param9 = model->addOperand(&type4);
3049 auto param10 = model->addOperand(&type4);
3050 auto param11 = model->addOperand(&type4);
3051 auto param12 = model->addOperand(&type4);
3052 auto param13 = model->addOperand(&type4);
3053 auto param14 = model->addOperand(&type4);
3054 auto param15 = model->addOperand(&type4);
3055 auto layout = model->addOperand(&type0);
3056 auto param16 = model->addOperand(&type4);
3057 auto param17 = model->addOperand(&type4);
3058 auto op41 = model->addOperand(&type19);
3059 // Phase 2, operations
3060 static int32_t param9_init[] = {0};
3061 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3062 static int32_t param10_init[] = {0};
3063 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3064 static int32_t param11_init[] = {0};
3065 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3066 static int32_t param12_init[] = {0};
3067 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3068 static int32_t param13_init[] = {1};
3069 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3070 static int32_t param14_init[] = {1};
3071 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3072 static int32_t param15_init[] = {0};
3073 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3074 static bool8 layout_init[] = {false};
3075 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3076 static int32_t param16_init[] = {3};
3077 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3078 static int32_t param17_init[] = {3};
3079 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3080 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3081 // Phase 3, inputs and outputs
3082 model->identifyInputsAndOutputs(
3083 {op11, op21, op31},
3084 {op41});
3085 assert(model->isValid());
3086 }
3087
is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i)3088 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) {
3089 static std::set<int> ignore = {};
3090 return ignore.find(i) != ignore.end();
3091 }
3092
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model * model)3093 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model *model) {
3094 OperandType type0(Type::BOOL, {});
3095 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3096 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3097 OperandType type3(Type::TENSOR_FLOAT32, {1});
3098 OperandType type4(Type::INT32, {});
3099 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
3100 // Phase 1, operands
3101 auto op11 = model->addOperand(&type5);
3102 auto op21 = model->addOperand(&type1);
3103 auto op31 = model->addOperand(&type3);
3104 auto param9 = model->addOperand(&type4);
3105 auto param10 = model->addOperand(&type4);
3106 auto param11 = model->addOperand(&type4);
3107 auto param12 = model->addOperand(&type4);
3108 auto param13 = model->addOperand(&type4);
3109 auto param14 = model->addOperand(&type4);
3110 auto param15 = model->addOperand(&type4);
3111 auto layout = model->addOperand(&type0);
3112 auto param16 = model->addOperand(&type4);
3113 auto param17 = model->addOperand(&type4);
3114 auto op41 = model->addOperand(&type19);
3115 // Phase 2, operations
3116 static int32_t param9_init[] = {0};
3117 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3118 static int32_t param10_init[] = {0};
3119 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3120 static int32_t param11_init[] = {0};
3121 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3122 static int32_t param12_init[] = {0};
3123 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3124 static int32_t param13_init[] = {1};
3125 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3126 static int32_t param14_init[] = {1};
3127 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3128 static int32_t param15_init[] = {0};
3129 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3130 static bool8 layout_init[] = {false};
3131 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3132 static int32_t param16_init[] = {3};
3133 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3134 static int32_t param17_init[] = {3};
3135 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3136 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3137 // Phase 3, inputs and outputs
3138 model->identifyInputsAndOutputs(
3139 {op11, op21, op31},
3140 {op41});
3141 // Phase 4: set relaxed execution
3142 model->relaxComputationFloat32toFloat16(true);
3143 assert(model->isValid());
3144 }
3145
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i)3146 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i) {
3147 static std::set<int> ignore = {};
3148 return ignore.find(i) != ignore.end();
3149 }
3150
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model * model)3151 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model *model) {
3152 OperandType type0(Type::BOOL, {});
3153 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
3154 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
3155 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
3156 OperandType type4(Type::INT32, {});
3157 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
3158 // Phase 1, operands
3159 auto op11 = model->addOperand(&type22);
3160 auto op21 = model->addOperand(&type23);
3161 auto op31 = model->addOperand(&type9);
3162 auto param9 = model->addOperand(&type4);
3163 auto param10 = model->addOperand(&type4);
3164 auto param11 = model->addOperand(&type4);
3165 auto param12 = model->addOperand(&type4);
3166 auto param13 = model->addOperand(&type4);
3167 auto param14 = model->addOperand(&type4);
3168 auto param15 = model->addOperand(&type4);
3169 auto layout = model->addOperand(&type0);
3170 auto param16 = model->addOperand(&type4);
3171 auto param17 = model->addOperand(&type4);
3172 auto op41 = model->addOperand(&type20);
3173 // Phase 2, operations
3174 static int32_t param9_init[] = {0};
3175 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3176 static int32_t param10_init[] = {0};
3177 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3178 static int32_t param11_init[] = {0};
3179 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3180 static int32_t param12_init[] = {0};
3181 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3182 static int32_t param13_init[] = {1};
3183 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3184 static int32_t param14_init[] = {1};
3185 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3186 static int32_t param15_init[] = {0};
3187 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3188 static bool8 layout_init[] = {false};
3189 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3190 static int32_t param16_init[] = {3};
3191 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3192 static int32_t param17_init[] = {3};
3193 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3194 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3195 // Phase 3, inputs and outputs
3196 model->identifyInputsAndOutputs(
3197 {op11, op21, op31},
3198 {op41});
3199 assert(model->isValid());
3200 }
3201
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i)3202 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i) {
3203 static std::set<int> ignore = {};
3204 return ignore.find(i) != ignore.end();
3205 }
3206
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model * model)3207 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model *model) {
3208 OperandType type0(Type::BOOL, {});
3209 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
3210 OperandType type12(Type::TENSOR_FLOAT16, {1});
3211 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3212 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
3213 OperandType type4(Type::INT32, {});
3214 // Phase 1, operands
3215 auto op11 = model->addOperand(&type24);
3216 auto op21 = model->addOperand(&type10);
3217 auto op31 = model->addOperand(&type12);
3218 auto param9 = model->addOperand(&type4);
3219 auto param10 = model->addOperand(&type4);
3220 auto param11 = model->addOperand(&type4);
3221 auto param12 = model->addOperand(&type4);
3222 auto param13 = model->addOperand(&type4);
3223 auto param14 = model->addOperand(&type4);
3224 auto param15 = model->addOperand(&type4);
3225 auto layout = model->addOperand(&type0);
3226 auto param16 = model->addOperand(&type4);
3227 auto param17 = model->addOperand(&type4);
3228 auto op41 = model->addOperand(&type21);
3229 // Phase 2, operations
3230 static int32_t param9_init[] = {0};
3231 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3232 static int32_t param10_init[] = {0};
3233 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3234 static int32_t param11_init[] = {0};
3235 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3236 static int32_t param12_init[] = {0};
3237 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3238 static int32_t param13_init[] = {1};
3239 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3240 static int32_t param14_init[] = {1};
3241 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3242 static int32_t param15_init[] = {0};
3243 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3244 static bool8 layout_init[] = {false};
3245 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3246 static int32_t param16_init[] = {3};
3247 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3248 static int32_t param17_init[] = {3};
3249 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3250 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3251 // Phase 3, inputs and outputs
3252 model->identifyInputsAndOutputs(
3253 {op11, op21, op31},
3254 {op41});
3255 assert(model->isValid());
3256 }
3257
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i)3258 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i) {
3259 static std::set<int> ignore = {};
3260 return ignore.find(i) != ignore.end();
3261 }
3262
CreateModel_dynamic_output_shape_nchw_2(Model * model)3263 void CreateModel_dynamic_output_shape_nchw_2(Model *model) {
3264 OperandType type0(Type::BOOL, {});
3265 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3266 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3267 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
3268 OperandType type3(Type::TENSOR_FLOAT32, {1});
3269 OperandType type4(Type::INT32, {});
3270 // Phase 1, operands
3271 auto op11 = model->addOperand(&type25);
3272 auto op21 = model->addOperand(&type1);
3273 auto op31 = model->addOperand(&type3);
3274 auto param9 = model->addOperand(&type4);
3275 auto param10 = model->addOperand(&type4);
3276 auto param11 = model->addOperand(&type4);
3277 auto param12 = model->addOperand(&type4);
3278 auto param13 = model->addOperand(&type4);
3279 auto param14 = model->addOperand(&type4);
3280 auto param15 = model->addOperand(&type4);
3281 auto layout = model->addOperand(&type0);
3282 auto param16 = model->addOperand(&type4);
3283 auto param17 = model->addOperand(&type4);
3284 auto op41 = model->addOperand(&type19);
3285 // Phase 2, operations
3286 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
3287 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
3288 static float op31_init[] = {0.0f};
3289 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
3290 static int32_t param9_init[] = {0};
3291 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3292 static int32_t param10_init[] = {0};
3293 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3294 static int32_t param11_init[] = {0};
3295 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3296 static int32_t param12_init[] = {0};
3297 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3298 static int32_t param13_init[] = {1};
3299 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3300 static int32_t param14_init[] = {1};
3301 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3302 static int32_t param15_init[] = {0};
3303 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3304 static bool8 layout_init[] = {true};
3305 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3306 static int32_t param16_init[] = {3};
3307 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3308 static int32_t param17_init[] = {3};
3309 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3310 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3311 // Phase 3, inputs and outputs
3312 model->identifyInputsAndOutputs(
3313 {op11},
3314 {op41});
3315 assert(model->isValid());
3316 }
3317
is_ignored_dynamic_output_shape_nchw_2(int i)3318 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
3319 static std::set<int> ignore = {};
3320 return ignore.find(i) != ignore.end();
3321 }
3322
CreateModel_dynamic_output_shape_nchw_relaxed_2(Model * model)3323 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) {
3324 OperandType type0(Type::BOOL, {});
3325 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3326 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3327 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
3328 OperandType type3(Type::TENSOR_FLOAT32, {1});
3329 OperandType type4(Type::INT32, {});
3330 // Phase 1, operands
3331 auto op11 = model->addOperand(&type25);
3332 auto op21 = model->addOperand(&type1);
3333 auto op31 = model->addOperand(&type3);
3334 auto param9 = model->addOperand(&type4);
3335 auto param10 = model->addOperand(&type4);
3336 auto param11 = model->addOperand(&type4);
3337 auto param12 = model->addOperand(&type4);
3338 auto param13 = model->addOperand(&type4);
3339 auto param14 = model->addOperand(&type4);
3340 auto param15 = model->addOperand(&type4);
3341 auto layout = model->addOperand(&type0);
3342 auto param16 = model->addOperand(&type4);
3343 auto param17 = model->addOperand(&type4);
3344 auto op41 = model->addOperand(&type19);
3345 // Phase 2, operations
3346 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
3347 model->setOperandValue(op21, op21_init, sizeof(float) * 9);
3348 static float op31_init[] = {0.0f};
3349 model->setOperandValue(op31, op31_init, sizeof(float) * 1);
3350 static int32_t param9_init[] = {0};
3351 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3352 static int32_t param10_init[] = {0};
3353 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3354 static int32_t param11_init[] = {0};
3355 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3356 static int32_t param12_init[] = {0};
3357 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3358 static int32_t param13_init[] = {1};
3359 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3360 static int32_t param14_init[] = {1};
3361 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3362 static int32_t param15_init[] = {0};
3363 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3364 static bool8 layout_init[] = {true};
3365 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3366 static int32_t param16_init[] = {3};
3367 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3368 static int32_t param17_init[] = {3};
3369 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3370 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3371 // Phase 3, inputs and outputs
3372 model->identifyInputsAndOutputs(
3373 {op11},
3374 {op41});
3375 // Phase 4: set relaxed execution
3376 model->relaxComputationFloat32toFloat16(true);
3377 assert(model->isValid());
3378 }
3379
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)3380 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
3381 static std::set<int> ignore = {};
3382 return ignore.find(i) != ignore.end();
3383 }
3384
CreateModel_dynamic_output_shape_nchw_quant8_2(Model * model)3385 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) {
3386 OperandType type0(Type::BOOL, {});
3387 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
3388 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
3389 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
3390 OperandType type4(Type::INT32, {});
3391 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
3392 // Phase 1, operands
3393 auto op11 = model->addOperand(&type26);
3394 auto op21 = model->addOperand(&type23);
3395 auto op31 = model->addOperand(&type9);
3396 auto param9 = model->addOperand(&type4);
3397 auto param10 = model->addOperand(&type4);
3398 auto param11 = model->addOperand(&type4);
3399 auto param12 = model->addOperand(&type4);
3400 auto param13 = model->addOperand(&type4);
3401 auto param14 = model->addOperand(&type4);
3402 auto param15 = model->addOperand(&type4);
3403 auto layout = model->addOperand(&type0);
3404 auto param16 = model->addOperand(&type4);
3405 auto param17 = model->addOperand(&type4);
3406 auto op41 = model->addOperand(&type20);
3407 // Phase 2, operations
3408 static uint8_t op21_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
3409 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9);
3410 static int32_t op31_init[] = {0};
3411 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1);
3412 static int32_t param9_init[] = {0};
3413 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3414 static int32_t param10_init[] = {0};
3415 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3416 static int32_t param11_init[] = {0};
3417 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3418 static int32_t param12_init[] = {0};
3419 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3420 static int32_t param13_init[] = {1};
3421 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3422 static int32_t param14_init[] = {1};
3423 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3424 static int32_t param15_init[] = {0};
3425 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3426 static bool8 layout_init[] = {true};
3427 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3428 static int32_t param16_init[] = {3};
3429 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3430 static int32_t param17_init[] = {3};
3431 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3432 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3433 // Phase 3, inputs and outputs
3434 model->identifyInputsAndOutputs(
3435 {op11},
3436 {op41});
3437 assert(model->isValid());
3438 }
3439
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)3440 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
3441 static std::set<int> ignore = {};
3442 return ignore.find(i) != ignore.end();
3443 }
3444
CreateModel_dynamic_output_shape_nchw_float16_2(Model * model)3445 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) {
3446 OperandType type0(Type::BOOL, {});
3447 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
3448 OperandType type12(Type::TENSOR_FLOAT16, {1});
3449 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3450 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
3451 OperandType type4(Type::INT32, {});
3452 // Phase 1, operands
3453 auto op11 = model->addOperand(&type28);
3454 auto op21 = model->addOperand(&type10);
3455 auto op31 = model->addOperand(&type12);
3456 auto param9 = model->addOperand(&type4);
3457 auto param10 = model->addOperand(&type4);
3458 auto param11 = model->addOperand(&type4);
3459 auto param12 = model->addOperand(&type4);
3460 auto param13 = model->addOperand(&type4);
3461 auto param14 = model->addOperand(&type4);
3462 auto param15 = model->addOperand(&type4);
3463 auto layout = model->addOperand(&type0);
3464 auto param16 = model->addOperand(&type4);
3465 auto param17 = model->addOperand(&type4);
3466 auto op41 = model->addOperand(&type21);
3467 // Phase 2, operations
3468 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
3469 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9);
3470 static _Float16 op31_init[] = {0.0f};
3471 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1);
3472 static int32_t param9_init[] = {0};
3473 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3474 static int32_t param10_init[] = {0};
3475 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3476 static int32_t param11_init[] = {0};
3477 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3478 static int32_t param12_init[] = {0};
3479 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3480 static int32_t param13_init[] = {1};
3481 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3482 static int32_t param14_init[] = {1};
3483 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3484 static int32_t param15_init[] = {0};
3485 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3486 static bool8 layout_init[] = {true};
3487 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3488 static int32_t param16_init[] = {3};
3489 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3490 static int32_t param17_init[] = {3};
3491 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3492 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3493 // Phase 3, inputs and outputs
3494 model->identifyInputsAndOutputs(
3495 {op11},
3496 {op41});
3497 assert(model->isValid());
3498 }
3499
is_ignored_dynamic_output_shape_nchw_float16_2(int i)3500 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
3501 static std::set<int> ignore = {};
3502 return ignore.find(i) != ignore.end();
3503 }
3504
CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model * model)3505 void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) {
3506 OperandType type0(Type::BOOL, {});
3507 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3508 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3509 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
3510 OperandType type3(Type::TENSOR_FLOAT32, {1});
3511 OperandType type4(Type::INT32, {});
3512 // Phase 1, operands
3513 auto op11 = model->addOperand(&type25);
3514 auto op21 = model->addOperand(&type1);
3515 auto op31 = model->addOperand(&type3);
3516 auto param9 = model->addOperand(&type4);
3517 auto param10 = model->addOperand(&type4);
3518 auto param11 = model->addOperand(&type4);
3519 auto param12 = model->addOperand(&type4);
3520 auto param13 = model->addOperand(&type4);
3521 auto param14 = model->addOperand(&type4);
3522 auto param15 = model->addOperand(&type4);
3523 auto layout = model->addOperand(&type0);
3524 auto param16 = model->addOperand(&type4);
3525 auto param17 = model->addOperand(&type4);
3526 auto op41 = model->addOperand(&type19);
3527 // Phase 2, operations
3528 static int32_t param9_init[] = {0};
3529 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3530 static int32_t param10_init[] = {0};
3531 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3532 static int32_t param11_init[] = {0};
3533 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3534 static int32_t param12_init[] = {0};
3535 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3536 static int32_t param13_init[] = {1};
3537 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3538 static int32_t param14_init[] = {1};
3539 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3540 static int32_t param15_init[] = {0};
3541 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3542 static bool8 layout_init[] = {true};
3543 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3544 static int32_t param16_init[] = {3};
3545 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3546 static int32_t param17_init[] = {3};
3547 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3548 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3549 // Phase 3, inputs and outputs
3550 model->identifyInputsAndOutputs(
3551 {op11, op21, op31},
3552 {op41});
3553 assert(model->isValid());
3554 }
3555
is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i)3556 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) {
3557 static std::set<int> ignore = {};
3558 return ignore.find(i) != ignore.end();
3559 }
3560
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model * model)3561 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model *model) {
3562 OperandType type0(Type::BOOL, {});
3563 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3564 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3565 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
3566 OperandType type3(Type::TENSOR_FLOAT32, {1});
3567 OperandType type4(Type::INT32, {});
3568 // Phase 1, operands
3569 auto op11 = model->addOperand(&type25);
3570 auto op21 = model->addOperand(&type1);
3571 auto op31 = model->addOperand(&type3);
3572 auto param9 = model->addOperand(&type4);
3573 auto param10 = model->addOperand(&type4);
3574 auto param11 = model->addOperand(&type4);
3575 auto param12 = model->addOperand(&type4);
3576 auto param13 = model->addOperand(&type4);
3577 auto param14 = model->addOperand(&type4);
3578 auto param15 = model->addOperand(&type4);
3579 auto layout = model->addOperand(&type0);
3580 auto param16 = model->addOperand(&type4);
3581 auto param17 = model->addOperand(&type4);
3582 auto op41 = model->addOperand(&type19);
3583 // Phase 2, operations
3584 static int32_t param9_init[] = {0};
3585 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3586 static int32_t param10_init[] = {0};
3587 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3588 static int32_t param11_init[] = {0};
3589 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3590 static int32_t param12_init[] = {0};
3591 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3592 static int32_t param13_init[] = {1};
3593 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3594 static int32_t param14_init[] = {1};
3595 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3596 static int32_t param15_init[] = {0};
3597 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3598 static bool8 layout_init[] = {true};
3599 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3600 static int32_t param16_init[] = {3};
3601 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3602 static int32_t param17_init[] = {3};
3603 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3604 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3605 // Phase 3, inputs and outputs
3606 model->identifyInputsAndOutputs(
3607 {op11, op21, op31},
3608 {op41});
3609 // Phase 4: set relaxed execution
3610 model->relaxComputationFloat32toFloat16(true);
3611 assert(model->isValid());
3612 }
3613
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i)3614 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i) {
3615 static std::set<int> ignore = {};
3616 return ignore.find(i) != ignore.end();
3617 }
3618
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model * model)3619 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model *model) {
3620 OperandType type0(Type::BOOL, {});
3621 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
3622 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
3623 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
3624 OperandType type4(Type::INT32, {});
3625 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
3626 // Phase 1, operands
3627 auto op11 = model->addOperand(&type26);
3628 auto op21 = model->addOperand(&type23);
3629 auto op31 = model->addOperand(&type9);
3630 auto param9 = model->addOperand(&type4);
3631 auto param10 = model->addOperand(&type4);
3632 auto param11 = model->addOperand(&type4);
3633 auto param12 = model->addOperand(&type4);
3634 auto param13 = model->addOperand(&type4);
3635 auto param14 = model->addOperand(&type4);
3636 auto param15 = model->addOperand(&type4);
3637 auto layout = model->addOperand(&type0);
3638 auto param16 = model->addOperand(&type4);
3639 auto param17 = model->addOperand(&type4);
3640 auto op41 = model->addOperand(&type20);
3641 // Phase 2, operations
3642 static int32_t param9_init[] = {0};
3643 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3644 static int32_t param10_init[] = {0};
3645 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3646 static int32_t param11_init[] = {0};
3647 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3648 static int32_t param12_init[] = {0};
3649 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3650 static int32_t param13_init[] = {1};
3651 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3652 static int32_t param14_init[] = {1};
3653 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3654 static int32_t param15_init[] = {0};
3655 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3656 static bool8 layout_init[] = {true};
3657 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3658 static int32_t param16_init[] = {3};
3659 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3660 static int32_t param17_init[] = {3};
3661 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3662 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3663 // Phase 3, inputs and outputs
3664 model->identifyInputsAndOutputs(
3665 {op11, op21, op31},
3666 {op41});
3667 assert(model->isValid());
3668 }
3669
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i)3670 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i) {
3671 static std::set<int> ignore = {};
3672 return ignore.find(i) != ignore.end();
3673 }
3674
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model * model)3675 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model *model) {
3676 OperandType type0(Type::BOOL, {});
3677 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
3678 OperandType type12(Type::TENSOR_FLOAT16, {1});
3679 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3680 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
3681 OperandType type4(Type::INT32, {});
3682 // Phase 1, operands
3683 auto op11 = model->addOperand(&type28);
3684 auto op21 = model->addOperand(&type10);
3685 auto op31 = model->addOperand(&type12);
3686 auto param9 = model->addOperand(&type4);
3687 auto param10 = model->addOperand(&type4);
3688 auto param11 = model->addOperand(&type4);
3689 auto param12 = model->addOperand(&type4);
3690 auto param13 = model->addOperand(&type4);
3691 auto param14 = model->addOperand(&type4);
3692 auto param15 = model->addOperand(&type4);
3693 auto layout = model->addOperand(&type0);
3694 auto param16 = model->addOperand(&type4);
3695 auto param17 = model->addOperand(&type4);
3696 auto op41 = model->addOperand(&type21);
3697 // Phase 2, operations
3698 static int32_t param9_init[] = {0};
3699 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3700 static int32_t param10_init[] = {0};
3701 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3702 static int32_t param11_init[] = {0};
3703 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3704 static int32_t param12_init[] = {0};
3705 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3706 static int32_t param13_init[] = {1};
3707 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
3708 static int32_t param14_init[] = {1};
3709 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
3710 static int32_t param15_init[] = {0};
3711 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
3712 static bool8 layout_init[] = {true};
3713 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3714 static int32_t param16_init[] = {3};
3715 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
3716 static int32_t param17_init[] = {3};
3717 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
3718 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param9, param10, param11, param12, param13, param14, param15, layout, param16, param17}, {op41});
3719 // Phase 3, inputs and outputs
3720 model->identifyInputsAndOutputs(
3721 {op11, op21, op31},
3722 {op41});
3723 assert(model->isValid());
3724 }
3725
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i)3726 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i) {
3727 static std::set<int> ignore = {};
3728 return ignore.find(i) != ignore.end();
3729 }
3730
CreateModel_nhwc_3(Model * model)3731 void CreateModel_nhwc_3(Model *model) {
3732 OperandType type0(Type::BOOL, {});
3733 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3734 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
3735 OperandType type3(Type::TENSOR_FLOAT32, {1});
3736 OperandType type4(Type::INT32, {});
3737 // Phase 1, operands
3738 auto op12 = model->addOperand(&type1);
3739 auto op22 = model->addOperand(&type2);
3740 auto op32 = model->addOperand(&type3);
3741 auto param18 = model->addOperand(&type4);
3742 auto param19 = model->addOperand(&type4);
3743 auto param20 = model->addOperand(&type4);
3744 auto param21 = model->addOperand(&type4);
3745 auto layout = model->addOperand(&type0);
3746 auto param22 = model->addOperand(&type4);
3747 auto param23 = model->addOperand(&type4);
3748 auto op42 = model->addOperand(&type2);
3749 // Phase 2, operations
3750 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
3751 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
3752 static float op32_init[] = {0.0f};
3753 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
3754 static int32_t param18_init[] = {2};
3755 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
3756 static int32_t param19_init[] = {1};
3757 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
3758 static int32_t param20_init[] = {1};
3759 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3760 static int32_t param21_init[] = {0};
3761 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3762 static bool8 layout_init[] = {false};
3763 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3764 static int32_t param22_init[] = {1};
3765 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3766 static int32_t param23_init[] = {1};
3767 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3768 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
3769 // Phase 3, inputs and outputs
3770 model->identifyInputsAndOutputs(
3771 {op12},
3772 {op42});
3773 assert(model->isValid());
3774 }
3775
is_ignored_nhwc_3(int i)3776 inline bool is_ignored_nhwc_3(int i) {
3777 static std::set<int> ignore = {};
3778 return ignore.find(i) != ignore.end();
3779 }
3780
CreateModel_nhwc_relaxed_3(Model * model)3781 void CreateModel_nhwc_relaxed_3(Model *model) {
3782 OperandType type0(Type::BOOL, {});
3783 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3784 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
3785 OperandType type3(Type::TENSOR_FLOAT32, {1});
3786 OperandType type4(Type::INT32, {});
3787 // Phase 1, operands
3788 auto op12 = model->addOperand(&type1);
3789 auto op22 = model->addOperand(&type2);
3790 auto op32 = model->addOperand(&type3);
3791 auto param18 = model->addOperand(&type4);
3792 auto param19 = model->addOperand(&type4);
3793 auto param20 = model->addOperand(&type4);
3794 auto param21 = model->addOperand(&type4);
3795 auto layout = model->addOperand(&type0);
3796 auto param22 = model->addOperand(&type4);
3797 auto param23 = model->addOperand(&type4);
3798 auto op42 = model->addOperand(&type2);
3799 // Phase 2, operations
3800 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
3801 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
3802 static float op32_init[] = {0.0f};
3803 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
3804 static int32_t param18_init[] = {2};
3805 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
3806 static int32_t param19_init[] = {1};
3807 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
3808 static int32_t param20_init[] = {1};
3809 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3810 static int32_t param21_init[] = {0};
3811 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3812 static bool8 layout_init[] = {false};
3813 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3814 static int32_t param22_init[] = {1};
3815 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3816 static int32_t param23_init[] = {1};
3817 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3818 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
3819 // Phase 3, inputs and outputs
3820 model->identifyInputsAndOutputs(
3821 {op12},
3822 {op42});
3823 // Phase 4: set relaxed execution
3824 model->relaxComputationFloat32toFloat16(true);
3825 assert(model->isValid());
3826 }
3827
is_ignored_nhwc_relaxed_3(int i)3828 inline bool is_ignored_nhwc_relaxed_3(int i) {
3829 static std::set<int> ignore = {};
3830 return ignore.find(i) != ignore.end();
3831 }
3832
CreateModel_nhwc_quant8_3(Model * model)3833 void CreateModel_nhwc_quant8_3(Model *model) {
3834 OperandType type0(Type::BOOL, {});
3835 OperandType type4(Type::INT32, {});
3836 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
3837 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
3838 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
3839 // Phase 1, operands
3840 auto op12 = model->addOperand(&type7);
3841 auto op22 = model->addOperand(&type8);
3842 auto op32 = model->addOperand(&type9);
3843 auto param18 = model->addOperand(&type4);
3844 auto param19 = model->addOperand(&type4);
3845 auto param20 = model->addOperand(&type4);
3846 auto param21 = model->addOperand(&type4);
3847 auto layout = model->addOperand(&type0);
3848 auto param22 = model->addOperand(&type4);
3849 auto param23 = model->addOperand(&type4);
3850 auto op42 = model->addOperand(&type8);
3851 // Phase 2, operations
3852 static uint8_t op22_init[] = {2, 2, 2, 2};
3853 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 4);
3854 static int32_t op32_init[] = {0};
3855 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1);
3856 static int32_t param18_init[] = {2};
3857 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
3858 static int32_t param19_init[] = {1};
3859 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
3860 static int32_t param20_init[] = {1};
3861 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3862 static int32_t param21_init[] = {0};
3863 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3864 static bool8 layout_init[] = {false};
3865 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3866 static int32_t param22_init[] = {1};
3867 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3868 static int32_t param23_init[] = {1};
3869 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3870 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
3871 // Phase 3, inputs and outputs
3872 model->identifyInputsAndOutputs(
3873 {op12},
3874 {op42});
3875 assert(model->isValid());
3876 }
3877
is_ignored_nhwc_quant8_3(int i)3878 inline bool is_ignored_nhwc_quant8_3(int i) {
3879 static std::set<int> ignore = {};
3880 return ignore.find(i) != ignore.end();
3881 }
3882
CreateModel_nhwc_float16_3(Model * model)3883 void CreateModel_nhwc_float16_3(Model *model) {
3884 OperandType type0(Type::BOOL, {});
3885 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
3886 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
3887 OperandType type12(Type::TENSOR_FLOAT16, {1});
3888 OperandType type4(Type::INT32, {});
3889 // Phase 1, operands
3890 auto op12 = model->addOperand(&type10);
3891 auto op22 = model->addOperand(&type11);
3892 auto op32 = model->addOperand(&type12);
3893 auto param18 = model->addOperand(&type4);
3894 auto param19 = model->addOperand(&type4);
3895 auto param20 = model->addOperand(&type4);
3896 auto param21 = model->addOperand(&type4);
3897 auto layout = model->addOperand(&type0);
3898 auto param22 = model->addOperand(&type4);
3899 auto param23 = model->addOperand(&type4);
3900 auto op42 = model->addOperand(&type11);
3901 // Phase 2, operations
3902 static _Float16 op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
3903 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 4);
3904 static _Float16 op32_init[] = {0.0f};
3905 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1);
3906 static int32_t param18_init[] = {2};
3907 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
3908 static int32_t param19_init[] = {1};
3909 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
3910 static int32_t param20_init[] = {1};
3911 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3912 static int32_t param21_init[] = {0};
3913 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3914 static bool8 layout_init[] = {false};
3915 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3916 static int32_t param22_init[] = {1};
3917 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3918 static int32_t param23_init[] = {1};
3919 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3920 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
3921 // Phase 3, inputs and outputs
3922 model->identifyInputsAndOutputs(
3923 {op12},
3924 {op42});
3925 assert(model->isValid());
3926 }
3927
is_ignored_nhwc_float16_3(int i)3928 inline bool is_ignored_nhwc_float16_3(int i) {
3929 static std::set<int> ignore = {};
3930 return ignore.find(i) != ignore.end();
3931 }
3932
CreateModel_nhwc_weight_as_input_3(Model * model)3933 void CreateModel_nhwc_weight_as_input_3(Model *model) {
3934 OperandType type0(Type::BOOL, {});
3935 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3936 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
3937 OperandType type3(Type::TENSOR_FLOAT32, {1});
3938 OperandType type4(Type::INT32, {});
3939 // Phase 1, operands
3940 auto op12 = model->addOperand(&type1);
3941 auto op22 = model->addOperand(&type2);
3942 auto op32 = model->addOperand(&type3);
3943 auto param18 = model->addOperand(&type4);
3944 auto param19 = model->addOperand(&type4);
3945 auto param20 = model->addOperand(&type4);
3946 auto param21 = model->addOperand(&type4);
3947 auto layout = model->addOperand(&type0);
3948 auto param22 = model->addOperand(&type4);
3949 auto param23 = model->addOperand(&type4);
3950 auto op42 = model->addOperand(&type2);
3951 // Phase 2, operations
3952 static int32_t param18_init[] = {2};
3953 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
3954 static int32_t param19_init[] = {1};
3955 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
3956 static int32_t param20_init[] = {1};
3957 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
3958 static int32_t param21_init[] = {0};
3959 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
3960 static bool8 layout_init[] = {false};
3961 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3962 static int32_t param22_init[] = {1};
3963 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
3964 static int32_t param23_init[] = {1};
3965 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
3966 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
3967 // Phase 3, inputs and outputs
3968 model->identifyInputsAndOutputs(
3969 {op12, op22, op32},
3970 {op42});
3971 assert(model->isValid());
3972 }
3973
is_ignored_nhwc_weight_as_input_3(int i)3974 inline bool is_ignored_nhwc_weight_as_input_3(int i) {
3975 static std::set<int> ignore = {};
3976 return ignore.find(i) != ignore.end();
3977 }
3978
CreateModel_nhwc_weight_as_input_relaxed_3(Model * model)3979 void CreateModel_nhwc_weight_as_input_relaxed_3(Model *model) {
3980 OperandType type0(Type::BOOL, {});
3981 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
3982 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
3983 OperandType type3(Type::TENSOR_FLOAT32, {1});
3984 OperandType type4(Type::INT32, {});
3985 // Phase 1, operands
3986 auto op12 = model->addOperand(&type1);
3987 auto op22 = model->addOperand(&type2);
3988 auto op32 = model->addOperand(&type3);
3989 auto param18 = model->addOperand(&type4);
3990 auto param19 = model->addOperand(&type4);
3991 auto param20 = model->addOperand(&type4);
3992 auto param21 = model->addOperand(&type4);
3993 auto layout = model->addOperand(&type0);
3994 auto param22 = model->addOperand(&type4);
3995 auto param23 = model->addOperand(&type4);
3996 auto op42 = model->addOperand(&type2);
3997 // Phase 2, operations
3998 static int32_t param18_init[] = {2};
3999 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4000 static int32_t param19_init[] = {1};
4001 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4002 static int32_t param20_init[] = {1};
4003 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4004 static int32_t param21_init[] = {0};
4005 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4006 static bool8 layout_init[] = {false};
4007 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4008 static int32_t param22_init[] = {1};
4009 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4010 static int32_t param23_init[] = {1};
4011 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4012 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4013 // Phase 3, inputs and outputs
4014 model->identifyInputsAndOutputs(
4015 {op12, op22, op32},
4016 {op42});
4017 // Phase 4: set relaxed execution
4018 model->relaxComputationFloat32toFloat16(true);
4019 assert(model->isValid());
4020 }
4021
is_ignored_nhwc_weight_as_input_relaxed_3(int i)4022 inline bool is_ignored_nhwc_weight_as_input_relaxed_3(int i) {
4023 static std::set<int> ignore = {};
4024 return ignore.find(i) != ignore.end();
4025 }
4026
CreateModel_nhwc_weight_as_input_quant8_3(Model * model)4027 void CreateModel_nhwc_weight_as_input_quant8_3(Model *model) {
4028 OperandType type0(Type::BOOL, {});
4029 OperandType type4(Type::INT32, {});
4030 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
4031 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4032 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4033 // Phase 1, operands
4034 auto op12 = model->addOperand(&type7);
4035 auto op22 = model->addOperand(&type8);
4036 auto op32 = model->addOperand(&type9);
4037 auto param18 = model->addOperand(&type4);
4038 auto param19 = model->addOperand(&type4);
4039 auto param20 = model->addOperand(&type4);
4040 auto param21 = model->addOperand(&type4);
4041 auto layout = model->addOperand(&type0);
4042 auto param22 = model->addOperand(&type4);
4043 auto param23 = model->addOperand(&type4);
4044 auto op42 = model->addOperand(&type8);
4045 // Phase 2, operations
4046 static int32_t param18_init[] = {2};
4047 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4048 static int32_t param19_init[] = {1};
4049 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4050 static int32_t param20_init[] = {1};
4051 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4052 static int32_t param21_init[] = {0};
4053 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4054 static bool8 layout_init[] = {false};
4055 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4056 static int32_t param22_init[] = {1};
4057 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4058 static int32_t param23_init[] = {1};
4059 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4060 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4061 // Phase 3, inputs and outputs
4062 model->identifyInputsAndOutputs(
4063 {op12, op22, op32},
4064 {op42});
4065 assert(model->isValid());
4066 }
4067
is_ignored_nhwc_weight_as_input_quant8_3(int i)4068 inline bool is_ignored_nhwc_weight_as_input_quant8_3(int i) {
4069 static std::set<int> ignore = {};
4070 return ignore.find(i) != ignore.end();
4071 }
4072
CreateModel_nhwc_weight_as_input_float16_3(Model * model)4073 void CreateModel_nhwc_weight_as_input_float16_3(Model *model) {
4074 OperandType type0(Type::BOOL, {});
4075 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
4076 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4077 OperandType type12(Type::TENSOR_FLOAT16, {1});
4078 OperandType type4(Type::INT32, {});
4079 // Phase 1, operands
4080 auto op12 = model->addOperand(&type10);
4081 auto op22 = model->addOperand(&type11);
4082 auto op32 = model->addOperand(&type12);
4083 auto param18 = model->addOperand(&type4);
4084 auto param19 = model->addOperand(&type4);
4085 auto param20 = model->addOperand(&type4);
4086 auto param21 = model->addOperand(&type4);
4087 auto layout = model->addOperand(&type0);
4088 auto param22 = model->addOperand(&type4);
4089 auto param23 = model->addOperand(&type4);
4090 auto op42 = model->addOperand(&type11);
4091 // Phase 2, operations
4092 static int32_t param18_init[] = {2};
4093 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4094 static int32_t param19_init[] = {1};
4095 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4096 static int32_t param20_init[] = {1};
4097 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4098 static int32_t param21_init[] = {0};
4099 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4100 static bool8 layout_init[] = {false};
4101 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4102 static int32_t param22_init[] = {1};
4103 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4104 static int32_t param23_init[] = {1};
4105 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4106 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4107 // Phase 3, inputs and outputs
4108 model->identifyInputsAndOutputs(
4109 {op12, op22, op32},
4110 {op42});
4111 assert(model->isValid());
4112 }
4113
is_ignored_nhwc_weight_as_input_float16_3(int i)4114 inline bool is_ignored_nhwc_weight_as_input_float16_3(int i) {
4115 static std::set<int> ignore = {};
4116 return ignore.find(i) != ignore.end();
4117 }
4118
CreateModel_nchw_3(Model * model)4119 void CreateModel_nchw_3(Model *model) {
4120 OperandType type0(Type::BOOL, {});
4121 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4122 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
4123 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4124 OperandType type3(Type::TENSOR_FLOAT32, {1});
4125 OperandType type4(Type::INT32, {});
4126 // Phase 1, operands
4127 auto op12 = model->addOperand(&type13);
4128 auto op22 = model->addOperand(&type2);
4129 auto op32 = model->addOperand(&type3);
4130 auto param18 = model->addOperand(&type4);
4131 auto param19 = model->addOperand(&type4);
4132 auto param20 = model->addOperand(&type4);
4133 auto param21 = model->addOperand(&type4);
4134 auto layout = model->addOperand(&type0);
4135 auto param22 = model->addOperand(&type4);
4136 auto param23 = model->addOperand(&type4);
4137 auto op42 = model->addOperand(&type14);
4138 // Phase 2, operations
4139 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4140 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4141 static float op32_init[] = {0.0f};
4142 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4143 static int32_t param18_init[] = {2};
4144 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4145 static int32_t param19_init[] = {1};
4146 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4147 static int32_t param20_init[] = {1};
4148 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4149 static int32_t param21_init[] = {0};
4150 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4151 static bool8 layout_init[] = {true};
4152 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4153 static int32_t param22_init[] = {1};
4154 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4155 static int32_t param23_init[] = {1};
4156 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4157 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4158 // Phase 3, inputs and outputs
4159 model->identifyInputsAndOutputs(
4160 {op12},
4161 {op42});
4162 assert(model->isValid());
4163 }
4164
is_ignored_nchw_3(int i)4165 inline bool is_ignored_nchw_3(int i) {
4166 static std::set<int> ignore = {};
4167 return ignore.find(i) != ignore.end();
4168 }
4169
CreateModel_nchw_relaxed_3(Model * model)4170 void CreateModel_nchw_relaxed_3(Model *model) {
4171 OperandType type0(Type::BOOL, {});
4172 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4173 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
4174 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4175 OperandType type3(Type::TENSOR_FLOAT32, {1});
4176 OperandType type4(Type::INT32, {});
4177 // Phase 1, operands
4178 auto op12 = model->addOperand(&type13);
4179 auto op22 = model->addOperand(&type2);
4180 auto op32 = model->addOperand(&type3);
4181 auto param18 = model->addOperand(&type4);
4182 auto param19 = model->addOperand(&type4);
4183 auto param20 = model->addOperand(&type4);
4184 auto param21 = model->addOperand(&type4);
4185 auto layout = model->addOperand(&type0);
4186 auto param22 = model->addOperand(&type4);
4187 auto param23 = model->addOperand(&type4);
4188 auto op42 = model->addOperand(&type14);
4189 // Phase 2, operations
4190 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4191 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4192 static float op32_init[] = {0.0f};
4193 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4194 static int32_t param18_init[] = {2};
4195 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4196 static int32_t param19_init[] = {1};
4197 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4198 static int32_t param20_init[] = {1};
4199 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4200 static int32_t param21_init[] = {0};
4201 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4202 static bool8 layout_init[] = {true};
4203 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4204 static int32_t param22_init[] = {1};
4205 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4206 static int32_t param23_init[] = {1};
4207 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4208 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4209 // Phase 3, inputs and outputs
4210 model->identifyInputsAndOutputs(
4211 {op12},
4212 {op42});
4213 // Phase 4: set relaxed execution
4214 model->relaxComputationFloat32toFloat16(true);
4215 assert(model->isValid());
4216 }
4217
is_ignored_nchw_relaxed_3(int i)4218 inline bool is_ignored_nchw_relaxed_3(int i) {
4219 static std::set<int> ignore = {};
4220 return ignore.find(i) != ignore.end();
4221 }
4222
CreateModel_nchw_quant8_3(Model * model)4223 void CreateModel_nchw_quant8_3(Model *model) {
4224 OperandType type0(Type::BOOL, {});
4225 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
4226 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0);
4227 OperandType type4(Type::INT32, {});
4228 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4229 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4230 // Phase 1, operands
4231 auto op12 = model->addOperand(&type15);
4232 auto op22 = model->addOperand(&type8);
4233 auto op32 = model->addOperand(&type9);
4234 auto param18 = model->addOperand(&type4);
4235 auto param19 = model->addOperand(&type4);
4236 auto param20 = model->addOperand(&type4);
4237 auto param21 = model->addOperand(&type4);
4238 auto layout = model->addOperand(&type0);
4239 auto param22 = model->addOperand(&type4);
4240 auto param23 = model->addOperand(&type4);
4241 auto op42 = model->addOperand(&type16);
4242 // Phase 2, operations
4243 static uint8_t op22_init[] = {2, 2, 2, 2};
4244 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 4);
4245 static int32_t op32_init[] = {0};
4246 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1);
4247 static int32_t param18_init[] = {2};
4248 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4249 static int32_t param19_init[] = {1};
4250 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4251 static int32_t param20_init[] = {1};
4252 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4253 static int32_t param21_init[] = {0};
4254 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4255 static bool8 layout_init[] = {true};
4256 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4257 static int32_t param22_init[] = {1};
4258 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4259 static int32_t param23_init[] = {1};
4260 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4261 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4262 // Phase 3, inputs and outputs
4263 model->identifyInputsAndOutputs(
4264 {op12},
4265 {op42});
4266 assert(model->isValid());
4267 }
4268
is_ignored_nchw_quant8_3(int i)4269 inline bool is_ignored_nchw_quant8_3(int i) {
4270 static std::set<int> ignore = {};
4271 return ignore.find(i) != ignore.end();
4272 }
4273
CreateModel_nchw_float16_3(Model * model)4274 void CreateModel_nchw_float16_3(Model *model) {
4275 OperandType type0(Type::BOOL, {});
4276 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4277 OperandType type12(Type::TENSOR_FLOAT16, {1});
4278 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
4279 OperandType type18(Type::TENSOR_FLOAT16, {1, 1, 2, 2});
4280 OperandType type4(Type::INT32, {});
4281 // Phase 1, operands
4282 auto op12 = model->addOperand(&type17);
4283 auto op22 = model->addOperand(&type11);
4284 auto op32 = model->addOperand(&type12);
4285 auto param18 = model->addOperand(&type4);
4286 auto param19 = model->addOperand(&type4);
4287 auto param20 = model->addOperand(&type4);
4288 auto param21 = model->addOperand(&type4);
4289 auto layout = model->addOperand(&type0);
4290 auto param22 = model->addOperand(&type4);
4291 auto param23 = model->addOperand(&type4);
4292 auto op42 = model->addOperand(&type18);
4293 // Phase 2, operations
4294 static _Float16 op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4295 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 4);
4296 static _Float16 op32_init[] = {0.0f};
4297 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1);
4298 static int32_t param18_init[] = {2};
4299 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4300 static int32_t param19_init[] = {1};
4301 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4302 static int32_t param20_init[] = {1};
4303 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4304 static int32_t param21_init[] = {0};
4305 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4306 static bool8 layout_init[] = {true};
4307 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4308 static int32_t param22_init[] = {1};
4309 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4310 static int32_t param23_init[] = {1};
4311 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4312 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4313 // Phase 3, inputs and outputs
4314 model->identifyInputsAndOutputs(
4315 {op12},
4316 {op42});
4317 assert(model->isValid());
4318 }
4319
is_ignored_nchw_float16_3(int i)4320 inline bool is_ignored_nchw_float16_3(int i) {
4321 static std::set<int> ignore = {};
4322 return ignore.find(i) != ignore.end();
4323 }
4324
CreateModel_nchw_weight_as_input_3(Model * model)4325 void CreateModel_nchw_weight_as_input_3(Model *model) {
4326 OperandType type0(Type::BOOL, {});
4327 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4328 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
4329 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4330 OperandType type3(Type::TENSOR_FLOAT32, {1});
4331 OperandType type4(Type::INT32, {});
4332 // Phase 1, operands
4333 auto op12 = model->addOperand(&type13);
4334 auto op22 = model->addOperand(&type2);
4335 auto op32 = model->addOperand(&type3);
4336 auto param18 = model->addOperand(&type4);
4337 auto param19 = model->addOperand(&type4);
4338 auto param20 = model->addOperand(&type4);
4339 auto param21 = model->addOperand(&type4);
4340 auto layout = model->addOperand(&type0);
4341 auto param22 = model->addOperand(&type4);
4342 auto param23 = model->addOperand(&type4);
4343 auto op42 = model->addOperand(&type14);
4344 // Phase 2, operations
4345 static int32_t param18_init[] = {2};
4346 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4347 static int32_t param19_init[] = {1};
4348 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4349 static int32_t param20_init[] = {1};
4350 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4351 static int32_t param21_init[] = {0};
4352 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4353 static bool8 layout_init[] = {true};
4354 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4355 static int32_t param22_init[] = {1};
4356 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4357 static int32_t param23_init[] = {1};
4358 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4359 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4360 // Phase 3, inputs and outputs
4361 model->identifyInputsAndOutputs(
4362 {op12, op22, op32},
4363 {op42});
4364 assert(model->isValid());
4365 }
4366
is_ignored_nchw_weight_as_input_3(int i)4367 inline bool is_ignored_nchw_weight_as_input_3(int i) {
4368 static std::set<int> ignore = {};
4369 return ignore.find(i) != ignore.end();
4370 }
4371
CreateModel_nchw_weight_as_input_relaxed_3(Model * model)4372 void CreateModel_nchw_weight_as_input_relaxed_3(Model *model) {
4373 OperandType type0(Type::BOOL, {});
4374 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4375 OperandType type14(Type::TENSOR_FLOAT32, {1, 1, 2, 2});
4376 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4377 OperandType type3(Type::TENSOR_FLOAT32, {1});
4378 OperandType type4(Type::INT32, {});
4379 // Phase 1, operands
4380 auto op12 = model->addOperand(&type13);
4381 auto op22 = model->addOperand(&type2);
4382 auto op32 = model->addOperand(&type3);
4383 auto param18 = model->addOperand(&type4);
4384 auto param19 = model->addOperand(&type4);
4385 auto param20 = model->addOperand(&type4);
4386 auto param21 = model->addOperand(&type4);
4387 auto layout = model->addOperand(&type0);
4388 auto param22 = model->addOperand(&type4);
4389 auto param23 = model->addOperand(&type4);
4390 auto op42 = model->addOperand(&type14);
4391 // Phase 2, operations
4392 static int32_t param18_init[] = {2};
4393 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4394 static int32_t param19_init[] = {1};
4395 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4396 static int32_t param20_init[] = {1};
4397 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4398 static int32_t param21_init[] = {0};
4399 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4400 static bool8 layout_init[] = {true};
4401 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4402 static int32_t param22_init[] = {1};
4403 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4404 static int32_t param23_init[] = {1};
4405 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4406 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4407 // Phase 3, inputs and outputs
4408 model->identifyInputsAndOutputs(
4409 {op12, op22, op32},
4410 {op42});
4411 // Phase 4: set relaxed execution
4412 model->relaxComputationFloat32toFloat16(true);
4413 assert(model->isValid());
4414 }
4415
is_ignored_nchw_weight_as_input_relaxed_3(int i)4416 inline bool is_ignored_nchw_weight_as_input_relaxed_3(int i) {
4417 static std::set<int> ignore = {};
4418 return ignore.find(i) != ignore.end();
4419 }
4420
CreateModel_nchw_weight_as_input_quant8_3(Model * model)4421 void CreateModel_nchw_weight_as_input_quant8_3(Model *model) {
4422 OperandType type0(Type::BOOL, {});
4423 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
4424 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0);
4425 OperandType type4(Type::INT32, {});
4426 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4427 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4428 // Phase 1, operands
4429 auto op12 = model->addOperand(&type15);
4430 auto op22 = model->addOperand(&type8);
4431 auto op32 = model->addOperand(&type9);
4432 auto param18 = model->addOperand(&type4);
4433 auto param19 = model->addOperand(&type4);
4434 auto param20 = model->addOperand(&type4);
4435 auto param21 = model->addOperand(&type4);
4436 auto layout = model->addOperand(&type0);
4437 auto param22 = model->addOperand(&type4);
4438 auto param23 = model->addOperand(&type4);
4439 auto op42 = model->addOperand(&type16);
4440 // Phase 2, operations
4441 static int32_t param18_init[] = {2};
4442 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4443 static int32_t param19_init[] = {1};
4444 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4445 static int32_t param20_init[] = {1};
4446 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4447 static int32_t param21_init[] = {0};
4448 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4449 static bool8 layout_init[] = {true};
4450 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4451 static int32_t param22_init[] = {1};
4452 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4453 static int32_t param23_init[] = {1};
4454 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4455 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4456 // Phase 3, inputs and outputs
4457 model->identifyInputsAndOutputs(
4458 {op12, op22, op32},
4459 {op42});
4460 assert(model->isValid());
4461 }
4462
is_ignored_nchw_weight_as_input_quant8_3(int i)4463 inline bool is_ignored_nchw_weight_as_input_quant8_3(int i) {
4464 static std::set<int> ignore = {};
4465 return ignore.find(i) != ignore.end();
4466 }
4467
CreateModel_nchw_weight_as_input_float16_3(Model * model)4468 void CreateModel_nchw_weight_as_input_float16_3(Model *model) {
4469 OperandType type0(Type::BOOL, {});
4470 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4471 OperandType type12(Type::TENSOR_FLOAT16, {1});
4472 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
4473 OperandType type18(Type::TENSOR_FLOAT16, {1, 1, 2, 2});
4474 OperandType type4(Type::INT32, {});
4475 // Phase 1, operands
4476 auto op12 = model->addOperand(&type17);
4477 auto op22 = model->addOperand(&type11);
4478 auto op32 = model->addOperand(&type12);
4479 auto param18 = model->addOperand(&type4);
4480 auto param19 = model->addOperand(&type4);
4481 auto param20 = model->addOperand(&type4);
4482 auto param21 = model->addOperand(&type4);
4483 auto layout = model->addOperand(&type0);
4484 auto param22 = model->addOperand(&type4);
4485 auto param23 = model->addOperand(&type4);
4486 auto op42 = model->addOperand(&type18);
4487 // Phase 2, operations
4488 static int32_t param18_init[] = {2};
4489 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4490 static int32_t param19_init[] = {1};
4491 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4492 static int32_t param20_init[] = {1};
4493 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4494 static int32_t param21_init[] = {0};
4495 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4496 static bool8 layout_init[] = {true};
4497 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4498 static int32_t param22_init[] = {1};
4499 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4500 static int32_t param23_init[] = {1};
4501 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4502 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4503 // Phase 3, inputs and outputs
4504 model->identifyInputsAndOutputs(
4505 {op12, op22, op32},
4506 {op42});
4507 assert(model->isValid());
4508 }
4509
is_ignored_nchw_weight_as_input_float16_3(int i)4510 inline bool is_ignored_nchw_weight_as_input_float16_3(int i) {
4511 static std::set<int> ignore = {};
4512 return ignore.find(i) != ignore.end();
4513 }
4514
CreateModel_dynamic_output_shape_nhwc_3(Model * model)4515 void CreateModel_dynamic_output_shape_nhwc_3(Model *model) {
4516 OperandType type0(Type::BOOL, {});
4517 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4518 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4519 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4520 OperandType type3(Type::TENSOR_FLOAT32, {1});
4521 OperandType type4(Type::INT32, {});
4522 // Phase 1, operands
4523 auto op12 = model->addOperand(&type1);
4524 auto op22 = model->addOperand(&type2);
4525 auto op32 = model->addOperand(&type3);
4526 auto param18 = model->addOperand(&type4);
4527 auto param19 = model->addOperand(&type4);
4528 auto param20 = model->addOperand(&type4);
4529 auto param21 = model->addOperand(&type4);
4530 auto layout = model->addOperand(&type0);
4531 auto param22 = model->addOperand(&type4);
4532 auto param23 = model->addOperand(&type4);
4533 auto op42 = model->addOperand(&type19);
4534 // Phase 2, operations
4535 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4536 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4537 static float op32_init[] = {0.0f};
4538 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4539 static int32_t param18_init[] = {2};
4540 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4541 static int32_t param19_init[] = {1};
4542 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4543 static int32_t param20_init[] = {1};
4544 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4545 static int32_t param21_init[] = {0};
4546 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4547 static bool8 layout_init[] = {false};
4548 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4549 static int32_t param22_init[] = {1};
4550 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4551 static int32_t param23_init[] = {1};
4552 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4553 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4554 // Phase 3, inputs and outputs
4555 model->identifyInputsAndOutputs(
4556 {op12},
4557 {op42});
4558 assert(model->isValid());
4559 }
4560
is_ignored_dynamic_output_shape_nhwc_3(int i)4561 inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) {
4562 static std::set<int> ignore = {};
4563 return ignore.find(i) != ignore.end();
4564 }
4565
CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model * model)4566 void CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model *model) {
4567 OperandType type0(Type::BOOL, {});
4568 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4569 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4570 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4571 OperandType type3(Type::TENSOR_FLOAT32, {1});
4572 OperandType type4(Type::INT32, {});
4573 // Phase 1, operands
4574 auto op12 = model->addOperand(&type1);
4575 auto op22 = model->addOperand(&type2);
4576 auto op32 = model->addOperand(&type3);
4577 auto param18 = model->addOperand(&type4);
4578 auto param19 = model->addOperand(&type4);
4579 auto param20 = model->addOperand(&type4);
4580 auto param21 = model->addOperand(&type4);
4581 auto layout = model->addOperand(&type0);
4582 auto param22 = model->addOperand(&type4);
4583 auto param23 = model->addOperand(&type4);
4584 auto op42 = model->addOperand(&type19);
4585 // Phase 2, operations
4586 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4587 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4588 static float op32_init[] = {0.0f};
4589 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4590 static int32_t param18_init[] = {2};
4591 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4592 static int32_t param19_init[] = {1};
4593 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4594 static int32_t param20_init[] = {1};
4595 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4596 static int32_t param21_init[] = {0};
4597 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4598 static bool8 layout_init[] = {false};
4599 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4600 static int32_t param22_init[] = {1};
4601 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4602 static int32_t param23_init[] = {1};
4603 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4604 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4605 // Phase 3, inputs and outputs
4606 model->identifyInputsAndOutputs(
4607 {op12},
4608 {op42});
4609 // Phase 4: set relaxed execution
4610 model->relaxComputationFloat32toFloat16(true);
4611 assert(model->isValid());
4612 }
4613
is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i)4614 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) {
4615 static std::set<int> ignore = {};
4616 return ignore.find(i) != ignore.end();
4617 }
4618
CreateModel_dynamic_output_shape_nhwc_quant8_3(Model * model)4619 void CreateModel_dynamic_output_shape_nhwc_quant8_3(Model *model) {
4620 OperandType type0(Type::BOOL, {});
4621 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
4622 OperandType type4(Type::INT32, {});
4623 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
4624 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4625 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4626 // Phase 1, operands
4627 auto op12 = model->addOperand(&type7);
4628 auto op22 = model->addOperand(&type8);
4629 auto op32 = model->addOperand(&type9);
4630 auto param18 = model->addOperand(&type4);
4631 auto param19 = model->addOperand(&type4);
4632 auto param20 = model->addOperand(&type4);
4633 auto param21 = model->addOperand(&type4);
4634 auto layout = model->addOperand(&type0);
4635 auto param22 = model->addOperand(&type4);
4636 auto param23 = model->addOperand(&type4);
4637 auto op42 = model->addOperand(&type20);
4638 // Phase 2, operations
4639 static uint8_t op22_init[] = {2, 2, 2, 2};
4640 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 4);
4641 static int32_t op32_init[] = {0};
4642 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1);
4643 static int32_t param18_init[] = {2};
4644 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4645 static int32_t param19_init[] = {1};
4646 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4647 static int32_t param20_init[] = {1};
4648 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4649 static int32_t param21_init[] = {0};
4650 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4651 static bool8 layout_init[] = {false};
4652 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4653 static int32_t param22_init[] = {1};
4654 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4655 static int32_t param23_init[] = {1};
4656 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4657 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4658 // Phase 3, inputs and outputs
4659 model->identifyInputsAndOutputs(
4660 {op12},
4661 {op42});
4662 assert(model->isValid());
4663 }
4664
is_ignored_dynamic_output_shape_nhwc_quant8_3(int i)4665 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) {
4666 static std::set<int> ignore = {};
4667 return ignore.find(i) != ignore.end();
4668 }
4669
CreateModel_dynamic_output_shape_nhwc_float16_3(Model * model)4670 void CreateModel_dynamic_output_shape_nhwc_float16_3(Model *model) {
4671 OperandType type0(Type::BOOL, {});
4672 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
4673 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4674 OperandType type12(Type::TENSOR_FLOAT16, {1});
4675 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
4676 OperandType type4(Type::INT32, {});
4677 // Phase 1, operands
4678 auto op12 = model->addOperand(&type10);
4679 auto op22 = model->addOperand(&type11);
4680 auto op32 = model->addOperand(&type12);
4681 auto param18 = model->addOperand(&type4);
4682 auto param19 = model->addOperand(&type4);
4683 auto param20 = model->addOperand(&type4);
4684 auto param21 = model->addOperand(&type4);
4685 auto layout = model->addOperand(&type0);
4686 auto param22 = model->addOperand(&type4);
4687 auto param23 = model->addOperand(&type4);
4688 auto op42 = model->addOperand(&type21);
4689 // Phase 2, operations
4690 static _Float16 op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4691 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 4);
4692 static _Float16 op32_init[] = {0.0f};
4693 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1);
4694 static int32_t param18_init[] = {2};
4695 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4696 static int32_t param19_init[] = {1};
4697 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4698 static int32_t param20_init[] = {1};
4699 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4700 static int32_t param21_init[] = {0};
4701 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4702 static bool8 layout_init[] = {false};
4703 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4704 static int32_t param22_init[] = {1};
4705 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4706 static int32_t param23_init[] = {1};
4707 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4708 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4709 // Phase 3, inputs and outputs
4710 model->identifyInputsAndOutputs(
4711 {op12},
4712 {op42});
4713 assert(model->isValid());
4714 }
4715
is_ignored_dynamic_output_shape_nhwc_float16_3(int i)4716 inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) {
4717 static std::set<int> ignore = {};
4718 return ignore.find(i) != ignore.end();
4719 }
4720
CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model * model)4721 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model *model) {
4722 OperandType type0(Type::BOOL, {});
4723 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4724 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4725 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4726 OperandType type3(Type::TENSOR_FLOAT32, {1});
4727 OperandType type4(Type::INT32, {});
4728 // Phase 1, operands
4729 auto op12 = model->addOperand(&type1);
4730 auto op22 = model->addOperand(&type2);
4731 auto op32 = model->addOperand(&type3);
4732 auto param18 = model->addOperand(&type4);
4733 auto param19 = model->addOperand(&type4);
4734 auto param20 = model->addOperand(&type4);
4735 auto param21 = model->addOperand(&type4);
4736 auto layout = model->addOperand(&type0);
4737 auto param22 = model->addOperand(&type4);
4738 auto param23 = model->addOperand(&type4);
4739 auto op42 = model->addOperand(&type19);
4740 // Phase 2, operations
4741 static int32_t param18_init[] = {2};
4742 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4743 static int32_t param19_init[] = {1};
4744 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4745 static int32_t param20_init[] = {1};
4746 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4747 static int32_t param21_init[] = {0};
4748 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4749 static bool8 layout_init[] = {false};
4750 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4751 static int32_t param22_init[] = {1};
4752 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4753 static int32_t param23_init[] = {1};
4754 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4755 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4756 // Phase 3, inputs and outputs
4757 model->identifyInputsAndOutputs(
4758 {op12, op22, op32},
4759 {op42});
4760 assert(model->isValid());
4761 }
4762
is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i)4763 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i) {
4764 static std::set<int> ignore = {};
4765 return ignore.find(i) != ignore.end();
4766 }
4767
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(Model * model)4768 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(Model *model) {
4769 OperandType type0(Type::BOOL, {});
4770 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
4771 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4772 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4773 OperandType type3(Type::TENSOR_FLOAT32, {1});
4774 OperandType type4(Type::INT32, {});
4775 // Phase 1, operands
4776 auto op12 = model->addOperand(&type1);
4777 auto op22 = model->addOperand(&type2);
4778 auto op32 = model->addOperand(&type3);
4779 auto param18 = model->addOperand(&type4);
4780 auto param19 = model->addOperand(&type4);
4781 auto param20 = model->addOperand(&type4);
4782 auto param21 = model->addOperand(&type4);
4783 auto layout = model->addOperand(&type0);
4784 auto param22 = model->addOperand(&type4);
4785 auto param23 = model->addOperand(&type4);
4786 auto op42 = model->addOperand(&type19);
4787 // Phase 2, operations
4788 static int32_t param18_init[] = {2};
4789 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4790 static int32_t param19_init[] = {1};
4791 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4792 static int32_t param20_init[] = {1};
4793 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4794 static int32_t param21_init[] = {0};
4795 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4796 static bool8 layout_init[] = {false};
4797 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4798 static int32_t param22_init[] = {1};
4799 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4800 static int32_t param23_init[] = {1};
4801 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4802 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4803 // Phase 3, inputs and outputs
4804 model->identifyInputsAndOutputs(
4805 {op12, op22, op32},
4806 {op42});
4807 // Phase 4: set relaxed execution
4808 model->relaxComputationFloat32toFloat16(true);
4809 assert(model->isValid());
4810 }
4811
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(int i)4812 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_3(int i) {
4813 static std::set<int> ignore = {};
4814 return ignore.find(i) != ignore.end();
4815 }
4816
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_3(Model * model)4817 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_3(Model *model) {
4818 OperandType type0(Type::BOOL, {});
4819 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
4820 OperandType type4(Type::INT32, {});
4821 OperandType type7(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0);
4822 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
4823 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
4824 // Phase 1, operands
4825 auto op12 = model->addOperand(&type7);
4826 auto op22 = model->addOperand(&type8);
4827 auto op32 = model->addOperand(&type9);
4828 auto param18 = model->addOperand(&type4);
4829 auto param19 = model->addOperand(&type4);
4830 auto param20 = model->addOperand(&type4);
4831 auto param21 = model->addOperand(&type4);
4832 auto layout = model->addOperand(&type0);
4833 auto param22 = model->addOperand(&type4);
4834 auto param23 = model->addOperand(&type4);
4835 auto op42 = model->addOperand(&type20);
4836 // Phase 2, operations
4837 static int32_t param18_init[] = {2};
4838 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4839 static int32_t param19_init[] = {1};
4840 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4841 static int32_t param20_init[] = {1};
4842 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4843 static int32_t param21_init[] = {0};
4844 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4845 static bool8 layout_init[] = {false};
4846 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4847 static int32_t param22_init[] = {1};
4848 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4849 static int32_t param23_init[] = {1};
4850 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4851 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4852 // Phase 3, inputs and outputs
4853 model->identifyInputsAndOutputs(
4854 {op12, op22, op32},
4855 {op42});
4856 assert(model->isValid());
4857 }
4858
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_3(int i)4859 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_3(int i) {
4860 static std::set<int> ignore = {};
4861 return ignore.find(i) != ignore.end();
4862 }
4863
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_3(Model * model)4864 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_3(Model *model) {
4865 OperandType type0(Type::BOOL, {});
4866 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
4867 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
4868 OperandType type12(Type::TENSOR_FLOAT16, {1});
4869 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
4870 OperandType type4(Type::INT32, {});
4871 // Phase 1, operands
4872 auto op12 = model->addOperand(&type10);
4873 auto op22 = model->addOperand(&type11);
4874 auto op32 = model->addOperand(&type12);
4875 auto param18 = model->addOperand(&type4);
4876 auto param19 = model->addOperand(&type4);
4877 auto param20 = model->addOperand(&type4);
4878 auto param21 = model->addOperand(&type4);
4879 auto layout = model->addOperand(&type0);
4880 auto param22 = model->addOperand(&type4);
4881 auto param23 = model->addOperand(&type4);
4882 auto op42 = model->addOperand(&type21);
4883 // Phase 2, operations
4884 static int32_t param18_init[] = {2};
4885 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4886 static int32_t param19_init[] = {1};
4887 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4888 static int32_t param20_init[] = {1};
4889 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4890 static int32_t param21_init[] = {0};
4891 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4892 static bool8 layout_init[] = {false};
4893 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4894 static int32_t param22_init[] = {1};
4895 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4896 static int32_t param23_init[] = {1};
4897 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4898 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4899 // Phase 3, inputs and outputs
4900 model->identifyInputsAndOutputs(
4901 {op12, op22, op32},
4902 {op42});
4903 assert(model->isValid());
4904 }
4905
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_3(int i)4906 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_3(int i) {
4907 static std::set<int> ignore = {};
4908 return ignore.find(i) != ignore.end();
4909 }
4910
CreateModel_dynamic_output_shape_nchw_3(Model * model)4911 void CreateModel_dynamic_output_shape_nchw_3(Model *model) {
4912 OperandType type0(Type::BOOL, {});
4913 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4914 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4915 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4916 OperandType type3(Type::TENSOR_FLOAT32, {1});
4917 OperandType type4(Type::INT32, {});
4918 // Phase 1, operands
4919 auto op12 = model->addOperand(&type13);
4920 auto op22 = model->addOperand(&type2);
4921 auto op32 = model->addOperand(&type3);
4922 auto param18 = model->addOperand(&type4);
4923 auto param19 = model->addOperand(&type4);
4924 auto param20 = model->addOperand(&type4);
4925 auto param21 = model->addOperand(&type4);
4926 auto layout = model->addOperand(&type0);
4927 auto param22 = model->addOperand(&type4);
4928 auto param23 = model->addOperand(&type4);
4929 auto op42 = model->addOperand(&type19);
4930 // Phase 2, operations
4931 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4932 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4933 static float op32_init[] = {0.0f};
4934 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4935 static int32_t param18_init[] = {2};
4936 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4937 static int32_t param19_init[] = {1};
4938 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4939 static int32_t param20_init[] = {1};
4940 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4941 static int32_t param21_init[] = {0};
4942 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4943 static bool8 layout_init[] = {true};
4944 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4945 static int32_t param22_init[] = {1};
4946 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4947 static int32_t param23_init[] = {1};
4948 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
4949 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
4950 // Phase 3, inputs and outputs
4951 model->identifyInputsAndOutputs(
4952 {op12},
4953 {op42});
4954 assert(model->isValid());
4955 }
4956
is_ignored_dynamic_output_shape_nchw_3(int i)4957 inline bool is_ignored_dynamic_output_shape_nchw_3(int i) {
4958 static std::set<int> ignore = {};
4959 return ignore.find(i) != ignore.end();
4960 }
4961
CreateModel_dynamic_output_shape_nchw_relaxed_3(Model * model)4962 void CreateModel_dynamic_output_shape_nchw_relaxed_3(Model *model) {
4963 OperandType type0(Type::BOOL, {});
4964 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
4965 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4966 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
4967 OperandType type3(Type::TENSOR_FLOAT32, {1});
4968 OperandType type4(Type::INT32, {});
4969 // Phase 1, operands
4970 auto op12 = model->addOperand(&type13);
4971 auto op22 = model->addOperand(&type2);
4972 auto op32 = model->addOperand(&type3);
4973 auto param18 = model->addOperand(&type4);
4974 auto param19 = model->addOperand(&type4);
4975 auto param20 = model->addOperand(&type4);
4976 auto param21 = model->addOperand(&type4);
4977 auto layout = model->addOperand(&type0);
4978 auto param22 = model->addOperand(&type4);
4979 auto param23 = model->addOperand(&type4);
4980 auto op42 = model->addOperand(&type19);
4981 // Phase 2, operations
4982 static float op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
4983 model->setOperandValue(op22, op22_init, sizeof(float) * 4);
4984 static float op32_init[] = {0.0f};
4985 model->setOperandValue(op32, op32_init, sizeof(float) * 1);
4986 static int32_t param18_init[] = {2};
4987 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4988 static int32_t param19_init[] = {1};
4989 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4990 static int32_t param20_init[] = {1};
4991 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4992 static int32_t param21_init[] = {0};
4993 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
4994 static bool8 layout_init[] = {true};
4995 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4996 static int32_t param22_init[] = {1};
4997 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
4998 static int32_t param23_init[] = {1};
4999 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5000 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5001 // Phase 3, inputs and outputs
5002 model->identifyInputsAndOutputs(
5003 {op12},
5004 {op42});
5005 // Phase 4: set relaxed execution
5006 model->relaxComputationFloat32toFloat16(true);
5007 assert(model->isValid());
5008 }
5009
is_ignored_dynamic_output_shape_nchw_relaxed_3(int i)5010 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) {
5011 static std::set<int> ignore = {};
5012 return ignore.find(i) != ignore.end();
5013 }
5014
CreateModel_dynamic_output_shape_nchw_quant8_3(Model * model)5015 void CreateModel_dynamic_output_shape_nchw_quant8_3(Model *model) {
5016 OperandType type0(Type::BOOL, {});
5017 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
5018 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
5019 OperandType type4(Type::INT32, {});
5020 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5021 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5022 // Phase 1, operands
5023 auto op12 = model->addOperand(&type15);
5024 auto op22 = model->addOperand(&type8);
5025 auto op32 = model->addOperand(&type9);
5026 auto param18 = model->addOperand(&type4);
5027 auto param19 = model->addOperand(&type4);
5028 auto param20 = model->addOperand(&type4);
5029 auto param21 = model->addOperand(&type4);
5030 auto layout = model->addOperand(&type0);
5031 auto param22 = model->addOperand(&type4);
5032 auto param23 = model->addOperand(&type4);
5033 auto op42 = model->addOperand(&type20);
5034 // Phase 2, operations
5035 static uint8_t op22_init[] = {2, 2, 2, 2};
5036 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 4);
5037 static int32_t op32_init[] = {0};
5038 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1);
5039 static int32_t param18_init[] = {2};
5040 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5041 static int32_t param19_init[] = {1};
5042 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5043 static int32_t param20_init[] = {1};
5044 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5045 static int32_t param21_init[] = {0};
5046 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5047 static bool8 layout_init[] = {true};
5048 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5049 static int32_t param22_init[] = {1};
5050 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5051 static int32_t param23_init[] = {1};
5052 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5053 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5054 // Phase 3, inputs and outputs
5055 model->identifyInputsAndOutputs(
5056 {op12},
5057 {op42});
5058 assert(model->isValid());
5059 }
5060
is_ignored_dynamic_output_shape_nchw_quant8_3(int i)5061 inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) {
5062 static std::set<int> ignore = {};
5063 return ignore.find(i) != ignore.end();
5064 }
5065
CreateModel_dynamic_output_shape_nchw_float16_3(Model * model)5066 void CreateModel_dynamic_output_shape_nchw_float16_3(Model *model) {
5067 OperandType type0(Type::BOOL, {});
5068 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5069 OperandType type12(Type::TENSOR_FLOAT16, {1});
5070 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
5071 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5072 OperandType type4(Type::INT32, {});
5073 // Phase 1, operands
5074 auto op12 = model->addOperand(&type17);
5075 auto op22 = model->addOperand(&type11);
5076 auto op32 = model->addOperand(&type12);
5077 auto param18 = model->addOperand(&type4);
5078 auto param19 = model->addOperand(&type4);
5079 auto param20 = model->addOperand(&type4);
5080 auto param21 = model->addOperand(&type4);
5081 auto layout = model->addOperand(&type0);
5082 auto param22 = model->addOperand(&type4);
5083 auto param23 = model->addOperand(&type4);
5084 auto op42 = model->addOperand(&type21);
5085 // Phase 2, operations
5086 static _Float16 op22_init[] = {0.25f, 0.25f, 0.25f, 0.25f};
5087 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 4);
5088 static _Float16 op32_init[] = {0.0f};
5089 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1);
5090 static int32_t param18_init[] = {2};
5091 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5092 static int32_t param19_init[] = {1};
5093 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5094 static int32_t param20_init[] = {1};
5095 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5096 static int32_t param21_init[] = {0};
5097 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5098 static bool8 layout_init[] = {true};
5099 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5100 static int32_t param22_init[] = {1};
5101 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5102 static int32_t param23_init[] = {1};
5103 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5104 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5105 // Phase 3, inputs and outputs
5106 model->identifyInputsAndOutputs(
5107 {op12},
5108 {op42});
5109 assert(model->isValid());
5110 }
5111
is_ignored_dynamic_output_shape_nchw_float16_3(int i)5112 inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) {
5113 static std::set<int> ignore = {};
5114 return ignore.find(i) != ignore.end();
5115 }
5116
CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model * model)5117 void CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model *model) {
5118 OperandType type0(Type::BOOL, {});
5119 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5120 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5121 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5122 OperandType type3(Type::TENSOR_FLOAT32, {1});
5123 OperandType type4(Type::INT32, {});
5124 // Phase 1, operands
5125 auto op12 = model->addOperand(&type13);
5126 auto op22 = model->addOperand(&type2);
5127 auto op32 = model->addOperand(&type3);
5128 auto param18 = model->addOperand(&type4);
5129 auto param19 = model->addOperand(&type4);
5130 auto param20 = model->addOperand(&type4);
5131 auto param21 = model->addOperand(&type4);
5132 auto layout = model->addOperand(&type0);
5133 auto param22 = model->addOperand(&type4);
5134 auto param23 = model->addOperand(&type4);
5135 auto op42 = model->addOperand(&type19);
5136 // Phase 2, operations
5137 static int32_t param18_init[] = {2};
5138 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5139 static int32_t param19_init[] = {1};
5140 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5141 static int32_t param20_init[] = {1};
5142 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5143 static int32_t param21_init[] = {0};
5144 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5145 static bool8 layout_init[] = {true};
5146 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5147 static int32_t param22_init[] = {1};
5148 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5149 static int32_t param23_init[] = {1};
5150 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5151 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5152 // Phase 3, inputs and outputs
5153 model->identifyInputsAndOutputs(
5154 {op12, op22, op32},
5155 {op42});
5156 assert(model->isValid());
5157 }
5158
is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i)5159 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i) {
5160 static std::set<int> ignore = {};
5161 return ignore.find(i) != ignore.end();
5162 }
5163
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_3(Model * model)5164 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_3(Model *model) {
5165 OperandType type0(Type::BOOL, {});
5166 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5167 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5168 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
5169 OperandType type3(Type::TENSOR_FLOAT32, {1});
5170 OperandType type4(Type::INT32, {});
5171 // Phase 1, operands
5172 auto op12 = model->addOperand(&type13);
5173 auto op22 = model->addOperand(&type2);
5174 auto op32 = model->addOperand(&type3);
5175 auto param18 = model->addOperand(&type4);
5176 auto param19 = model->addOperand(&type4);
5177 auto param20 = model->addOperand(&type4);
5178 auto param21 = model->addOperand(&type4);
5179 auto layout = model->addOperand(&type0);
5180 auto param22 = model->addOperand(&type4);
5181 auto param23 = model->addOperand(&type4);
5182 auto op42 = model->addOperand(&type19);
5183 // Phase 2, operations
5184 static int32_t param18_init[] = {2};
5185 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5186 static int32_t param19_init[] = {1};
5187 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5188 static int32_t param20_init[] = {1};
5189 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5190 static int32_t param21_init[] = {0};
5191 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5192 static bool8 layout_init[] = {true};
5193 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5194 static int32_t param22_init[] = {1};
5195 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5196 static int32_t param23_init[] = {1};
5197 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5198 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5199 // Phase 3, inputs and outputs
5200 model->identifyInputsAndOutputs(
5201 {op12, op22, op32},
5202 {op42});
5203 // Phase 4: set relaxed execution
5204 model->relaxComputationFloat32toFloat16(true);
5205 assert(model->isValid());
5206 }
5207
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_3(int i)5208 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_3(int i) {
5209 static std::set<int> ignore = {};
5210 return ignore.find(i) != ignore.end();
5211 }
5212
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_3(Model * model)5213 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_3(Model *model) {
5214 OperandType type0(Type::BOOL, {});
5215 OperandType type15(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0);
5216 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
5217 OperandType type4(Type::INT32, {});
5218 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
5219 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5220 // Phase 1, operands
5221 auto op12 = model->addOperand(&type15);
5222 auto op22 = model->addOperand(&type8);
5223 auto op32 = model->addOperand(&type9);
5224 auto param18 = model->addOperand(&type4);
5225 auto param19 = model->addOperand(&type4);
5226 auto param20 = model->addOperand(&type4);
5227 auto param21 = model->addOperand(&type4);
5228 auto layout = model->addOperand(&type0);
5229 auto param22 = model->addOperand(&type4);
5230 auto param23 = model->addOperand(&type4);
5231 auto op42 = model->addOperand(&type20);
5232 // Phase 2, operations
5233 static int32_t param18_init[] = {2};
5234 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5235 static int32_t param19_init[] = {1};
5236 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5237 static int32_t param20_init[] = {1};
5238 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5239 static int32_t param21_init[] = {0};
5240 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5241 static bool8 layout_init[] = {true};
5242 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5243 static int32_t param22_init[] = {1};
5244 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5245 static int32_t param23_init[] = {1};
5246 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5247 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5248 // Phase 3, inputs and outputs
5249 model->identifyInputsAndOutputs(
5250 {op12, op22, op32},
5251 {op42});
5252 assert(model->isValid());
5253 }
5254
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_3(int i)5255 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_3(int i) {
5256 static std::set<int> ignore = {};
5257 return ignore.find(i) != ignore.end();
5258 }
5259
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_3(Model * model)5260 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_3(Model *model) {
5261 OperandType type0(Type::BOOL, {});
5262 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
5263 OperandType type12(Type::TENSOR_FLOAT16, {1});
5264 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
5265 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5266 OperandType type4(Type::INT32, {});
5267 // Phase 1, operands
5268 auto op12 = model->addOperand(&type17);
5269 auto op22 = model->addOperand(&type11);
5270 auto op32 = model->addOperand(&type12);
5271 auto param18 = model->addOperand(&type4);
5272 auto param19 = model->addOperand(&type4);
5273 auto param20 = model->addOperand(&type4);
5274 auto param21 = model->addOperand(&type4);
5275 auto layout = model->addOperand(&type0);
5276 auto param22 = model->addOperand(&type4);
5277 auto param23 = model->addOperand(&type4);
5278 auto op42 = model->addOperand(&type21);
5279 // Phase 2, operations
5280 static int32_t param18_init[] = {2};
5281 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5282 static int32_t param19_init[] = {1};
5283 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5284 static int32_t param20_init[] = {1};
5285 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5286 static int32_t param21_init[] = {0};
5287 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
5288 static bool8 layout_init[] = {true};
5289 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5290 static int32_t param22_init[] = {1};
5291 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
5292 static int32_t param23_init[] = {1};
5293 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
5294 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param18, param19, param20, param21, layout, param22, param23}, {op42});
5295 // Phase 3, inputs and outputs
5296 model->identifyInputsAndOutputs(
5297 {op12, op22, op32},
5298 {op42});
5299 assert(model->isValid());
5300 }
5301
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_3(int i)5302 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_3(int i) {
5303 static std::set<int> ignore = {};
5304 return ignore.find(i) != ignore.end();
5305 }
5306
CreateModel_nhwc_4(Model * model)5307 void CreateModel_nhwc_4(Model *model) {
5308 OperandType type0(Type::BOOL, {});
5309 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5310 OperandType type3(Type::TENSOR_FLOAT32, {1});
5311 OperandType type4(Type::INT32, {});
5312 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
5313 // Phase 1, operands
5314 auto op13 = model->addOperand(&type5);
5315 auto op23 = model->addOperand(&type1);
5316 auto op33 = model->addOperand(&type3);
5317 auto param24 = model->addOperand(&type4);
5318 auto param25 = model->addOperand(&type4);
5319 auto param26 = model->addOperand(&type4);
5320 auto param27 = model->addOperand(&type4);
5321 auto layout = model->addOperand(&type0);
5322 auto param28 = model->addOperand(&type4);
5323 auto param29 = model->addOperand(&type4);
5324 auto op43 = model->addOperand(&type1);
5325 // Phase 2, operations
5326 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5327 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
5328 static float op33_init[] = {0.0f};
5329 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
5330 static int32_t param24_init[] = {2};
5331 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5332 static int32_t param25_init[] = {1};
5333 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5334 static int32_t param26_init[] = {1};
5335 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5336 static int32_t param27_init[] = {0};
5337 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5338 static bool8 layout_init[] = {false};
5339 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5340 static int32_t param28_init[] = {3};
5341 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5342 static int32_t param29_init[] = {3};
5343 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5344 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5345 // Phase 3, inputs and outputs
5346 model->identifyInputsAndOutputs(
5347 {op13},
5348 {op43});
5349 assert(model->isValid());
5350 }
5351
is_ignored_nhwc_4(int i)5352 inline bool is_ignored_nhwc_4(int i) {
5353 static std::set<int> ignore = {};
5354 return ignore.find(i) != ignore.end();
5355 }
5356
CreateModel_nhwc_relaxed_4(Model * model)5357 void CreateModel_nhwc_relaxed_4(Model *model) {
5358 OperandType type0(Type::BOOL, {});
5359 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5360 OperandType type3(Type::TENSOR_FLOAT32, {1});
5361 OperandType type4(Type::INT32, {});
5362 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
5363 // Phase 1, operands
5364 auto op13 = model->addOperand(&type5);
5365 auto op23 = model->addOperand(&type1);
5366 auto op33 = model->addOperand(&type3);
5367 auto param24 = model->addOperand(&type4);
5368 auto param25 = model->addOperand(&type4);
5369 auto param26 = model->addOperand(&type4);
5370 auto param27 = model->addOperand(&type4);
5371 auto layout = model->addOperand(&type0);
5372 auto param28 = model->addOperand(&type4);
5373 auto param29 = model->addOperand(&type4);
5374 auto op43 = model->addOperand(&type1);
5375 // Phase 2, operations
5376 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5377 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
5378 static float op33_init[] = {0.0f};
5379 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
5380 static int32_t param24_init[] = {2};
5381 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5382 static int32_t param25_init[] = {1};
5383 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5384 static int32_t param26_init[] = {1};
5385 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5386 static int32_t param27_init[] = {0};
5387 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5388 static bool8 layout_init[] = {false};
5389 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5390 static int32_t param28_init[] = {3};
5391 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5392 static int32_t param29_init[] = {3};
5393 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5394 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5395 // Phase 3, inputs and outputs
5396 model->identifyInputsAndOutputs(
5397 {op13},
5398 {op43});
5399 // Phase 4: set relaxed execution
5400 model->relaxComputationFloat32toFloat16(true);
5401 assert(model->isValid());
5402 }
5403
is_ignored_nhwc_relaxed_4(int i)5404 inline bool is_ignored_nhwc_relaxed_4(int i) {
5405 static std::set<int> ignore = {};
5406 return ignore.find(i) != ignore.end();
5407 }
5408
CreateModel_nhwc_quant8_4(Model * model)5409 void CreateModel_nhwc_quant8_4(Model *model) {
5410 OperandType type0(Type::BOOL, {});
5411 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
5412 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
5413 OperandType type4(Type::INT32, {});
5414 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5415 // Phase 1, operands
5416 auto op13 = model->addOperand(&type22);
5417 auto op23 = model->addOperand(&type23);
5418 auto op33 = model->addOperand(&type9);
5419 auto param24 = model->addOperand(&type4);
5420 auto param25 = model->addOperand(&type4);
5421 auto param26 = model->addOperand(&type4);
5422 auto param27 = model->addOperand(&type4);
5423 auto layout = model->addOperand(&type0);
5424 auto param28 = model->addOperand(&type4);
5425 auto param29 = model->addOperand(&type4);
5426 auto op43 = model->addOperand(&type23);
5427 // Phase 2, operations
5428 static uint8_t op23_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
5429 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9);
5430 static int32_t op33_init[] = {0};
5431 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1);
5432 static int32_t param24_init[] = {2};
5433 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5434 static int32_t param25_init[] = {1};
5435 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5436 static int32_t param26_init[] = {1};
5437 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5438 static int32_t param27_init[] = {0};
5439 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5440 static bool8 layout_init[] = {false};
5441 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5442 static int32_t param28_init[] = {3};
5443 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5444 static int32_t param29_init[] = {3};
5445 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5446 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5447 // Phase 3, inputs and outputs
5448 model->identifyInputsAndOutputs(
5449 {op13},
5450 {op43});
5451 assert(model->isValid());
5452 }
5453
is_ignored_nhwc_quant8_4(int i)5454 inline bool is_ignored_nhwc_quant8_4(int i) {
5455 static std::set<int> ignore = {};
5456 return ignore.find(i) != ignore.end();
5457 }
5458
CreateModel_nhwc_float16_4(Model * model)5459 void CreateModel_nhwc_float16_4(Model *model) {
5460 OperandType type0(Type::BOOL, {});
5461 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
5462 OperandType type12(Type::TENSOR_FLOAT16, {1});
5463 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
5464 OperandType type4(Type::INT32, {});
5465 // Phase 1, operands
5466 auto op13 = model->addOperand(&type24);
5467 auto op23 = model->addOperand(&type10);
5468 auto op33 = model->addOperand(&type12);
5469 auto param24 = model->addOperand(&type4);
5470 auto param25 = model->addOperand(&type4);
5471 auto param26 = model->addOperand(&type4);
5472 auto param27 = model->addOperand(&type4);
5473 auto layout = model->addOperand(&type0);
5474 auto param28 = model->addOperand(&type4);
5475 auto param29 = model->addOperand(&type4);
5476 auto op43 = model->addOperand(&type10);
5477 // Phase 2, operations
5478 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5479 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9);
5480 static _Float16 op33_init[] = {0.0f};
5481 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1);
5482 static int32_t param24_init[] = {2};
5483 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5484 static int32_t param25_init[] = {1};
5485 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5486 static int32_t param26_init[] = {1};
5487 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5488 static int32_t param27_init[] = {0};
5489 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5490 static bool8 layout_init[] = {false};
5491 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5492 static int32_t param28_init[] = {3};
5493 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5494 static int32_t param29_init[] = {3};
5495 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5496 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5497 // Phase 3, inputs and outputs
5498 model->identifyInputsAndOutputs(
5499 {op13},
5500 {op43});
5501 assert(model->isValid());
5502 }
5503
is_ignored_nhwc_float16_4(int i)5504 inline bool is_ignored_nhwc_float16_4(int i) {
5505 static std::set<int> ignore = {};
5506 return ignore.find(i) != ignore.end();
5507 }
5508
CreateModel_nhwc_weight_as_input_4(Model * model)5509 void CreateModel_nhwc_weight_as_input_4(Model *model) {
5510 OperandType type0(Type::BOOL, {});
5511 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5512 OperandType type3(Type::TENSOR_FLOAT32, {1});
5513 OperandType type4(Type::INT32, {});
5514 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
5515 // Phase 1, operands
5516 auto op13 = model->addOperand(&type5);
5517 auto op23 = model->addOperand(&type1);
5518 auto op33 = model->addOperand(&type3);
5519 auto param24 = model->addOperand(&type4);
5520 auto param25 = model->addOperand(&type4);
5521 auto param26 = model->addOperand(&type4);
5522 auto param27 = model->addOperand(&type4);
5523 auto layout = model->addOperand(&type0);
5524 auto param28 = model->addOperand(&type4);
5525 auto param29 = model->addOperand(&type4);
5526 auto op43 = model->addOperand(&type1);
5527 // Phase 2, operations
5528 static int32_t param24_init[] = {2};
5529 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5530 static int32_t param25_init[] = {1};
5531 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5532 static int32_t param26_init[] = {1};
5533 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5534 static int32_t param27_init[] = {0};
5535 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5536 static bool8 layout_init[] = {false};
5537 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5538 static int32_t param28_init[] = {3};
5539 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5540 static int32_t param29_init[] = {3};
5541 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5542 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5543 // Phase 3, inputs and outputs
5544 model->identifyInputsAndOutputs(
5545 {op13, op23, op33},
5546 {op43});
5547 assert(model->isValid());
5548 }
5549
is_ignored_nhwc_weight_as_input_4(int i)5550 inline bool is_ignored_nhwc_weight_as_input_4(int i) {
5551 static std::set<int> ignore = {};
5552 return ignore.find(i) != ignore.end();
5553 }
5554
CreateModel_nhwc_weight_as_input_relaxed_4(Model * model)5555 void CreateModel_nhwc_weight_as_input_relaxed_4(Model *model) {
5556 OperandType type0(Type::BOOL, {});
5557 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5558 OperandType type3(Type::TENSOR_FLOAT32, {1});
5559 OperandType type4(Type::INT32, {});
5560 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
5561 // Phase 1, operands
5562 auto op13 = model->addOperand(&type5);
5563 auto op23 = model->addOperand(&type1);
5564 auto op33 = model->addOperand(&type3);
5565 auto param24 = model->addOperand(&type4);
5566 auto param25 = model->addOperand(&type4);
5567 auto param26 = model->addOperand(&type4);
5568 auto param27 = model->addOperand(&type4);
5569 auto layout = model->addOperand(&type0);
5570 auto param28 = model->addOperand(&type4);
5571 auto param29 = model->addOperand(&type4);
5572 auto op43 = model->addOperand(&type1);
5573 // Phase 2, operations
5574 static int32_t param24_init[] = {2};
5575 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5576 static int32_t param25_init[] = {1};
5577 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5578 static int32_t param26_init[] = {1};
5579 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5580 static int32_t param27_init[] = {0};
5581 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5582 static bool8 layout_init[] = {false};
5583 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5584 static int32_t param28_init[] = {3};
5585 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5586 static int32_t param29_init[] = {3};
5587 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5588 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5589 // Phase 3, inputs and outputs
5590 model->identifyInputsAndOutputs(
5591 {op13, op23, op33},
5592 {op43});
5593 // Phase 4: set relaxed execution
5594 model->relaxComputationFloat32toFloat16(true);
5595 assert(model->isValid());
5596 }
5597
is_ignored_nhwc_weight_as_input_relaxed_4(int i)5598 inline bool is_ignored_nhwc_weight_as_input_relaxed_4(int i) {
5599 static std::set<int> ignore = {};
5600 return ignore.find(i) != ignore.end();
5601 }
5602
CreateModel_nhwc_weight_as_input_quant8_4(Model * model)5603 void CreateModel_nhwc_weight_as_input_quant8_4(Model *model) {
5604 OperandType type0(Type::BOOL, {});
5605 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
5606 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
5607 OperandType type4(Type::INT32, {});
5608 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5609 // Phase 1, operands
5610 auto op13 = model->addOperand(&type22);
5611 auto op23 = model->addOperand(&type23);
5612 auto op33 = model->addOperand(&type9);
5613 auto param24 = model->addOperand(&type4);
5614 auto param25 = model->addOperand(&type4);
5615 auto param26 = model->addOperand(&type4);
5616 auto param27 = model->addOperand(&type4);
5617 auto layout = model->addOperand(&type0);
5618 auto param28 = model->addOperand(&type4);
5619 auto param29 = model->addOperand(&type4);
5620 auto op43 = model->addOperand(&type23);
5621 // Phase 2, operations
5622 static int32_t param24_init[] = {2};
5623 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5624 static int32_t param25_init[] = {1};
5625 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5626 static int32_t param26_init[] = {1};
5627 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5628 static int32_t param27_init[] = {0};
5629 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5630 static bool8 layout_init[] = {false};
5631 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5632 static int32_t param28_init[] = {3};
5633 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5634 static int32_t param29_init[] = {3};
5635 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5636 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5637 // Phase 3, inputs and outputs
5638 model->identifyInputsAndOutputs(
5639 {op13, op23, op33},
5640 {op43});
5641 assert(model->isValid());
5642 }
5643
is_ignored_nhwc_weight_as_input_quant8_4(int i)5644 inline bool is_ignored_nhwc_weight_as_input_quant8_4(int i) {
5645 static std::set<int> ignore = {};
5646 return ignore.find(i) != ignore.end();
5647 }
5648
CreateModel_nhwc_weight_as_input_float16_4(Model * model)5649 void CreateModel_nhwc_weight_as_input_float16_4(Model *model) {
5650 OperandType type0(Type::BOOL, {});
5651 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
5652 OperandType type12(Type::TENSOR_FLOAT16, {1});
5653 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
5654 OperandType type4(Type::INT32, {});
5655 // Phase 1, operands
5656 auto op13 = model->addOperand(&type24);
5657 auto op23 = model->addOperand(&type10);
5658 auto op33 = model->addOperand(&type12);
5659 auto param24 = model->addOperand(&type4);
5660 auto param25 = model->addOperand(&type4);
5661 auto param26 = model->addOperand(&type4);
5662 auto param27 = model->addOperand(&type4);
5663 auto layout = model->addOperand(&type0);
5664 auto param28 = model->addOperand(&type4);
5665 auto param29 = model->addOperand(&type4);
5666 auto op43 = model->addOperand(&type10);
5667 // Phase 2, operations
5668 static int32_t param24_init[] = {2};
5669 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5670 static int32_t param25_init[] = {1};
5671 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5672 static int32_t param26_init[] = {1};
5673 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5674 static int32_t param27_init[] = {0};
5675 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5676 static bool8 layout_init[] = {false};
5677 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5678 static int32_t param28_init[] = {3};
5679 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5680 static int32_t param29_init[] = {3};
5681 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5682 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5683 // Phase 3, inputs and outputs
5684 model->identifyInputsAndOutputs(
5685 {op13, op23, op33},
5686 {op43});
5687 assert(model->isValid());
5688 }
5689
is_ignored_nhwc_weight_as_input_float16_4(int i)5690 inline bool is_ignored_nhwc_weight_as_input_float16_4(int i) {
5691 static std::set<int> ignore = {};
5692 return ignore.find(i) != ignore.end();
5693 }
5694
CreateModel_nchw_4(Model * model)5695 void CreateModel_nchw_4(Model *model) {
5696 OperandType type0(Type::BOOL, {});
5697 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5698 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5699 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
5700 OperandType type3(Type::TENSOR_FLOAT32, {1});
5701 OperandType type4(Type::INT32, {});
5702 // Phase 1, operands
5703 auto op13 = model->addOperand(&type25);
5704 auto op23 = model->addOperand(&type1);
5705 auto op33 = model->addOperand(&type3);
5706 auto param24 = model->addOperand(&type4);
5707 auto param25 = model->addOperand(&type4);
5708 auto param26 = model->addOperand(&type4);
5709 auto param27 = model->addOperand(&type4);
5710 auto layout = model->addOperand(&type0);
5711 auto param28 = model->addOperand(&type4);
5712 auto param29 = model->addOperand(&type4);
5713 auto op43 = model->addOperand(&type13);
5714 // Phase 2, operations
5715 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5716 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
5717 static float op33_init[] = {0.0f};
5718 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
5719 static int32_t param24_init[] = {2};
5720 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5721 static int32_t param25_init[] = {1};
5722 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5723 static int32_t param26_init[] = {1};
5724 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5725 static int32_t param27_init[] = {0};
5726 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5727 static bool8 layout_init[] = {true};
5728 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5729 static int32_t param28_init[] = {3};
5730 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5731 static int32_t param29_init[] = {3};
5732 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5733 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5734 // Phase 3, inputs and outputs
5735 model->identifyInputsAndOutputs(
5736 {op13},
5737 {op43});
5738 assert(model->isValid());
5739 }
5740
is_ignored_nchw_4(int i)5741 inline bool is_ignored_nchw_4(int i) {
5742 static std::set<int> ignore = {};
5743 return ignore.find(i) != ignore.end();
5744 }
5745
CreateModel_nchw_relaxed_4(Model * model)5746 void CreateModel_nchw_relaxed_4(Model *model) {
5747 OperandType type0(Type::BOOL, {});
5748 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5749 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5750 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
5751 OperandType type3(Type::TENSOR_FLOAT32, {1});
5752 OperandType type4(Type::INT32, {});
5753 // Phase 1, operands
5754 auto op13 = model->addOperand(&type25);
5755 auto op23 = model->addOperand(&type1);
5756 auto op33 = model->addOperand(&type3);
5757 auto param24 = model->addOperand(&type4);
5758 auto param25 = model->addOperand(&type4);
5759 auto param26 = model->addOperand(&type4);
5760 auto param27 = model->addOperand(&type4);
5761 auto layout = model->addOperand(&type0);
5762 auto param28 = model->addOperand(&type4);
5763 auto param29 = model->addOperand(&type4);
5764 auto op43 = model->addOperand(&type13);
5765 // Phase 2, operations
5766 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5767 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
5768 static float op33_init[] = {0.0f};
5769 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
5770 static int32_t param24_init[] = {2};
5771 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5772 static int32_t param25_init[] = {1};
5773 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5774 static int32_t param26_init[] = {1};
5775 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5776 static int32_t param27_init[] = {0};
5777 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5778 static bool8 layout_init[] = {true};
5779 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5780 static int32_t param28_init[] = {3};
5781 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5782 static int32_t param29_init[] = {3};
5783 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5784 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5785 // Phase 3, inputs and outputs
5786 model->identifyInputsAndOutputs(
5787 {op13},
5788 {op43});
5789 // Phase 4: set relaxed execution
5790 model->relaxComputationFloat32toFloat16(true);
5791 assert(model->isValid());
5792 }
5793
is_ignored_nchw_relaxed_4(int i)5794 inline bool is_ignored_nchw_relaxed_4(int i) {
5795 static std::set<int> ignore = {};
5796 return ignore.find(i) != ignore.end();
5797 }
5798
CreateModel_nchw_quant8_4(Model * model)5799 void CreateModel_nchw_quant8_4(Model *model) {
5800 OperandType type0(Type::BOOL, {});
5801 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
5802 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
5803 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
5804 OperandType type4(Type::INT32, {});
5805 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
5806 // Phase 1, operands
5807 auto op13 = model->addOperand(&type26);
5808 auto op23 = model->addOperand(&type23);
5809 auto op33 = model->addOperand(&type9);
5810 auto param24 = model->addOperand(&type4);
5811 auto param25 = model->addOperand(&type4);
5812 auto param26 = model->addOperand(&type4);
5813 auto param27 = model->addOperand(&type4);
5814 auto layout = model->addOperand(&type0);
5815 auto param28 = model->addOperand(&type4);
5816 auto param29 = model->addOperand(&type4);
5817 auto op43 = model->addOperand(&type27);
5818 // Phase 2, operations
5819 static uint8_t op23_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
5820 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9);
5821 static int32_t op33_init[] = {0};
5822 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1);
5823 static int32_t param24_init[] = {2};
5824 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5825 static int32_t param25_init[] = {1};
5826 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5827 static int32_t param26_init[] = {1};
5828 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5829 static int32_t param27_init[] = {0};
5830 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5831 static bool8 layout_init[] = {true};
5832 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5833 static int32_t param28_init[] = {3};
5834 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5835 static int32_t param29_init[] = {3};
5836 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5837 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5838 // Phase 3, inputs and outputs
5839 model->identifyInputsAndOutputs(
5840 {op13},
5841 {op43});
5842 assert(model->isValid());
5843 }
5844
is_ignored_nchw_quant8_4(int i)5845 inline bool is_ignored_nchw_quant8_4(int i) {
5846 static std::set<int> ignore = {};
5847 return ignore.find(i) != ignore.end();
5848 }
5849
CreateModel_nchw_float16_4(Model * model)5850 void CreateModel_nchw_float16_4(Model *model) {
5851 OperandType type0(Type::BOOL, {});
5852 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
5853 OperandType type12(Type::TENSOR_FLOAT16, {1});
5854 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
5855 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
5856 OperandType type4(Type::INT32, {});
5857 // Phase 1, operands
5858 auto op13 = model->addOperand(&type28);
5859 auto op23 = model->addOperand(&type10);
5860 auto op33 = model->addOperand(&type12);
5861 auto param24 = model->addOperand(&type4);
5862 auto param25 = model->addOperand(&type4);
5863 auto param26 = model->addOperand(&type4);
5864 auto param27 = model->addOperand(&type4);
5865 auto layout = model->addOperand(&type0);
5866 auto param28 = model->addOperand(&type4);
5867 auto param29 = model->addOperand(&type4);
5868 auto op43 = model->addOperand(&type17);
5869 // Phase 2, operations
5870 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
5871 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9);
5872 static _Float16 op33_init[] = {0.0f};
5873 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1);
5874 static int32_t param24_init[] = {2};
5875 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5876 static int32_t param25_init[] = {1};
5877 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5878 static int32_t param26_init[] = {1};
5879 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5880 static int32_t param27_init[] = {0};
5881 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5882 static bool8 layout_init[] = {true};
5883 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5884 static int32_t param28_init[] = {3};
5885 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5886 static int32_t param29_init[] = {3};
5887 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5888 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5889 // Phase 3, inputs and outputs
5890 model->identifyInputsAndOutputs(
5891 {op13},
5892 {op43});
5893 assert(model->isValid());
5894 }
5895
is_ignored_nchw_float16_4(int i)5896 inline bool is_ignored_nchw_float16_4(int i) {
5897 static std::set<int> ignore = {};
5898 return ignore.find(i) != ignore.end();
5899 }
5900
CreateModel_nchw_weight_as_input_4(Model * model)5901 void CreateModel_nchw_weight_as_input_4(Model *model) {
5902 OperandType type0(Type::BOOL, {});
5903 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5904 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5905 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
5906 OperandType type3(Type::TENSOR_FLOAT32, {1});
5907 OperandType type4(Type::INT32, {});
5908 // Phase 1, operands
5909 auto op13 = model->addOperand(&type25);
5910 auto op23 = model->addOperand(&type1);
5911 auto op33 = model->addOperand(&type3);
5912 auto param24 = model->addOperand(&type4);
5913 auto param25 = model->addOperand(&type4);
5914 auto param26 = model->addOperand(&type4);
5915 auto param27 = model->addOperand(&type4);
5916 auto layout = model->addOperand(&type0);
5917 auto param28 = model->addOperand(&type4);
5918 auto param29 = model->addOperand(&type4);
5919 auto op43 = model->addOperand(&type13);
5920 // Phase 2, operations
5921 static int32_t param24_init[] = {2};
5922 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5923 static int32_t param25_init[] = {1};
5924 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5925 static int32_t param26_init[] = {1};
5926 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5927 static int32_t param27_init[] = {0};
5928 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5929 static bool8 layout_init[] = {true};
5930 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5931 static int32_t param28_init[] = {3};
5932 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5933 static int32_t param29_init[] = {3};
5934 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5935 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5936 // Phase 3, inputs and outputs
5937 model->identifyInputsAndOutputs(
5938 {op13, op23, op33},
5939 {op43});
5940 assert(model->isValid());
5941 }
5942
is_ignored_nchw_weight_as_input_4(int i)5943 inline bool is_ignored_nchw_weight_as_input_4(int i) {
5944 static std::set<int> ignore = {};
5945 return ignore.find(i) != ignore.end();
5946 }
5947
CreateModel_nchw_weight_as_input_relaxed_4(Model * model)5948 void CreateModel_nchw_weight_as_input_relaxed_4(Model *model) {
5949 OperandType type0(Type::BOOL, {});
5950 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
5951 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
5952 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
5953 OperandType type3(Type::TENSOR_FLOAT32, {1});
5954 OperandType type4(Type::INT32, {});
5955 // Phase 1, operands
5956 auto op13 = model->addOperand(&type25);
5957 auto op23 = model->addOperand(&type1);
5958 auto op33 = model->addOperand(&type3);
5959 auto param24 = model->addOperand(&type4);
5960 auto param25 = model->addOperand(&type4);
5961 auto param26 = model->addOperand(&type4);
5962 auto param27 = model->addOperand(&type4);
5963 auto layout = model->addOperand(&type0);
5964 auto param28 = model->addOperand(&type4);
5965 auto param29 = model->addOperand(&type4);
5966 auto op43 = model->addOperand(&type13);
5967 // Phase 2, operations
5968 static int32_t param24_init[] = {2};
5969 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
5970 static int32_t param25_init[] = {1};
5971 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
5972 static int32_t param26_init[] = {1};
5973 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
5974 static int32_t param27_init[] = {0};
5975 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
5976 static bool8 layout_init[] = {true};
5977 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5978 static int32_t param28_init[] = {3};
5979 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
5980 static int32_t param29_init[] = {3};
5981 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
5982 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
5983 // Phase 3, inputs and outputs
5984 model->identifyInputsAndOutputs(
5985 {op13, op23, op33},
5986 {op43});
5987 // Phase 4: set relaxed execution
5988 model->relaxComputationFloat32toFloat16(true);
5989 assert(model->isValid());
5990 }
5991
is_ignored_nchw_weight_as_input_relaxed_4(int i)5992 inline bool is_ignored_nchw_weight_as_input_relaxed_4(int i) {
5993 static std::set<int> ignore = {};
5994 return ignore.find(i) != ignore.end();
5995 }
5996
CreateModel_nchw_weight_as_input_quant8_4(Model * model)5997 void CreateModel_nchw_weight_as_input_quant8_4(Model *model) {
5998 OperandType type0(Type::BOOL, {});
5999 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6000 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
6001 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
6002 OperandType type4(Type::INT32, {});
6003 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6004 // Phase 1, operands
6005 auto op13 = model->addOperand(&type26);
6006 auto op23 = model->addOperand(&type23);
6007 auto op33 = model->addOperand(&type9);
6008 auto param24 = model->addOperand(&type4);
6009 auto param25 = model->addOperand(&type4);
6010 auto param26 = model->addOperand(&type4);
6011 auto param27 = model->addOperand(&type4);
6012 auto layout = model->addOperand(&type0);
6013 auto param28 = model->addOperand(&type4);
6014 auto param29 = model->addOperand(&type4);
6015 auto op43 = model->addOperand(&type27);
6016 // Phase 2, operations
6017 static int32_t param24_init[] = {2};
6018 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6019 static int32_t param25_init[] = {1};
6020 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6021 static int32_t param26_init[] = {1};
6022 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6023 static int32_t param27_init[] = {0};
6024 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6025 static bool8 layout_init[] = {true};
6026 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6027 static int32_t param28_init[] = {3};
6028 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6029 static int32_t param29_init[] = {3};
6030 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6031 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6032 // Phase 3, inputs and outputs
6033 model->identifyInputsAndOutputs(
6034 {op13, op23, op33},
6035 {op43});
6036 assert(model->isValid());
6037 }
6038
is_ignored_nchw_weight_as_input_quant8_4(int i)6039 inline bool is_ignored_nchw_weight_as_input_quant8_4(int i) {
6040 static std::set<int> ignore = {};
6041 return ignore.find(i) != ignore.end();
6042 }
6043
CreateModel_nchw_weight_as_input_float16_4(Model * model)6044 void CreateModel_nchw_weight_as_input_float16_4(Model *model) {
6045 OperandType type0(Type::BOOL, {});
6046 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
6047 OperandType type12(Type::TENSOR_FLOAT16, {1});
6048 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
6049 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
6050 OperandType type4(Type::INT32, {});
6051 // Phase 1, operands
6052 auto op13 = model->addOperand(&type28);
6053 auto op23 = model->addOperand(&type10);
6054 auto op33 = model->addOperand(&type12);
6055 auto param24 = model->addOperand(&type4);
6056 auto param25 = model->addOperand(&type4);
6057 auto param26 = model->addOperand(&type4);
6058 auto param27 = model->addOperand(&type4);
6059 auto layout = model->addOperand(&type0);
6060 auto param28 = model->addOperand(&type4);
6061 auto param29 = model->addOperand(&type4);
6062 auto op43 = model->addOperand(&type17);
6063 // Phase 2, operations
6064 static int32_t param24_init[] = {2};
6065 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6066 static int32_t param25_init[] = {1};
6067 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6068 static int32_t param26_init[] = {1};
6069 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6070 static int32_t param27_init[] = {0};
6071 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6072 static bool8 layout_init[] = {true};
6073 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6074 static int32_t param28_init[] = {3};
6075 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6076 static int32_t param29_init[] = {3};
6077 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6078 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6079 // Phase 3, inputs and outputs
6080 model->identifyInputsAndOutputs(
6081 {op13, op23, op33},
6082 {op43});
6083 assert(model->isValid());
6084 }
6085
is_ignored_nchw_weight_as_input_float16_4(int i)6086 inline bool is_ignored_nchw_weight_as_input_float16_4(int i) {
6087 static std::set<int> ignore = {};
6088 return ignore.find(i) != ignore.end();
6089 }
6090
CreateModel_dynamic_output_shape_nhwc_4(Model * model)6091 void CreateModel_dynamic_output_shape_nhwc_4(Model *model) {
6092 OperandType type0(Type::BOOL, {});
6093 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6094 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6095 OperandType type3(Type::TENSOR_FLOAT32, {1});
6096 OperandType type4(Type::INT32, {});
6097 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
6098 // Phase 1, operands
6099 auto op13 = model->addOperand(&type5);
6100 auto op23 = model->addOperand(&type1);
6101 auto op33 = model->addOperand(&type3);
6102 auto param24 = model->addOperand(&type4);
6103 auto param25 = model->addOperand(&type4);
6104 auto param26 = model->addOperand(&type4);
6105 auto param27 = model->addOperand(&type4);
6106 auto layout = model->addOperand(&type0);
6107 auto param28 = model->addOperand(&type4);
6108 auto param29 = model->addOperand(&type4);
6109 auto op43 = model->addOperand(&type19);
6110 // Phase 2, operations
6111 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6112 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
6113 static float op33_init[] = {0.0f};
6114 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
6115 static int32_t param24_init[] = {2};
6116 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6117 static int32_t param25_init[] = {1};
6118 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6119 static int32_t param26_init[] = {1};
6120 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6121 static int32_t param27_init[] = {0};
6122 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6123 static bool8 layout_init[] = {false};
6124 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6125 static int32_t param28_init[] = {3};
6126 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6127 static int32_t param29_init[] = {3};
6128 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6129 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6130 // Phase 3, inputs and outputs
6131 model->identifyInputsAndOutputs(
6132 {op13},
6133 {op43});
6134 assert(model->isValid());
6135 }
6136
is_ignored_dynamic_output_shape_nhwc_4(int i)6137 inline bool is_ignored_dynamic_output_shape_nhwc_4(int i) {
6138 static std::set<int> ignore = {};
6139 return ignore.find(i) != ignore.end();
6140 }
6141
CreateModel_dynamic_output_shape_nhwc_relaxed_4(Model * model)6142 void CreateModel_dynamic_output_shape_nhwc_relaxed_4(Model *model) {
6143 OperandType type0(Type::BOOL, {});
6144 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6145 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6146 OperandType type3(Type::TENSOR_FLOAT32, {1});
6147 OperandType type4(Type::INT32, {});
6148 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
6149 // Phase 1, operands
6150 auto op13 = model->addOperand(&type5);
6151 auto op23 = model->addOperand(&type1);
6152 auto op33 = model->addOperand(&type3);
6153 auto param24 = model->addOperand(&type4);
6154 auto param25 = model->addOperand(&type4);
6155 auto param26 = model->addOperand(&type4);
6156 auto param27 = model->addOperand(&type4);
6157 auto layout = model->addOperand(&type0);
6158 auto param28 = model->addOperand(&type4);
6159 auto param29 = model->addOperand(&type4);
6160 auto op43 = model->addOperand(&type19);
6161 // Phase 2, operations
6162 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6163 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
6164 static float op33_init[] = {0.0f};
6165 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
6166 static int32_t param24_init[] = {2};
6167 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6168 static int32_t param25_init[] = {1};
6169 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6170 static int32_t param26_init[] = {1};
6171 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6172 static int32_t param27_init[] = {0};
6173 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6174 static bool8 layout_init[] = {false};
6175 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6176 static int32_t param28_init[] = {3};
6177 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6178 static int32_t param29_init[] = {3};
6179 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6180 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6181 // Phase 3, inputs and outputs
6182 model->identifyInputsAndOutputs(
6183 {op13},
6184 {op43});
6185 // Phase 4: set relaxed execution
6186 model->relaxComputationFloat32toFloat16(true);
6187 assert(model->isValid());
6188 }
6189
is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i)6190 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i) {
6191 static std::set<int> ignore = {};
6192 return ignore.find(i) != ignore.end();
6193 }
6194
CreateModel_dynamic_output_shape_nhwc_quant8_4(Model * model)6195 void CreateModel_dynamic_output_shape_nhwc_quant8_4(Model *model) {
6196 OperandType type0(Type::BOOL, {});
6197 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
6198 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
6199 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6200 OperandType type4(Type::INT32, {});
6201 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6202 // Phase 1, operands
6203 auto op13 = model->addOperand(&type22);
6204 auto op23 = model->addOperand(&type23);
6205 auto op33 = model->addOperand(&type9);
6206 auto param24 = model->addOperand(&type4);
6207 auto param25 = model->addOperand(&type4);
6208 auto param26 = model->addOperand(&type4);
6209 auto param27 = model->addOperand(&type4);
6210 auto layout = model->addOperand(&type0);
6211 auto param28 = model->addOperand(&type4);
6212 auto param29 = model->addOperand(&type4);
6213 auto op43 = model->addOperand(&type20);
6214 // Phase 2, operations
6215 static uint8_t op23_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
6216 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9);
6217 static int32_t op33_init[] = {0};
6218 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1);
6219 static int32_t param24_init[] = {2};
6220 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6221 static int32_t param25_init[] = {1};
6222 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6223 static int32_t param26_init[] = {1};
6224 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6225 static int32_t param27_init[] = {0};
6226 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6227 static bool8 layout_init[] = {false};
6228 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6229 static int32_t param28_init[] = {3};
6230 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6231 static int32_t param29_init[] = {3};
6232 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6233 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6234 // Phase 3, inputs and outputs
6235 model->identifyInputsAndOutputs(
6236 {op13},
6237 {op43});
6238 assert(model->isValid());
6239 }
6240
is_ignored_dynamic_output_shape_nhwc_quant8_4(int i)6241 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_4(int i) {
6242 static std::set<int> ignore = {};
6243 return ignore.find(i) != ignore.end();
6244 }
6245
CreateModel_dynamic_output_shape_nhwc_float16_4(Model * model)6246 void CreateModel_dynamic_output_shape_nhwc_float16_4(Model *model) {
6247 OperandType type0(Type::BOOL, {});
6248 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
6249 OperandType type12(Type::TENSOR_FLOAT16, {1});
6250 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6251 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
6252 OperandType type4(Type::INT32, {});
6253 // Phase 1, operands
6254 auto op13 = model->addOperand(&type24);
6255 auto op23 = model->addOperand(&type10);
6256 auto op33 = model->addOperand(&type12);
6257 auto param24 = model->addOperand(&type4);
6258 auto param25 = model->addOperand(&type4);
6259 auto param26 = model->addOperand(&type4);
6260 auto param27 = model->addOperand(&type4);
6261 auto layout = model->addOperand(&type0);
6262 auto param28 = model->addOperand(&type4);
6263 auto param29 = model->addOperand(&type4);
6264 auto op43 = model->addOperand(&type21);
6265 // Phase 2, operations
6266 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6267 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9);
6268 static _Float16 op33_init[] = {0.0f};
6269 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1);
6270 static int32_t param24_init[] = {2};
6271 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6272 static int32_t param25_init[] = {1};
6273 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6274 static int32_t param26_init[] = {1};
6275 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6276 static int32_t param27_init[] = {0};
6277 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6278 static bool8 layout_init[] = {false};
6279 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6280 static int32_t param28_init[] = {3};
6281 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6282 static int32_t param29_init[] = {3};
6283 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6284 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6285 // Phase 3, inputs and outputs
6286 model->identifyInputsAndOutputs(
6287 {op13},
6288 {op43});
6289 assert(model->isValid());
6290 }
6291
is_ignored_dynamic_output_shape_nhwc_float16_4(int i)6292 inline bool is_ignored_dynamic_output_shape_nhwc_float16_4(int i) {
6293 static std::set<int> ignore = {};
6294 return ignore.find(i) != ignore.end();
6295 }
6296
CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model * model)6297 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model *model) {
6298 OperandType type0(Type::BOOL, {});
6299 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6300 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6301 OperandType type3(Type::TENSOR_FLOAT32, {1});
6302 OperandType type4(Type::INT32, {});
6303 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
6304 // Phase 1, operands
6305 auto op13 = model->addOperand(&type5);
6306 auto op23 = model->addOperand(&type1);
6307 auto op33 = model->addOperand(&type3);
6308 auto param24 = model->addOperand(&type4);
6309 auto param25 = model->addOperand(&type4);
6310 auto param26 = model->addOperand(&type4);
6311 auto param27 = model->addOperand(&type4);
6312 auto layout = model->addOperand(&type0);
6313 auto param28 = model->addOperand(&type4);
6314 auto param29 = model->addOperand(&type4);
6315 auto op43 = model->addOperand(&type19);
6316 // Phase 2, operations
6317 static int32_t param24_init[] = {2};
6318 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6319 static int32_t param25_init[] = {1};
6320 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6321 static int32_t param26_init[] = {1};
6322 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6323 static int32_t param27_init[] = {0};
6324 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6325 static bool8 layout_init[] = {false};
6326 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6327 static int32_t param28_init[] = {3};
6328 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6329 static int32_t param29_init[] = {3};
6330 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6331 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6332 // Phase 3, inputs and outputs
6333 model->identifyInputsAndOutputs(
6334 {op13, op23, op33},
6335 {op43});
6336 assert(model->isValid());
6337 }
6338
is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i)6339 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i) {
6340 static std::set<int> ignore = {};
6341 return ignore.find(i) != ignore.end();
6342 }
6343
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_4(Model * model)6344 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_4(Model *model) {
6345 OperandType type0(Type::BOOL, {});
6346 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6347 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6348 OperandType type3(Type::TENSOR_FLOAT32, {1});
6349 OperandType type4(Type::INT32, {});
6350 OperandType type5(Type::TENSOR_FLOAT32, {1, 9, 9, 1});
6351 // Phase 1, operands
6352 auto op13 = model->addOperand(&type5);
6353 auto op23 = model->addOperand(&type1);
6354 auto op33 = model->addOperand(&type3);
6355 auto param24 = model->addOperand(&type4);
6356 auto param25 = model->addOperand(&type4);
6357 auto param26 = model->addOperand(&type4);
6358 auto param27 = model->addOperand(&type4);
6359 auto layout = model->addOperand(&type0);
6360 auto param28 = model->addOperand(&type4);
6361 auto param29 = model->addOperand(&type4);
6362 auto op43 = model->addOperand(&type19);
6363 // Phase 2, operations
6364 static int32_t param24_init[] = {2};
6365 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6366 static int32_t param25_init[] = {1};
6367 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6368 static int32_t param26_init[] = {1};
6369 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6370 static int32_t param27_init[] = {0};
6371 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6372 static bool8 layout_init[] = {false};
6373 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6374 static int32_t param28_init[] = {3};
6375 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6376 static int32_t param29_init[] = {3};
6377 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6378 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6379 // Phase 3, inputs and outputs
6380 model->identifyInputsAndOutputs(
6381 {op13, op23, op33},
6382 {op43});
6383 // Phase 4: set relaxed execution
6384 model->relaxComputationFloat32toFloat16(true);
6385 assert(model->isValid());
6386 }
6387
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_4(int i)6388 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_4(int i) {
6389 static std::set<int> ignore = {};
6390 return ignore.find(i) != ignore.end();
6391 }
6392
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_4(Model * model)6393 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_4(Model *model) {
6394 OperandType type0(Type::BOOL, {});
6395 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
6396 OperandType type22(Type::TENSOR_QUANT8_ASYMM, {1, 9, 9, 1}, 0.5f, 0);
6397 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6398 OperandType type4(Type::INT32, {});
6399 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6400 // Phase 1, operands
6401 auto op13 = model->addOperand(&type22);
6402 auto op23 = model->addOperand(&type23);
6403 auto op33 = model->addOperand(&type9);
6404 auto param24 = model->addOperand(&type4);
6405 auto param25 = model->addOperand(&type4);
6406 auto param26 = model->addOperand(&type4);
6407 auto param27 = model->addOperand(&type4);
6408 auto layout = model->addOperand(&type0);
6409 auto param28 = model->addOperand(&type4);
6410 auto param29 = model->addOperand(&type4);
6411 auto op43 = model->addOperand(&type20);
6412 // Phase 2, operations
6413 static int32_t param24_init[] = {2};
6414 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6415 static int32_t param25_init[] = {1};
6416 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6417 static int32_t param26_init[] = {1};
6418 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6419 static int32_t param27_init[] = {0};
6420 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6421 static bool8 layout_init[] = {false};
6422 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6423 static int32_t param28_init[] = {3};
6424 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6425 static int32_t param29_init[] = {3};
6426 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6427 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6428 // Phase 3, inputs and outputs
6429 model->identifyInputsAndOutputs(
6430 {op13, op23, op33},
6431 {op43});
6432 assert(model->isValid());
6433 }
6434
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_4(int i)6435 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_4(int i) {
6436 static std::set<int> ignore = {};
6437 return ignore.find(i) != ignore.end();
6438 }
6439
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_4(Model * model)6440 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_4(Model *model) {
6441 OperandType type0(Type::BOOL, {});
6442 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
6443 OperandType type12(Type::TENSOR_FLOAT16, {1});
6444 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6445 OperandType type24(Type::TENSOR_FLOAT16, {1, 9, 9, 1});
6446 OperandType type4(Type::INT32, {});
6447 // Phase 1, operands
6448 auto op13 = model->addOperand(&type24);
6449 auto op23 = model->addOperand(&type10);
6450 auto op33 = model->addOperand(&type12);
6451 auto param24 = model->addOperand(&type4);
6452 auto param25 = model->addOperand(&type4);
6453 auto param26 = model->addOperand(&type4);
6454 auto param27 = model->addOperand(&type4);
6455 auto layout = model->addOperand(&type0);
6456 auto param28 = model->addOperand(&type4);
6457 auto param29 = model->addOperand(&type4);
6458 auto op43 = model->addOperand(&type21);
6459 // Phase 2, operations
6460 static int32_t param24_init[] = {2};
6461 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6462 static int32_t param25_init[] = {1};
6463 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6464 static int32_t param26_init[] = {1};
6465 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6466 static int32_t param27_init[] = {0};
6467 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6468 static bool8 layout_init[] = {false};
6469 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6470 static int32_t param28_init[] = {3};
6471 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6472 static int32_t param29_init[] = {3};
6473 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6474 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6475 // Phase 3, inputs and outputs
6476 model->identifyInputsAndOutputs(
6477 {op13, op23, op33},
6478 {op43});
6479 assert(model->isValid());
6480 }
6481
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_4(int i)6482 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_4(int i) {
6483 static std::set<int> ignore = {};
6484 return ignore.find(i) != ignore.end();
6485 }
6486
CreateModel_dynamic_output_shape_nchw_4(Model * model)6487 void CreateModel_dynamic_output_shape_nchw_4(Model *model) {
6488 OperandType type0(Type::BOOL, {});
6489 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6490 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6491 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
6492 OperandType type3(Type::TENSOR_FLOAT32, {1});
6493 OperandType type4(Type::INT32, {});
6494 // Phase 1, operands
6495 auto op13 = model->addOperand(&type25);
6496 auto op23 = model->addOperand(&type1);
6497 auto op33 = model->addOperand(&type3);
6498 auto param24 = model->addOperand(&type4);
6499 auto param25 = model->addOperand(&type4);
6500 auto param26 = model->addOperand(&type4);
6501 auto param27 = model->addOperand(&type4);
6502 auto layout = model->addOperand(&type0);
6503 auto param28 = model->addOperand(&type4);
6504 auto param29 = model->addOperand(&type4);
6505 auto op43 = model->addOperand(&type19);
6506 // Phase 2, operations
6507 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6508 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
6509 static float op33_init[] = {0.0f};
6510 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
6511 static int32_t param24_init[] = {2};
6512 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6513 static int32_t param25_init[] = {1};
6514 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6515 static int32_t param26_init[] = {1};
6516 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6517 static int32_t param27_init[] = {0};
6518 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6519 static bool8 layout_init[] = {true};
6520 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6521 static int32_t param28_init[] = {3};
6522 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6523 static int32_t param29_init[] = {3};
6524 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6525 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6526 // Phase 3, inputs and outputs
6527 model->identifyInputsAndOutputs(
6528 {op13},
6529 {op43});
6530 assert(model->isValid());
6531 }
6532
is_ignored_dynamic_output_shape_nchw_4(int i)6533 inline bool is_ignored_dynamic_output_shape_nchw_4(int i) {
6534 static std::set<int> ignore = {};
6535 return ignore.find(i) != ignore.end();
6536 }
6537
CreateModel_dynamic_output_shape_nchw_relaxed_4(Model * model)6538 void CreateModel_dynamic_output_shape_nchw_relaxed_4(Model *model) {
6539 OperandType type0(Type::BOOL, {});
6540 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6541 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6542 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
6543 OperandType type3(Type::TENSOR_FLOAT32, {1});
6544 OperandType type4(Type::INT32, {});
6545 // Phase 1, operands
6546 auto op13 = model->addOperand(&type25);
6547 auto op23 = model->addOperand(&type1);
6548 auto op33 = model->addOperand(&type3);
6549 auto param24 = model->addOperand(&type4);
6550 auto param25 = model->addOperand(&type4);
6551 auto param26 = model->addOperand(&type4);
6552 auto param27 = model->addOperand(&type4);
6553 auto layout = model->addOperand(&type0);
6554 auto param28 = model->addOperand(&type4);
6555 auto param29 = model->addOperand(&type4);
6556 auto op43 = model->addOperand(&type19);
6557 // Phase 2, operations
6558 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6559 model->setOperandValue(op23, op23_init, sizeof(float) * 9);
6560 static float op33_init[] = {0.0f};
6561 model->setOperandValue(op33, op33_init, sizeof(float) * 1);
6562 static int32_t param24_init[] = {2};
6563 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6564 static int32_t param25_init[] = {1};
6565 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6566 static int32_t param26_init[] = {1};
6567 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6568 static int32_t param27_init[] = {0};
6569 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6570 static bool8 layout_init[] = {true};
6571 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6572 static int32_t param28_init[] = {3};
6573 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6574 static int32_t param29_init[] = {3};
6575 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6576 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6577 // Phase 3, inputs and outputs
6578 model->identifyInputsAndOutputs(
6579 {op13},
6580 {op43});
6581 // Phase 4: set relaxed execution
6582 model->relaxComputationFloat32toFloat16(true);
6583 assert(model->isValid());
6584 }
6585
is_ignored_dynamic_output_shape_nchw_relaxed_4(int i)6586 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_4(int i) {
6587 static std::set<int> ignore = {};
6588 return ignore.find(i) != ignore.end();
6589 }
6590
CreateModel_dynamic_output_shape_nchw_quant8_4(Model * model)6591 void CreateModel_dynamic_output_shape_nchw_quant8_4(Model *model) {
6592 OperandType type0(Type::BOOL, {});
6593 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
6594 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6595 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
6596 OperandType type4(Type::INT32, {});
6597 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6598 // Phase 1, operands
6599 auto op13 = model->addOperand(&type26);
6600 auto op23 = model->addOperand(&type23);
6601 auto op33 = model->addOperand(&type9);
6602 auto param24 = model->addOperand(&type4);
6603 auto param25 = model->addOperand(&type4);
6604 auto param26 = model->addOperand(&type4);
6605 auto param27 = model->addOperand(&type4);
6606 auto layout = model->addOperand(&type0);
6607 auto param28 = model->addOperand(&type4);
6608 auto param29 = model->addOperand(&type4);
6609 auto op43 = model->addOperand(&type20);
6610 // Phase 2, operations
6611 static uint8_t op23_init[] = {8, 16, 24, 32, 40, 48, 56, 64, 72};
6612 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9);
6613 static int32_t op33_init[] = {0};
6614 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1);
6615 static int32_t param24_init[] = {2};
6616 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6617 static int32_t param25_init[] = {1};
6618 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6619 static int32_t param26_init[] = {1};
6620 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6621 static int32_t param27_init[] = {0};
6622 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6623 static bool8 layout_init[] = {true};
6624 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6625 static int32_t param28_init[] = {3};
6626 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6627 static int32_t param29_init[] = {3};
6628 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6629 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6630 // Phase 3, inputs and outputs
6631 model->identifyInputsAndOutputs(
6632 {op13},
6633 {op43});
6634 assert(model->isValid());
6635 }
6636
is_ignored_dynamic_output_shape_nchw_quant8_4(int i)6637 inline bool is_ignored_dynamic_output_shape_nchw_quant8_4(int i) {
6638 static std::set<int> ignore = {};
6639 return ignore.find(i) != ignore.end();
6640 }
6641
CreateModel_dynamic_output_shape_nchw_float16_4(Model * model)6642 void CreateModel_dynamic_output_shape_nchw_float16_4(Model *model) {
6643 OperandType type0(Type::BOOL, {});
6644 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
6645 OperandType type12(Type::TENSOR_FLOAT16, {1});
6646 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6647 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
6648 OperandType type4(Type::INT32, {});
6649 // Phase 1, operands
6650 auto op13 = model->addOperand(&type28);
6651 auto op23 = model->addOperand(&type10);
6652 auto op33 = model->addOperand(&type12);
6653 auto param24 = model->addOperand(&type4);
6654 auto param25 = model->addOperand(&type4);
6655 auto param26 = model->addOperand(&type4);
6656 auto param27 = model->addOperand(&type4);
6657 auto layout = model->addOperand(&type0);
6658 auto param28 = model->addOperand(&type4);
6659 auto param29 = model->addOperand(&type4);
6660 auto op43 = model->addOperand(&type21);
6661 // Phase 2, operations
6662 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f};
6663 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9);
6664 static _Float16 op33_init[] = {0.0f};
6665 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1);
6666 static int32_t param24_init[] = {2};
6667 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6668 static int32_t param25_init[] = {1};
6669 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6670 static int32_t param26_init[] = {1};
6671 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6672 static int32_t param27_init[] = {0};
6673 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6674 static bool8 layout_init[] = {true};
6675 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6676 static int32_t param28_init[] = {3};
6677 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6678 static int32_t param29_init[] = {3};
6679 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6680 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6681 // Phase 3, inputs and outputs
6682 model->identifyInputsAndOutputs(
6683 {op13},
6684 {op43});
6685 assert(model->isValid());
6686 }
6687
is_ignored_dynamic_output_shape_nchw_float16_4(int i)6688 inline bool is_ignored_dynamic_output_shape_nchw_float16_4(int i) {
6689 static std::set<int> ignore = {};
6690 return ignore.find(i) != ignore.end();
6691 }
6692
CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model * model)6693 void CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model *model) {
6694 OperandType type0(Type::BOOL, {});
6695 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6696 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6697 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
6698 OperandType type3(Type::TENSOR_FLOAT32, {1});
6699 OperandType type4(Type::INT32, {});
6700 // Phase 1, operands
6701 auto op13 = model->addOperand(&type25);
6702 auto op23 = model->addOperand(&type1);
6703 auto op33 = model->addOperand(&type3);
6704 auto param24 = model->addOperand(&type4);
6705 auto param25 = model->addOperand(&type4);
6706 auto param26 = model->addOperand(&type4);
6707 auto param27 = model->addOperand(&type4);
6708 auto layout = model->addOperand(&type0);
6709 auto param28 = model->addOperand(&type4);
6710 auto param29 = model->addOperand(&type4);
6711 auto op43 = model->addOperand(&type19);
6712 // Phase 2, operations
6713 static int32_t param24_init[] = {2};
6714 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6715 static int32_t param25_init[] = {1};
6716 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6717 static int32_t param26_init[] = {1};
6718 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6719 static int32_t param27_init[] = {0};
6720 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6721 static bool8 layout_init[] = {true};
6722 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6723 static int32_t param28_init[] = {3};
6724 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6725 static int32_t param29_init[] = {3};
6726 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6727 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6728 // Phase 3, inputs and outputs
6729 model->identifyInputsAndOutputs(
6730 {op13, op23, op33},
6731 {op43});
6732 assert(model->isValid());
6733 }
6734
is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i)6735 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i) {
6736 static std::set<int> ignore = {};
6737 return ignore.find(i) != ignore.end();
6738 }
6739
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_4(Model * model)6740 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_4(Model *model) {
6741 OperandType type0(Type::BOOL, {});
6742 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6743 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6744 OperandType type25(Type::TENSOR_FLOAT32, {1, 1, 9, 9});
6745 OperandType type3(Type::TENSOR_FLOAT32, {1});
6746 OperandType type4(Type::INT32, {});
6747 // Phase 1, operands
6748 auto op13 = model->addOperand(&type25);
6749 auto op23 = model->addOperand(&type1);
6750 auto op33 = model->addOperand(&type3);
6751 auto param24 = model->addOperand(&type4);
6752 auto param25 = model->addOperand(&type4);
6753 auto param26 = model->addOperand(&type4);
6754 auto param27 = model->addOperand(&type4);
6755 auto layout = model->addOperand(&type0);
6756 auto param28 = model->addOperand(&type4);
6757 auto param29 = model->addOperand(&type4);
6758 auto op43 = model->addOperand(&type19);
6759 // Phase 2, operations
6760 static int32_t param24_init[] = {2};
6761 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6762 static int32_t param25_init[] = {1};
6763 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6764 static int32_t param26_init[] = {1};
6765 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6766 static int32_t param27_init[] = {0};
6767 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6768 static bool8 layout_init[] = {true};
6769 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6770 static int32_t param28_init[] = {3};
6771 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6772 static int32_t param29_init[] = {3};
6773 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6774 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6775 // Phase 3, inputs and outputs
6776 model->identifyInputsAndOutputs(
6777 {op13, op23, op33},
6778 {op43});
6779 // Phase 4: set relaxed execution
6780 model->relaxComputationFloat32toFloat16(true);
6781 assert(model->isValid());
6782 }
6783
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_4(int i)6784 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_4(int i) {
6785 static std::set<int> ignore = {};
6786 return ignore.find(i) != ignore.end();
6787 }
6788
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_4(Model * model)6789 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_4(Model *model) {
6790 OperandType type0(Type::BOOL, {});
6791 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
6792 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6793 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 1, 9, 9}, 0.5f, 0);
6794 OperandType type4(Type::INT32, {});
6795 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6796 // Phase 1, operands
6797 auto op13 = model->addOperand(&type26);
6798 auto op23 = model->addOperand(&type23);
6799 auto op33 = model->addOperand(&type9);
6800 auto param24 = model->addOperand(&type4);
6801 auto param25 = model->addOperand(&type4);
6802 auto param26 = model->addOperand(&type4);
6803 auto param27 = model->addOperand(&type4);
6804 auto layout = model->addOperand(&type0);
6805 auto param28 = model->addOperand(&type4);
6806 auto param29 = model->addOperand(&type4);
6807 auto op43 = model->addOperand(&type20);
6808 // Phase 2, operations
6809 static int32_t param24_init[] = {2};
6810 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6811 static int32_t param25_init[] = {1};
6812 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6813 static int32_t param26_init[] = {1};
6814 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6815 static int32_t param27_init[] = {0};
6816 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6817 static bool8 layout_init[] = {true};
6818 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6819 static int32_t param28_init[] = {3};
6820 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6821 static int32_t param29_init[] = {3};
6822 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6823 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6824 // Phase 3, inputs and outputs
6825 model->identifyInputsAndOutputs(
6826 {op13, op23, op33},
6827 {op43});
6828 assert(model->isValid());
6829 }
6830
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_4(int i)6831 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_4(int i) {
6832 static std::set<int> ignore = {};
6833 return ignore.find(i) != ignore.end();
6834 }
6835
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_4(Model * model)6836 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_4(Model *model) {
6837 OperandType type0(Type::BOOL, {});
6838 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
6839 OperandType type12(Type::TENSOR_FLOAT16, {1});
6840 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6841 OperandType type28(Type::TENSOR_FLOAT16, {1, 1, 9, 9});
6842 OperandType type4(Type::INT32, {});
6843 // Phase 1, operands
6844 auto op13 = model->addOperand(&type28);
6845 auto op23 = model->addOperand(&type10);
6846 auto op33 = model->addOperand(&type12);
6847 auto param24 = model->addOperand(&type4);
6848 auto param25 = model->addOperand(&type4);
6849 auto param26 = model->addOperand(&type4);
6850 auto param27 = model->addOperand(&type4);
6851 auto layout = model->addOperand(&type0);
6852 auto param28 = model->addOperand(&type4);
6853 auto param29 = model->addOperand(&type4);
6854 auto op43 = model->addOperand(&type21);
6855 // Phase 2, operations
6856 static int32_t param24_init[] = {2};
6857 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6858 static int32_t param25_init[] = {1};
6859 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6860 static int32_t param26_init[] = {1};
6861 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6862 static int32_t param27_init[] = {0};
6863 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6864 static bool8 layout_init[] = {true};
6865 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6866 static int32_t param28_init[] = {3};
6867 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6868 static int32_t param29_init[] = {3};
6869 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
6870 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param24, param25, param26, param27, layout, param28, param29}, {op43});
6871 // Phase 3, inputs and outputs
6872 model->identifyInputsAndOutputs(
6873 {op13, op23, op33},
6874 {op43});
6875 assert(model->isValid());
6876 }
6877
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_4(int i)6878 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_4(int i) {
6879 static std::set<int> ignore = {};
6880 return ignore.find(i) != ignore.end();
6881 }
6882
CreateModel_nhwc_5(Model * model)6883 void CreateModel_nhwc_5(Model *model) {
6884 OperandType type0(Type::BOOL, {});
6885 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6886 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
6887 OperandType type3(Type::TENSOR_FLOAT32, {1});
6888 OperandType type4(Type::INT32, {});
6889 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
6890 // Phase 1, operands
6891 auto op14 = model->addOperand(&type6);
6892 auto op24 = model->addOperand(&type2);
6893 auto op34 = model->addOperand(&type3);
6894 auto param30 = model->addOperand(&type4);
6895 auto param31 = model->addOperand(&type4);
6896 auto param32 = model->addOperand(&type4);
6897 auto param33 = model->addOperand(&type4);
6898 auto layout = model->addOperand(&type0);
6899 auto param34 = model->addOperand(&type4);
6900 auto param35 = model->addOperand(&type4);
6901 auto op44 = model->addOperand(&type1);
6902 // Phase 2, operations
6903 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
6904 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
6905 static float op34_init[] = {0.0f};
6906 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
6907 static int32_t param30_init[] = {1};
6908 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
6909 static int32_t param31_init[] = {2};
6910 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
6911 static int32_t param32_init[] = {2};
6912 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
6913 static int32_t param33_init[] = {0};
6914 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
6915 static bool8 layout_init[] = {false};
6916 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6917 static int32_t param34_init[] = {3};
6918 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6919 static int32_t param35_init[] = {3};
6920 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6921 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
6922 // Phase 3, inputs and outputs
6923 model->identifyInputsAndOutputs(
6924 {op14},
6925 {op44});
6926 assert(model->isValid());
6927 }
6928
is_ignored_nhwc_5(int i)6929 inline bool is_ignored_nhwc_5(int i) {
6930 static std::set<int> ignore = {};
6931 return ignore.find(i) != ignore.end();
6932 }
6933
CreateModel_nhwc_relaxed_5(Model * model)6934 void CreateModel_nhwc_relaxed_5(Model *model) {
6935 OperandType type0(Type::BOOL, {});
6936 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
6937 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
6938 OperandType type3(Type::TENSOR_FLOAT32, {1});
6939 OperandType type4(Type::INT32, {});
6940 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
6941 // Phase 1, operands
6942 auto op14 = model->addOperand(&type6);
6943 auto op24 = model->addOperand(&type2);
6944 auto op34 = model->addOperand(&type3);
6945 auto param30 = model->addOperand(&type4);
6946 auto param31 = model->addOperand(&type4);
6947 auto param32 = model->addOperand(&type4);
6948 auto param33 = model->addOperand(&type4);
6949 auto layout = model->addOperand(&type0);
6950 auto param34 = model->addOperand(&type4);
6951 auto param35 = model->addOperand(&type4);
6952 auto op44 = model->addOperand(&type1);
6953 // Phase 2, operations
6954 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
6955 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
6956 static float op34_init[] = {0.0f};
6957 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
6958 static int32_t param30_init[] = {1};
6959 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
6960 static int32_t param31_init[] = {2};
6961 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
6962 static int32_t param32_init[] = {2};
6963 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
6964 static int32_t param33_init[] = {0};
6965 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
6966 static bool8 layout_init[] = {false};
6967 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6968 static int32_t param34_init[] = {3};
6969 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
6970 static int32_t param35_init[] = {3};
6971 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
6972 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
6973 // Phase 3, inputs and outputs
6974 model->identifyInputsAndOutputs(
6975 {op14},
6976 {op44});
6977 // Phase 4: set relaxed execution
6978 model->relaxComputationFloat32toFloat16(true);
6979 assert(model->isValid());
6980 }
6981
is_ignored_nhwc_relaxed_5(int i)6982 inline bool is_ignored_nhwc_relaxed_5(int i) {
6983 static std::set<int> ignore = {};
6984 return ignore.find(i) != ignore.end();
6985 }
6986
CreateModel_nhwc_quant8_5(Model * model)6987 void CreateModel_nhwc_quant8_5(Model *model) {
6988 OperandType type0(Type::BOOL, {});
6989 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
6990 OperandType type29(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
6991 OperandType type4(Type::INT32, {});
6992 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
6993 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
6994 // Phase 1, operands
6995 auto op14 = model->addOperand(&type29);
6996 auto op24 = model->addOperand(&type8);
6997 auto op34 = model->addOperand(&type9);
6998 auto param30 = model->addOperand(&type4);
6999 auto param31 = model->addOperand(&type4);
7000 auto param32 = model->addOperand(&type4);
7001 auto param33 = model->addOperand(&type4);
7002 auto layout = model->addOperand(&type0);
7003 auto param34 = model->addOperand(&type4);
7004 auto param35 = model->addOperand(&type4);
7005 auto op44 = model->addOperand(&type23);
7006 // Phase 2, operations
7007 static uint8_t op24_init[] = {8, 16, 24, 32};
7008 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
7009 static int32_t op34_init[] = {0};
7010 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
7011 static int32_t param30_init[] = {1};
7012 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7013 static int32_t param31_init[] = {2};
7014 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7015 static int32_t param32_init[] = {2};
7016 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7017 static int32_t param33_init[] = {0};
7018 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7019 static bool8 layout_init[] = {false};
7020 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7021 static int32_t param34_init[] = {3};
7022 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7023 static int32_t param35_init[] = {3};
7024 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7025 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7026 // Phase 3, inputs and outputs
7027 model->identifyInputsAndOutputs(
7028 {op14},
7029 {op44});
7030 assert(model->isValid());
7031 }
7032
is_ignored_nhwc_quant8_5(int i)7033 inline bool is_ignored_nhwc_quant8_5(int i) {
7034 static std::set<int> ignore = {};
7035 return ignore.find(i) != ignore.end();
7036 }
7037
CreateModel_nhwc_float16_5(Model * model)7038 void CreateModel_nhwc_float16_5(Model *model) {
7039 OperandType type0(Type::BOOL, {});
7040 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
7041 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
7042 OperandType type12(Type::TENSOR_FLOAT16, {1});
7043 OperandType type30(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
7044 OperandType type4(Type::INT32, {});
7045 // Phase 1, operands
7046 auto op14 = model->addOperand(&type30);
7047 auto op24 = model->addOperand(&type11);
7048 auto op34 = model->addOperand(&type12);
7049 auto param30 = model->addOperand(&type4);
7050 auto param31 = model->addOperand(&type4);
7051 auto param32 = model->addOperand(&type4);
7052 auto param33 = model->addOperand(&type4);
7053 auto layout = model->addOperand(&type0);
7054 auto param34 = model->addOperand(&type4);
7055 auto param35 = model->addOperand(&type4);
7056 auto op44 = model->addOperand(&type10);
7057 // Phase 2, operations
7058 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7059 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
7060 static _Float16 op34_init[] = {0.0f};
7061 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
7062 static int32_t param30_init[] = {1};
7063 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7064 static int32_t param31_init[] = {2};
7065 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7066 static int32_t param32_init[] = {2};
7067 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7068 static int32_t param33_init[] = {0};
7069 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7070 static bool8 layout_init[] = {false};
7071 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7072 static int32_t param34_init[] = {3};
7073 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7074 static int32_t param35_init[] = {3};
7075 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7076 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7077 // Phase 3, inputs and outputs
7078 model->identifyInputsAndOutputs(
7079 {op14},
7080 {op44});
7081 assert(model->isValid());
7082 }
7083
is_ignored_nhwc_float16_5(int i)7084 inline bool is_ignored_nhwc_float16_5(int i) {
7085 static std::set<int> ignore = {};
7086 return ignore.find(i) != ignore.end();
7087 }
7088
CreateModel_nhwc_weight_as_input_5(Model * model)7089 void CreateModel_nhwc_weight_as_input_5(Model *model) {
7090 OperandType type0(Type::BOOL, {});
7091 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
7092 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7093 OperandType type3(Type::TENSOR_FLOAT32, {1});
7094 OperandType type4(Type::INT32, {});
7095 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7096 // Phase 1, operands
7097 auto op14 = model->addOperand(&type6);
7098 auto op24 = model->addOperand(&type2);
7099 auto op34 = model->addOperand(&type3);
7100 auto param30 = model->addOperand(&type4);
7101 auto param31 = model->addOperand(&type4);
7102 auto param32 = model->addOperand(&type4);
7103 auto param33 = model->addOperand(&type4);
7104 auto layout = model->addOperand(&type0);
7105 auto param34 = model->addOperand(&type4);
7106 auto param35 = model->addOperand(&type4);
7107 auto op44 = model->addOperand(&type1);
7108 // Phase 2, operations
7109 static int32_t param30_init[] = {1};
7110 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7111 static int32_t param31_init[] = {2};
7112 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7113 static int32_t param32_init[] = {2};
7114 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7115 static int32_t param33_init[] = {0};
7116 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7117 static bool8 layout_init[] = {false};
7118 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7119 static int32_t param34_init[] = {3};
7120 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7121 static int32_t param35_init[] = {3};
7122 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7123 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7124 // Phase 3, inputs and outputs
7125 model->identifyInputsAndOutputs(
7126 {op14, op24, op34},
7127 {op44});
7128 assert(model->isValid());
7129 }
7130
is_ignored_nhwc_weight_as_input_5(int i)7131 inline bool is_ignored_nhwc_weight_as_input_5(int i) {
7132 static std::set<int> ignore = {};
7133 return ignore.find(i) != ignore.end();
7134 }
7135
CreateModel_nhwc_weight_as_input_relaxed_5(Model * model)7136 void CreateModel_nhwc_weight_as_input_relaxed_5(Model *model) {
7137 OperandType type0(Type::BOOL, {});
7138 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1});
7139 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7140 OperandType type3(Type::TENSOR_FLOAT32, {1});
7141 OperandType type4(Type::INT32, {});
7142 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7143 // Phase 1, operands
7144 auto op14 = model->addOperand(&type6);
7145 auto op24 = model->addOperand(&type2);
7146 auto op34 = model->addOperand(&type3);
7147 auto param30 = model->addOperand(&type4);
7148 auto param31 = model->addOperand(&type4);
7149 auto param32 = model->addOperand(&type4);
7150 auto param33 = model->addOperand(&type4);
7151 auto layout = model->addOperand(&type0);
7152 auto param34 = model->addOperand(&type4);
7153 auto param35 = model->addOperand(&type4);
7154 auto op44 = model->addOperand(&type1);
7155 // Phase 2, operations
7156 static int32_t param30_init[] = {1};
7157 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7158 static int32_t param31_init[] = {2};
7159 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7160 static int32_t param32_init[] = {2};
7161 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7162 static int32_t param33_init[] = {0};
7163 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7164 static bool8 layout_init[] = {false};
7165 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7166 static int32_t param34_init[] = {3};
7167 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7168 static int32_t param35_init[] = {3};
7169 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7170 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7171 // Phase 3, inputs and outputs
7172 model->identifyInputsAndOutputs(
7173 {op14, op24, op34},
7174 {op44});
7175 // Phase 4: set relaxed execution
7176 model->relaxComputationFloat32toFloat16(true);
7177 assert(model->isValid());
7178 }
7179
is_ignored_nhwc_weight_as_input_relaxed_5(int i)7180 inline bool is_ignored_nhwc_weight_as_input_relaxed_5(int i) {
7181 static std::set<int> ignore = {};
7182 return ignore.find(i) != ignore.end();
7183 }
7184
CreateModel_nhwc_weight_as_input_quant8_5(Model * model)7185 void CreateModel_nhwc_weight_as_input_quant8_5(Model *model) {
7186 OperandType type0(Type::BOOL, {});
7187 OperandType type23(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.125f, 0);
7188 OperandType type29(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
7189 OperandType type4(Type::INT32, {});
7190 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
7191 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
7192 // Phase 1, operands
7193 auto op14 = model->addOperand(&type29);
7194 auto op24 = model->addOperand(&type8);
7195 auto op34 = model->addOperand(&type9);
7196 auto param30 = model->addOperand(&type4);
7197 auto param31 = model->addOperand(&type4);
7198 auto param32 = model->addOperand(&type4);
7199 auto param33 = model->addOperand(&type4);
7200 auto layout = model->addOperand(&type0);
7201 auto param34 = model->addOperand(&type4);
7202 auto param35 = model->addOperand(&type4);
7203 auto op44 = model->addOperand(&type23);
7204 // Phase 2, operations
7205 static int32_t param30_init[] = {1};
7206 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7207 static int32_t param31_init[] = {2};
7208 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7209 static int32_t param32_init[] = {2};
7210 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7211 static int32_t param33_init[] = {0};
7212 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7213 static bool8 layout_init[] = {false};
7214 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7215 static int32_t param34_init[] = {3};
7216 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7217 static int32_t param35_init[] = {3};
7218 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7219 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7220 // Phase 3, inputs and outputs
7221 model->identifyInputsAndOutputs(
7222 {op14, op24, op34},
7223 {op44});
7224 assert(model->isValid());
7225 }
7226
is_ignored_nhwc_weight_as_input_quant8_5(int i)7227 inline bool is_ignored_nhwc_weight_as_input_quant8_5(int i) {
7228 static std::set<int> ignore = {};
7229 return ignore.find(i) != ignore.end();
7230 }
7231
CreateModel_nhwc_weight_as_input_float16_5(Model * model)7232 void CreateModel_nhwc_weight_as_input_float16_5(Model *model) {
7233 OperandType type0(Type::BOOL, {});
7234 OperandType type10(Type::TENSOR_FLOAT16, {1, 3, 3, 1});
7235 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
7236 OperandType type12(Type::TENSOR_FLOAT16, {1});
7237 OperandType type30(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
7238 OperandType type4(Type::INT32, {});
7239 // Phase 1, operands
7240 auto op14 = model->addOperand(&type30);
7241 auto op24 = model->addOperand(&type11);
7242 auto op34 = model->addOperand(&type12);
7243 auto param30 = model->addOperand(&type4);
7244 auto param31 = model->addOperand(&type4);
7245 auto param32 = model->addOperand(&type4);
7246 auto param33 = model->addOperand(&type4);
7247 auto layout = model->addOperand(&type0);
7248 auto param34 = model->addOperand(&type4);
7249 auto param35 = model->addOperand(&type4);
7250 auto op44 = model->addOperand(&type10);
7251 // Phase 2, operations
7252 static int32_t param30_init[] = {1};
7253 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7254 static int32_t param31_init[] = {2};
7255 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7256 static int32_t param32_init[] = {2};
7257 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7258 static int32_t param33_init[] = {0};
7259 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7260 static bool8 layout_init[] = {false};
7261 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7262 static int32_t param34_init[] = {3};
7263 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7264 static int32_t param35_init[] = {3};
7265 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7266 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7267 // Phase 3, inputs and outputs
7268 model->identifyInputsAndOutputs(
7269 {op14, op24, op34},
7270 {op44});
7271 assert(model->isValid());
7272 }
7273
is_ignored_nhwc_weight_as_input_float16_5(int i)7274 inline bool is_ignored_nhwc_weight_as_input_float16_5(int i) {
7275 static std::set<int> ignore = {};
7276 return ignore.find(i) != ignore.end();
7277 }
7278
CreateModel_nchw_5(Model * model)7279 void CreateModel_nchw_5(Model *model) {
7280 OperandType type0(Type::BOOL, {});
7281 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
7282 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7283 OperandType type3(Type::TENSOR_FLOAT32, {1});
7284 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
7285 OperandType type4(Type::INT32, {});
7286 // Phase 1, operands
7287 auto op14 = model->addOperand(&type31);
7288 auto op24 = model->addOperand(&type2);
7289 auto op34 = model->addOperand(&type3);
7290 auto param30 = model->addOperand(&type4);
7291 auto param31 = model->addOperand(&type4);
7292 auto param32 = model->addOperand(&type4);
7293 auto param33 = model->addOperand(&type4);
7294 auto layout = model->addOperand(&type0);
7295 auto param34 = model->addOperand(&type4);
7296 auto param35 = model->addOperand(&type4);
7297 auto op44 = model->addOperand(&type13);
7298 // Phase 2, operations
7299 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7300 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
7301 static float op34_init[] = {0.0f};
7302 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
7303 static int32_t param30_init[] = {1};
7304 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7305 static int32_t param31_init[] = {2};
7306 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7307 static int32_t param32_init[] = {2};
7308 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7309 static int32_t param33_init[] = {0};
7310 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7311 static bool8 layout_init[] = {true};
7312 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7313 static int32_t param34_init[] = {3};
7314 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7315 static int32_t param35_init[] = {3};
7316 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7317 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7318 // Phase 3, inputs and outputs
7319 model->identifyInputsAndOutputs(
7320 {op14},
7321 {op44});
7322 assert(model->isValid());
7323 }
7324
is_ignored_nchw_5(int i)7325 inline bool is_ignored_nchw_5(int i) {
7326 static std::set<int> ignore = {};
7327 return ignore.find(i) != ignore.end();
7328 }
7329
CreateModel_nchw_relaxed_5(Model * model)7330 void CreateModel_nchw_relaxed_5(Model *model) {
7331 OperandType type0(Type::BOOL, {});
7332 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
7333 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7334 OperandType type3(Type::TENSOR_FLOAT32, {1});
7335 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
7336 OperandType type4(Type::INT32, {});
7337 // Phase 1, operands
7338 auto op14 = model->addOperand(&type31);
7339 auto op24 = model->addOperand(&type2);
7340 auto op34 = model->addOperand(&type3);
7341 auto param30 = model->addOperand(&type4);
7342 auto param31 = model->addOperand(&type4);
7343 auto param32 = model->addOperand(&type4);
7344 auto param33 = model->addOperand(&type4);
7345 auto layout = model->addOperand(&type0);
7346 auto param34 = model->addOperand(&type4);
7347 auto param35 = model->addOperand(&type4);
7348 auto op44 = model->addOperand(&type13);
7349 // Phase 2, operations
7350 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7351 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
7352 static float op34_init[] = {0.0f};
7353 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
7354 static int32_t param30_init[] = {1};
7355 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7356 static int32_t param31_init[] = {2};
7357 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7358 static int32_t param32_init[] = {2};
7359 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7360 static int32_t param33_init[] = {0};
7361 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7362 static bool8 layout_init[] = {true};
7363 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7364 static int32_t param34_init[] = {3};
7365 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7366 static int32_t param35_init[] = {3};
7367 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7368 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7369 // Phase 3, inputs and outputs
7370 model->identifyInputsAndOutputs(
7371 {op14},
7372 {op44});
7373 // Phase 4: set relaxed execution
7374 model->relaxComputationFloat32toFloat16(true);
7375 assert(model->isValid());
7376 }
7377
is_ignored_nchw_relaxed_5(int i)7378 inline bool is_ignored_nchw_relaxed_5(int i) {
7379 static std::set<int> ignore = {};
7380 return ignore.find(i) != ignore.end();
7381 }
7382
CreateModel_nchw_quant8_5(Model * model)7383 void CreateModel_nchw_quant8_5(Model *model) {
7384 OperandType type0(Type::BOOL, {});
7385 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
7386 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
7387 OperandType type4(Type::INT32, {});
7388 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
7389 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
7390 // Phase 1, operands
7391 auto op14 = model->addOperand(&type32);
7392 auto op24 = model->addOperand(&type8);
7393 auto op34 = model->addOperand(&type9);
7394 auto param30 = model->addOperand(&type4);
7395 auto param31 = model->addOperand(&type4);
7396 auto param32 = model->addOperand(&type4);
7397 auto param33 = model->addOperand(&type4);
7398 auto layout = model->addOperand(&type0);
7399 auto param34 = model->addOperand(&type4);
7400 auto param35 = model->addOperand(&type4);
7401 auto op44 = model->addOperand(&type27);
7402 // Phase 2, operations
7403 static uint8_t op24_init[] = {8, 16, 24, 32};
7404 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
7405 static int32_t op34_init[] = {0};
7406 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
7407 static int32_t param30_init[] = {1};
7408 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7409 static int32_t param31_init[] = {2};
7410 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7411 static int32_t param32_init[] = {2};
7412 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7413 static int32_t param33_init[] = {0};
7414 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7415 static bool8 layout_init[] = {true};
7416 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7417 static int32_t param34_init[] = {3};
7418 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7419 static int32_t param35_init[] = {3};
7420 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7421 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7422 // Phase 3, inputs and outputs
7423 model->identifyInputsAndOutputs(
7424 {op14},
7425 {op44});
7426 assert(model->isValid());
7427 }
7428
is_ignored_nchw_quant8_5(int i)7429 inline bool is_ignored_nchw_quant8_5(int i) {
7430 static std::set<int> ignore = {};
7431 return ignore.find(i) != ignore.end();
7432 }
7433
CreateModel_nchw_float16_5(Model * model)7434 void CreateModel_nchw_float16_5(Model *model) {
7435 OperandType type0(Type::BOOL, {});
7436 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
7437 OperandType type12(Type::TENSOR_FLOAT16, {1});
7438 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
7439 OperandType type33(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
7440 OperandType type4(Type::INT32, {});
7441 // Phase 1, operands
7442 auto op14 = model->addOperand(&type33);
7443 auto op24 = model->addOperand(&type11);
7444 auto op34 = model->addOperand(&type12);
7445 auto param30 = model->addOperand(&type4);
7446 auto param31 = model->addOperand(&type4);
7447 auto param32 = model->addOperand(&type4);
7448 auto param33 = model->addOperand(&type4);
7449 auto layout = model->addOperand(&type0);
7450 auto param34 = model->addOperand(&type4);
7451 auto param35 = model->addOperand(&type4);
7452 auto op44 = model->addOperand(&type17);
7453 // Phase 2, operations
7454 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7455 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
7456 static _Float16 op34_init[] = {0.0f};
7457 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
7458 static int32_t param30_init[] = {1};
7459 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7460 static int32_t param31_init[] = {2};
7461 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7462 static int32_t param32_init[] = {2};
7463 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7464 static int32_t param33_init[] = {0};
7465 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7466 static bool8 layout_init[] = {true};
7467 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7468 static int32_t param34_init[] = {3};
7469 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7470 static int32_t param35_init[] = {3};
7471 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7472 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7473 // Phase 3, inputs and outputs
7474 model->identifyInputsAndOutputs(
7475 {op14},
7476 {op44});
7477 assert(model->isValid());
7478 }
7479
is_ignored_nchw_float16_5(int i)7480 inline bool is_ignored_nchw_float16_5(int i) {
7481 static std::set<int> ignore = {};
7482 return ignore.find(i) != ignore.end();
7483 }
7484
CreateModel_nchw_weight_as_input_5(Model * model)7485 void CreateModel_nchw_weight_as_input_5(Model *model) {
7486 OperandType type0(Type::BOOL, {});
7487 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
7488 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7489 OperandType type3(Type::TENSOR_FLOAT32, {1});
7490 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
7491 OperandType type4(Type::INT32, {});
7492 // Phase 1, operands
7493 auto op14 = model->addOperand(&type31);
7494 auto op24 = model->addOperand(&type2);
7495 auto op34 = model->addOperand(&type3);
7496 auto param30 = model->addOperand(&type4);
7497 auto param31 = model->addOperand(&type4);
7498 auto param32 = model->addOperand(&type4);
7499 auto param33 = model->addOperand(&type4);
7500 auto layout = model->addOperand(&type0);
7501 auto param34 = model->addOperand(&type4);
7502 auto param35 = model->addOperand(&type4);
7503 auto op44 = model->addOperand(&type13);
7504 // Phase 2, operations
7505 static int32_t param30_init[] = {1};
7506 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7507 static int32_t param31_init[] = {2};
7508 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7509 static int32_t param32_init[] = {2};
7510 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7511 static int32_t param33_init[] = {0};
7512 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7513 static bool8 layout_init[] = {true};
7514 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7515 static int32_t param34_init[] = {3};
7516 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7517 static int32_t param35_init[] = {3};
7518 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7519 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7520 // Phase 3, inputs and outputs
7521 model->identifyInputsAndOutputs(
7522 {op14, op24, op34},
7523 {op44});
7524 assert(model->isValid());
7525 }
7526
is_ignored_nchw_weight_as_input_5(int i)7527 inline bool is_ignored_nchw_weight_as_input_5(int i) {
7528 static std::set<int> ignore = {};
7529 return ignore.find(i) != ignore.end();
7530 }
7531
CreateModel_nchw_weight_as_input_relaxed_5(Model * model)7532 void CreateModel_nchw_weight_as_input_relaxed_5(Model *model) {
7533 OperandType type0(Type::BOOL, {});
7534 OperandType type13(Type::TENSOR_FLOAT32, {1, 1, 3, 3});
7535 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7536 OperandType type3(Type::TENSOR_FLOAT32, {1});
7537 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
7538 OperandType type4(Type::INT32, {});
7539 // Phase 1, operands
7540 auto op14 = model->addOperand(&type31);
7541 auto op24 = model->addOperand(&type2);
7542 auto op34 = model->addOperand(&type3);
7543 auto param30 = model->addOperand(&type4);
7544 auto param31 = model->addOperand(&type4);
7545 auto param32 = model->addOperand(&type4);
7546 auto param33 = model->addOperand(&type4);
7547 auto layout = model->addOperand(&type0);
7548 auto param34 = model->addOperand(&type4);
7549 auto param35 = model->addOperand(&type4);
7550 auto op44 = model->addOperand(&type13);
7551 // Phase 2, operations
7552 static int32_t param30_init[] = {1};
7553 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7554 static int32_t param31_init[] = {2};
7555 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7556 static int32_t param32_init[] = {2};
7557 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7558 static int32_t param33_init[] = {0};
7559 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7560 static bool8 layout_init[] = {true};
7561 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7562 static int32_t param34_init[] = {3};
7563 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7564 static int32_t param35_init[] = {3};
7565 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7566 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7567 // Phase 3, inputs and outputs
7568 model->identifyInputsAndOutputs(
7569 {op14, op24, op34},
7570 {op44});
7571 // Phase 4: set relaxed execution
7572 model->relaxComputationFloat32toFloat16(true);
7573 assert(model->isValid());
7574 }
7575
is_ignored_nchw_weight_as_input_relaxed_5(int i)7576 inline bool is_ignored_nchw_weight_as_input_relaxed_5(int i) {
7577 static std::set<int> ignore = {};
7578 return ignore.find(i) != ignore.end();
7579 }
7580
CreateModel_nchw_weight_as_input_quant8_5(Model * model)7581 void CreateModel_nchw_weight_as_input_quant8_5(Model *model) {
7582 OperandType type0(Type::BOOL, {});
7583 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.125f, 0);
7584 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
7585 OperandType type4(Type::INT32, {});
7586 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
7587 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
7588 // Phase 1, operands
7589 auto op14 = model->addOperand(&type32);
7590 auto op24 = model->addOperand(&type8);
7591 auto op34 = model->addOperand(&type9);
7592 auto param30 = model->addOperand(&type4);
7593 auto param31 = model->addOperand(&type4);
7594 auto param32 = model->addOperand(&type4);
7595 auto param33 = model->addOperand(&type4);
7596 auto layout = model->addOperand(&type0);
7597 auto param34 = model->addOperand(&type4);
7598 auto param35 = model->addOperand(&type4);
7599 auto op44 = model->addOperand(&type27);
7600 // Phase 2, operations
7601 static int32_t param30_init[] = {1};
7602 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7603 static int32_t param31_init[] = {2};
7604 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7605 static int32_t param32_init[] = {2};
7606 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7607 static int32_t param33_init[] = {0};
7608 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7609 static bool8 layout_init[] = {true};
7610 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7611 static int32_t param34_init[] = {3};
7612 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7613 static int32_t param35_init[] = {3};
7614 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7615 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7616 // Phase 3, inputs and outputs
7617 model->identifyInputsAndOutputs(
7618 {op14, op24, op34},
7619 {op44});
7620 assert(model->isValid());
7621 }
7622
is_ignored_nchw_weight_as_input_quant8_5(int i)7623 inline bool is_ignored_nchw_weight_as_input_quant8_5(int i) {
7624 static std::set<int> ignore = {};
7625 return ignore.find(i) != ignore.end();
7626 }
7627
CreateModel_nchw_weight_as_input_float16_5(Model * model)7628 void CreateModel_nchw_weight_as_input_float16_5(Model *model) {
7629 OperandType type0(Type::BOOL, {});
7630 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
7631 OperandType type12(Type::TENSOR_FLOAT16, {1});
7632 OperandType type17(Type::TENSOR_FLOAT16, {1, 1, 3, 3});
7633 OperandType type33(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
7634 OperandType type4(Type::INT32, {});
7635 // Phase 1, operands
7636 auto op14 = model->addOperand(&type33);
7637 auto op24 = model->addOperand(&type11);
7638 auto op34 = model->addOperand(&type12);
7639 auto param30 = model->addOperand(&type4);
7640 auto param31 = model->addOperand(&type4);
7641 auto param32 = model->addOperand(&type4);
7642 auto param33 = model->addOperand(&type4);
7643 auto layout = model->addOperand(&type0);
7644 auto param34 = model->addOperand(&type4);
7645 auto param35 = model->addOperand(&type4);
7646 auto op44 = model->addOperand(&type17);
7647 // Phase 2, operations
7648 static int32_t param30_init[] = {1};
7649 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7650 static int32_t param31_init[] = {2};
7651 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7652 static int32_t param32_init[] = {2};
7653 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7654 static int32_t param33_init[] = {0};
7655 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7656 static bool8 layout_init[] = {true};
7657 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7658 static int32_t param34_init[] = {3};
7659 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7660 static int32_t param35_init[] = {3};
7661 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7662 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7663 // Phase 3, inputs and outputs
7664 model->identifyInputsAndOutputs(
7665 {op14, op24, op34},
7666 {op44});
7667 assert(model->isValid());
7668 }
7669
is_ignored_nchw_weight_as_input_float16_5(int i)7670 inline bool is_ignored_nchw_weight_as_input_float16_5(int i) {
7671 static std::set<int> ignore = {};
7672 return ignore.find(i) != ignore.end();
7673 }
7674
CreateModel_dynamic_output_shape_nhwc_5(Model * model)7675 void CreateModel_dynamic_output_shape_nhwc_5(Model *model) {
7676 OperandType type0(Type::BOOL, {});
7677 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7678 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7679 OperandType type3(Type::TENSOR_FLOAT32, {1});
7680 OperandType type4(Type::INT32, {});
7681 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7682 // Phase 1, operands
7683 auto op14 = model->addOperand(&type6);
7684 auto op24 = model->addOperand(&type2);
7685 auto op34 = model->addOperand(&type3);
7686 auto param30 = model->addOperand(&type4);
7687 auto param31 = model->addOperand(&type4);
7688 auto param32 = model->addOperand(&type4);
7689 auto param33 = model->addOperand(&type4);
7690 auto layout = model->addOperand(&type0);
7691 auto param34 = model->addOperand(&type4);
7692 auto param35 = model->addOperand(&type4);
7693 auto op44 = model->addOperand(&type19);
7694 // Phase 2, operations
7695 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7696 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
7697 static float op34_init[] = {0.0f};
7698 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
7699 static int32_t param30_init[] = {1};
7700 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7701 static int32_t param31_init[] = {2};
7702 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7703 static int32_t param32_init[] = {2};
7704 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7705 static int32_t param33_init[] = {0};
7706 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7707 static bool8 layout_init[] = {false};
7708 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7709 static int32_t param34_init[] = {3};
7710 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7711 static int32_t param35_init[] = {3};
7712 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7713 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7714 // Phase 3, inputs and outputs
7715 model->identifyInputsAndOutputs(
7716 {op14},
7717 {op44});
7718 assert(model->isValid());
7719 }
7720
is_ignored_dynamic_output_shape_nhwc_5(int i)7721 inline bool is_ignored_dynamic_output_shape_nhwc_5(int i) {
7722 static std::set<int> ignore = {};
7723 return ignore.find(i) != ignore.end();
7724 }
7725
CreateModel_dynamic_output_shape_nhwc_relaxed_5(Model * model)7726 void CreateModel_dynamic_output_shape_nhwc_relaxed_5(Model *model) {
7727 OperandType type0(Type::BOOL, {});
7728 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7729 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7730 OperandType type3(Type::TENSOR_FLOAT32, {1});
7731 OperandType type4(Type::INT32, {});
7732 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7733 // Phase 1, operands
7734 auto op14 = model->addOperand(&type6);
7735 auto op24 = model->addOperand(&type2);
7736 auto op34 = model->addOperand(&type3);
7737 auto param30 = model->addOperand(&type4);
7738 auto param31 = model->addOperand(&type4);
7739 auto param32 = model->addOperand(&type4);
7740 auto param33 = model->addOperand(&type4);
7741 auto layout = model->addOperand(&type0);
7742 auto param34 = model->addOperand(&type4);
7743 auto param35 = model->addOperand(&type4);
7744 auto op44 = model->addOperand(&type19);
7745 // Phase 2, operations
7746 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7747 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
7748 static float op34_init[] = {0.0f};
7749 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
7750 static int32_t param30_init[] = {1};
7751 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7752 static int32_t param31_init[] = {2};
7753 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7754 static int32_t param32_init[] = {2};
7755 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7756 static int32_t param33_init[] = {0};
7757 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7758 static bool8 layout_init[] = {false};
7759 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7760 static int32_t param34_init[] = {3};
7761 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7762 static int32_t param35_init[] = {3};
7763 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7764 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7765 // Phase 3, inputs and outputs
7766 model->identifyInputsAndOutputs(
7767 {op14},
7768 {op44});
7769 // Phase 4: set relaxed execution
7770 model->relaxComputationFloat32toFloat16(true);
7771 assert(model->isValid());
7772 }
7773
is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i)7774 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i) {
7775 static std::set<int> ignore = {};
7776 return ignore.find(i) != ignore.end();
7777 }
7778
CreateModel_dynamic_output_shape_nhwc_quant8_5(Model * model)7779 void CreateModel_dynamic_output_shape_nhwc_quant8_5(Model *model) {
7780 OperandType type0(Type::BOOL, {});
7781 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
7782 OperandType type29(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
7783 OperandType type4(Type::INT32, {});
7784 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
7785 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
7786 // Phase 1, operands
7787 auto op14 = model->addOperand(&type29);
7788 auto op24 = model->addOperand(&type8);
7789 auto op34 = model->addOperand(&type9);
7790 auto param30 = model->addOperand(&type4);
7791 auto param31 = model->addOperand(&type4);
7792 auto param32 = model->addOperand(&type4);
7793 auto param33 = model->addOperand(&type4);
7794 auto layout = model->addOperand(&type0);
7795 auto param34 = model->addOperand(&type4);
7796 auto param35 = model->addOperand(&type4);
7797 auto op44 = model->addOperand(&type20);
7798 // Phase 2, operations
7799 static uint8_t op24_init[] = {8, 16, 24, 32};
7800 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
7801 static int32_t op34_init[] = {0};
7802 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
7803 static int32_t param30_init[] = {1};
7804 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7805 static int32_t param31_init[] = {2};
7806 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7807 static int32_t param32_init[] = {2};
7808 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7809 static int32_t param33_init[] = {0};
7810 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7811 static bool8 layout_init[] = {false};
7812 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7813 static int32_t param34_init[] = {3};
7814 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7815 static int32_t param35_init[] = {3};
7816 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7817 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7818 // Phase 3, inputs and outputs
7819 model->identifyInputsAndOutputs(
7820 {op14},
7821 {op44});
7822 assert(model->isValid());
7823 }
7824
is_ignored_dynamic_output_shape_nhwc_quant8_5(int i)7825 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_5(int i) {
7826 static std::set<int> ignore = {};
7827 return ignore.find(i) != ignore.end();
7828 }
7829
CreateModel_dynamic_output_shape_nhwc_float16_5(Model * model)7830 void CreateModel_dynamic_output_shape_nhwc_float16_5(Model *model) {
7831 OperandType type0(Type::BOOL, {});
7832 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
7833 OperandType type12(Type::TENSOR_FLOAT16, {1});
7834 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
7835 OperandType type30(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
7836 OperandType type4(Type::INT32, {});
7837 // Phase 1, operands
7838 auto op14 = model->addOperand(&type30);
7839 auto op24 = model->addOperand(&type11);
7840 auto op34 = model->addOperand(&type12);
7841 auto param30 = model->addOperand(&type4);
7842 auto param31 = model->addOperand(&type4);
7843 auto param32 = model->addOperand(&type4);
7844 auto param33 = model->addOperand(&type4);
7845 auto layout = model->addOperand(&type0);
7846 auto param34 = model->addOperand(&type4);
7847 auto param35 = model->addOperand(&type4);
7848 auto op44 = model->addOperand(&type21);
7849 // Phase 2, operations
7850 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
7851 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
7852 static _Float16 op34_init[] = {0.0f};
7853 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
7854 static int32_t param30_init[] = {1};
7855 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7856 static int32_t param31_init[] = {2};
7857 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7858 static int32_t param32_init[] = {2};
7859 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7860 static int32_t param33_init[] = {0};
7861 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7862 static bool8 layout_init[] = {false};
7863 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7864 static int32_t param34_init[] = {3};
7865 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7866 static int32_t param35_init[] = {3};
7867 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7868 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7869 // Phase 3, inputs and outputs
7870 model->identifyInputsAndOutputs(
7871 {op14},
7872 {op44});
7873 assert(model->isValid());
7874 }
7875
is_ignored_dynamic_output_shape_nhwc_float16_5(int i)7876 inline bool is_ignored_dynamic_output_shape_nhwc_float16_5(int i) {
7877 static std::set<int> ignore = {};
7878 return ignore.find(i) != ignore.end();
7879 }
7880
CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model * model)7881 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model *model) {
7882 OperandType type0(Type::BOOL, {});
7883 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7884 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7885 OperandType type3(Type::TENSOR_FLOAT32, {1});
7886 OperandType type4(Type::INT32, {});
7887 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7888 // Phase 1, operands
7889 auto op14 = model->addOperand(&type6);
7890 auto op24 = model->addOperand(&type2);
7891 auto op34 = model->addOperand(&type3);
7892 auto param30 = model->addOperand(&type4);
7893 auto param31 = model->addOperand(&type4);
7894 auto param32 = model->addOperand(&type4);
7895 auto param33 = model->addOperand(&type4);
7896 auto layout = model->addOperand(&type0);
7897 auto param34 = model->addOperand(&type4);
7898 auto param35 = model->addOperand(&type4);
7899 auto op44 = model->addOperand(&type19);
7900 // Phase 2, operations
7901 static int32_t param30_init[] = {1};
7902 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7903 static int32_t param31_init[] = {2};
7904 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7905 static int32_t param32_init[] = {2};
7906 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7907 static int32_t param33_init[] = {0};
7908 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7909 static bool8 layout_init[] = {false};
7910 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7911 static int32_t param34_init[] = {3};
7912 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7913 static int32_t param35_init[] = {3};
7914 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7915 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7916 // Phase 3, inputs and outputs
7917 model->identifyInputsAndOutputs(
7918 {op14, op24, op34},
7919 {op44});
7920 assert(model->isValid());
7921 }
7922
is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i)7923 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i) {
7924 static std::set<int> ignore = {};
7925 return ignore.find(i) != ignore.end();
7926 }
7927
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_5(Model * model)7928 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_5(Model *model) {
7929 OperandType type0(Type::BOOL, {});
7930 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7931 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
7932 OperandType type3(Type::TENSOR_FLOAT32, {1});
7933 OperandType type4(Type::INT32, {});
7934 OperandType type6(Type::TENSOR_FLOAT32, {1, 6, 6, 1});
7935 // Phase 1, operands
7936 auto op14 = model->addOperand(&type6);
7937 auto op24 = model->addOperand(&type2);
7938 auto op34 = model->addOperand(&type3);
7939 auto param30 = model->addOperand(&type4);
7940 auto param31 = model->addOperand(&type4);
7941 auto param32 = model->addOperand(&type4);
7942 auto param33 = model->addOperand(&type4);
7943 auto layout = model->addOperand(&type0);
7944 auto param34 = model->addOperand(&type4);
7945 auto param35 = model->addOperand(&type4);
7946 auto op44 = model->addOperand(&type19);
7947 // Phase 2, operations
7948 static int32_t param30_init[] = {1};
7949 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7950 static int32_t param31_init[] = {2};
7951 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
7952 static int32_t param32_init[] = {2};
7953 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
7954 static int32_t param33_init[] = {0};
7955 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
7956 static bool8 layout_init[] = {false};
7957 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7958 static int32_t param34_init[] = {3};
7959 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
7960 static int32_t param35_init[] = {3};
7961 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
7962 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
7963 // Phase 3, inputs and outputs
7964 model->identifyInputsAndOutputs(
7965 {op14, op24, op34},
7966 {op44});
7967 // Phase 4: set relaxed execution
7968 model->relaxComputationFloat32toFloat16(true);
7969 assert(model->isValid());
7970 }
7971
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_5(int i)7972 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_5(int i) {
7973 static std::set<int> ignore = {};
7974 return ignore.find(i) != ignore.end();
7975 }
7976
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_5(Model * model)7977 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_5(Model *model) {
7978 OperandType type0(Type::BOOL, {});
7979 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
7980 OperandType type29(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 0.5f, 0);
7981 OperandType type4(Type::INT32, {});
7982 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
7983 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
7984 // Phase 1, operands
7985 auto op14 = model->addOperand(&type29);
7986 auto op24 = model->addOperand(&type8);
7987 auto op34 = model->addOperand(&type9);
7988 auto param30 = model->addOperand(&type4);
7989 auto param31 = model->addOperand(&type4);
7990 auto param32 = model->addOperand(&type4);
7991 auto param33 = model->addOperand(&type4);
7992 auto layout = model->addOperand(&type0);
7993 auto param34 = model->addOperand(&type4);
7994 auto param35 = model->addOperand(&type4);
7995 auto op44 = model->addOperand(&type20);
7996 // Phase 2, operations
7997 static int32_t param30_init[] = {1};
7998 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
7999 static int32_t param31_init[] = {2};
8000 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8001 static int32_t param32_init[] = {2};
8002 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8003 static int32_t param33_init[] = {0};
8004 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8005 static bool8 layout_init[] = {false};
8006 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8007 static int32_t param34_init[] = {3};
8008 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8009 static int32_t param35_init[] = {3};
8010 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8011 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8012 // Phase 3, inputs and outputs
8013 model->identifyInputsAndOutputs(
8014 {op14, op24, op34},
8015 {op44});
8016 assert(model->isValid());
8017 }
8018
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_5(int i)8019 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_5(int i) {
8020 static std::set<int> ignore = {};
8021 return ignore.find(i) != ignore.end();
8022 }
8023
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_5(Model * model)8024 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_5(Model *model) {
8025 OperandType type0(Type::BOOL, {});
8026 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
8027 OperandType type12(Type::TENSOR_FLOAT16, {1});
8028 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8029 OperandType type30(Type::TENSOR_FLOAT16, {1, 6, 6, 1});
8030 OperandType type4(Type::INT32, {});
8031 // Phase 1, operands
8032 auto op14 = model->addOperand(&type30);
8033 auto op24 = model->addOperand(&type11);
8034 auto op34 = model->addOperand(&type12);
8035 auto param30 = model->addOperand(&type4);
8036 auto param31 = model->addOperand(&type4);
8037 auto param32 = model->addOperand(&type4);
8038 auto param33 = model->addOperand(&type4);
8039 auto layout = model->addOperand(&type0);
8040 auto param34 = model->addOperand(&type4);
8041 auto param35 = model->addOperand(&type4);
8042 auto op44 = model->addOperand(&type21);
8043 // Phase 2, operations
8044 static int32_t param30_init[] = {1};
8045 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8046 static int32_t param31_init[] = {2};
8047 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8048 static int32_t param32_init[] = {2};
8049 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8050 static int32_t param33_init[] = {0};
8051 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8052 static bool8 layout_init[] = {false};
8053 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8054 static int32_t param34_init[] = {3};
8055 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8056 static int32_t param35_init[] = {3};
8057 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8058 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8059 // Phase 3, inputs and outputs
8060 model->identifyInputsAndOutputs(
8061 {op14, op24, op34},
8062 {op44});
8063 assert(model->isValid());
8064 }
8065
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_5(int i)8066 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_5(int i) {
8067 static std::set<int> ignore = {};
8068 return ignore.find(i) != ignore.end();
8069 }
8070
CreateModel_dynamic_output_shape_nchw_5(Model * model)8071 void CreateModel_dynamic_output_shape_nchw_5(Model *model) {
8072 OperandType type0(Type::BOOL, {});
8073 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8074 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
8075 OperandType type3(Type::TENSOR_FLOAT32, {1});
8076 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
8077 OperandType type4(Type::INT32, {});
8078 // Phase 1, operands
8079 auto op14 = model->addOperand(&type31);
8080 auto op24 = model->addOperand(&type2);
8081 auto op34 = model->addOperand(&type3);
8082 auto param30 = model->addOperand(&type4);
8083 auto param31 = model->addOperand(&type4);
8084 auto param32 = model->addOperand(&type4);
8085 auto param33 = model->addOperand(&type4);
8086 auto layout = model->addOperand(&type0);
8087 auto param34 = model->addOperand(&type4);
8088 auto param35 = model->addOperand(&type4);
8089 auto op44 = model->addOperand(&type19);
8090 // Phase 2, operations
8091 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
8092 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
8093 static float op34_init[] = {0.0f};
8094 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
8095 static int32_t param30_init[] = {1};
8096 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8097 static int32_t param31_init[] = {2};
8098 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8099 static int32_t param32_init[] = {2};
8100 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8101 static int32_t param33_init[] = {0};
8102 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8103 static bool8 layout_init[] = {true};
8104 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8105 static int32_t param34_init[] = {3};
8106 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8107 static int32_t param35_init[] = {3};
8108 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8109 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8110 // Phase 3, inputs and outputs
8111 model->identifyInputsAndOutputs(
8112 {op14},
8113 {op44});
8114 assert(model->isValid());
8115 }
8116
is_ignored_dynamic_output_shape_nchw_5(int i)8117 inline bool is_ignored_dynamic_output_shape_nchw_5(int i) {
8118 static std::set<int> ignore = {};
8119 return ignore.find(i) != ignore.end();
8120 }
8121
CreateModel_dynamic_output_shape_nchw_relaxed_5(Model * model)8122 void CreateModel_dynamic_output_shape_nchw_relaxed_5(Model *model) {
8123 OperandType type0(Type::BOOL, {});
8124 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8125 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
8126 OperandType type3(Type::TENSOR_FLOAT32, {1});
8127 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
8128 OperandType type4(Type::INT32, {});
8129 // Phase 1, operands
8130 auto op14 = model->addOperand(&type31);
8131 auto op24 = model->addOperand(&type2);
8132 auto op34 = model->addOperand(&type3);
8133 auto param30 = model->addOperand(&type4);
8134 auto param31 = model->addOperand(&type4);
8135 auto param32 = model->addOperand(&type4);
8136 auto param33 = model->addOperand(&type4);
8137 auto layout = model->addOperand(&type0);
8138 auto param34 = model->addOperand(&type4);
8139 auto param35 = model->addOperand(&type4);
8140 auto op44 = model->addOperand(&type19);
8141 // Phase 2, operations
8142 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
8143 model->setOperandValue(op24, op24_init, sizeof(float) * 4);
8144 static float op34_init[] = {0.0f};
8145 model->setOperandValue(op34, op34_init, sizeof(float) * 1);
8146 static int32_t param30_init[] = {1};
8147 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8148 static int32_t param31_init[] = {2};
8149 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8150 static int32_t param32_init[] = {2};
8151 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8152 static int32_t param33_init[] = {0};
8153 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8154 static bool8 layout_init[] = {true};
8155 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8156 static int32_t param34_init[] = {3};
8157 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8158 static int32_t param35_init[] = {3};
8159 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8160 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8161 // Phase 3, inputs and outputs
8162 model->identifyInputsAndOutputs(
8163 {op14},
8164 {op44});
8165 // Phase 4: set relaxed execution
8166 model->relaxComputationFloat32toFloat16(true);
8167 assert(model->isValid());
8168 }
8169
is_ignored_dynamic_output_shape_nchw_relaxed_5(int i)8170 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_5(int i) {
8171 static std::set<int> ignore = {};
8172 return ignore.find(i) != ignore.end();
8173 }
8174
CreateModel_dynamic_output_shape_nchw_quant8_5(Model * model)8175 void CreateModel_dynamic_output_shape_nchw_quant8_5(Model *model) {
8176 OperandType type0(Type::BOOL, {});
8177 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
8178 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
8179 OperandType type4(Type::INT32, {});
8180 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
8181 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
8182 // Phase 1, operands
8183 auto op14 = model->addOperand(&type32);
8184 auto op24 = model->addOperand(&type8);
8185 auto op34 = model->addOperand(&type9);
8186 auto param30 = model->addOperand(&type4);
8187 auto param31 = model->addOperand(&type4);
8188 auto param32 = model->addOperand(&type4);
8189 auto param33 = model->addOperand(&type4);
8190 auto layout = model->addOperand(&type0);
8191 auto param34 = model->addOperand(&type4);
8192 auto param35 = model->addOperand(&type4);
8193 auto op44 = model->addOperand(&type20);
8194 // Phase 2, operations
8195 static uint8_t op24_init[] = {8, 16, 24, 32};
8196 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 4);
8197 static int32_t op34_init[] = {0};
8198 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1);
8199 static int32_t param30_init[] = {1};
8200 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8201 static int32_t param31_init[] = {2};
8202 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8203 static int32_t param32_init[] = {2};
8204 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8205 static int32_t param33_init[] = {0};
8206 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8207 static bool8 layout_init[] = {true};
8208 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8209 static int32_t param34_init[] = {3};
8210 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8211 static int32_t param35_init[] = {3};
8212 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8213 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8214 // Phase 3, inputs and outputs
8215 model->identifyInputsAndOutputs(
8216 {op14},
8217 {op44});
8218 assert(model->isValid());
8219 }
8220
is_ignored_dynamic_output_shape_nchw_quant8_5(int i)8221 inline bool is_ignored_dynamic_output_shape_nchw_quant8_5(int i) {
8222 static std::set<int> ignore = {};
8223 return ignore.find(i) != ignore.end();
8224 }
8225
CreateModel_dynamic_output_shape_nchw_float16_5(Model * model)8226 void CreateModel_dynamic_output_shape_nchw_float16_5(Model *model) {
8227 OperandType type0(Type::BOOL, {});
8228 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
8229 OperandType type12(Type::TENSOR_FLOAT16, {1});
8230 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8231 OperandType type33(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
8232 OperandType type4(Type::INT32, {});
8233 // Phase 1, operands
8234 auto op14 = model->addOperand(&type33);
8235 auto op24 = model->addOperand(&type11);
8236 auto op34 = model->addOperand(&type12);
8237 auto param30 = model->addOperand(&type4);
8238 auto param31 = model->addOperand(&type4);
8239 auto param32 = model->addOperand(&type4);
8240 auto param33 = model->addOperand(&type4);
8241 auto layout = model->addOperand(&type0);
8242 auto param34 = model->addOperand(&type4);
8243 auto param35 = model->addOperand(&type4);
8244 auto op44 = model->addOperand(&type21);
8245 // Phase 2, operations
8246 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
8247 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 4);
8248 static _Float16 op34_init[] = {0.0f};
8249 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1);
8250 static int32_t param30_init[] = {1};
8251 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8252 static int32_t param31_init[] = {2};
8253 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8254 static int32_t param32_init[] = {2};
8255 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8256 static int32_t param33_init[] = {0};
8257 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8258 static bool8 layout_init[] = {true};
8259 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8260 static int32_t param34_init[] = {3};
8261 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8262 static int32_t param35_init[] = {3};
8263 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8264 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8265 // Phase 3, inputs and outputs
8266 model->identifyInputsAndOutputs(
8267 {op14},
8268 {op44});
8269 assert(model->isValid());
8270 }
8271
is_ignored_dynamic_output_shape_nchw_float16_5(int i)8272 inline bool is_ignored_dynamic_output_shape_nchw_float16_5(int i) {
8273 static std::set<int> ignore = {};
8274 return ignore.find(i) != ignore.end();
8275 }
8276
CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model * model)8277 void CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model *model) {
8278 OperandType type0(Type::BOOL, {});
8279 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8280 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
8281 OperandType type3(Type::TENSOR_FLOAT32, {1});
8282 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
8283 OperandType type4(Type::INT32, {});
8284 // Phase 1, operands
8285 auto op14 = model->addOperand(&type31);
8286 auto op24 = model->addOperand(&type2);
8287 auto op34 = model->addOperand(&type3);
8288 auto param30 = model->addOperand(&type4);
8289 auto param31 = model->addOperand(&type4);
8290 auto param32 = model->addOperand(&type4);
8291 auto param33 = model->addOperand(&type4);
8292 auto layout = model->addOperand(&type0);
8293 auto param34 = model->addOperand(&type4);
8294 auto param35 = model->addOperand(&type4);
8295 auto op44 = model->addOperand(&type19);
8296 // Phase 2, operations
8297 static int32_t param30_init[] = {1};
8298 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8299 static int32_t param31_init[] = {2};
8300 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8301 static int32_t param32_init[] = {2};
8302 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8303 static int32_t param33_init[] = {0};
8304 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8305 static bool8 layout_init[] = {true};
8306 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8307 static int32_t param34_init[] = {3};
8308 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8309 static int32_t param35_init[] = {3};
8310 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8311 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8312 // Phase 3, inputs and outputs
8313 model->identifyInputsAndOutputs(
8314 {op14, op24, op34},
8315 {op44});
8316 assert(model->isValid());
8317 }
8318
is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i)8319 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i) {
8320 static std::set<int> ignore = {};
8321 return ignore.find(i) != ignore.end();
8322 }
8323
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_5(Model * model)8324 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_5(Model *model) {
8325 OperandType type0(Type::BOOL, {});
8326 OperandType type19(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8327 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1});
8328 OperandType type3(Type::TENSOR_FLOAT32, {1});
8329 OperandType type31(Type::TENSOR_FLOAT32, {1, 1, 6, 6});
8330 OperandType type4(Type::INT32, {});
8331 // Phase 1, operands
8332 auto op14 = model->addOperand(&type31);
8333 auto op24 = model->addOperand(&type2);
8334 auto op34 = model->addOperand(&type3);
8335 auto param30 = model->addOperand(&type4);
8336 auto param31 = model->addOperand(&type4);
8337 auto param32 = model->addOperand(&type4);
8338 auto param33 = model->addOperand(&type4);
8339 auto layout = model->addOperand(&type0);
8340 auto param34 = model->addOperand(&type4);
8341 auto param35 = model->addOperand(&type4);
8342 auto op44 = model->addOperand(&type19);
8343 // Phase 2, operations
8344 static int32_t param30_init[] = {1};
8345 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8346 static int32_t param31_init[] = {2};
8347 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8348 static int32_t param32_init[] = {2};
8349 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8350 static int32_t param33_init[] = {0};
8351 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8352 static bool8 layout_init[] = {true};
8353 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8354 static int32_t param34_init[] = {3};
8355 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8356 static int32_t param35_init[] = {3};
8357 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8358 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8359 // Phase 3, inputs and outputs
8360 model->identifyInputsAndOutputs(
8361 {op14, op24, op34},
8362 {op44});
8363 // Phase 4: set relaxed execution
8364 model->relaxComputationFloat32toFloat16(true);
8365 assert(model->isValid());
8366 }
8367
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_5(int i)8368 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_5(int i) {
8369 static std::set<int> ignore = {};
8370 return ignore.find(i) != ignore.end();
8371 }
8372
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_5(Model * model)8373 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_5(Model *model) {
8374 OperandType type0(Type::BOOL, {});
8375 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0);
8376 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 0.5f, 0);
8377 OperandType type4(Type::INT32, {});
8378 OperandType type8(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0);
8379 OperandType type9(Type::TENSOR_INT32, {1}, 0.0625f, 0);
8380 // Phase 1, operands
8381 auto op14 = model->addOperand(&type32);
8382 auto op24 = model->addOperand(&type8);
8383 auto op34 = model->addOperand(&type9);
8384 auto param30 = model->addOperand(&type4);
8385 auto param31 = model->addOperand(&type4);
8386 auto param32 = model->addOperand(&type4);
8387 auto param33 = model->addOperand(&type4);
8388 auto layout = model->addOperand(&type0);
8389 auto param34 = model->addOperand(&type4);
8390 auto param35 = model->addOperand(&type4);
8391 auto op44 = model->addOperand(&type20);
8392 // Phase 2, operations
8393 static int32_t param30_init[] = {1};
8394 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8395 static int32_t param31_init[] = {2};
8396 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8397 static int32_t param32_init[] = {2};
8398 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8399 static int32_t param33_init[] = {0};
8400 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8401 static bool8 layout_init[] = {true};
8402 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8403 static int32_t param34_init[] = {3};
8404 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8405 static int32_t param35_init[] = {3};
8406 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8407 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8408 // Phase 3, inputs and outputs
8409 model->identifyInputsAndOutputs(
8410 {op14, op24, op34},
8411 {op44});
8412 assert(model->isValid());
8413 }
8414
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_5(int i)8415 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_5(int i) {
8416 static std::set<int> ignore = {};
8417 return ignore.find(i) != ignore.end();
8418 }
8419
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_5(Model * model)8420 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_5(Model *model) {
8421 OperandType type0(Type::BOOL, {});
8422 OperandType type11(Type::TENSOR_FLOAT16, {1, 2, 2, 1});
8423 OperandType type12(Type::TENSOR_FLOAT16, {1});
8424 OperandType type21(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8425 OperandType type33(Type::TENSOR_FLOAT16, {1, 1, 6, 6});
8426 OperandType type4(Type::INT32, {});
8427 // Phase 1, operands
8428 auto op14 = model->addOperand(&type33);
8429 auto op24 = model->addOperand(&type11);
8430 auto op34 = model->addOperand(&type12);
8431 auto param30 = model->addOperand(&type4);
8432 auto param31 = model->addOperand(&type4);
8433 auto param32 = model->addOperand(&type4);
8434 auto param33 = model->addOperand(&type4);
8435 auto layout = model->addOperand(&type0);
8436 auto param34 = model->addOperand(&type4);
8437 auto param35 = model->addOperand(&type4);
8438 auto op44 = model->addOperand(&type21);
8439 // Phase 2, operations
8440 static int32_t param30_init[] = {1};
8441 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8442 static int32_t param31_init[] = {2};
8443 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8444 static int32_t param32_init[] = {2};
8445 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8446 static int32_t param33_init[] = {0};
8447 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8448 static bool8 layout_init[] = {true};
8449 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8450 static int32_t param34_init[] = {3};
8451 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1);
8452 static int32_t param35_init[] = {3};
8453 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1);
8454 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param30, param31, param32, param33, layout, param34, param35}, {op44});
8455 // Phase 3, inputs and outputs
8456 model->identifyInputsAndOutputs(
8457 {op14, op24, op34},
8458 {op44});
8459 assert(model->isValid());
8460 }
8461
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_5(int i)8462 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_5(int i) {
8463 static std::set<int> ignore = {};
8464 return ignore.find(i) != ignore.end();
8465 }
8466
8467