1 // clang-format off
2 // Generated file (from: depthwise_conv2d_v1_2.mod.py). Do not edit
CreateModel_nhwc(Model * model)3 void CreateModel_nhwc(Model *model) {
4 OperandType type0(Type::BOOL, {});
5 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
6 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7 OperandType type3(Type::TENSOR_FLOAT32, {4});
8 OperandType type4(Type::INT32, {});
9 // Phase 1, operands
10 auto op1 = model->addOperand(&type1);
11 auto op2 = model->addOperand(&type2);
12 auto op3 = model->addOperand(&type3);
13 auto param = model->addOperand(&type4);
14 auto param1 = model->addOperand(&type4);
15 auto param2 = model->addOperand(&type4);
16 auto param3 = model->addOperand(&type4);
17 auto param4 = model->addOperand(&type4);
18 auto param5 = model->addOperand(&type4);
19 auto param6 = model->addOperand(&type4);
20 auto param7 = model->addOperand(&type4);
21 auto layout = model->addOperand(&type0);
22 auto op4 = model->addOperand(&type2);
23 // Phase 2, operations
24 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
25 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
26 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
27 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
28 static int32_t param_init[] = {0};
29 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
30 static int32_t param1_init[] = {0};
31 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
32 static int32_t param2_init[] = {0};
33 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
34 static int32_t param3_init[] = {0};
35 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
36 static int32_t param4_init[] = {1};
37 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
38 static int32_t param5_init[] = {1};
39 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
40 static int32_t param6_init[] = {2};
41 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
42 static int32_t param7_init[] = {0};
43 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
44 static bool8 layout_init[] = {false};
45 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
46 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
47 // Phase 3, inputs and outputs
48 model->identifyInputsAndOutputs(
49 {op1},
50 {op4});
51 assert(model->isValid());
52 }
53
is_ignored_nhwc(int i)54 inline bool is_ignored_nhwc(int i) {
55 static std::set<int> ignore = {};
56 return ignore.find(i) != ignore.end();
57 }
58
CreateModel_nhwc_relaxed(Model * model)59 void CreateModel_nhwc_relaxed(Model *model) {
60 OperandType type0(Type::BOOL, {});
61 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
62 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
63 OperandType type3(Type::TENSOR_FLOAT32, {4});
64 OperandType type4(Type::INT32, {});
65 // Phase 1, operands
66 auto op1 = model->addOperand(&type1);
67 auto op2 = model->addOperand(&type2);
68 auto op3 = model->addOperand(&type3);
69 auto param = model->addOperand(&type4);
70 auto param1 = model->addOperand(&type4);
71 auto param2 = model->addOperand(&type4);
72 auto param3 = model->addOperand(&type4);
73 auto param4 = model->addOperand(&type4);
74 auto param5 = model->addOperand(&type4);
75 auto param6 = model->addOperand(&type4);
76 auto param7 = model->addOperand(&type4);
77 auto layout = model->addOperand(&type0);
78 auto op4 = model->addOperand(&type2);
79 // Phase 2, operations
80 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
81 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
82 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
83 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
84 static int32_t param_init[] = {0};
85 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
86 static int32_t param1_init[] = {0};
87 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
88 static int32_t param2_init[] = {0};
89 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
90 static int32_t param3_init[] = {0};
91 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
92 static int32_t param4_init[] = {1};
93 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
94 static int32_t param5_init[] = {1};
95 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
96 static int32_t param6_init[] = {2};
97 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
98 static int32_t param7_init[] = {0};
99 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
100 static bool8 layout_init[] = {false};
101 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
102 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
103 // Phase 3, inputs and outputs
104 model->identifyInputsAndOutputs(
105 {op1},
106 {op4});
107 // Phase 4: set relaxed execution
108 model->relaxComputationFloat32toFloat16(true);
109 assert(model->isValid());
110 }
111
is_ignored_nhwc_relaxed(int i)112 inline bool is_ignored_nhwc_relaxed(int i) {
113 static std::set<int> ignore = {};
114 return ignore.find(i) != ignore.end();
115 }
116
CreateModel_nhwc_float16(Model * model)117 void CreateModel_nhwc_float16(Model *model) {
118 OperandType type0(Type::BOOL, {});
119 OperandType type15(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
120 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
121 OperandType type17(Type::TENSOR_FLOAT16, {4});
122 OperandType type4(Type::INT32, {});
123 // Phase 1, operands
124 auto op1 = model->addOperand(&type15);
125 auto op2 = model->addOperand(&type16);
126 auto op3 = model->addOperand(&type17);
127 auto param = model->addOperand(&type4);
128 auto param1 = model->addOperand(&type4);
129 auto param2 = model->addOperand(&type4);
130 auto param3 = model->addOperand(&type4);
131 auto param4 = model->addOperand(&type4);
132 auto param5 = model->addOperand(&type4);
133 auto param6 = model->addOperand(&type4);
134 auto param7 = model->addOperand(&type4);
135 auto layout = model->addOperand(&type0);
136 auto op4 = model->addOperand(&type16);
137 // Phase 2, operations
138 static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
139 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
140 static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
141 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
142 static int32_t param_init[] = {0};
143 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
144 static int32_t param1_init[] = {0};
145 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
146 static int32_t param2_init[] = {0};
147 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
148 static int32_t param3_init[] = {0};
149 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
150 static int32_t param4_init[] = {1};
151 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
152 static int32_t param5_init[] = {1};
153 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
154 static int32_t param6_init[] = {2};
155 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
156 static int32_t param7_init[] = {0};
157 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
158 static bool8 layout_init[] = {false};
159 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
160 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
161 // Phase 3, inputs and outputs
162 model->identifyInputsAndOutputs(
163 {op1},
164 {op4});
165 assert(model->isValid());
166 }
167
is_ignored_nhwc_float16(int i)168 inline bool is_ignored_nhwc_float16(int i) {
169 static std::set<int> ignore = {};
170 return ignore.find(i) != ignore.end();
171 }
172
CreateModel_nhwc_channelQuant8(Model * model)173 void CreateModel_nhwc_channelQuant8(Model *model) {
174 OperandType type0(Type::BOOL, {});
175 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
176 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
177 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
178 OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
179 OperandType type4(Type::INT32, {});
180 // Phase 1, operands
181 auto op1 = model->addOperand(&type18);
182 auto op2 = model->addOperand(&type19);
183 auto op3 = model->addOperand(&type20);
184 auto param = model->addOperand(&type4);
185 auto param1 = model->addOperand(&type4);
186 auto param2 = model->addOperand(&type4);
187 auto param3 = model->addOperand(&type4);
188 auto param4 = model->addOperand(&type4);
189 auto param5 = model->addOperand(&type4);
190 auto param6 = model->addOperand(&type4);
191 auto param7 = model->addOperand(&type4);
192 auto layout = model->addOperand(&type0);
193 auto op4 = model->addOperand(&type21);
194 // Phase 2, operations
195 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
196 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
197 static int32_t op3_init[] = {200, 800, 600, 1600};
198 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
199 static int32_t param_init[] = {0};
200 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
201 static int32_t param1_init[] = {0};
202 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
203 static int32_t param2_init[] = {0};
204 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
205 static int32_t param3_init[] = {0};
206 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
207 static int32_t param4_init[] = {1};
208 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
209 static int32_t param5_init[] = {1};
210 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
211 static int32_t param6_init[] = {2};
212 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
213 static int32_t param7_init[] = {0};
214 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
215 static bool8 layout_init[] = {false};
216 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
217 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
218 // Phase 3, inputs and outputs
219 model->identifyInputsAndOutputs(
220 {op1},
221 {op4});
222 assert(model->isValid());
223 }
224
is_ignored_nhwc_channelQuant8(int i)225 inline bool is_ignored_nhwc_channelQuant8(int i) {
226 static std::set<int> ignore = {};
227 return ignore.find(i) != ignore.end();
228 }
229
CreateModel_nhwc_channelQuant8_2(Model * model)230 void CreateModel_nhwc_channelQuant8_2(Model *model) {
231 OperandType type0(Type::BOOL, {});
232 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
233 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
234 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
235 OperandType type24(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.0001f, 0);
236 OperandType type4(Type::INT32, {});
237 // Phase 1, operands
238 auto op1 = model->addOperand(&type18);
239 auto op2 = model->addOperand(&type22);
240 auto op3 = model->addOperand(&type23);
241 auto param = model->addOperand(&type4);
242 auto param1 = model->addOperand(&type4);
243 auto param2 = model->addOperand(&type4);
244 auto param3 = model->addOperand(&type4);
245 auto param4 = model->addOperand(&type4);
246 auto param5 = model->addOperand(&type4);
247 auto param6 = model->addOperand(&type4);
248 auto param7 = model->addOperand(&type4);
249 auto layout = model->addOperand(&type0);
250 auto op4 = model->addOperand(&type24);
251 // Phase 2, operations
252 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
253 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
254 static int32_t op3_init[] = {200, 800, 600, 1600};
255 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
256 static int32_t param_init[] = {0};
257 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
258 static int32_t param1_init[] = {0};
259 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
260 static int32_t param2_init[] = {0};
261 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
262 static int32_t param3_init[] = {0};
263 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
264 static int32_t param4_init[] = {1};
265 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
266 static int32_t param5_init[] = {1};
267 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
268 static int32_t param6_init[] = {2};
269 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
270 static int32_t param7_init[] = {0};
271 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
272 static bool8 layout_init[] = {false};
273 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
274 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
275 // Phase 3, inputs and outputs
276 model->identifyInputsAndOutputs(
277 {op1},
278 {op4});
279 assert(model->isValid());
280 }
281
is_ignored_nhwc_channelQuant8_2(int i)282 inline bool is_ignored_nhwc_channelQuant8_2(int i) {
283 static std::set<int> ignore = {};
284 return ignore.find(i) != ignore.end();
285 }
286
CreateModel_nhwc_quant8(Model * model)287 void CreateModel_nhwc_quant8(Model *model) {
288 OperandType type0(Type::BOOL, {});
289 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
290 OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
291 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
292 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
293 OperandType type4(Type::INT32, {});
294 // Phase 1, operands
295 auto op1 = model->addOperand(&type18);
296 auto op2 = model->addOperand(&type25);
297 auto op3 = model->addOperand(&type26);
298 auto param = model->addOperand(&type4);
299 auto param1 = model->addOperand(&type4);
300 auto param2 = model->addOperand(&type4);
301 auto param3 = model->addOperand(&type4);
302 auto param4 = model->addOperand(&type4);
303 auto param5 = model->addOperand(&type4);
304 auto param6 = model->addOperand(&type4);
305 auto param7 = model->addOperand(&type4);
306 auto layout = model->addOperand(&type0);
307 auto op4 = model->addOperand(&type21);
308 // Phase 2, operations
309 static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
310 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
311 static int32_t op3_init[] = {200, 400, 600, 800};
312 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
313 static int32_t param_init[] = {0};
314 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
315 static int32_t param1_init[] = {0};
316 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
317 static int32_t param2_init[] = {0};
318 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
319 static int32_t param3_init[] = {0};
320 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
321 static int32_t param4_init[] = {1};
322 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
323 static int32_t param5_init[] = {1};
324 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
325 static int32_t param6_init[] = {2};
326 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
327 static int32_t param7_init[] = {0};
328 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
329 static bool8 layout_init[] = {false};
330 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
331 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
332 // Phase 3, inputs and outputs
333 model->identifyInputsAndOutputs(
334 {op1},
335 {op4});
336 assert(model->isValid());
337 }
338
is_ignored_nhwc_quant8(int i)339 inline bool is_ignored_nhwc_quant8(int i) {
340 static std::set<int> ignore = {};
341 return ignore.find(i) != ignore.end();
342 }
343
CreateModel_nhwc_weight_as_input(Model * model)344 void CreateModel_nhwc_weight_as_input(Model *model) {
345 OperandType type0(Type::BOOL, {});
346 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
347 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
348 OperandType type3(Type::TENSOR_FLOAT32, {4});
349 OperandType type4(Type::INT32, {});
350 // Phase 1, operands
351 auto op1 = model->addOperand(&type1);
352 auto op2 = model->addOperand(&type2);
353 auto op3 = model->addOperand(&type3);
354 auto param = model->addOperand(&type4);
355 auto param1 = model->addOperand(&type4);
356 auto param2 = model->addOperand(&type4);
357 auto param3 = model->addOperand(&type4);
358 auto param4 = model->addOperand(&type4);
359 auto param5 = model->addOperand(&type4);
360 auto param6 = model->addOperand(&type4);
361 auto param7 = model->addOperand(&type4);
362 auto layout = model->addOperand(&type0);
363 auto op4 = model->addOperand(&type2);
364 // Phase 2, operations
365 static int32_t param_init[] = {0};
366 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
367 static int32_t param1_init[] = {0};
368 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
369 static int32_t param2_init[] = {0};
370 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
371 static int32_t param3_init[] = {0};
372 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
373 static int32_t param4_init[] = {1};
374 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
375 static int32_t param5_init[] = {1};
376 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
377 static int32_t param6_init[] = {2};
378 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
379 static int32_t param7_init[] = {0};
380 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
381 static bool8 layout_init[] = {false};
382 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
383 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
384 // Phase 3, inputs and outputs
385 model->identifyInputsAndOutputs(
386 {op1, op2, op3},
387 {op4});
388 assert(model->isValid());
389 }
390
is_ignored_nhwc_weight_as_input(int i)391 inline bool is_ignored_nhwc_weight_as_input(int i) {
392 static std::set<int> ignore = {};
393 return ignore.find(i) != ignore.end();
394 }
395
CreateModel_nhwc_weight_as_input_relaxed(Model * model)396 void CreateModel_nhwc_weight_as_input_relaxed(Model *model) {
397 OperandType type0(Type::BOOL, {});
398 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
399 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
400 OperandType type3(Type::TENSOR_FLOAT32, {4});
401 OperandType type4(Type::INT32, {});
402 // Phase 1, operands
403 auto op1 = model->addOperand(&type1);
404 auto op2 = model->addOperand(&type2);
405 auto op3 = model->addOperand(&type3);
406 auto param = model->addOperand(&type4);
407 auto param1 = model->addOperand(&type4);
408 auto param2 = model->addOperand(&type4);
409 auto param3 = model->addOperand(&type4);
410 auto param4 = model->addOperand(&type4);
411 auto param5 = model->addOperand(&type4);
412 auto param6 = model->addOperand(&type4);
413 auto param7 = model->addOperand(&type4);
414 auto layout = model->addOperand(&type0);
415 auto op4 = model->addOperand(&type2);
416 // Phase 2, operations
417 static int32_t param_init[] = {0};
418 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
419 static int32_t param1_init[] = {0};
420 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
421 static int32_t param2_init[] = {0};
422 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
423 static int32_t param3_init[] = {0};
424 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
425 static int32_t param4_init[] = {1};
426 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
427 static int32_t param5_init[] = {1};
428 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
429 static int32_t param6_init[] = {2};
430 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
431 static int32_t param7_init[] = {0};
432 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
433 static bool8 layout_init[] = {false};
434 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
435 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
436 // Phase 3, inputs and outputs
437 model->identifyInputsAndOutputs(
438 {op1, op2, op3},
439 {op4});
440 // Phase 4: set relaxed execution
441 model->relaxComputationFloat32toFloat16(true);
442 assert(model->isValid());
443 }
444
is_ignored_nhwc_weight_as_input_relaxed(int i)445 inline bool is_ignored_nhwc_weight_as_input_relaxed(int i) {
446 static std::set<int> ignore = {};
447 return ignore.find(i) != ignore.end();
448 }
449
CreateModel_nhwc_weight_as_input_float16(Model * model)450 void CreateModel_nhwc_weight_as_input_float16(Model *model) {
451 OperandType type0(Type::BOOL, {});
452 OperandType type15(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
453 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
454 OperandType type17(Type::TENSOR_FLOAT16, {4});
455 OperandType type4(Type::INT32, {});
456 // Phase 1, operands
457 auto op1 = model->addOperand(&type15);
458 auto op2 = model->addOperand(&type16);
459 auto op3 = model->addOperand(&type17);
460 auto param = model->addOperand(&type4);
461 auto param1 = model->addOperand(&type4);
462 auto param2 = model->addOperand(&type4);
463 auto param3 = model->addOperand(&type4);
464 auto param4 = model->addOperand(&type4);
465 auto param5 = model->addOperand(&type4);
466 auto param6 = model->addOperand(&type4);
467 auto param7 = model->addOperand(&type4);
468 auto layout = model->addOperand(&type0);
469 auto op4 = model->addOperand(&type16);
470 // Phase 2, operations
471 static int32_t param_init[] = {0};
472 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
473 static int32_t param1_init[] = {0};
474 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
475 static int32_t param2_init[] = {0};
476 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
477 static int32_t param3_init[] = {0};
478 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
479 static int32_t param4_init[] = {1};
480 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
481 static int32_t param5_init[] = {1};
482 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
483 static int32_t param6_init[] = {2};
484 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
485 static int32_t param7_init[] = {0};
486 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
487 static bool8 layout_init[] = {false};
488 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
489 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
490 // Phase 3, inputs and outputs
491 model->identifyInputsAndOutputs(
492 {op1, op2, op3},
493 {op4});
494 assert(model->isValid());
495 }
496
is_ignored_nhwc_weight_as_input_float16(int i)497 inline bool is_ignored_nhwc_weight_as_input_float16(int i) {
498 static std::set<int> ignore = {};
499 return ignore.find(i) != ignore.end();
500 }
501
CreateModel_nhwc_weight_as_input_channelQuant8(Model * model)502 void CreateModel_nhwc_weight_as_input_channelQuant8(Model *model) {
503 OperandType type0(Type::BOOL, {});
504 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
505 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
506 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
507 OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
508 OperandType type4(Type::INT32, {});
509 // Phase 1, operands
510 auto op1 = model->addOperand(&type18);
511 auto op2 = model->addOperand(&type19);
512 auto op3 = model->addOperand(&type20);
513 auto param = model->addOperand(&type4);
514 auto param1 = model->addOperand(&type4);
515 auto param2 = model->addOperand(&type4);
516 auto param3 = model->addOperand(&type4);
517 auto param4 = model->addOperand(&type4);
518 auto param5 = model->addOperand(&type4);
519 auto param6 = model->addOperand(&type4);
520 auto param7 = model->addOperand(&type4);
521 auto layout = model->addOperand(&type0);
522 auto op4 = model->addOperand(&type21);
523 // Phase 2, operations
524 static int32_t param_init[] = {0};
525 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
526 static int32_t param1_init[] = {0};
527 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
528 static int32_t param2_init[] = {0};
529 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
530 static int32_t param3_init[] = {0};
531 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
532 static int32_t param4_init[] = {1};
533 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
534 static int32_t param5_init[] = {1};
535 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
536 static int32_t param6_init[] = {2};
537 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
538 static int32_t param7_init[] = {0};
539 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
540 static bool8 layout_init[] = {false};
541 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
542 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
543 // Phase 3, inputs and outputs
544 model->identifyInputsAndOutputs(
545 {op1, op2, op3},
546 {op4});
547 assert(model->isValid());
548 }
549
is_ignored_nhwc_weight_as_input_channelQuant8(int i)550 inline bool is_ignored_nhwc_weight_as_input_channelQuant8(int i) {
551 static std::set<int> ignore = {};
552 return ignore.find(i) != ignore.end();
553 }
554
CreateModel_nhwc_weight_as_input_channelQuant8_2(Model * model)555 void CreateModel_nhwc_weight_as_input_channelQuant8_2(Model *model) {
556 OperandType type0(Type::BOOL, {});
557 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
558 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
559 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
560 OperandType type24(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.0001f, 0);
561 OperandType type4(Type::INT32, {});
562 // Phase 1, operands
563 auto op1 = model->addOperand(&type18);
564 auto op2 = model->addOperand(&type22);
565 auto op3 = model->addOperand(&type23);
566 auto param = model->addOperand(&type4);
567 auto param1 = model->addOperand(&type4);
568 auto param2 = model->addOperand(&type4);
569 auto param3 = model->addOperand(&type4);
570 auto param4 = model->addOperand(&type4);
571 auto param5 = model->addOperand(&type4);
572 auto param6 = model->addOperand(&type4);
573 auto param7 = model->addOperand(&type4);
574 auto layout = model->addOperand(&type0);
575 auto op4 = model->addOperand(&type24);
576 // Phase 2, operations
577 static int32_t param_init[] = {0};
578 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
579 static int32_t param1_init[] = {0};
580 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
581 static int32_t param2_init[] = {0};
582 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
583 static int32_t param3_init[] = {0};
584 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
585 static int32_t param4_init[] = {1};
586 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
587 static int32_t param5_init[] = {1};
588 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
589 static int32_t param6_init[] = {2};
590 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
591 static int32_t param7_init[] = {0};
592 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
593 static bool8 layout_init[] = {false};
594 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
595 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
596 // Phase 3, inputs and outputs
597 model->identifyInputsAndOutputs(
598 {op1, op2, op3},
599 {op4});
600 assert(model->isValid());
601 }
602
is_ignored_nhwc_weight_as_input_channelQuant8_2(int i)603 inline bool is_ignored_nhwc_weight_as_input_channelQuant8_2(int i) {
604 static std::set<int> ignore = {};
605 return ignore.find(i) != ignore.end();
606 }
607
CreateModel_nhwc_weight_as_input_quant8(Model * model)608 void CreateModel_nhwc_weight_as_input_quant8(Model *model) {
609 OperandType type0(Type::BOOL, {});
610 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
611 OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.1f, 0);
612 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
613 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
614 OperandType type4(Type::INT32, {});
615 // Phase 1, operands
616 auto op1 = model->addOperand(&type18);
617 auto op2 = model->addOperand(&type25);
618 auto op3 = model->addOperand(&type26);
619 auto param = model->addOperand(&type4);
620 auto param1 = model->addOperand(&type4);
621 auto param2 = model->addOperand(&type4);
622 auto param3 = model->addOperand(&type4);
623 auto param4 = model->addOperand(&type4);
624 auto param5 = model->addOperand(&type4);
625 auto param6 = model->addOperand(&type4);
626 auto param7 = model->addOperand(&type4);
627 auto layout = model->addOperand(&type0);
628 auto op4 = model->addOperand(&type21);
629 // Phase 2, operations
630 static int32_t param_init[] = {0};
631 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
632 static int32_t param1_init[] = {0};
633 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
634 static int32_t param2_init[] = {0};
635 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
636 static int32_t param3_init[] = {0};
637 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
638 static int32_t param4_init[] = {1};
639 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
640 static int32_t param5_init[] = {1};
641 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
642 static int32_t param6_init[] = {2};
643 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
644 static int32_t param7_init[] = {0};
645 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
646 static bool8 layout_init[] = {false};
647 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
648 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
649 // Phase 3, inputs and outputs
650 model->identifyInputsAndOutputs(
651 {op1, op2, op3},
652 {op4});
653 assert(model->isValid());
654 }
655
is_ignored_nhwc_weight_as_input_quant8(int i)656 inline bool is_ignored_nhwc_weight_as_input_quant8(int i) {
657 static std::set<int> ignore = {};
658 return ignore.find(i) != ignore.end();
659 }
660
CreateModel_nchw(Model * model)661 void CreateModel_nchw(Model *model) {
662 OperandType type0(Type::BOOL, {});
663 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
664 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
665 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
666 OperandType type3(Type::TENSOR_FLOAT32, {4});
667 OperandType type4(Type::INT32, {});
668 // Phase 1, operands
669 auto op1 = model->addOperand(&type27);
670 auto op2 = model->addOperand(&type2);
671 auto op3 = model->addOperand(&type3);
672 auto param = model->addOperand(&type4);
673 auto param1 = model->addOperand(&type4);
674 auto param2 = model->addOperand(&type4);
675 auto param3 = model->addOperand(&type4);
676 auto param4 = model->addOperand(&type4);
677 auto param5 = model->addOperand(&type4);
678 auto param6 = model->addOperand(&type4);
679 auto param7 = model->addOperand(&type4);
680 auto layout = model->addOperand(&type0);
681 auto op4 = model->addOperand(&type28);
682 // Phase 2, operations
683 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
684 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
685 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
686 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
687 static int32_t param_init[] = {0};
688 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
689 static int32_t param1_init[] = {0};
690 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
691 static int32_t param2_init[] = {0};
692 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
693 static int32_t param3_init[] = {0};
694 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
695 static int32_t param4_init[] = {1};
696 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
697 static int32_t param5_init[] = {1};
698 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
699 static int32_t param6_init[] = {2};
700 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
701 static int32_t param7_init[] = {0};
702 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
703 static bool8 layout_init[] = {true};
704 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
705 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
706 // Phase 3, inputs and outputs
707 model->identifyInputsAndOutputs(
708 {op1},
709 {op4});
710 assert(model->isValid());
711 }
712
is_ignored_nchw(int i)713 inline bool is_ignored_nchw(int i) {
714 static std::set<int> ignore = {};
715 return ignore.find(i) != ignore.end();
716 }
717
CreateModel_nchw_relaxed(Model * model)718 void CreateModel_nchw_relaxed(Model *model) {
719 OperandType type0(Type::BOOL, {});
720 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
721 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
722 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
723 OperandType type3(Type::TENSOR_FLOAT32, {4});
724 OperandType type4(Type::INT32, {});
725 // Phase 1, operands
726 auto op1 = model->addOperand(&type27);
727 auto op2 = model->addOperand(&type2);
728 auto op3 = model->addOperand(&type3);
729 auto param = model->addOperand(&type4);
730 auto param1 = model->addOperand(&type4);
731 auto param2 = model->addOperand(&type4);
732 auto param3 = model->addOperand(&type4);
733 auto param4 = model->addOperand(&type4);
734 auto param5 = model->addOperand(&type4);
735 auto param6 = model->addOperand(&type4);
736 auto param7 = model->addOperand(&type4);
737 auto layout = model->addOperand(&type0);
738 auto op4 = model->addOperand(&type28);
739 // Phase 2, operations
740 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
741 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
742 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
743 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
744 static int32_t param_init[] = {0};
745 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
746 static int32_t param1_init[] = {0};
747 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
748 static int32_t param2_init[] = {0};
749 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
750 static int32_t param3_init[] = {0};
751 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
752 static int32_t param4_init[] = {1};
753 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
754 static int32_t param5_init[] = {1};
755 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
756 static int32_t param6_init[] = {2};
757 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
758 static int32_t param7_init[] = {0};
759 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
760 static bool8 layout_init[] = {true};
761 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
762 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
763 // Phase 3, inputs and outputs
764 model->identifyInputsAndOutputs(
765 {op1},
766 {op4});
767 // Phase 4: set relaxed execution
768 model->relaxComputationFloat32toFloat16(true);
769 assert(model->isValid());
770 }
771
is_ignored_nchw_relaxed(int i)772 inline bool is_ignored_nchw_relaxed(int i) {
773 static std::set<int> ignore = {};
774 return ignore.find(i) != ignore.end();
775 }
776
CreateModel_nchw_float16(Model * model)777 void CreateModel_nchw_float16(Model *model) {
778 OperandType type0(Type::BOOL, {});
779 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
780 OperandType type17(Type::TENSOR_FLOAT16, {4});
781 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
782 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
783 OperandType type4(Type::INT32, {});
784 // Phase 1, operands
785 auto op1 = model->addOperand(&type29);
786 auto op2 = model->addOperand(&type16);
787 auto op3 = model->addOperand(&type17);
788 auto param = model->addOperand(&type4);
789 auto param1 = model->addOperand(&type4);
790 auto param2 = model->addOperand(&type4);
791 auto param3 = model->addOperand(&type4);
792 auto param4 = model->addOperand(&type4);
793 auto param5 = model->addOperand(&type4);
794 auto param6 = model->addOperand(&type4);
795 auto param7 = model->addOperand(&type4);
796 auto layout = model->addOperand(&type0);
797 auto op4 = model->addOperand(&type30);
798 // Phase 2, operations
799 static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
800 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
801 static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
802 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
803 static int32_t param_init[] = {0};
804 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
805 static int32_t param1_init[] = {0};
806 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
807 static int32_t param2_init[] = {0};
808 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
809 static int32_t param3_init[] = {0};
810 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
811 static int32_t param4_init[] = {1};
812 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
813 static int32_t param5_init[] = {1};
814 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
815 static int32_t param6_init[] = {2};
816 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
817 static int32_t param7_init[] = {0};
818 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
819 static bool8 layout_init[] = {true};
820 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
821 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
822 // Phase 3, inputs and outputs
823 model->identifyInputsAndOutputs(
824 {op1},
825 {op4});
826 assert(model->isValid());
827 }
828
is_ignored_nchw_float16(int i)829 inline bool is_ignored_nchw_float16(int i) {
830 static std::set<int> ignore = {};
831 return ignore.find(i) != ignore.end();
832 }
833
CreateModel_nchw_channelQuant8(Model * model)834 void CreateModel_nchw_channelQuant8(Model *model) {
835 OperandType type0(Type::BOOL, {});
836 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
837 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
838 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
839 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
840 OperandType type4(Type::INT32, {});
841 // Phase 1, operands
842 auto op1 = model->addOperand(&type31);
843 auto op2 = model->addOperand(&type19);
844 auto op3 = model->addOperand(&type20);
845 auto param = model->addOperand(&type4);
846 auto param1 = model->addOperand(&type4);
847 auto param2 = model->addOperand(&type4);
848 auto param3 = model->addOperand(&type4);
849 auto param4 = model->addOperand(&type4);
850 auto param5 = model->addOperand(&type4);
851 auto param6 = model->addOperand(&type4);
852 auto param7 = model->addOperand(&type4);
853 auto layout = model->addOperand(&type0);
854 auto op4 = model->addOperand(&type32);
855 // Phase 2, operations
856 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
857 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
858 static int32_t op3_init[] = {200, 800, 600, 1600};
859 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
860 static int32_t param_init[] = {0};
861 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
862 static int32_t param1_init[] = {0};
863 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
864 static int32_t param2_init[] = {0};
865 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
866 static int32_t param3_init[] = {0};
867 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
868 static int32_t param4_init[] = {1};
869 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
870 static int32_t param5_init[] = {1};
871 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
872 static int32_t param6_init[] = {2};
873 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
874 static int32_t param7_init[] = {0};
875 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
876 static bool8 layout_init[] = {true};
877 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
878 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
879 // Phase 3, inputs and outputs
880 model->identifyInputsAndOutputs(
881 {op1},
882 {op4});
883 assert(model->isValid());
884 }
885
is_ignored_nchw_channelQuant8(int i)886 inline bool is_ignored_nchw_channelQuant8(int i) {
887 static std::set<int> ignore = {};
888 return ignore.find(i) != ignore.end();
889 }
890
CreateModel_nchw_channelQuant8_2(Model * model)891 void CreateModel_nchw_channelQuant8_2(Model *model) {
892 OperandType type0(Type::BOOL, {});
893 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
894 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
895 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
896 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.0001f, 0);
897 OperandType type4(Type::INT32, {});
898 // Phase 1, operands
899 auto op1 = model->addOperand(&type31);
900 auto op2 = model->addOperand(&type22);
901 auto op3 = model->addOperand(&type23);
902 auto param = model->addOperand(&type4);
903 auto param1 = model->addOperand(&type4);
904 auto param2 = model->addOperand(&type4);
905 auto param3 = model->addOperand(&type4);
906 auto param4 = model->addOperand(&type4);
907 auto param5 = model->addOperand(&type4);
908 auto param6 = model->addOperand(&type4);
909 auto param7 = model->addOperand(&type4);
910 auto layout = model->addOperand(&type0);
911 auto op4 = model->addOperand(&type33);
912 // Phase 2, operations
913 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
914 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
915 static int32_t op3_init[] = {200, 800, 600, 1600};
916 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
917 static int32_t param_init[] = {0};
918 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
919 static int32_t param1_init[] = {0};
920 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
921 static int32_t param2_init[] = {0};
922 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
923 static int32_t param3_init[] = {0};
924 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
925 static int32_t param4_init[] = {1};
926 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
927 static int32_t param5_init[] = {1};
928 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
929 static int32_t param6_init[] = {2};
930 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
931 static int32_t param7_init[] = {0};
932 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
933 static bool8 layout_init[] = {true};
934 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
935 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
936 // Phase 3, inputs and outputs
937 model->identifyInputsAndOutputs(
938 {op1},
939 {op4});
940 assert(model->isValid());
941 }
942
is_ignored_nchw_channelQuant8_2(int i)943 inline bool is_ignored_nchw_channelQuant8_2(int i) {
944 static std::set<int> ignore = {};
945 return ignore.find(i) != ignore.end();
946 }
947
CreateModel_nchw_quant8(Model * model)948 void CreateModel_nchw_quant8(Model *model) {
949 OperandType type0(Type::BOOL, {});
950 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
951 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
952 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
953 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
954 OperandType type4(Type::INT32, {});
955 // Phase 1, operands
956 auto op1 = model->addOperand(&type31);
957 auto op2 = model->addOperand(&type25);
958 auto op3 = model->addOperand(&type26);
959 auto param = model->addOperand(&type4);
960 auto param1 = model->addOperand(&type4);
961 auto param2 = model->addOperand(&type4);
962 auto param3 = model->addOperand(&type4);
963 auto param4 = model->addOperand(&type4);
964 auto param5 = model->addOperand(&type4);
965 auto param6 = model->addOperand(&type4);
966 auto param7 = model->addOperand(&type4);
967 auto layout = model->addOperand(&type0);
968 auto op4 = model->addOperand(&type32);
969 // Phase 2, operations
970 static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
971 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
972 static int32_t op3_init[] = {200, 400, 600, 800};
973 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
974 static int32_t param_init[] = {0};
975 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
976 static int32_t param1_init[] = {0};
977 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
978 static int32_t param2_init[] = {0};
979 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
980 static int32_t param3_init[] = {0};
981 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
982 static int32_t param4_init[] = {1};
983 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
984 static int32_t param5_init[] = {1};
985 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
986 static int32_t param6_init[] = {2};
987 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
988 static int32_t param7_init[] = {0};
989 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
990 static bool8 layout_init[] = {true};
991 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
992 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
993 // Phase 3, inputs and outputs
994 model->identifyInputsAndOutputs(
995 {op1},
996 {op4});
997 assert(model->isValid());
998 }
999
is_ignored_nchw_quant8(int i)1000 inline bool is_ignored_nchw_quant8(int i) {
1001 static std::set<int> ignore = {};
1002 return ignore.find(i) != ignore.end();
1003 }
1004
CreateModel_nchw_weight_as_input(Model * model)1005 void CreateModel_nchw_weight_as_input(Model *model) {
1006 OperandType type0(Type::BOOL, {});
1007 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1008 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1009 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
1010 OperandType type3(Type::TENSOR_FLOAT32, {4});
1011 OperandType type4(Type::INT32, {});
1012 // Phase 1, operands
1013 auto op1 = model->addOperand(&type27);
1014 auto op2 = model->addOperand(&type2);
1015 auto op3 = model->addOperand(&type3);
1016 auto param = model->addOperand(&type4);
1017 auto param1 = model->addOperand(&type4);
1018 auto param2 = model->addOperand(&type4);
1019 auto param3 = model->addOperand(&type4);
1020 auto param4 = model->addOperand(&type4);
1021 auto param5 = model->addOperand(&type4);
1022 auto param6 = model->addOperand(&type4);
1023 auto param7 = model->addOperand(&type4);
1024 auto layout = model->addOperand(&type0);
1025 auto op4 = model->addOperand(&type28);
1026 // Phase 2, operations
1027 static int32_t param_init[] = {0};
1028 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1029 static int32_t param1_init[] = {0};
1030 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1031 static int32_t param2_init[] = {0};
1032 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1033 static int32_t param3_init[] = {0};
1034 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1035 static int32_t param4_init[] = {1};
1036 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1037 static int32_t param5_init[] = {1};
1038 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1039 static int32_t param6_init[] = {2};
1040 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1041 static int32_t param7_init[] = {0};
1042 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1043 static bool8 layout_init[] = {true};
1044 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1045 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1046 // Phase 3, inputs and outputs
1047 model->identifyInputsAndOutputs(
1048 {op1, op2, op3},
1049 {op4});
1050 assert(model->isValid());
1051 }
1052
is_ignored_nchw_weight_as_input(int i)1053 inline bool is_ignored_nchw_weight_as_input(int i) {
1054 static std::set<int> ignore = {};
1055 return ignore.find(i) != ignore.end();
1056 }
1057
CreateModel_nchw_weight_as_input_relaxed(Model * model)1058 void CreateModel_nchw_weight_as_input_relaxed(Model *model) {
1059 OperandType type0(Type::BOOL, {});
1060 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1061 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1062 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
1063 OperandType type3(Type::TENSOR_FLOAT32, {4});
1064 OperandType type4(Type::INT32, {});
1065 // Phase 1, operands
1066 auto op1 = model->addOperand(&type27);
1067 auto op2 = model->addOperand(&type2);
1068 auto op3 = model->addOperand(&type3);
1069 auto param = model->addOperand(&type4);
1070 auto param1 = model->addOperand(&type4);
1071 auto param2 = model->addOperand(&type4);
1072 auto param3 = model->addOperand(&type4);
1073 auto param4 = model->addOperand(&type4);
1074 auto param5 = model->addOperand(&type4);
1075 auto param6 = model->addOperand(&type4);
1076 auto param7 = model->addOperand(&type4);
1077 auto layout = model->addOperand(&type0);
1078 auto op4 = model->addOperand(&type28);
1079 // Phase 2, operations
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[] = {2};
1093 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1094 static int32_t param7_init[] = {0};
1095 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1096 static bool8 layout_init[] = {true};
1097 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1098 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1099 // Phase 3, inputs and outputs
1100 model->identifyInputsAndOutputs(
1101 {op1, op2, op3},
1102 {op4});
1103 // Phase 4: set relaxed execution
1104 model->relaxComputationFloat32toFloat16(true);
1105 assert(model->isValid());
1106 }
1107
is_ignored_nchw_weight_as_input_relaxed(int i)1108 inline bool is_ignored_nchw_weight_as_input_relaxed(int i) {
1109 static std::set<int> ignore = {};
1110 return ignore.find(i) != ignore.end();
1111 }
1112
CreateModel_nchw_weight_as_input_float16(Model * model)1113 void CreateModel_nchw_weight_as_input_float16(Model *model) {
1114 OperandType type0(Type::BOOL, {});
1115 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1116 OperandType type17(Type::TENSOR_FLOAT16, {4});
1117 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
1118 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
1119 OperandType type4(Type::INT32, {});
1120 // Phase 1, operands
1121 auto op1 = model->addOperand(&type29);
1122 auto op2 = model->addOperand(&type16);
1123 auto op3 = model->addOperand(&type17);
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 param7 = model->addOperand(&type4);
1132 auto layout = model->addOperand(&type0);
1133 auto op4 = model->addOperand(&type30);
1134 // Phase 2, operations
1135 static int32_t param_init[] = {0};
1136 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1137 static int32_t param1_init[] = {0};
1138 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1139 static int32_t param2_init[] = {0};
1140 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1141 static int32_t param3_init[] = {0};
1142 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1143 static int32_t param4_init[] = {1};
1144 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1145 static int32_t param5_init[] = {1};
1146 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1147 static int32_t param6_init[] = {2};
1148 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1149 static int32_t param7_init[] = {0};
1150 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1151 static bool8 layout_init[] = {true};
1152 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1153 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1154 // Phase 3, inputs and outputs
1155 model->identifyInputsAndOutputs(
1156 {op1, op2, op3},
1157 {op4});
1158 assert(model->isValid());
1159 }
1160
is_ignored_nchw_weight_as_input_float16(int i)1161 inline bool is_ignored_nchw_weight_as_input_float16(int i) {
1162 static std::set<int> ignore = {};
1163 return ignore.find(i) != ignore.end();
1164 }
1165
CreateModel_nchw_weight_as_input_channelQuant8(Model * model)1166 void CreateModel_nchw_weight_as_input_channelQuant8(Model *model) {
1167 OperandType type0(Type::BOOL, {});
1168 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1169 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
1170 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
1171 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
1172 OperandType type4(Type::INT32, {});
1173 // Phase 1, operands
1174 auto op1 = model->addOperand(&type31);
1175 auto op2 = model->addOperand(&type19);
1176 auto op3 = model->addOperand(&type20);
1177 auto param = model->addOperand(&type4);
1178 auto param1 = model->addOperand(&type4);
1179 auto param2 = model->addOperand(&type4);
1180 auto param3 = model->addOperand(&type4);
1181 auto param4 = model->addOperand(&type4);
1182 auto param5 = model->addOperand(&type4);
1183 auto param6 = model->addOperand(&type4);
1184 auto param7 = model->addOperand(&type4);
1185 auto layout = model->addOperand(&type0);
1186 auto op4 = model->addOperand(&type32);
1187 // Phase 2, operations
1188 static int32_t param_init[] = {0};
1189 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1190 static int32_t param1_init[] = {0};
1191 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1192 static int32_t param2_init[] = {0};
1193 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1194 static int32_t param3_init[] = {0};
1195 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1196 static int32_t param4_init[] = {1};
1197 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1198 static int32_t param5_init[] = {1};
1199 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1200 static int32_t param6_init[] = {2};
1201 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1202 static int32_t param7_init[] = {0};
1203 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1204 static bool8 layout_init[] = {true};
1205 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1206 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1207 // Phase 3, inputs and outputs
1208 model->identifyInputsAndOutputs(
1209 {op1, op2, op3},
1210 {op4});
1211 assert(model->isValid());
1212 }
1213
is_ignored_nchw_weight_as_input_channelQuant8(int i)1214 inline bool is_ignored_nchw_weight_as_input_channelQuant8(int i) {
1215 static std::set<int> ignore = {};
1216 return ignore.find(i) != ignore.end();
1217 }
1218
CreateModel_nchw_weight_as_input_channelQuant8_2(Model * model)1219 void CreateModel_nchw_weight_as_input_channelQuant8_2(Model *model) {
1220 OperandType type0(Type::BOOL, {});
1221 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1222 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
1223 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
1224 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.0001f, 0);
1225 OperandType type4(Type::INT32, {});
1226 // Phase 1, operands
1227 auto op1 = model->addOperand(&type31);
1228 auto op2 = model->addOperand(&type22);
1229 auto op3 = model->addOperand(&type23);
1230 auto param = model->addOperand(&type4);
1231 auto param1 = model->addOperand(&type4);
1232 auto param2 = model->addOperand(&type4);
1233 auto param3 = model->addOperand(&type4);
1234 auto param4 = model->addOperand(&type4);
1235 auto param5 = model->addOperand(&type4);
1236 auto param6 = model->addOperand(&type4);
1237 auto param7 = model->addOperand(&type4);
1238 auto layout = model->addOperand(&type0);
1239 auto op4 = model->addOperand(&type33);
1240 // Phase 2, operations
1241 static int32_t param_init[] = {0};
1242 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1243 static int32_t param1_init[] = {0};
1244 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1245 static int32_t param2_init[] = {0};
1246 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1247 static int32_t param3_init[] = {0};
1248 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1249 static int32_t param4_init[] = {1};
1250 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1251 static int32_t param5_init[] = {1};
1252 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1253 static int32_t param6_init[] = {2};
1254 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1255 static int32_t param7_init[] = {0};
1256 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1257 static bool8 layout_init[] = {true};
1258 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1259 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1260 // Phase 3, inputs and outputs
1261 model->identifyInputsAndOutputs(
1262 {op1, op2, op3},
1263 {op4});
1264 assert(model->isValid());
1265 }
1266
is_ignored_nchw_weight_as_input_channelQuant8_2(int i)1267 inline bool is_ignored_nchw_weight_as_input_channelQuant8_2(int i) {
1268 static std::set<int> ignore = {};
1269 return ignore.find(i) != ignore.end();
1270 }
1271
CreateModel_nchw_weight_as_input_quant8(Model * model)1272 void CreateModel_nchw_weight_as_input_quant8(Model *model) {
1273 OperandType type0(Type::BOOL, {});
1274 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1275 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
1276 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
1277 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.1f, 0);
1278 OperandType type4(Type::INT32, {});
1279 // Phase 1, operands
1280 auto op1 = model->addOperand(&type31);
1281 auto op2 = model->addOperand(&type25);
1282 auto op3 = model->addOperand(&type26);
1283 auto param = model->addOperand(&type4);
1284 auto param1 = model->addOperand(&type4);
1285 auto param2 = model->addOperand(&type4);
1286 auto param3 = model->addOperand(&type4);
1287 auto param4 = model->addOperand(&type4);
1288 auto param5 = model->addOperand(&type4);
1289 auto param6 = model->addOperand(&type4);
1290 auto param7 = model->addOperand(&type4);
1291 auto layout = model->addOperand(&type0);
1292 auto op4 = model->addOperand(&type32);
1293 // Phase 2, operations
1294 static int32_t param_init[] = {0};
1295 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1296 static int32_t param1_init[] = {0};
1297 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1298 static int32_t param2_init[] = {0};
1299 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1300 static int32_t param3_init[] = {0};
1301 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1302 static int32_t param4_init[] = {1};
1303 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1304 static int32_t param5_init[] = {1};
1305 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1306 static int32_t param6_init[] = {2};
1307 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1308 static int32_t param7_init[] = {0};
1309 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1310 static bool8 layout_init[] = {true};
1311 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1312 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1313 // Phase 3, inputs and outputs
1314 model->identifyInputsAndOutputs(
1315 {op1, op2, op3},
1316 {op4});
1317 assert(model->isValid());
1318 }
1319
is_ignored_nchw_weight_as_input_quant8(int i)1320 inline bool is_ignored_nchw_weight_as_input_quant8(int i) {
1321 static std::set<int> ignore = {};
1322 return ignore.find(i) != ignore.end();
1323 }
1324
CreateModel_dynamic_output_shape_nhwc(Model * model)1325 void CreateModel_dynamic_output_shape_nhwc(Model *model) {
1326 OperandType type0(Type::BOOL, {});
1327 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1328 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1329 OperandType type3(Type::TENSOR_FLOAT32, {4});
1330 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1331 OperandType type4(Type::INT32, {});
1332 // Phase 1, operands
1333 auto op1 = model->addOperand(&type1);
1334 auto op2 = model->addOperand(&type2);
1335 auto op3 = model->addOperand(&type3);
1336 auto param = model->addOperand(&type4);
1337 auto param1 = model->addOperand(&type4);
1338 auto param2 = model->addOperand(&type4);
1339 auto param3 = model->addOperand(&type4);
1340 auto param4 = model->addOperand(&type4);
1341 auto param5 = model->addOperand(&type4);
1342 auto param6 = model->addOperand(&type4);
1343 auto param7 = model->addOperand(&type4);
1344 auto layout = model->addOperand(&type0);
1345 auto op4 = model->addOperand(&type34);
1346 // Phase 2, operations
1347 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1348 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1349 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1350 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1351 static int32_t param_init[] = {0};
1352 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1353 static int32_t param1_init[] = {0};
1354 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1355 static int32_t param2_init[] = {0};
1356 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1357 static int32_t param3_init[] = {0};
1358 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1359 static int32_t param4_init[] = {1};
1360 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1361 static int32_t param5_init[] = {1};
1362 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1363 static int32_t param6_init[] = {2};
1364 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1365 static int32_t param7_init[] = {0};
1366 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1367 static bool8 layout_init[] = {false};
1368 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1369 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1370 // Phase 3, inputs and outputs
1371 model->identifyInputsAndOutputs(
1372 {op1},
1373 {op4});
1374 assert(model->isValid());
1375 }
1376
is_ignored_dynamic_output_shape_nhwc(int i)1377 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
1378 static std::set<int> ignore = {};
1379 return ignore.find(i) != ignore.end();
1380 }
1381
CreateModel_dynamic_output_shape_nhwc_relaxed(Model * model)1382 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) {
1383 OperandType type0(Type::BOOL, {});
1384 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1385 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1386 OperandType type3(Type::TENSOR_FLOAT32, {4});
1387 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1388 OperandType type4(Type::INT32, {});
1389 // Phase 1, operands
1390 auto op1 = model->addOperand(&type1);
1391 auto op2 = model->addOperand(&type2);
1392 auto op3 = model->addOperand(&type3);
1393 auto param = model->addOperand(&type4);
1394 auto param1 = model->addOperand(&type4);
1395 auto param2 = model->addOperand(&type4);
1396 auto param3 = model->addOperand(&type4);
1397 auto param4 = model->addOperand(&type4);
1398 auto param5 = model->addOperand(&type4);
1399 auto param6 = model->addOperand(&type4);
1400 auto param7 = model->addOperand(&type4);
1401 auto layout = model->addOperand(&type0);
1402 auto op4 = model->addOperand(&type34);
1403 // Phase 2, operations
1404 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
1405 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
1406 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1407 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
1408 static int32_t param_init[] = {0};
1409 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1410 static int32_t param1_init[] = {0};
1411 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1412 static int32_t param2_init[] = {0};
1413 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1414 static int32_t param3_init[] = {0};
1415 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1416 static int32_t param4_init[] = {1};
1417 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1418 static int32_t param5_init[] = {1};
1419 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1420 static int32_t param6_init[] = {2};
1421 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1422 static int32_t param7_init[] = {0};
1423 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1424 static bool8 layout_init[] = {false};
1425 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1426 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1427 // Phase 3, inputs and outputs
1428 model->identifyInputsAndOutputs(
1429 {op1},
1430 {op4});
1431 // Phase 4: set relaxed execution
1432 model->relaxComputationFloat32toFloat16(true);
1433 assert(model->isValid());
1434 }
1435
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)1436 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
1437 static std::set<int> ignore = {};
1438 return ignore.find(i) != ignore.end();
1439 }
1440
CreateModel_dynamic_output_shape_nhwc_float16(Model * model)1441 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) {
1442 OperandType type0(Type::BOOL, {});
1443 OperandType type15(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
1444 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1445 OperandType type17(Type::TENSOR_FLOAT16, {4});
1446 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1447 OperandType type4(Type::INT32, {});
1448 // Phase 1, operands
1449 auto op1 = model->addOperand(&type15);
1450 auto op2 = model->addOperand(&type16);
1451 auto op3 = model->addOperand(&type17);
1452 auto param = model->addOperand(&type4);
1453 auto param1 = model->addOperand(&type4);
1454 auto param2 = model->addOperand(&type4);
1455 auto param3 = model->addOperand(&type4);
1456 auto param4 = model->addOperand(&type4);
1457 auto param5 = model->addOperand(&type4);
1458 auto param6 = model->addOperand(&type4);
1459 auto param7 = model->addOperand(&type4);
1460 auto layout = model->addOperand(&type0);
1461 auto op4 = model->addOperand(&type35);
1462 // Phase 2, operations
1463 static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
1464 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
1465 static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
1466 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
1467 static int32_t param_init[] = {0};
1468 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1469 static int32_t param1_init[] = {0};
1470 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1471 static int32_t param2_init[] = {0};
1472 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1473 static int32_t param3_init[] = {0};
1474 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1475 static int32_t param4_init[] = {1};
1476 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1477 static int32_t param5_init[] = {1};
1478 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1479 static int32_t param6_init[] = {2};
1480 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1481 static int32_t param7_init[] = {0};
1482 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1483 static bool8 layout_init[] = {false};
1484 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1485 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1486 // Phase 3, inputs and outputs
1487 model->identifyInputsAndOutputs(
1488 {op1},
1489 {op4});
1490 assert(model->isValid());
1491 }
1492
is_ignored_dynamic_output_shape_nhwc_float16(int i)1493 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
1494 static std::set<int> ignore = {};
1495 return ignore.find(i) != ignore.end();
1496 }
1497
CreateModel_dynamic_output_shape_nhwc_channelQuant8(Model * model)1498 void CreateModel_dynamic_output_shape_nhwc_channelQuant8(Model *model) {
1499 OperandType type0(Type::BOOL, {});
1500 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1501 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1502 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
1503 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1504 OperandType type4(Type::INT32, {});
1505 // Phase 1, operands
1506 auto op1 = model->addOperand(&type18);
1507 auto op2 = model->addOperand(&type19);
1508 auto op3 = model->addOperand(&type20);
1509 auto param = model->addOperand(&type4);
1510 auto param1 = model->addOperand(&type4);
1511 auto param2 = model->addOperand(&type4);
1512 auto param3 = model->addOperand(&type4);
1513 auto param4 = model->addOperand(&type4);
1514 auto param5 = model->addOperand(&type4);
1515 auto param6 = model->addOperand(&type4);
1516 auto param7 = model->addOperand(&type4);
1517 auto layout = model->addOperand(&type0);
1518 auto op4 = model->addOperand(&type36);
1519 // Phase 2, operations
1520 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
1521 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
1522 static int32_t op3_init[] = {200, 800, 600, 1600};
1523 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
1524 static int32_t param_init[] = {0};
1525 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1526 static int32_t param1_init[] = {0};
1527 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1528 static int32_t param2_init[] = {0};
1529 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1530 static int32_t param3_init[] = {0};
1531 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1532 static int32_t param4_init[] = {1};
1533 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1534 static int32_t param5_init[] = {1};
1535 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1536 static int32_t param6_init[] = {2};
1537 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1538 static int32_t param7_init[] = {0};
1539 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1540 static bool8 layout_init[] = {false};
1541 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1542 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1543 // Phase 3, inputs and outputs
1544 model->identifyInputsAndOutputs(
1545 {op1},
1546 {op4});
1547 assert(model->isValid());
1548 }
1549
is_ignored_dynamic_output_shape_nhwc_channelQuant8(int i)1550 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8(int i) {
1551 static std::set<int> ignore = {};
1552 return ignore.find(i) != ignore.end();
1553 }
1554
CreateModel_dynamic_output_shape_nhwc_channelQuant8_2(Model * model)1555 void CreateModel_dynamic_output_shape_nhwc_channelQuant8_2(Model *model) {
1556 OperandType type0(Type::BOOL, {});
1557 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1558 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1559 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
1560 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.0001f, 0);
1561 OperandType type4(Type::INT32, {});
1562 // Phase 1, operands
1563 auto op1 = model->addOperand(&type18);
1564 auto op2 = model->addOperand(&type22);
1565 auto op3 = model->addOperand(&type23);
1566 auto param = model->addOperand(&type4);
1567 auto param1 = model->addOperand(&type4);
1568 auto param2 = model->addOperand(&type4);
1569 auto param3 = model->addOperand(&type4);
1570 auto param4 = model->addOperand(&type4);
1571 auto param5 = model->addOperand(&type4);
1572 auto param6 = model->addOperand(&type4);
1573 auto param7 = model->addOperand(&type4);
1574 auto layout = model->addOperand(&type0);
1575 auto op4 = model->addOperand(&type37);
1576 // Phase 2, operations
1577 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
1578 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
1579 static int32_t op3_init[] = {200, 800, 600, 1600};
1580 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
1581 static int32_t param_init[] = {0};
1582 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1583 static int32_t param1_init[] = {0};
1584 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1585 static int32_t param2_init[] = {0};
1586 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1587 static int32_t param3_init[] = {0};
1588 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1589 static int32_t param4_init[] = {1};
1590 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1591 static int32_t param5_init[] = {1};
1592 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1593 static int32_t param6_init[] = {2};
1594 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1595 static int32_t param7_init[] = {0};
1596 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1597 static bool8 layout_init[] = {false};
1598 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1599 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1600 // Phase 3, inputs and outputs
1601 model->identifyInputsAndOutputs(
1602 {op1},
1603 {op4});
1604 assert(model->isValid());
1605 }
1606
is_ignored_dynamic_output_shape_nhwc_channelQuant8_2(int i)1607 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8_2(int i) {
1608 static std::set<int> ignore = {};
1609 return ignore.find(i) != ignore.end();
1610 }
1611
CreateModel_dynamic_output_shape_nhwc_quant8(Model * model)1612 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) {
1613 OperandType type0(Type::BOOL, {});
1614 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1615 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1616 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
1617 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1618 OperandType type4(Type::INT32, {});
1619 // Phase 1, operands
1620 auto op1 = model->addOperand(&type18);
1621 auto op2 = model->addOperand(&type25);
1622 auto op3 = model->addOperand(&type26);
1623 auto param = model->addOperand(&type4);
1624 auto param1 = model->addOperand(&type4);
1625 auto param2 = model->addOperand(&type4);
1626 auto param3 = model->addOperand(&type4);
1627 auto param4 = model->addOperand(&type4);
1628 auto param5 = model->addOperand(&type4);
1629 auto param6 = model->addOperand(&type4);
1630 auto param7 = model->addOperand(&type4);
1631 auto layout = model->addOperand(&type0);
1632 auto op4 = model->addOperand(&type36);
1633 // Phase 2, operations
1634 static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
1635 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
1636 static int32_t op3_init[] = {200, 400, 600, 800};
1637 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
1638 static int32_t param_init[] = {0};
1639 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1640 static int32_t param1_init[] = {0};
1641 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1642 static int32_t param2_init[] = {0};
1643 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1644 static int32_t param3_init[] = {0};
1645 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1646 static int32_t param4_init[] = {1};
1647 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1648 static int32_t param5_init[] = {1};
1649 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1650 static int32_t param6_init[] = {2};
1651 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1652 static int32_t param7_init[] = {0};
1653 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1654 static bool8 layout_init[] = {false};
1655 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1656 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1657 // Phase 3, inputs and outputs
1658 model->identifyInputsAndOutputs(
1659 {op1},
1660 {op4});
1661 assert(model->isValid());
1662 }
1663
is_ignored_dynamic_output_shape_nhwc_quant8(int i)1664 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
1665 static std::set<int> ignore = {};
1666 return ignore.find(i) != ignore.end();
1667 }
1668
CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model * model)1669 void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) {
1670 OperandType type0(Type::BOOL, {});
1671 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1672 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1673 OperandType type3(Type::TENSOR_FLOAT32, {4});
1674 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1675 OperandType type4(Type::INT32, {});
1676 // Phase 1, operands
1677 auto op1 = model->addOperand(&type1);
1678 auto op2 = model->addOperand(&type2);
1679 auto op3 = model->addOperand(&type3);
1680 auto param = model->addOperand(&type4);
1681 auto param1 = model->addOperand(&type4);
1682 auto param2 = model->addOperand(&type4);
1683 auto param3 = model->addOperand(&type4);
1684 auto param4 = model->addOperand(&type4);
1685 auto param5 = model->addOperand(&type4);
1686 auto param6 = model->addOperand(&type4);
1687 auto param7 = model->addOperand(&type4);
1688 auto layout = model->addOperand(&type0);
1689 auto op4 = model->addOperand(&type34);
1690 // Phase 2, operations
1691 static int32_t param_init[] = {0};
1692 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1693 static int32_t param1_init[] = {0};
1694 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1695 static int32_t param2_init[] = {0};
1696 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1697 static int32_t param3_init[] = {0};
1698 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1699 static int32_t param4_init[] = {1};
1700 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1701 static int32_t param5_init[] = {1};
1702 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1703 static int32_t param6_init[] = {2};
1704 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1705 static int32_t param7_init[] = {0};
1706 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1707 static bool8 layout_init[] = {false};
1708 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1709 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1710 // Phase 3, inputs and outputs
1711 model->identifyInputsAndOutputs(
1712 {op1, op2, op3},
1713 {op4});
1714 assert(model->isValid());
1715 }
1716
is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i)1717 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) {
1718 static std::set<int> ignore = {};
1719 return ignore.find(i) != ignore.end();
1720 }
1721
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model * model)1722 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) {
1723 OperandType type0(Type::BOOL, {});
1724 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
1725 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1726 OperandType type3(Type::TENSOR_FLOAT32, {4});
1727 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1728 OperandType type4(Type::INT32, {});
1729 // Phase 1, operands
1730 auto op1 = model->addOperand(&type1);
1731 auto op2 = model->addOperand(&type2);
1732 auto op3 = model->addOperand(&type3);
1733 auto param = model->addOperand(&type4);
1734 auto param1 = model->addOperand(&type4);
1735 auto param2 = model->addOperand(&type4);
1736 auto param3 = model->addOperand(&type4);
1737 auto param4 = model->addOperand(&type4);
1738 auto param5 = model->addOperand(&type4);
1739 auto param6 = model->addOperand(&type4);
1740 auto param7 = model->addOperand(&type4);
1741 auto layout = model->addOperand(&type0);
1742 auto op4 = model->addOperand(&type34);
1743 // Phase 2, operations
1744 static int32_t param_init[] = {0};
1745 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1746 static int32_t param1_init[] = {0};
1747 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1748 static int32_t param2_init[] = {0};
1749 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1750 static int32_t param3_init[] = {0};
1751 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1752 static int32_t param4_init[] = {1};
1753 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1754 static int32_t param5_init[] = {1};
1755 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1756 static int32_t param6_init[] = {2};
1757 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1758 static int32_t param7_init[] = {0};
1759 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1760 static bool8 layout_init[] = {false};
1761 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1762 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1763 // Phase 3, inputs and outputs
1764 model->identifyInputsAndOutputs(
1765 {op1, op2, op3},
1766 {op4});
1767 // Phase 4: set relaxed execution
1768 model->relaxComputationFloat32toFloat16(true);
1769 assert(model->isValid());
1770 }
1771
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i)1772 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) {
1773 static std::set<int> ignore = {};
1774 return ignore.find(i) != ignore.end();
1775 }
1776
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model * model)1777 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) {
1778 OperandType type0(Type::BOOL, {});
1779 OperandType type15(Type::TENSOR_FLOAT16, {1, 3, 3, 2});
1780 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
1781 OperandType type17(Type::TENSOR_FLOAT16, {4});
1782 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1783 OperandType type4(Type::INT32, {});
1784 // Phase 1, operands
1785 auto op1 = model->addOperand(&type15);
1786 auto op2 = model->addOperand(&type16);
1787 auto op3 = model->addOperand(&type17);
1788 auto param = model->addOperand(&type4);
1789 auto param1 = model->addOperand(&type4);
1790 auto param2 = model->addOperand(&type4);
1791 auto param3 = model->addOperand(&type4);
1792 auto param4 = model->addOperand(&type4);
1793 auto param5 = model->addOperand(&type4);
1794 auto param6 = model->addOperand(&type4);
1795 auto param7 = model->addOperand(&type4);
1796 auto layout = model->addOperand(&type0);
1797 auto op4 = model->addOperand(&type35);
1798 // Phase 2, operations
1799 static int32_t param_init[] = {0};
1800 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1801 static int32_t param1_init[] = {0};
1802 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1803 static int32_t param2_init[] = {0};
1804 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1805 static int32_t param3_init[] = {0};
1806 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1807 static int32_t param4_init[] = {1};
1808 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1809 static int32_t param5_init[] = {1};
1810 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1811 static int32_t param6_init[] = {2};
1812 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1813 static int32_t param7_init[] = {0};
1814 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1815 static bool8 layout_init[] = {false};
1816 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1817 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1818 // Phase 3, inputs and outputs
1819 model->identifyInputsAndOutputs(
1820 {op1, op2, op3},
1821 {op4});
1822 assert(model->isValid());
1823 }
1824
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i)1825 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i) {
1826 static std::set<int> ignore = {};
1827 return ignore.find(i) != ignore.end();
1828 }
1829
CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model * model)1830 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model *model) {
1831 OperandType type0(Type::BOOL, {});
1832 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1833 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1834 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
1835 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1836 OperandType type4(Type::INT32, {});
1837 // Phase 1, operands
1838 auto op1 = model->addOperand(&type18);
1839 auto op2 = model->addOperand(&type19);
1840 auto op3 = model->addOperand(&type20);
1841 auto param = model->addOperand(&type4);
1842 auto param1 = model->addOperand(&type4);
1843 auto param2 = model->addOperand(&type4);
1844 auto param3 = model->addOperand(&type4);
1845 auto param4 = model->addOperand(&type4);
1846 auto param5 = model->addOperand(&type4);
1847 auto param6 = model->addOperand(&type4);
1848 auto param7 = model->addOperand(&type4);
1849 auto layout = model->addOperand(&type0);
1850 auto op4 = model->addOperand(&type36);
1851 // Phase 2, operations
1852 static int32_t param_init[] = {0};
1853 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1854 static int32_t param1_init[] = {0};
1855 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1856 static int32_t param2_init[] = {0};
1857 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1858 static int32_t param3_init[] = {0};
1859 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1860 static int32_t param4_init[] = {1};
1861 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1862 static int32_t param5_init[] = {1};
1863 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1864 static int32_t param6_init[] = {2};
1865 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1866 static int32_t param7_init[] = {0};
1867 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1868 static bool8 layout_init[] = {false};
1869 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1870 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1871 // Phase 3, inputs and outputs
1872 model->identifyInputsAndOutputs(
1873 {op1, op2, op3},
1874 {op4});
1875 assert(model->isValid());
1876 }
1877
is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i)1878 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i) {
1879 static std::set<int> ignore = {};
1880 return ignore.find(i) != ignore.end();
1881 }
1882
CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model * model)1883 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model *model) {
1884 OperandType type0(Type::BOOL, {});
1885 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1886 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
1887 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
1888 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.0001f, 0);
1889 OperandType type4(Type::INT32, {});
1890 // Phase 1, operands
1891 auto op1 = model->addOperand(&type18);
1892 auto op2 = model->addOperand(&type22);
1893 auto op3 = model->addOperand(&type23);
1894 auto param = model->addOperand(&type4);
1895 auto param1 = model->addOperand(&type4);
1896 auto param2 = model->addOperand(&type4);
1897 auto param3 = model->addOperand(&type4);
1898 auto param4 = model->addOperand(&type4);
1899 auto param5 = model->addOperand(&type4);
1900 auto param6 = model->addOperand(&type4);
1901 auto param7 = model->addOperand(&type4);
1902 auto layout = model->addOperand(&type0);
1903 auto op4 = model->addOperand(&type37);
1904 // Phase 2, operations
1905 static int32_t param_init[] = {0};
1906 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1907 static int32_t param1_init[] = {0};
1908 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1909 static int32_t param2_init[] = {0};
1910 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1911 static int32_t param3_init[] = {0};
1912 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1913 static int32_t param4_init[] = {1};
1914 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1915 static int32_t param5_init[] = {1};
1916 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1917 static int32_t param6_init[] = {2};
1918 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1919 static int32_t param7_init[] = {0};
1920 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1921 static bool8 layout_init[] = {false};
1922 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1923 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1924 // Phase 3, inputs and outputs
1925 model->identifyInputsAndOutputs(
1926 {op1, op2, op3},
1927 {op4});
1928 assert(model->isValid());
1929 }
1930
is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i)1931 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i) {
1932 static std::set<int> ignore = {};
1933 return ignore.find(i) != ignore.end();
1934 }
1935
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model * model)1936 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) {
1937 OperandType type0(Type::BOOL, {});
1938 OperandType type18(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 0);
1939 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
1940 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
1941 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
1942 OperandType type4(Type::INT32, {});
1943 // Phase 1, operands
1944 auto op1 = model->addOperand(&type18);
1945 auto op2 = model->addOperand(&type25);
1946 auto op3 = model->addOperand(&type26);
1947 auto param = model->addOperand(&type4);
1948 auto param1 = model->addOperand(&type4);
1949 auto param2 = model->addOperand(&type4);
1950 auto param3 = model->addOperand(&type4);
1951 auto param4 = model->addOperand(&type4);
1952 auto param5 = model->addOperand(&type4);
1953 auto param6 = model->addOperand(&type4);
1954 auto param7 = model->addOperand(&type4);
1955 auto layout = model->addOperand(&type0);
1956 auto op4 = model->addOperand(&type36);
1957 // Phase 2, operations
1958 static int32_t param_init[] = {0};
1959 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
1960 static int32_t param1_init[] = {0};
1961 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
1962 static int32_t param2_init[] = {0};
1963 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1964 static int32_t param3_init[] = {0};
1965 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
1966 static int32_t param4_init[] = {1};
1967 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
1968 static int32_t param5_init[] = {1};
1969 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
1970 static int32_t param6_init[] = {2};
1971 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
1972 static int32_t param7_init[] = {0};
1973 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
1974 static bool8 layout_init[] = {false};
1975 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1976 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
1977 // Phase 3, inputs and outputs
1978 model->identifyInputsAndOutputs(
1979 {op1, op2, op3},
1980 {op4});
1981 assert(model->isValid());
1982 }
1983
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i)1984 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) {
1985 static std::set<int> ignore = {};
1986 return ignore.find(i) != ignore.end();
1987 }
1988
CreateModel_dynamic_output_shape_nchw(Model * model)1989 void CreateModel_dynamic_output_shape_nchw(Model *model) {
1990 OperandType type0(Type::BOOL, {});
1991 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
1992 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
1993 OperandType type3(Type::TENSOR_FLOAT32, {4});
1994 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1995 OperandType type4(Type::INT32, {});
1996 // Phase 1, operands
1997 auto op1 = model->addOperand(&type27);
1998 auto op2 = model->addOperand(&type2);
1999 auto op3 = model->addOperand(&type3);
2000 auto param = model->addOperand(&type4);
2001 auto param1 = model->addOperand(&type4);
2002 auto param2 = model->addOperand(&type4);
2003 auto param3 = model->addOperand(&type4);
2004 auto param4 = model->addOperand(&type4);
2005 auto param5 = model->addOperand(&type4);
2006 auto param6 = model->addOperand(&type4);
2007 auto param7 = model->addOperand(&type4);
2008 auto layout = model->addOperand(&type0);
2009 auto op4 = model->addOperand(&type34);
2010 // Phase 2, operations
2011 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2012 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
2013 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2014 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
2015 static int32_t param_init[] = {0};
2016 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2017 static int32_t param1_init[] = {0};
2018 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2019 static int32_t param2_init[] = {0};
2020 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2021 static int32_t param3_init[] = {0};
2022 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2023 static int32_t param4_init[] = {1};
2024 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2025 static int32_t param5_init[] = {1};
2026 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2027 static int32_t param6_init[] = {2};
2028 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2029 static int32_t param7_init[] = {0};
2030 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2031 static bool8 layout_init[] = {true};
2032 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2033 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2034 // Phase 3, inputs and outputs
2035 model->identifyInputsAndOutputs(
2036 {op1},
2037 {op4});
2038 assert(model->isValid());
2039 }
2040
is_ignored_dynamic_output_shape_nchw(int i)2041 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
2042 static std::set<int> ignore = {};
2043 return ignore.find(i) != ignore.end();
2044 }
2045
CreateModel_dynamic_output_shape_nchw_relaxed(Model * model)2046 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) {
2047 OperandType type0(Type::BOOL, {});
2048 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2049 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
2050 OperandType type3(Type::TENSOR_FLOAT32, {4});
2051 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2052 OperandType type4(Type::INT32, {});
2053 // Phase 1, operands
2054 auto op1 = model->addOperand(&type27);
2055 auto op2 = model->addOperand(&type2);
2056 auto op3 = model->addOperand(&type3);
2057 auto param = model->addOperand(&type4);
2058 auto param1 = model->addOperand(&type4);
2059 auto param2 = model->addOperand(&type4);
2060 auto param3 = model->addOperand(&type4);
2061 auto param4 = model->addOperand(&type4);
2062 auto param5 = model->addOperand(&type4);
2063 auto param6 = model->addOperand(&type4);
2064 auto param7 = model->addOperand(&type4);
2065 auto layout = model->addOperand(&type0);
2066 auto op4 = model->addOperand(&type34);
2067 // Phase 2, operations
2068 static float op2_init[] = {0.25f, 0.0f, 0.2f, 0.0f, 0.25f, 0.0f, 0.0f, 0.3f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.1f, 0.0f, 0.0f};
2069 model->setOperandValue(op2, op2_init, sizeof(float) * 16);
2070 static float op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2071 model->setOperandValue(op3, op3_init, sizeof(float) * 4);
2072 static int32_t param_init[] = {0};
2073 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2074 static int32_t param1_init[] = {0};
2075 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2076 static int32_t param2_init[] = {0};
2077 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2078 static int32_t param3_init[] = {0};
2079 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2080 static int32_t param4_init[] = {1};
2081 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2082 static int32_t param5_init[] = {1};
2083 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2084 static int32_t param6_init[] = {2};
2085 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2086 static int32_t param7_init[] = {0};
2087 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2088 static bool8 layout_init[] = {true};
2089 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2090 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2091 // Phase 3, inputs and outputs
2092 model->identifyInputsAndOutputs(
2093 {op1},
2094 {op4});
2095 // Phase 4: set relaxed execution
2096 model->relaxComputationFloat32toFloat16(true);
2097 assert(model->isValid());
2098 }
2099
is_ignored_dynamic_output_shape_nchw_relaxed(int i)2100 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
2101 static std::set<int> ignore = {};
2102 return ignore.find(i) != ignore.end();
2103 }
2104
CreateModel_dynamic_output_shape_nchw_float16(Model * model)2105 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) {
2106 OperandType type0(Type::BOOL, {});
2107 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2108 OperandType type17(Type::TENSOR_FLOAT16, {4});
2109 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
2110 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
2111 OperandType type4(Type::INT32, {});
2112 // Phase 1, operands
2113 auto op1 = model->addOperand(&type29);
2114 auto op2 = model->addOperand(&type16);
2115 auto op3 = model->addOperand(&type17);
2116 auto param = model->addOperand(&type4);
2117 auto param1 = model->addOperand(&type4);
2118 auto param2 = model->addOperand(&type4);
2119 auto param3 = model->addOperand(&type4);
2120 auto param4 = model->addOperand(&type4);
2121 auto param5 = model->addOperand(&type4);
2122 auto param6 = model->addOperand(&type4);
2123 auto param7 = model->addOperand(&type4);
2124 auto layout = model->addOperand(&type0);
2125 auto op4 = model->addOperand(&type35);
2126 // Phase 2, operations
2127 static _Float16 op2_init[] = {0.25f, 0.0f, 0.20000000298023224f, 0.0f, 0.25f, 0.0f, 0.0f, 0.30000001192092896f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.10000000149011612f, 0.0f, 0.0f};
2128 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 16);
2129 static _Float16 op3_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2130 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 4);
2131 static int32_t param_init[] = {0};
2132 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2133 static int32_t param1_init[] = {0};
2134 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2135 static int32_t param2_init[] = {0};
2136 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2137 static int32_t param3_init[] = {0};
2138 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2139 static int32_t param4_init[] = {1};
2140 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2141 static int32_t param5_init[] = {1};
2142 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2143 static int32_t param6_init[] = {2};
2144 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2145 static int32_t param7_init[] = {0};
2146 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2147 static bool8 layout_init[] = {true};
2148 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2149 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2150 // Phase 3, inputs and outputs
2151 model->identifyInputsAndOutputs(
2152 {op1},
2153 {op4});
2154 assert(model->isValid());
2155 }
2156
is_ignored_dynamic_output_shape_nchw_float16(int i)2157 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
2158 static std::set<int> ignore = {};
2159 return ignore.find(i) != ignore.end();
2160 }
2161
CreateModel_dynamic_output_shape_nchw_channelQuant8(Model * model)2162 void CreateModel_dynamic_output_shape_nchw_channelQuant8(Model *model) {
2163 OperandType type0(Type::BOOL, {});
2164 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
2165 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
2166 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2167 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
2168 OperandType type4(Type::INT32, {});
2169 // Phase 1, operands
2170 auto op1 = model->addOperand(&type31);
2171 auto op2 = model->addOperand(&type19);
2172 auto op3 = model->addOperand(&type20);
2173 auto param = model->addOperand(&type4);
2174 auto param1 = model->addOperand(&type4);
2175 auto param2 = model->addOperand(&type4);
2176 auto param3 = model->addOperand(&type4);
2177 auto param4 = model->addOperand(&type4);
2178 auto param5 = model->addOperand(&type4);
2179 auto param6 = model->addOperand(&type4);
2180 auto param7 = model->addOperand(&type4);
2181 auto layout = model->addOperand(&type0);
2182 auto op4 = model->addOperand(&type36);
2183 // Phase 2, operations
2184 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
2185 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
2186 static int32_t op3_init[] = {200, 800, 600, 1600};
2187 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
2188 static int32_t param_init[] = {0};
2189 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2190 static int32_t param1_init[] = {0};
2191 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2192 static int32_t param2_init[] = {0};
2193 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2194 static int32_t param3_init[] = {0};
2195 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2196 static int32_t param4_init[] = {1};
2197 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2198 static int32_t param5_init[] = {1};
2199 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2200 static int32_t param6_init[] = {2};
2201 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2202 static int32_t param7_init[] = {0};
2203 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2204 static bool8 layout_init[] = {true};
2205 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2206 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2207 // Phase 3, inputs and outputs
2208 model->identifyInputsAndOutputs(
2209 {op1},
2210 {op4});
2211 assert(model->isValid());
2212 }
2213
is_ignored_dynamic_output_shape_nchw_channelQuant8(int i)2214 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8(int i) {
2215 static std::set<int> ignore = {};
2216 return ignore.find(i) != ignore.end();
2217 }
2218
CreateModel_dynamic_output_shape_nchw_channelQuant8_2(Model * model)2219 void CreateModel_dynamic_output_shape_nchw_channelQuant8_2(Model *model) {
2220 OperandType type0(Type::BOOL, {});
2221 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
2222 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
2223 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2224 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.0001f, 0);
2225 OperandType type4(Type::INT32, {});
2226 // Phase 1, operands
2227 auto op1 = model->addOperand(&type31);
2228 auto op2 = model->addOperand(&type22);
2229 auto op3 = model->addOperand(&type23);
2230 auto param = model->addOperand(&type4);
2231 auto param1 = model->addOperand(&type4);
2232 auto param2 = model->addOperand(&type4);
2233 auto param3 = model->addOperand(&type4);
2234 auto param4 = model->addOperand(&type4);
2235 auto param5 = model->addOperand(&type4);
2236 auto param6 = model->addOperand(&type4);
2237 auto param7 = model->addOperand(&type4);
2238 auto layout = model->addOperand(&type0);
2239 auto op4 = model->addOperand(&type37);
2240 // Phase 2, operations
2241 static int8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 60, 25, 0, 0, 0, 25, 20, 0, 0};
2242 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 16);
2243 static int32_t op3_init[] = {200, 800, 600, 1600};
2244 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
2245 static int32_t param_init[] = {0};
2246 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2247 static int32_t param1_init[] = {0};
2248 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2249 static int32_t param2_init[] = {0};
2250 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2251 static int32_t param3_init[] = {0};
2252 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2253 static int32_t param4_init[] = {1};
2254 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2255 static int32_t param5_init[] = {1};
2256 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2257 static int32_t param6_init[] = {2};
2258 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2259 static int32_t param7_init[] = {0};
2260 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2261 static bool8 layout_init[] = {true};
2262 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2263 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2264 // Phase 3, inputs and outputs
2265 model->identifyInputsAndOutputs(
2266 {op1},
2267 {op4});
2268 assert(model->isValid());
2269 }
2270
is_ignored_dynamic_output_shape_nchw_channelQuant8_2(int i)2271 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8_2(int i) {
2272 static std::set<int> ignore = {};
2273 return ignore.find(i) != ignore.end();
2274 }
2275
CreateModel_dynamic_output_shape_nchw_quant8(Model * model)2276 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) {
2277 OperandType type0(Type::BOOL, {});
2278 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
2279 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
2280 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2281 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
2282 OperandType type4(Type::INT32, {});
2283 // Phase 1, operands
2284 auto op1 = model->addOperand(&type31);
2285 auto op2 = model->addOperand(&type25);
2286 auto op3 = model->addOperand(&type26);
2287 auto param = model->addOperand(&type4);
2288 auto param1 = model->addOperand(&type4);
2289 auto param2 = model->addOperand(&type4);
2290 auto param3 = model->addOperand(&type4);
2291 auto param4 = model->addOperand(&type4);
2292 auto param5 = model->addOperand(&type4);
2293 auto param6 = model->addOperand(&type4);
2294 auto param7 = model->addOperand(&type4);
2295 auto layout = model->addOperand(&type0);
2296 auto op4 = model->addOperand(&type36);
2297 // Phase 2, operations
2298 static uint8_t op2_init[] = {25, 0, 20, 0, 25, 0, 0, 30, 25, 0, 0, 0, 25, 10, 0, 0};
2299 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 16);
2300 static int32_t op3_init[] = {200, 400, 600, 800};
2301 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 4);
2302 static int32_t param_init[] = {0};
2303 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2304 static int32_t param1_init[] = {0};
2305 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2306 static int32_t param2_init[] = {0};
2307 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2308 static int32_t param3_init[] = {0};
2309 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2310 static int32_t param4_init[] = {1};
2311 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2312 static int32_t param5_init[] = {1};
2313 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2314 static int32_t param6_init[] = {2};
2315 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2316 static int32_t param7_init[] = {0};
2317 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2318 static bool8 layout_init[] = {true};
2319 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2320 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2321 // Phase 3, inputs and outputs
2322 model->identifyInputsAndOutputs(
2323 {op1},
2324 {op4});
2325 assert(model->isValid());
2326 }
2327
is_ignored_dynamic_output_shape_nchw_quant8(int i)2328 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
2329 static std::set<int> ignore = {};
2330 return ignore.find(i) != ignore.end();
2331 }
2332
CreateModel_dynamic_output_shape_nchw_weight_as_input(Model * model)2333 void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) {
2334 OperandType type0(Type::BOOL, {});
2335 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2336 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
2337 OperandType type3(Type::TENSOR_FLOAT32, {4});
2338 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2339 OperandType type4(Type::INT32, {});
2340 // Phase 1, operands
2341 auto op1 = model->addOperand(&type27);
2342 auto op2 = model->addOperand(&type2);
2343 auto op3 = model->addOperand(&type3);
2344 auto param = model->addOperand(&type4);
2345 auto param1 = model->addOperand(&type4);
2346 auto param2 = model->addOperand(&type4);
2347 auto param3 = model->addOperand(&type4);
2348 auto param4 = model->addOperand(&type4);
2349 auto param5 = model->addOperand(&type4);
2350 auto param6 = model->addOperand(&type4);
2351 auto param7 = model->addOperand(&type4);
2352 auto layout = model->addOperand(&type0);
2353 auto op4 = model->addOperand(&type34);
2354 // Phase 2, operations
2355 static int32_t param_init[] = {0};
2356 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2357 static int32_t param1_init[] = {0};
2358 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2359 static int32_t param2_init[] = {0};
2360 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2361 static int32_t param3_init[] = {0};
2362 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2363 static int32_t param4_init[] = {1};
2364 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2365 static int32_t param5_init[] = {1};
2366 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2367 static int32_t param6_init[] = {2};
2368 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2369 static int32_t param7_init[] = {0};
2370 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2371 static bool8 layout_init[] = {true};
2372 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2373 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2374 // Phase 3, inputs and outputs
2375 model->identifyInputsAndOutputs(
2376 {op1, op2, op3},
2377 {op4});
2378 assert(model->isValid());
2379 }
2380
is_ignored_dynamic_output_shape_nchw_weight_as_input(int i)2381 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) {
2382 static std::set<int> ignore = {};
2383 return ignore.find(i) != ignore.end();
2384 }
2385
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model * model)2386 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) {
2387 OperandType type0(Type::BOOL, {});
2388 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2389 OperandType type27(Type::TENSOR_FLOAT32, {1, 2, 3, 3});
2390 OperandType type3(Type::TENSOR_FLOAT32, {4});
2391 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
2392 OperandType type4(Type::INT32, {});
2393 // Phase 1, operands
2394 auto op1 = model->addOperand(&type27);
2395 auto op2 = model->addOperand(&type2);
2396 auto op3 = model->addOperand(&type3);
2397 auto param = model->addOperand(&type4);
2398 auto param1 = model->addOperand(&type4);
2399 auto param2 = model->addOperand(&type4);
2400 auto param3 = model->addOperand(&type4);
2401 auto param4 = model->addOperand(&type4);
2402 auto param5 = model->addOperand(&type4);
2403 auto param6 = model->addOperand(&type4);
2404 auto param7 = model->addOperand(&type4);
2405 auto layout = model->addOperand(&type0);
2406 auto op4 = model->addOperand(&type34);
2407 // Phase 2, operations
2408 static int32_t param_init[] = {0};
2409 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2410 static int32_t param1_init[] = {0};
2411 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2412 static int32_t param2_init[] = {0};
2413 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2414 static int32_t param3_init[] = {0};
2415 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2416 static int32_t param4_init[] = {1};
2417 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2418 static int32_t param5_init[] = {1};
2419 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2420 static int32_t param6_init[] = {2};
2421 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2422 static int32_t param7_init[] = {0};
2423 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2424 static bool8 layout_init[] = {true};
2425 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2426 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2427 // Phase 3, inputs and outputs
2428 model->identifyInputsAndOutputs(
2429 {op1, op2, op3},
2430 {op4});
2431 // Phase 4: set relaxed execution
2432 model->relaxComputationFloat32toFloat16(true);
2433 assert(model->isValid());
2434 }
2435
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i)2436 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) {
2437 static std::set<int> ignore = {};
2438 return ignore.find(i) != ignore.end();
2439 }
2440
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model * model)2441 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) {
2442 OperandType type0(Type::BOOL, {});
2443 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2444 OperandType type17(Type::TENSOR_FLOAT16, {4});
2445 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 3, 3});
2446 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
2447 OperandType type4(Type::INT32, {});
2448 // Phase 1, operands
2449 auto op1 = model->addOperand(&type29);
2450 auto op2 = model->addOperand(&type16);
2451 auto op3 = model->addOperand(&type17);
2452 auto param = model->addOperand(&type4);
2453 auto param1 = model->addOperand(&type4);
2454 auto param2 = model->addOperand(&type4);
2455 auto param3 = model->addOperand(&type4);
2456 auto param4 = model->addOperand(&type4);
2457 auto param5 = model->addOperand(&type4);
2458 auto param6 = model->addOperand(&type4);
2459 auto param7 = model->addOperand(&type4);
2460 auto layout = model->addOperand(&type0);
2461 auto op4 = model->addOperand(&type35);
2462 // Phase 2, operations
2463 static int32_t param_init[] = {0};
2464 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2465 static int32_t param1_init[] = {0};
2466 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2467 static int32_t param2_init[] = {0};
2468 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2469 static int32_t param3_init[] = {0};
2470 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2471 static int32_t param4_init[] = {1};
2472 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2473 static int32_t param5_init[] = {1};
2474 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2475 static int32_t param6_init[] = {2};
2476 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2477 static int32_t param7_init[] = {0};
2478 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2479 static bool8 layout_init[] = {true};
2480 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2481 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2482 // Phase 3, inputs and outputs
2483 model->identifyInputsAndOutputs(
2484 {op1, op2, op3},
2485 {op4});
2486 assert(model->isValid());
2487 }
2488
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i)2489 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i) {
2490 static std::set<int> ignore = {};
2491 return ignore.find(i) != ignore.end();
2492 }
2493
CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model * model)2494 void CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model *model) {
2495 OperandType type0(Type::BOOL, {});
2496 OperandType type19(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
2497 OperandType type20(Type::TENSOR_INT32, {4}, 0.0f, 0);
2498 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2499 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
2500 OperandType type4(Type::INT32, {});
2501 // Phase 1, operands
2502 auto op1 = model->addOperand(&type31);
2503 auto op2 = model->addOperand(&type19);
2504 auto op3 = model->addOperand(&type20);
2505 auto param = model->addOperand(&type4);
2506 auto param1 = model->addOperand(&type4);
2507 auto param2 = model->addOperand(&type4);
2508 auto param3 = model->addOperand(&type4);
2509 auto param4 = model->addOperand(&type4);
2510 auto param5 = model->addOperand(&type4);
2511 auto param6 = model->addOperand(&type4);
2512 auto param7 = model->addOperand(&type4);
2513 auto layout = model->addOperand(&type0);
2514 auto op4 = model->addOperand(&type36);
2515 // Phase 2, operations
2516 static int32_t param_init[] = {0};
2517 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2518 static int32_t param1_init[] = {0};
2519 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2520 static int32_t param2_init[] = {0};
2521 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2522 static int32_t param3_init[] = {0};
2523 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2524 static int32_t param4_init[] = {1};
2525 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2526 static int32_t param5_init[] = {1};
2527 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2528 static int32_t param6_init[] = {2};
2529 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2530 static int32_t param7_init[] = {0};
2531 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2532 static bool8 layout_init[] = {true};
2533 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2534 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2535 // Phase 3, inputs and outputs
2536 model->identifyInputsAndOutputs(
2537 {op1, op2, op3},
2538 {op4});
2539 assert(model->isValid());
2540 }
2541
is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i)2542 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i) {
2543 static std::set<int> ignore = {};
2544 return ignore.find(i) != ignore.end();
2545 }
2546
CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model * model)2547 void CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model *model) {
2548 OperandType type0(Type::BOOL, {});
2549 OperandType type22(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.01f, 0.005f, 0.01f, 0.005f},3));
2550 OperandType type23(Type::TENSOR_INT32, {4}, 0.0f, 0);
2551 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2552 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.0001f, 0);
2553 OperandType type4(Type::INT32, {});
2554 // Phase 1, operands
2555 auto op1 = model->addOperand(&type31);
2556 auto op2 = model->addOperand(&type22);
2557 auto op3 = model->addOperand(&type23);
2558 auto param = model->addOperand(&type4);
2559 auto param1 = model->addOperand(&type4);
2560 auto param2 = model->addOperand(&type4);
2561 auto param3 = model->addOperand(&type4);
2562 auto param4 = model->addOperand(&type4);
2563 auto param5 = model->addOperand(&type4);
2564 auto param6 = model->addOperand(&type4);
2565 auto param7 = model->addOperand(&type4);
2566 auto layout = model->addOperand(&type0);
2567 auto op4 = model->addOperand(&type37);
2568 // Phase 2, operations
2569 static int32_t param_init[] = {0};
2570 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2571 static int32_t param1_init[] = {0};
2572 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2573 static int32_t param2_init[] = {0};
2574 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2575 static int32_t param3_init[] = {0};
2576 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2577 static int32_t param4_init[] = {1};
2578 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2579 static int32_t param5_init[] = {1};
2580 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2581 static int32_t param6_init[] = {2};
2582 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2583 static int32_t param7_init[] = {0};
2584 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2585 static bool8 layout_init[] = {true};
2586 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2587 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2588 // Phase 3, inputs and outputs
2589 model->identifyInputsAndOutputs(
2590 {op1, op2, op3},
2591 {op4});
2592 assert(model->isValid());
2593 }
2594
is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i)2595 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i) {
2596 static std::set<int> ignore = {};
2597 return ignore.find(i) != ignore.end();
2598 }
2599
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model * model)2600 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) {
2601 OperandType type0(Type::BOOL, {});
2602 OperandType type25(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.01f, 0);
2603 OperandType type26(Type::TENSOR_INT32, {4}, 0.005f, 0);
2604 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 0);
2605 OperandType type36(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
2606 OperandType type4(Type::INT32, {});
2607 // Phase 1, operands
2608 auto op1 = model->addOperand(&type31);
2609 auto op2 = model->addOperand(&type25);
2610 auto op3 = model->addOperand(&type26);
2611 auto param = model->addOperand(&type4);
2612 auto param1 = model->addOperand(&type4);
2613 auto param2 = model->addOperand(&type4);
2614 auto param3 = model->addOperand(&type4);
2615 auto param4 = model->addOperand(&type4);
2616 auto param5 = model->addOperand(&type4);
2617 auto param6 = model->addOperand(&type4);
2618 auto param7 = model->addOperand(&type4);
2619 auto layout = model->addOperand(&type0);
2620 auto op4 = model->addOperand(&type36);
2621 // Phase 2, operations
2622 static int32_t param_init[] = {0};
2623 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
2624 static int32_t param1_init[] = {0};
2625 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
2626 static int32_t param2_init[] = {0};
2627 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
2628 static int32_t param3_init[] = {0};
2629 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1);
2630 static int32_t param4_init[] = {1};
2631 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1);
2632 static int32_t param5_init[] = {1};
2633 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1);
2634 static int32_t param6_init[] = {2};
2635 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1);
2636 static int32_t param7_init[] = {0};
2637 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1);
2638 static bool8 layout_init[] = {true};
2639 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2640 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, param7, layout}, {op4});
2641 // Phase 3, inputs and outputs
2642 model->identifyInputsAndOutputs(
2643 {op1, op2, op3},
2644 {op4});
2645 assert(model->isValid());
2646 }
2647
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i)2648 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i) {
2649 static std::set<int> ignore = {};
2650 return ignore.find(i) != ignore.end();
2651 }
2652
CreateModel_nhwc_2(Model * model)2653 void CreateModel_nhwc_2(Model *model) {
2654 OperandType type0(Type::BOOL, {});
2655 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2656 OperandType type3(Type::TENSOR_FLOAT32, {4});
2657 OperandType type4(Type::INT32, {});
2658 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
2659 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 1, 4});
2660 // Phase 1, operands
2661 auto op11 = model->addOperand(&type5);
2662 auto op21 = model->addOperand(&type2);
2663 auto op31 = model->addOperand(&type3);
2664 auto param8 = model->addOperand(&type4);
2665 auto param9 = model->addOperand(&type4);
2666 auto param10 = model->addOperand(&type4);
2667 auto param11 = model->addOperand(&type4);
2668 auto param12 = model->addOperand(&type4);
2669 auto layout = model->addOperand(&type0);
2670 auto op41 = model->addOperand(&type6);
2671 // Phase 2, operations
2672 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
2673 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
2674 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2675 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
2676 static int32_t param8_init[] = {2};
2677 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2678 static int32_t param9_init[] = {1};
2679 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2680 static int32_t param10_init[] = {1};
2681 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2682 static int32_t param11_init[] = {2};
2683 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2684 static int32_t param12_init[] = {0};
2685 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2686 static bool8 layout_init[] = {false};
2687 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2688 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2689 // Phase 3, inputs and outputs
2690 model->identifyInputsAndOutputs(
2691 {op11},
2692 {op41});
2693 assert(model->isValid());
2694 }
2695
is_ignored_nhwc_2(int i)2696 inline bool is_ignored_nhwc_2(int i) {
2697 static std::set<int> ignore = {};
2698 return ignore.find(i) != ignore.end();
2699 }
2700
CreateModel_nhwc_relaxed_2(Model * model)2701 void CreateModel_nhwc_relaxed_2(Model *model) {
2702 OperandType type0(Type::BOOL, {});
2703 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2704 OperandType type3(Type::TENSOR_FLOAT32, {4});
2705 OperandType type4(Type::INT32, {});
2706 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
2707 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 1, 4});
2708 // Phase 1, operands
2709 auto op11 = model->addOperand(&type5);
2710 auto op21 = model->addOperand(&type2);
2711 auto op31 = model->addOperand(&type3);
2712 auto param8 = model->addOperand(&type4);
2713 auto param9 = model->addOperand(&type4);
2714 auto param10 = model->addOperand(&type4);
2715 auto param11 = model->addOperand(&type4);
2716 auto param12 = model->addOperand(&type4);
2717 auto layout = model->addOperand(&type0);
2718 auto op41 = model->addOperand(&type6);
2719 // Phase 2, operations
2720 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
2721 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
2722 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2723 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
2724 static int32_t param8_init[] = {2};
2725 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2726 static int32_t param9_init[] = {1};
2727 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2728 static int32_t param10_init[] = {1};
2729 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2730 static int32_t param11_init[] = {2};
2731 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2732 static int32_t param12_init[] = {0};
2733 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2734 static bool8 layout_init[] = {false};
2735 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2736 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2737 // Phase 3, inputs and outputs
2738 model->identifyInputsAndOutputs(
2739 {op11},
2740 {op41});
2741 // Phase 4: set relaxed execution
2742 model->relaxComputationFloat32toFloat16(true);
2743 assert(model->isValid());
2744 }
2745
is_ignored_nhwc_relaxed_2(int i)2746 inline bool is_ignored_nhwc_relaxed_2(int i) {
2747 static std::set<int> ignore = {};
2748 return ignore.find(i) != ignore.end();
2749 }
2750
CreateModel_nhwc_float16_2(Model * model)2751 void CreateModel_nhwc_float16_2(Model *model) {
2752 OperandType type0(Type::BOOL, {});
2753 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2754 OperandType type17(Type::TENSOR_FLOAT16, {4});
2755 OperandType type38(Type::TENSOR_FLOAT16, {1, 3, 2, 2});
2756 OperandType type39(Type::TENSOR_FLOAT16, {1, 2, 1, 4});
2757 OperandType type4(Type::INT32, {});
2758 // Phase 1, operands
2759 auto op11 = model->addOperand(&type38);
2760 auto op21 = model->addOperand(&type16);
2761 auto op31 = model->addOperand(&type17);
2762 auto param8 = model->addOperand(&type4);
2763 auto param9 = model->addOperand(&type4);
2764 auto param10 = model->addOperand(&type4);
2765 auto param11 = model->addOperand(&type4);
2766 auto param12 = model->addOperand(&type4);
2767 auto layout = model->addOperand(&type0);
2768 auto op41 = model->addOperand(&type39);
2769 // Phase 2, operations
2770 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
2771 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 16);
2772 static _Float16 op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
2773 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 4);
2774 static int32_t param8_init[] = {2};
2775 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2776 static int32_t param9_init[] = {1};
2777 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2778 static int32_t param10_init[] = {1};
2779 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2780 static int32_t param11_init[] = {2};
2781 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2782 static int32_t param12_init[] = {0};
2783 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2784 static bool8 layout_init[] = {false};
2785 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2786 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2787 // Phase 3, inputs and outputs
2788 model->identifyInputsAndOutputs(
2789 {op11},
2790 {op41});
2791 assert(model->isValid());
2792 }
2793
is_ignored_nhwc_float16_2(int i)2794 inline bool is_ignored_nhwc_float16_2(int i) {
2795 static std::set<int> ignore = {};
2796 return ignore.find(i) != ignore.end();
2797 }
2798
CreateModel_nhwc_quant8_2(Model * model)2799 void CreateModel_nhwc_quant8_2(Model *model) {
2800 OperandType type0(Type::BOOL, {});
2801 OperandType type4(Type::INT32, {});
2802 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
2803 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
2804 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
2805 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 100);
2806 // Phase 1, operands
2807 auto op11 = model->addOperand(&type40);
2808 auto op21 = model->addOperand(&type41);
2809 auto op31 = model->addOperand(&type42);
2810 auto param8 = model->addOperand(&type4);
2811 auto param9 = model->addOperand(&type4);
2812 auto param10 = model->addOperand(&type4);
2813 auto param11 = model->addOperand(&type4);
2814 auto param12 = model->addOperand(&type4);
2815 auto layout = model->addOperand(&type0);
2816 auto op41 = model->addOperand(&type43);
2817 // Phase 2, operations
2818 static uint8_t op21_init[] = {130, 132, 134, 136, 110, 148, 106, 152, 138, 140, 142, 144, 154, 100, 158, 96};
2819 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 16);
2820 static int32_t op31_init[] = {4, 8, 12, 16};
2821 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
2822 static int32_t param8_init[] = {2};
2823 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2824 static int32_t param9_init[] = {1};
2825 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2826 static int32_t param10_init[] = {1};
2827 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2828 static int32_t param11_init[] = {2};
2829 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2830 static int32_t param12_init[] = {0};
2831 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2832 static bool8 layout_init[] = {false};
2833 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2834 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2835 // Phase 3, inputs and outputs
2836 model->identifyInputsAndOutputs(
2837 {op11},
2838 {op41});
2839 assert(model->isValid());
2840 }
2841
is_ignored_nhwc_quant8_2(int i)2842 inline bool is_ignored_nhwc_quant8_2(int i) {
2843 static std::set<int> ignore = {};
2844 return ignore.find(i) != ignore.end();
2845 }
2846
CreateModel_nhwc_channelQuant8_3(Model * model)2847 void CreateModel_nhwc_channelQuant8_3(Model *model) {
2848 OperandType type0(Type::BOOL, {});
2849 OperandType type4(Type::INT32, {});
2850 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
2851 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 100);
2852 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
2853 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
2854 // Phase 1, operands
2855 auto op11 = model->addOperand(&type40);
2856 auto op21 = model->addOperand(&type44);
2857 auto op31 = model->addOperand(&type45);
2858 auto param8 = model->addOperand(&type4);
2859 auto param9 = model->addOperand(&type4);
2860 auto param10 = model->addOperand(&type4);
2861 auto param11 = model->addOperand(&type4);
2862 auto param12 = model->addOperand(&type4);
2863 auto layout = model->addOperand(&type0);
2864 auto op41 = model->addOperand(&type43);
2865 // Phase 2, operations
2866 static int8_t op21_init[] = {2, 8, 6, 16, -18, 40, -22, 48, 10, 24, 14, 32, 26, -56, 30, -64};
2867 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
2868 static int32_t op31_init[] = {4, 16, 12, 32};
2869 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
2870 static int32_t param8_init[] = {2};
2871 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2872 static int32_t param9_init[] = {1};
2873 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2874 static int32_t param10_init[] = {1};
2875 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2876 static int32_t param11_init[] = {2};
2877 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2878 static int32_t param12_init[] = {0};
2879 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2880 static bool8 layout_init[] = {false};
2881 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2882 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2883 // Phase 3, inputs and outputs
2884 model->identifyInputsAndOutputs(
2885 {op11},
2886 {op41});
2887 assert(model->isValid());
2888 }
2889
is_ignored_nhwc_channelQuant8_3(int i)2890 inline bool is_ignored_nhwc_channelQuant8_3(int i) {
2891 static std::set<int> ignore = {};
2892 return ignore.find(i) != ignore.end();
2893 }
2894
CreateModel_nhwc_weight_as_input_2(Model * model)2895 void CreateModel_nhwc_weight_as_input_2(Model *model) {
2896 OperandType type0(Type::BOOL, {});
2897 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2898 OperandType type3(Type::TENSOR_FLOAT32, {4});
2899 OperandType type4(Type::INT32, {});
2900 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
2901 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 1, 4});
2902 // Phase 1, operands
2903 auto op11 = model->addOperand(&type5);
2904 auto op21 = model->addOperand(&type2);
2905 auto op31 = model->addOperand(&type3);
2906 auto param8 = model->addOperand(&type4);
2907 auto param9 = model->addOperand(&type4);
2908 auto param10 = model->addOperand(&type4);
2909 auto param11 = model->addOperand(&type4);
2910 auto param12 = model->addOperand(&type4);
2911 auto layout = model->addOperand(&type0);
2912 auto op41 = model->addOperand(&type6);
2913 // Phase 2, operations
2914 static int32_t param8_init[] = {2};
2915 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2916 static int32_t param9_init[] = {1};
2917 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2918 static int32_t param10_init[] = {1};
2919 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2920 static int32_t param11_init[] = {2};
2921 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2922 static int32_t param12_init[] = {0};
2923 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2924 static bool8 layout_init[] = {false};
2925 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2926 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2927 // Phase 3, inputs and outputs
2928 model->identifyInputsAndOutputs(
2929 {op11, op21, op31},
2930 {op41});
2931 assert(model->isValid());
2932 }
2933
is_ignored_nhwc_weight_as_input_2(int i)2934 inline bool is_ignored_nhwc_weight_as_input_2(int i) {
2935 static std::set<int> ignore = {};
2936 return ignore.find(i) != ignore.end();
2937 }
2938
CreateModel_nhwc_weight_as_input_relaxed_2(Model * model)2939 void CreateModel_nhwc_weight_as_input_relaxed_2(Model *model) {
2940 OperandType type0(Type::BOOL, {});
2941 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
2942 OperandType type3(Type::TENSOR_FLOAT32, {4});
2943 OperandType type4(Type::INT32, {});
2944 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
2945 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 1, 4});
2946 // Phase 1, operands
2947 auto op11 = model->addOperand(&type5);
2948 auto op21 = model->addOperand(&type2);
2949 auto op31 = model->addOperand(&type3);
2950 auto param8 = model->addOperand(&type4);
2951 auto param9 = model->addOperand(&type4);
2952 auto param10 = model->addOperand(&type4);
2953 auto param11 = model->addOperand(&type4);
2954 auto param12 = model->addOperand(&type4);
2955 auto layout = model->addOperand(&type0);
2956 auto op41 = model->addOperand(&type6);
2957 // Phase 2, operations
2958 static int32_t param8_init[] = {2};
2959 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
2960 static int32_t param9_init[] = {1};
2961 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
2962 static int32_t param10_init[] = {1};
2963 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
2964 static int32_t param11_init[] = {2};
2965 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
2966 static int32_t param12_init[] = {0};
2967 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
2968 static bool8 layout_init[] = {false};
2969 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
2970 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
2971 // Phase 3, inputs and outputs
2972 model->identifyInputsAndOutputs(
2973 {op11, op21, op31},
2974 {op41});
2975 // Phase 4: set relaxed execution
2976 model->relaxComputationFloat32toFloat16(true);
2977 assert(model->isValid());
2978 }
2979
is_ignored_nhwc_weight_as_input_relaxed_2(int i)2980 inline bool is_ignored_nhwc_weight_as_input_relaxed_2(int i) {
2981 static std::set<int> ignore = {};
2982 return ignore.find(i) != ignore.end();
2983 }
2984
CreateModel_nhwc_weight_as_input_float16_2(Model * model)2985 void CreateModel_nhwc_weight_as_input_float16_2(Model *model) {
2986 OperandType type0(Type::BOOL, {});
2987 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
2988 OperandType type17(Type::TENSOR_FLOAT16, {4});
2989 OperandType type38(Type::TENSOR_FLOAT16, {1, 3, 2, 2});
2990 OperandType type39(Type::TENSOR_FLOAT16, {1, 2, 1, 4});
2991 OperandType type4(Type::INT32, {});
2992 // Phase 1, operands
2993 auto op11 = model->addOperand(&type38);
2994 auto op21 = model->addOperand(&type16);
2995 auto op31 = model->addOperand(&type17);
2996 auto param8 = model->addOperand(&type4);
2997 auto param9 = model->addOperand(&type4);
2998 auto param10 = model->addOperand(&type4);
2999 auto param11 = model->addOperand(&type4);
3000 auto param12 = model->addOperand(&type4);
3001 auto layout = model->addOperand(&type0);
3002 auto op41 = model->addOperand(&type39);
3003 // Phase 2, operations
3004 static int32_t param8_init[] = {2};
3005 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3006 static int32_t param9_init[] = {1};
3007 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3008 static int32_t param10_init[] = {1};
3009 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3010 static int32_t param11_init[] = {2};
3011 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3012 static int32_t param12_init[] = {0};
3013 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3014 static bool8 layout_init[] = {false};
3015 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3016 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3017 // Phase 3, inputs and outputs
3018 model->identifyInputsAndOutputs(
3019 {op11, op21, op31},
3020 {op41});
3021 assert(model->isValid());
3022 }
3023
is_ignored_nhwc_weight_as_input_float16_2(int i)3024 inline bool is_ignored_nhwc_weight_as_input_float16_2(int i) {
3025 static std::set<int> ignore = {};
3026 return ignore.find(i) != ignore.end();
3027 }
3028
CreateModel_nhwc_weight_as_input_quant8_2(Model * model)3029 void CreateModel_nhwc_weight_as_input_quant8_2(Model *model) {
3030 OperandType type0(Type::BOOL, {});
3031 OperandType type4(Type::INT32, {});
3032 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
3033 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
3034 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
3035 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 100);
3036 // Phase 1, operands
3037 auto op11 = model->addOperand(&type40);
3038 auto op21 = model->addOperand(&type41);
3039 auto op31 = model->addOperand(&type42);
3040 auto param8 = model->addOperand(&type4);
3041 auto param9 = model->addOperand(&type4);
3042 auto param10 = model->addOperand(&type4);
3043 auto param11 = model->addOperand(&type4);
3044 auto param12 = model->addOperand(&type4);
3045 auto layout = model->addOperand(&type0);
3046 auto op41 = model->addOperand(&type43);
3047 // Phase 2, operations
3048 static int32_t param8_init[] = {2};
3049 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3050 static int32_t param9_init[] = {1};
3051 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3052 static int32_t param10_init[] = {1};
3053 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3054 static int32_t param11_init[] = {2};
3055 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3056 static int32_t param12_init[] = {0};
3057 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3058 static bool8 layout_init[] = {false};
3059 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3060 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3061 // Phase 3, inputs and outputs
3062 model->identifyInputsAndOutputs(
3063 {op11, op21, op31},
3064 {op41});
3065 assert(model->isValid());
3066 }
3067
is_ignored_nhwc_weight_as_input_quant8_2(int i)3068 inline bool is_ignored_nhwc_weight_as_input_quant8_2(int i) {
3069 static std::set<int> ignore = {};
3070 return ignore.find(i) != ignore.end();
3071 }
3072
CreateModel_nhwc_weight_as_input_channelQuant8_3(Model * model)3073 void CreateModel_nhwc_weight_as_input_channelQuant8_3(Model *model) {
3074 OperandType type0(Type::BOOL, {});
3075 OperandType type4(Type::INT32, {});
3076 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
3077 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 100);
3078 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
3079 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
3080 // Phase 1, operands
3081 auto op11 = model->addOperand(&type40);
3082 auto op21 = model->addOperand(&type44);
3083 auto op31 = model->addOperand(&type45);
3084 auto param8 = model->addOperand(&type4);
3085 auto param9 = model->addOperand(&type4);
3086 auto param10 = model->addOperand(&type4);
3087 auto param11 = model->addOperand(&type4);
3088 auto param12 = model->addOperand(&type4);
3089 auto layout = model->addOperand(&type0);
3090 auto op41 = model->addOperand(&type43);
3091 // Phase 2, operations
3092 static int32_t param8_init[] = {2};
3093 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3094 static int32_t param9_init[] = {1};
3095 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3096 static int32_t param10_init[] = {1};
3097 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3098 static int32_t param11_init[] = {2};
3099 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3100 static int32_t param12_init[] = {0};
3101 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3102 static bool8 layout_init[] = {false};
3103 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3104 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3105 // Phase 3, inputs and outputs
3106 model->identifyInputsAndOutputs(
3107 {op11, op21, op31},
3108 {op41});
3109 assert(model->isValid());
3110 }
3111
is_ignored_nhwc_weight_as_input_channelQuant8_3(int i)3112 inline bool is_ignored_nhwc_weight_as_input_channelQuant8_3(int i) {
3113 static std::set<int> ignore = {};
3114 return ignore.find(i) != ignore.end();
3115 }
3116
CreateModel_nchw_2(Model * model)3117 void CreateModel_nchw_2(Model *model) {
3118 OperandType type0(Type::BOOL, {});
3119 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3120 OperandType type3(Type::TENSOR_FLOAT32, {4});
3121 OperandType type4(Type::INT32, {});
3122 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
3123 OperandType type47(Type::TENSOR_FLOAT32, {1, 4, 2, 1});
3124 // Phase 1, operands
3125 auto op11 = model->addOperand(&type46);
3126 auto op21 = model->addOperand(&type2);
3127 auto op31 = model->addOperand(&type3);
3128 auto param8 = model->addOperand(&type4);
3129 auto param9 = model->addOperand(&type4);
3130 auto param10 = model->addOperand(&type4);
3131 auto param11 = model->addOperand(&type4);
3132 auto param12 = model->addOperand(&type4);
3133 auto layout = model->addOperand(&type0);
3134 auto op41 = model->addOperand(&type47);
3135 // Phase 2, operations
3136 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3137 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
3138 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3139 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
3140 static int32_t param8_init[] = {2};
3141 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3142 static int32_t param9_init[] = {1};
3143 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3144 static int32_t param10_init[] = {1};
3145 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3146 static int32_t param11_init[] = {2};
3147 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3148 static int32_t param12_init[] = {0};
3149 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3150 static bool8 layout_init[] = {true};
3151 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3152 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3153 // Phase 3, inputs and outputs
3154 model->identifyInputsAndOutputs(
3155 {op11},
3156 {op41});
3157 assert(model->isValid());
3158 }
3159
is_ignored_nchw_2(int i)3160 inline bool is_ignored_nchw_2(int i) {
3161 static std::set<int> ignore = {};
3162 return ignore.find(i) != ignore.end();
3163 }
3164
CreateModel_nchw_relaxed_2(Model * model)3165 void CreateModel_nchw_relaxed_2(Model *model) {
3166 OperandType type0(Type::BOOL, {});
3167 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3168 OperandType type3(Type::TENSOR_FLOAT32, {4});
3169 OperandType type4(Type::INT32, {});
3170 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
3171 OperandType type47(Type::TENSOR_FLOAT32, {1, 4, 2, 1});
3172 // Phase 1, operands
3173 auto op11 = model->addOperand(&type46);
3174 auto op21 = model->addOperand(&type2);
3175 auto op31 = model->addOperand(&type3);
3176 auto param8 = model->addOperand(&type4);
3177 auto param9 = model->addOperand(&type4);
3178 auto param10 = model->addOperand(&type4);
3179 auto param11 = model->addOperand(&type4);
3180 auto param12 = model->addOperand(&type4);
3181 auto layout = model->addOperand(&type0);
3182 auto op41 = model->addOperand(&type47);
3183 // Phase 2, operations
3184 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3185 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
3186 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3187 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
3188 static int32_t param8_init[] = {2};
3189 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3190 static int32_t param9_init[] = {1};
3191 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3192 static int32_t param10_init[] = {1};
3193 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3194 static int32_t param11_init[] = {2};
3195 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3196 static int32_t param12_init[] = {0};
3197 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3198 static bool8 layout_init[] = {true};
3199 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3200 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3201 // Phase 3, inputs and outputs
3202 model->identifyInputsAndOutputs(
3203 {op11},
3204 {op41});
3205 // Phase 4: set relaxed execution
3206 model->relaxComputationFloat32toFloat16(true);
3207 assert(model->isValid());
3208 }
3209
is_ignored_nchw_relaxed_2(int i)3210 inline bool is_ignored_nchw_relaxed_2(int i) {
3211 static std::set<int> ignore = {};
3212 return ignore.find(i) != ignore.end();
3213 }
3214
CreateModel_nchw_float16_2(Model * model)3215 void CreateModel_nchw_float16_2(Model *model) {
3216 OperandType type0(Type::BOOL, {});
3217 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3218 OperandType type17(Type::TENSOR_FLOAT16, {4});
3219 OperandType type4(Type::INT32, {});
3220 OperandType type48(Type::TENSOR_FLOAT16, {1, 2, 3, 2});
3221 OperandType type49(Type::TENSOR_FLOAT16, {1, 4, 2, 1});
3222 // Phase 1, operands
3223 auto op11 = model->addOperand(&type48);
3224 auto op21 = model->addOperand(&type16);
3225 auto op31 = model->addOperand(&type17);
3226 auto param8 = model->addOperand(&type4);
3227 auto param9 = model->addOperand(&type4);
3228 auto param10 = model->addOperand(&type4);
3229 auto param11 = model->addOperand(&type4);
3230 auto param12 = model->addOperand(&type4);
3231 auto layout = model->addOperand(&type0);
3232 auto op41 = model->addOperand(&type49);
3233 // Phase 2, operations
3234 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3235 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 16);
3236 static _Float16 op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3237 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 4);
3238 static int32_t param8_init[] = {2};
3239 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3240 static int32_t param9_init[] = {1};
3241 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3242 static int32_t param10_init[] = {1};
3243 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3244 static int32_t param11_init[] = {2};
3245 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3246 static int32_t param12_init[] = {0};
3247 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3248 static bool8 layout_init[] = {true};
3249 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3250 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3251 // Phase 3, inputs and outputs
3252 model->identifyInputsAndOutputs(
3253 {op11},
3254 {op41});
3255 assert(model->isValid());
3256 }
3257
is_ignored_nchw_float16_2(int i)3258 inline bool is_ignored_nchw_float16_2(int i) {
3259 static std::set<int> ignore = {};
3260 return ignore.find(i) != ignore.end();
3261 }
3262
CreateModel_nchw_quant8_2(Model * model)3263 void CreateModel_nchw_quant8_2(Model *model) {
3264 OperandType type0(Type::BOOL, {});
3265 OperandType type4(Type::INT32, {});
3266 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
3267 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
3268 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
3269 OperandType type51(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 1}, 1.0f, 100);
3270 // Phase 1, operands
3271 auto op11 = model->addOperand(&type50);
3272 auto op21 = model->addOperand(&type41);
3273 auto op31 = model->addOperand(&type42);
3274 auto param8 = model->addOperand(&type4);
3275 auto param9 = model->addOperand(&type4);
3276 auto param10 = model->addOperand(&type4);
3277 auto param11 = model->addOperand(&type4);
3278 auto param12 = model->addOperand(&type4);
3279 auto layout = model->addOperand(&type0);
3280 auto op41 = model->addOperand(&type51);
3281 // Phase 2, operations
3282 static uint8_t op21_init[] = {130, 132, 134, 136, 110, 148, 106, 152, 138, 140, 142, 144, 154, 100, 158, 96};
3283 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 16);
3284 static int32_t op31_init[] = {4, 8, 12, 16};
3285 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
3286 static int32_t param8_init[] = {2};
3287 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3288 static int32_t param9_init[] = {1};
3289 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3290 static int32_t param10_init[] = {1};
3291 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3292 static int32_t param11_init[] = {2};
3293 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3294 static int32_t param12_init[] = {0};
3295 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3296 static bool8 layout_init[] = {true};
3297 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3298 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3299 // Phase 3, inputs and outputs
3300 model->identifyInputsAndOutputs(
3301 {op11},
3302 {op41});
3303 assert(model->isValid());
3304 }
3305
is_ignored_nchw_quant8_2(int i)3306 inline bool is_ignored_nchw_quant8_2(int i) {
3307 static std::set<int> ignore = {};
3308 return ignore.find(i) != ignore.end();
3309 }
3310
CreateModel_nchw_channelQuant8_3(Model * model)3311 void CreateModel_nchw_channelQuant8_3(Model *model) {
3312 OperandType type0(Type::BOOL, {});
3313 OperandType type4(Type::INT32, {});
3314 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
3315 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
3316 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
3317 OperandType type51(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 1}, 1.0f, 100);
3318 // Phase 1, operands
3319 auto op11 = model->addOperand(&type50);
3320 auto op21 = model->addOperand(&type44);
3321 auto op31 = model->addOperand(&type45);
3322 auto param8 = model->addOperand(&type4);
3323 auto param9 = model->addOperand(&type4);
3324 auto param10 = model->addOperand(&type4);
3325 auto param11 = model->addOperand(&type4);
3326 auto param12 = model->addOperand(&type4);
3327 auto layout = model->addOperand(&type0);
3328 auto op41 = model->addOperand(&type51);
3329 // Phase 2, operations
3330 static int8_t op21_init[] = {2, 8, 6, 16, -18, 40, -22, 48, 10, 24, 14, 32, 26, -56, 30, -64};
3331 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
3332 static int32_t op31_init[] = {4, 16, 12, 32};
3333 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
3334 static int32_t param8_init[] = {2};
3335 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3336 static int32_t param9_init[] = {1};
3337 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3338 static int32_t param10_init[] = {1};
3339 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3340 static int32_t param11_init[] = {2};
3341 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3342 static int32_t param12_init[] = {0};
3343 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3344 static bool8 layout_init[] = {true};
3345 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3346 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3347 // Phase 3, inputs and outputs
3348 model->identifyInputsAndOutputs(
3349 {op11},
3350 {op41});
3351 assert(model->isValid());
3352 }
3353
is_ignored_nchw_channelQuant8_3(int i)3354 inline bool is_ignored_nchw_channelQuant8_3(int i) {
3355 static std::set<int> ignore = {};
3356 return ignore.find(i) != ignore.end();
3357 }
3358
CreateModel_nchw_weight_as_input_2(Model * model)3359 void CreateModel_nchw_weight_as_input_2(Model *model) {
3360 OperandType type0(Type::BOOL, {});
3361 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3362 OperandType type3(Type::TENSOR_FLOAT32, {4});
3363 OperandType type4(Type::INT32, {});
3364 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
3365 OperandType type47(Type::TENSOR_FLOAT32, {1, 4, 2, 1});
3366 // Phase 1, operands
3367 auto op11 = model->addOperand(&type46);
3368 auto op21 = model->addOperand(&type2);
3369 auto op31 = model->addOperand(&type3);
3370 auto param8 = model->addOperand(&type4);
3371 auto param9 = model->addOperand(&type4);
3372 auto param10 = model->addOperand(&type4);
3373 auto param11 = model->addOperand(&type4);
3374 auto param12 = model->addOperand(&type4);
3375 auto layout = model->addOperand(&type0);
3376 auto op41 = model->addOperand(&type47);
3377 // Phase 2, operations
3378 static int32_t param8_init[] = {2};
3379 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3380 static int32_t param9_init[] = {1};
3381 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3382 static int32_t param10_init[] = {1};
3383 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3384 static int32_t param11_init[] = {2};
3385 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3386 static int32_t param12_init[] = {0};
3387 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3388 static bool8 layout_init[] = {true};
3389 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3390 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3391 // Phase 3, inputs and outputs
3392 model->identifyInputsAndOutputs(
3393 {op11, op21, op31},
3394 {op41});
3395 assert(model->isValid());
3396 }
3397
is_ignored_nchw_weight_as_input_2(int i)3398 inline bool is_ignored_nchw_weight_as_input_2(int i) {
3399 static std::set<int> ignore = {};
3400 return ignore.find(i) != ignore.end();
3401 }
3402
CreateModel_nchw_weight_as_input_relaxed_2(Model * model)3403 void CreateModel_nchw_weight_as_input_relaxed_2(Model *model) {
3404 OperandType type0(Type::BOOL, {});
3405 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3406 OperandType type3(Type::TENSOR_FLOAT32, {4});
3407 OperandType type4(Type::INT32, {});
3408 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
3409 OperandType type47(Type::TENSOR_FLOAT32, {1, 4, 2, 1});
3410 // Phase 1, operands
3411 auto op11 = model->addOperand(&type46);
3412 auto op21 = model->addOperand(&type2);
3413 auto op31 = model->addOperand(&type3);
3414 auto param8 = model->addOperand(&type4);
3415 auto param9 = model->addOperand(&type4);
3416 auto param10 = model->addOperand(&type4);
3417 auto param11 = model->addOperand(&type4);
3418 auto param12 = model->addOperand(&type4);
3419 auto layout = model->addOperand(&type0);
3420 auto op41 = model->addOperand(&type47);
3421 // Phase 2, operations
3422 static int32_t param8_init[] = {2};
3423 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3424 static int32_t param9_init[] = {1};
3425 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3426 static int32_t param10_init[] = {1};
3427 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3428 static int32_t param11_init[] = {2};
3429 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3430 static int32_t param12_init[] = {0};
3431 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3432 static bool8 layout_init[] = {true};
3433 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3434 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3435 // Phase 3, inputs and outputs
3436 model->identifyInputsAndOutputs(
3437 {op11, op21, op31},
3438 {op41});
3439 // Phase 4: set relaxed execution
3440 model->relaxComputationFloat32toFloat16(true);
3441 assert(model->isValid());
3442 }
3443
is_ignored_nchw_weight_as_input_relaxed_2(int i)3444 inline bool is_ignored_nchw_weight_as_input_relaxed_2(int i) {
3445 static std::set<int> ignore = {};
3446 return ignore.find(i) != ignore.end();
3447 }
3448
CreateModel_nchw_weight_as_input_float16_2(Model * model)3449 void CreateModel_nchw_weight_as_input_float16_2(Model *model) {
3450 OperandType type0(Type::BOOL, {});
3451 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3452 OperandType type17(Type::TENSOR_FLOAT16, {4});
3453 OperandType type4(Type::INT32, {});
3454 OperandType type48(Type::TENSOR_FLOAT16, {1, 2, 3, 2});
3455 OperandType type49(Type::TENSOR_FLOAT16, {1, 4, 2, 1});
3456 // Phase 1, operands
3457 auto op11 = model->addOperand(&type48);
3458 auto op21 = model->addOperand(&type16);
3459 auto op31 = model->addOperand(&type17);
3460 auto param8 = model->addOperand(&type4);
3461 auto param9 = model->addOperand(&type4);
3462 auto param10 = model->addOperand(&type4);
3463 auto param11 = model->addOperand(&type4);
3464 auto param12 = model->addOperand(&type4);
3465 auto layout = model->addOperand(&type0);
3466 auto op41 = model->addOperand(&type49);
3467 // Phase 2, operations
3468 static int32_t param8_init[] = {2};
3469 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3470 static int32_t param9_init[] = {1};
3471 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3472 static int32_t param10_init[] = {1};
3473 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3474 static int32_t param11_init[] = {2};
3475 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3476 static int32_t param12_init[] = {0};
3477 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3478 static bool8 layout_init[] = {true};
3479 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3480 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3481 // Phase 3, inputs and outputs
3482 model->identifyInputsAndOutputs(
3483 {op11, op21, op31},
3484 {op41});
3485 assert(model->isValid());
3486 }
3487
is_ignored_nchw_weight_as_input_float16_2(int i)3488 inline bool is_ignored_nchw_weight_as_input_float16_2(int i) {
3489 static std::set<int> ignore = {};
3490 return ignore.find(i) != ignore.end();
3491 }
3492
CreateModel_nchw_weight_as_input_quant8_2(Model * model)3493 void CreateModel_nchw_weight_as_input_quant8_2(Model *model) {
3494 OperandType type0(Type::BOOL, {});
3495 OperandType type4(Type::INT32, {});
3496 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
3497 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
3498 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
3499 OperandType type51(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 1}, 1.0f, 100);
3500 // Phase 1, operands
3501 auto op11 = model->addOperand(&type50);
3502 auto op21 = model->addOperand(&type41);
3503 auto op31 = model->addOperand(&type42);
3504 auto param8 = model->addOperand(&type4);
3505 auto param9 = model->addOperand(&type4);
3506 auto param10 = model->addOperand(&type4);
3507 auto param11 = model->addOperand(&type4);
3508 auto param12 = model->addOperand(&type4);
3509 auto layout = model->addOperand(&type0);
3510 auto op41 = model->addOperand(&type51);
3511 // Phase 2, operations
3512 static int32_t param8_init[] = {2};
3513 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3514 static int32_t param9_init[] = {1};
3515 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3516 static int32_t param10_init[] = {1};
3517 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3518 static int32_t param11_init[] = {2};
3519 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3520 static int32_t param12_init[] = {0};
3521 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3522 static bool8 layout_init[] = {true};
3523 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3524 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3525 // Phase 3, inputs and outputs
3526 model->identifyInputsAndOutputs(
3527 {op11, op21, op31},
3528 {op41});
3529 assert(model->isValid());
3530 }
3531
is_ignored_nchw_weight_as_input_quant8_2(int i)3532 inline bool is_ignored_nchw_weight_as_input_quant8_2(int i) {
3533 static std::set<int> ignore = {};
3534 return ignore.find(i) != ignore.end();
3535 }
3536
CreateModel_nchw_weight_as_input_channelQuant8_3(Model * model)3537 void CreateModel_nchw_weight_as_input_channelQuant8_3(Model *model) {
3538 OperandType type0(Type::BOOL, {});
3539 OperandType type4(Type::INT32, {});
3540 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
3541 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
3542 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
3543 OperandType type51(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 1}, 1.0f, 100);
3544 // Phase 1, operands
3545 auto op11 = model->addOperand(&type50);
3546 auto op21 = model->addOperand(&type44);
3547 auto op31 = model->addOperand(&type45);
3548 auto param8 = model->addOperand(&type4);
3549 auto param9 = model->addOperand(&type4);
3550 auto param10 = model->addOperand(&type4);
3551 auto param11 = model->addOperand(&type4);
3552 auto param12 = model->addOperand(&type4);
3553 auto layout = model->addOperand(&type0);
3554 auto op41 = model->addOperand(&type51);
3555 // Phase 2, operations
3556 static int32_t param8_init[] = {2};
3557 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3558 static int32_t param9_init[] = {1};
3559 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3560 static int32_t param10_init[] = {1};
3561 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3562 static int32_t param11_init[] = {2};
3563 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3564 static int32_t param12_init[] = {0};
3565 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3566 static bool8 layout_init[] = {true};
3567 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3568 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3569 // Phase 3, inputs and outputs
3570 model->identifyInputsAndOutputs(
3571 {op11, op21, op31},
3572 {op41});
3573 assert(model->isValid());
3574 }
3575
is_ignored_nchw_weight_as_input_channelQuant8_3(int i)3576 inline bool is_ignored_nchw_weight_as_input_channelQuant8_3(int i) {
3577 static std::set<int> ignore = {};
3578 return ignore.find(i) != ignore.end();
3579 }
3580
CreateModel_dynamic_output_shape_nhwc_2(Model * model)3581 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) {
3582 OperandType type0(Type::BOOL, {});
3583 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3584 OperandType type3(Type::TENSOR_FLOAT32, {4});
3585 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3586 OperandType type4(Type::INT32, {});
3587 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
3588 // Phase 1, operands
3589 auto op11 = model->addOperand(&type5);
3590 auto op21 = model->addOperand(&type2);
3591 auto op31 = model->addOperand(&type3);
3592 auto param8 = model->addOperand(&type4);
3593 auto param9 = model->addOperand(&type4);
3594 auto param10 = model->addOperand(&type4);
3595 auto param11 = model->addOperand(&type4);
3596 auto param12 = model->addOperand(&type4);
3597 auto layout = model->addOperand(&type0);
3598 auto op41 = model->addOperand(&type34);
3599 // Phase 2, operations
3600 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3601 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
3602 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3603 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
3604 static int32_t param8_init[] = {2};
3605 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3606 static int32_t param9_init[] = {1};
3607 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3608 static int32_t param10_init[] = {1};
3609 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3610 static int32_t param11_init[] = {2};
3611 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3612 static int32_t param12_init[] = {0};
3613 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3614 static bool8 layout_init[] = {false};
3615 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3616 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3617 // Phase 3, inputs and outputs
3618 model->identifyInputsAndOutputs(
3619 {op11},
3620 {op41});
3621 assert(model->isValid());
3622 }
3623
is_ignored_dynamic_output_shape_nhwc_2(int i)3624 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
3625 static std::set<int> ignore = {};
3626 return ignore.find(i) != ignore.end();
3627 }
3628
CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model * model)3629 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) {
3630 OperandType type0(Type::BOOL, {});
3631 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3632 OperandType type3(Type::TENSOR_FLOAT32, {4});
3633 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3634 OperandType type4(Type::INT32, {});
3635 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
3636 // Phase 1, operands
3637 auto op11 = model->addOperand(&type5);
3638 auto op21 = model->addOperand(&type2);
3639 auto op31 = model->addOperand(&type3);
3640 auto param8 = model->addOperand(&type4);
3641 auto param9 = model->addOperand(&type4);
3642 auto param10 = model->addOperand(&type4);
3643 auto param11 = model->addOperand(&type4);
3644 auto param12 = model->addOperand(&type4);
3645 auto layout = model->addOperand(&type0);
3646 auto op41 = model->addOperand(&type34);
3647 // Phase 2, operations
3648 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3649 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
3650 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3651 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
3652 static int32_t param8_init[] = {2};
3653 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3654 static int32_t param9_init[] = {1};
3655 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3656 static int32_t param10_init[] = {1};
3657 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3658 static int32_t param11_init[] = {2};
3659 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3660 static int32_t param12_init[] = {0};
3661 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3662 static bool8 layout_init[] = {false};
3663 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3664 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3665 // Phase 3, inputs and outputs
3666 model->identifyInputsAndOutputs(
3667 {op11},
3668 {op41});
3669 // Phase 4: set relaxed execution
3670 model->relaxComputationFloat32toFloat16(true);
3671 assert(model->isValid());
3672 }
3673
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)3674 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
3675 static std::set<int> ignore = {};
3676 return ignore.find(i) != ignore.end();
3677 }
3678
CreateModel_dynamic_output_shape_nhwc_float16_2(Model * model)3679 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) {
3680 OperandType type0(Type::BOOL, {});
3681 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3682 OperandType type17(Type::TENSOR_FLOAT16, {4});
3683 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3684 OperandType type38(Type::TENSOR_FLOAT16, {1, 3, 2, 2});
3685 OperandType type4(Type::INT32, {});
3686 // Phase 1, operands
3687 auto op11 = model->addOperand(&type38);
3688 auto op21 = model->addOperand(&type16);
3689 auto op31 = model->addOperand(&type17);
3690 auto param8 = model->addOperand(&type4);
3691 auto param9 = model->addOperand(&type4);
3692 auto param10 = model->addOperand(&type4);
3693 auto param11 = model->addOperand(&type4);
3694 auto param12 = model->addOperand(&type4);
3695 auto layout = model->addOperand(&type0);
3696 auto op41 = model->addOperand(&type35);
3697 // Phase 2, operations
3698 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
3699 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 16);
3700 static _Float16 op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
3701 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 4);
3702 static int32_t param8_init[] = {2};
3703 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3704 static int32_t param9_init[] = {1};
3705 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3706 static int32_t param10_init[] = {1};
3707 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3708 static int32_t param11_init[] = {2};
3709 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3710 static int32_t param12_init[] = {0};
3711 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3712 static bool8 layout_init[] = {false};
3713 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3714 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3715 // Phase 3, inputs and outputs
3716 model->identifyInputsAndOutputs(
3717 {op11},
3718 {op41});
3719 assert(model->isValid());
3720 }
3721
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)3722 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
3723 static std::set<int> ignore = {};
3724 return ignore.find(i) != ignore.end();
3725 }
3726
CreateModel_dynamic_output_shape_nhwc_quant8_2(Model * model)3727 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) {
3728 OperandType type0(Type::BOOL, {});
3729 OperandType type4(Type::INT32, {});
3730 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
3731 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
3732 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
3733 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
3734 // Phase 1, operands
3735 auto op11 = model->addOperand(&type40);
3736 auto op21 = model->addOperand(&type41);
3737 auto op31 = model->addOperand(&type42);
3738 auto param8 = model->addOperand(&type4);
3739 auto param9 = model->addOperand(&type4);
3740 auto param10 = model->addOperand(&type4);
3741 auto param11 = model->addOperand(&type4);
3742 auto param12 = model->addOperand(&type4);
3743 auto layout = model->addOperand(&type0);
3744 auto op41 = model->addOperand(&type52);
3745 // Phase 2, operations
3746 static uint8_t op21_init[] = {130, 132, 134, 136, 110, 148, 106, 152, 138, 140, 142, 144, 154, 100, 158, 96};
3747 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 16);
3748 static int32_t op31_init[] = {4, 8, 12, 16};
3749 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
3750 static int32_t param8_init[] = {2};
3751 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3752 static int32_t param9_init[] = {1};
3753 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3754 static int32_t param10_init[] = {1};
3755 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3756 static int32_t param11_init[] = {2};
3757 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3758 static int32_t param12_init[] = {0};
3759 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3760 static bool8 layout_init[] = {false};
3761 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3762 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3763 // Phase 3, inputs and outputs
3764 model->identifyInputsAndOutputs(
3765 {op11},
3766 {op41});
3767 assert(model->isValid());
3768 }
3769
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)3770 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
3771 static std::set<int> ignore = {};
3772 return ignore.find(i) != ignore.end();
3773 }
3774
CreateModel_dynamic_output_shape_nhwc_channelQuant8_3(Model * model)3775 void CreateModel_dynamic_output_shape_nhwc_channelQuant8_3(Model *model) {
3776 OperandType type0(Type::BOOL, {});
3777 OperandType type4(Type::INT32, {});
3778 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
3779 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
3780 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
3781 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
3782 // Phase 1, operands
3783 auto op11 = model->addOperand(&type40);
3784 auto op21 = model->addOperand(&type44);
3785 auto op31 = model->addOperand(&type45);
3786 auto param8 = model->addOperand(&type4);
3787 auto param9 = model->addOperand(&type4);
3788 auto param10 = model->addOperand(&type4);
3789 auto param11 = model->addOperand(&type4);
3790 auto param12 = model->addOperand(&type4);
3791 auto layout = model->addOperand(&type0);
3792 auto op41 = model->addOperand(&type52);
3793 // Phase 2, operations
3794 static int8_t op21_init[] = {2, 8, 6, 16, -18, 40, -22, 48, 10, 24, 14, 32, 26, -56, 30, -64};
3795 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
3796 static int32_t op31_init[] = {4, 16, 12, 32};
3797 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
3798 static int32_t param8_init[] = {2};
3799 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3800 static int32_t param9_init[] = {1};
3801 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3802 static int32_t param10_init[] = {1};
3803 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3804 static int32_t param11_init[] = {2};
3805 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3806 static int32_t param12_init[] = {0};
3807 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3808 static bool8 layout_init[] = {false};
3809 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3810 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3811 // Phase 3, inputs and outputs
3812 model->identifyInputsAndOutputs(
3813 {op11},
3814 {op41});
3815 assert(model->isValid());
3816 }
3817
is_ignored_dynamic_output_shape_nhwc_channelQuant8_3(int i)3818 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8_3(int i) {
3819 static std::set<int> ignore = {};
3820 return ignore.find(i) != ignore.end();
3821 }
3822
CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model * model)3823 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) {
3824 OperandType type0(Type::BOOL, {});
3825 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3826 OperandType type3(Type::TENSOR_FLOAT32, {4});
3827 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3828 OperandType type4(Type::INT32, {});
3829 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
3830 // Phase 1, operands
3831 auto op11 = model->addOperand(&type5);
3832 auto op21 = model->addOperand(&type2);
3833 auto op31 = model->addOperand(&type3);
3834 auto param8 = model->addOperand(&type4);
3835 auto param9 = model->addOperand(&type4);
3836 auto param10 = model->addOperand(&type4);
3837 auto param11 = model->addOperand(&type4);
3838 auto param12 = model->addOperand(&type4);
3839 auto layout = model->addOperand(&type0);
3840 auto op41 = model->addOperand(&type34);
3841 // Phase 2, operations
3842 static int32_t param8_init[] = {2};
3843 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3844 static int32_t param9_init[] = {1};
3845 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3846 static int32_t param10_init[] = {1};
3847 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3848 static int32_t param11_init[] = {2};
3849 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3850 static int32_t param12_init[] = {0};
3851 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3852 static bool8 layout_init[] = {false};
3853 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3854 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3855 // Phase 3, inputs and outputs
3856 model->identifyInputsAndOutputs(
3857 {op11, op21, op31},
3858 {op41});
3859 assert(model->isValid());
3860 }
3861
is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i)3862 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) {
3863 static std::set<int> ignore = {};
3864 return ignore.find(i) != ignore.end();
3865 }
3866
CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model * model)3867 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model *model) {
3868 OperandType type0(Type::BOOL, {});
3869 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
3870 OperandType type3(Type::TENSOR_FLOAT32, {4});
3871 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
3872 OperandType type4(Type::INT32, {});
3873 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 2, 2});
3874 // Phase 1, operands
3875 auto op11 = model->addOperand(&type5);
3876 auto op21 = model->addOperand(&type2);
3877 auto op31 = model->addOperand(&type3);
3878 auto param8 = model->addOperand(&type4);
3879 auto param9 = model->addOperand(&type4);
3880 auto param10 = model->addOperand(&type4);
3881 auto param11 = model->addOperand(&type4);
3882 auto param12 = model->addOperand(&type4);
3883 auto layout = model->addOperand(&type0);
3884 auto op41 = model->addOperand(&type34);
3885 // Phase 2, operations
3886 static int32_t param8_init[] = {2};
3887 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3888 static int32_t param9_init[] = {1};
3889 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3890 static int32_t param10_init[] = {1};
3891 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3892 static int32_t param11_init[] = {2};
3893 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3894 static int32_t param12_init[] = {0};
3895 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3896 static bool8 layout_init[] = {false};
3897 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3898 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3899 // Phase 3, inputs and outputs
3900 model->identifyInputsAndOutputs(
3901 {op11, op21, op31},
3902 {op41});
3903 // Phase 4: set relaxed execution
3904 model->relaxComputationFloat32toFloat16(true);
3905 assert(model->isValid());
3906 }
3907
is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i)3908 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i) {
3909 static std::set<int> ignore = {};
3910 return ignore.find(i) != ignore.end();
3911 }
3912
CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model * model)3913 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model *model) {
3914 OperandType type0(Type::BOOL, {});
3915 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
3916 OperandType type17(Type::TENSOR_FLOAT16, {4});
3917 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
3918 OperandType type38(Type::TENSOR_FLOAT16, {1, 3, 2, 2});
3919 OperandType type4(Type::INT32, {});
3920 // Phase 1, operands
3921 auto op11 = model->addOperand(&type38);
3922 auto op21 = model->addOperand(&type16);
3923 auto op31 = model->addOperand(&type17);
3924 auto param8 = model->addOperand(&type4);
3925 auto param9 = model->addOperand(&type4);
3926 auto param10 = model->addOperand(&type4);
3927 auto param11 = model->addOperand(&type4);
3928 auto param12 = model->addOperand(&type4);
3929 auto layout = model->addOperand(&type0);
3930 auto op41 = model->addOperand(&type35);
3931 // Phase 2, operations
3932 static int32_t param8_init[] = {2};
3933 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3934 static int32_t param9_init[] = {1};
3935 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3936 static int32_t param10_init[] = {1};
3937 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3938 static int32_t param11_init[] = {2};
3939 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3940 static int32_t param12_init[] = {0};
3941 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3942 static bool8 layout_init[] = {false};
3943 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3944 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3945 // Phase 3, inputs and outputs
3946 model->identifyInputsAndOutputs(
3947 {op11, op21, op31},
3948 {op41});
3949 assert(model->isValid());
3950 }
3951
is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i)3952 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i) {
3953 static std::set<int> ignore = {};
3954 return ignore.find(i) != ignore.end();
3955 }
3956
CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model * model)3957 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model *model) {
3958 OperandType type0(Type::BOOL, {});
3959 OperandType type4(Type::INT32, {});
3960 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
3961 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
3962 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
3963 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
3964 // Phase 1, operands
3965 auto op11 = model->addOperand(&type40);
3966 auto op21 = model->addOperand(&type41);
3967 auto op31 = model->addOperand(&type42);
3968 auto param8 = model->addOperand(&type4);
3969 auto param9 = model->addOperand(&type4);
3970 auto param10 = model->addOperand(&type4);
3971 auto param11 = model->addOperand(&type4);
3972 auto param12 = model->addOperand(&type4);
3973 auto layout = model->addOperand(&type0);
3974 auto op41 = model->addOperand(&type52);
3975 // Phase 2, operations
3976 static int32_t param8_init[] = {2};
3977 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
3978 static int32_t param9_init[] = {1};
3979 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
3980 static int32_t param10_init[] = {1};
3981 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
3982 static int32_t param11_init[] = {2};
3983 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
3984 static int32_t param12_init[] = {0};
3985 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
3986 static bool8 layout_init[] = {false};
3987 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
3988 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
3989 // Phase 3, inputs and outputs
3990 model->identifyInputsAndOutputs(
3991 {op11, op21, op31},
3992 {op41});
3993 assert(model->isValid());
3994 }
3995
is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i)3996 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i) {
3997 static std::set<int> ignore = {};
3998 return ignore.find(i) != ignore.end();
3999 }
4000
CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_3(Model * model)4001 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_3(Model *model) {
4002 OperandType type0(Type::BOOL, {});
4003 OperandType type4(Type::INT32, {});
4004 OperandType type40(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 0.5f, 128);
4005 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
4006 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
4007 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
4008 // Phase 1, operands
4009 auto op11 = model->addOperand(&type40);
4010 auto op21 = model->addOperand(&type44);
4011 auto op31 = model->addOperand(&type45);
4012 auto param8 = model->addOperand(&type4);
4013 auto param9 = model->addOperand(&type4);
4014 auto param10 = model->addOperand(&type4);
4015 auto param11 = model->addOperand(&type4);
4016 auto param12 = model->addOperand(&type4);
4017 auto layout = model->addOperand(&type0);
4018 auto op41 = model->addOperand(&type52);
4019 // Phase 2, operations
4020 static int32_t param8_init[] = {2};
4021 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4022 static int32_t param9_init[] = {1};
4023 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4024 static int32_t param10_init[] = {1};
4025 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4026 static int32_t param11_init[] = {2};
4027 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4028 static int32_t param12_init[] = {0};
4029 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4030 static bool8 layout_init[] = {false};
4031 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4032 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4033 // Phase 3, inputs and outputs
4034 model->identifyInputsAndOutputs(
4035 {op11, op21, op31},
4036 {op41});
4037 assert(model->isValid());
4038 }
4039
is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_3(int i)4040 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_3(int i) {
4041 static std::set<int> ignore = {};
4042 return ignore.find(i) != ignore.end();
4043 }
4044
CreateModel_dynamic_output_shape_nchw_2(Model * model)4045 void CreateModel_dynamic_output_shape_nchw_2(Model *model) {
4046 OperandType type0(Type::BOOL, {});
4047 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4048 OperandType type3(Type::TENSOR_FLOAT32, {4});
4049 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4050 OperandType type4(Type::INT32, {});
4051 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
4052 // Phase 1, operands
4053 auto op11 = model->addOperand(&type46);
4054 auto op21 = model->addOperand(&type2);
4055 auto op31 = model->addOperand(&type3);
4056 auto param8 = model->addOperand(&type4);
4057 auto param9 = model->addOperand(&type4);
4058 auto param10 = model->addOperand(&type4);
4059 auto param11 = model->addOperand(&type4);
4060 auto param12 = model->addOperand(&type4);
4061 auto layout = model->addOperand(&type0);
4062 auto op41 = model->addOperand(&type34);
4063 // Phase 2, operations
4064 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
4065 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
4066 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4067 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
4068 static int32_t param8_init[] = {2};
4069 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4070 static int32_t param9_init[] = {1};
4071 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4072 static int32_t param10_init[] = {1};
4073 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4074 static int32_t param11_init[] = {2};
4075 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4076 static int32_t param12_init[] = {0};
4077 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4078 static bool8 layout_init[] = {true};
4079 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4080 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4081 // Phase 3, inputs and outputs
4082 model->identifyInputsAndOutputs(
4083 {op11},
4084 {op41});
4085 assert(model->isValid());
4086 }
4087
is_ignored_dynamic_output_shape_nchw_2(int i)4088 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
4089 static std::set<int> ignore = {};
4090 return ignore.find(i) != ignore.end();
4091 }
4092
CreateModel_dynamic_output_shape_nchw_relaxed_2(Model * model)4093 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) {
4094 OperandType type0(Type::BOOL, {});
4095 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4096 OperandType type3(Type::TENSOR_FLOAT32, {4});
4097 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4098 OperandType type4(Type::INT32, {});
4099 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
4100 // Phase 1, operands
4101 auto op11 = model->addOperand(&type46);
4102 auto op21 = model->addOperand(&type2);
4103 auto op31 = model->addOperand(&type3);
4104 auto param8 = model->addOperand(&type4);
4105 auto param9 = model->addOperand(&type4);
4106 auto param10 = model->addOperand(&type4);
4107 auto param11 = model->addOperand(&type4);
4108 auto param12 = model->addOperand(&type4);
4109 auto layout = model->addOperand(&type0);
4110 auto op41 = model->addOperand(&type34);
4111 // Phase 2, operations
4112 static float op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
4113 model->setOperandValue(op21, op21_init, sizeof(float) * 16);
4114 static float op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4115 model->setOperandValue(op31, op31_init, sizeof(float) * 4);
4116 static int32_t param8_init[] = {2};
4117 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4118 static int32_t param9_init[] = {1};
4119 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4120 static int32_t param10_init[] = {1};
4121 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4122 static int32_t param11_init[] = {2};
4123 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4124 static int32_t param12_init[] = {0};
4125 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4126 static bool8 layout_init[] = {true};
4127 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4128 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4129 // Phase 3, inputs and outputs
4130 model->identifyInputsAndOutputs(
4131 {op11},
4132 {op41});
4133 // Phase 4: set relaxed execution
4134 model->relaxComputationFloat32toFloat16(true);
4135 assert(model->isValid());
4136 }
4137
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)4138 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
4139 static std::set<int> ignore = {};
4140 return ignore.find(i) != ignore.end();
4141 }
4142
CreateModel_dynamic_output_shape_nchw_float16_2(Model * model)4143 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) {
4144 OperandType type0(Type::BOOL, {});
4145 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
4146 OperandType type17(Type::TENSOR_FLOAT16, {4});
4147 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
4148 OperandType type4(Type::INT32, {});
4149 OperandType type48(Type::TENSOR_FLOAT16, {1, 2, 3, 2});
4150 // Phase 1, operands
4151 auto op11 = model->addOperand(&type48);
4152 auto op21 = model->addOperand(&type16);
4153 auto op31 = model->addOperand(&type17);
4154 auto param8 = model->addOperand(&type4);
4155 auto param9 = model->addOperand(&type4);
4156 auto param10 = model->addOperand(&type4);
4157 auto param11 = model->addOperand(&type4);
4158 auto param12 = model->addOperand(&type4);
4159 auto layout = model->addOperand(&type0);
4160 auto op41 = model->addOperand(&type35);
4161 // Phase 2, operations
4162 static _Float16 op21_init[] = {1.0f, 2.0f, 3.0f, 4.0f, -9.0f, 10.0f, -11.0f, 12.0f, 5.0f, 6.0f, 7.0f, 8.0f, 13.0f, -14.0f, 15.0f, -16.0f};
4163 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 16);
4164 static _Float16 op31_init[] = {1.0f, 2.0f, 3.0f, 4.0f};
4165 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 4);
4166 static int32_t param8_init[] = {2};
4167 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4168 static int32_t param9_init[] = {1};
4169 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4170 static int32_t param10_init[] = {1};
4171 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4172 static int32_t param11_init[] = {2};
4173 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4174 static int32_t param12_init[] = {0};
4175 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4176 static bool8 layout_init[] = {true};
4177 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4178 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4179 // Phase 3, inputs and outputs
4180 model->identifyInputsAndOutputs(
4181 {op11},
4182 {op41});
4183 assert(model->isValid());
4184 }
4185
is_ignored_dynamic_output_shape_nchw_float16_2(int i)4186 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
4187 static std::set<int> ignore = {};
4188 return ignore.find(i) != ignore.end();
4189 }
4190
CreateModel_dynamic_output_shape_nchw_quant8_2(Model * model)4191 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) {
4192 OperandType type0(Type::BOOL, {});
4193 OperandType type4(Type::INT32, {});
4194 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
4195 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
4196 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
4197 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
4198 // Phase 1, operands
4199 auto op11 = model->addOperand(&type50);
4200 auto op21 = model->addOperand(&type41);
4201 auto op31 = model->addOperand(&type42);
4202 auto param8 = model->addOperand(&type4);
4203 auto param9 = model->addOperand(&type4);
4204 auto param10 = model->addOperand(&type4);
4205 auto param11 = model->addOperand(&type4);
4206 auto param12 = model->addOperand(&type4);
4207 auto layout = model->addOperand(&type0);
4208 auto op41 = model->addOperand(&type52);
4209 // Phase 2, operations
4210 static uint8_t op21_init[] = {130, 132, 134, 136, 110, 148, 106, 152, 138, 140, 142, 144, 154, 100, 158, 96};
4211 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 16);
4212 static int32_t op31_init[] = {4, 8, 12, 16};
4213 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
4214 static int32_t param8_init[] = {2};
4215 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4216 static int32_t param9_init[] = {1};
4217 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4218 static int32_t param10_init[] = {1};
4219 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4220 static int32_t param11_init[] = {2};
4221 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4222 static int32_t param12_init[] = {0};
4223 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4224 static bool8 layout_init[] = {true};
4225 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4226 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4227 // Phase 3, inputs and outputs
4228 model->identifyInputsAndOutputs(
4229 {op11},
4230 {op41});
4231 assert(model->isValid());
4232 }
4233
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)4234 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
4235 static std::set<int> ignore = {};
4236 return ignore.find(i) != ignore.end();
4237 }
4238
CreateModel_dynamic_output_shape_nchw_channelQuant8_3(Model * model)4239 void CreateModel_dynamic_output_shape_nchw_channelQuant8_3(Model *model) {
4240 OperandType type0(Type::BOOL, {});
4241 OperandType type4(Type::INT32, {});
4242 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
4243 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
4244 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
4245 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
4246 // Phase 1, operands
4247 auto op11 = model->addOperand(&type50);
4248 auto op21 = model->addOperand(&type44);
4249 auto op31 = model->addOperand(&type45);
4250 auto param8 = model->addOperand(&type4);
4251 auto param9 = model->addOperand(&type4);
4252 auto param10 = model->addOperand(&type4);
4253 auto param11 = model->addOperand(&type4);
4254 auto param12 = model->addOperand(&type4);
4255 auto layout = model->addOperand(&type0);
4256 auto op41 = model->addOperand(&type52);
4257 // Phase 2, operations
4258 static int8_t op21_init[] = {2, 8, 6, 16, -18, 40, -22, 48, 10, 24, 14, 32, 26, -56, 30, -64};
4259 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 16);
4260 static int32_t op31_init[] = {4, 16, 12, 32};
4261 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 4);
4262 static int32_t param8_init[] = {2};
4263 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4264 static int32_t param9_init[] = {1};
4265 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4266 static int32_t param10_init[] = {1};
4267 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4268 static int32_t param11_init[] = {2};
4269 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4270 static int32_t param12_init[] = {0};
4271 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4272 static bool8 layout_init[] = {true};
4273 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4274 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4275 // Phase 3, inputs and outputs
4276 model->identifyInputsAndOutputs(
4277 {op11},
4278 {op41});
4279 assert(model->isValid());
4280 }
4281
is_ignored_dynamic_output_shape_nchw_channelQuant8_3(int i)4282 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8_3(int i) {
4283 static std::set<int> ignore = {};
4284 return ignore.find(i) != ignore.end();
4285 }
4286
CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model * model)4287 void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) {
4288 OperandType type0(Type::BOOL, {});
4289 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4290 OperandType type3(Type::TENSOR_FLOAT32, {4});
4291 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4292 OperandType type4(Type::INT32, {});
4293 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
4294 // Phase 1, operands
4295 auto op11 = model->addOperand(&type46);
4296 auto op21 = model->addOperand(&type2);
4297 auto op31 = model->addOperand(&type3);
4298 auto param8 = model->addOperand(&type4);
4299 auto param9 = model->addOperand(&type4);
4300 auto param10 = model->addOperand(&type4);
4301 auto param11 = model->addOperand(&type4);
4302 auto param12 = model->addOperand(&type4);
4303 auto layout = model->addOperand(&type0);
4304 auto op41 = model->addOperand(&type34);
4305 // Phase 2, operations
4306 static int32_t param8_init[] = {2};
4307 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4308 static int32_t param9_init[] = {1};
4309 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4310 static int32_t param10_init[] = {1};
4311 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4312 static int32_t param11_init[] = {2};
4313 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4314 static int32_t param12_init[] = {0};
4315 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4316 static bool8 layout_init[] = {true};
4317 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4318 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4319 // Phase 3, inputs and outputs
4320 model->identifyInputsAndOutputs(
4321 {op11, op21, op31},
4322 {op41});
4323 assert(model->isValid());
4324 }
4325
is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i)4326 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) {
4327 static std::set<int> ignore = {};
4328 return ignore.find(i) != ignore.end();
4329 }
4330
CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model * model)4331 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model *model) {
4332 OperandType type0(Type::BOOL, {});
4333 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
4334 OperandType type3(Type::TENSOR_FLOAT32, {4});
4335 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
4336 OperandType type4(Type::INT32, {});
4337 OperandType type46(Type::TENSOR_FLOAT32, {1, 2, 3, 2});
4338 // Phase 1, operands
4339 auto op11 = model->addOperand(&type46);
4340 auto op21 = model->addOperand(&type2);
4341 auto op31 = model->addOperand(&type3);
4342 auto param8 = model->addOperand(&type4);
4343 auto param9 = model->addOperand(&type4);
4344 auto param10 = model->addOperand(&type4);
4345 auto param11 = model->addOperand(&type4);
4346 auto param12 = model->addOperand(&type4);
4347 auto layout = model->addOperand(&type0);
4348 auto op41 = model->addOperand(&type34);
4349 // Phase 2, operations
4350 static int32_t param8_init[] = {2};
4351 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4352 static int32_t param9_init[] = {1};
4353 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4354 static int32_t param10_init[] = {1};
4355 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4356 static int32_t param11_init[] = {2};
4357 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4358 static int32_t param12_init[] = {0};
4359 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4360 static bool8 layout_init[] = {true};
4361 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4362 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4363 // Phase 3, inputs and outputs
4364 model->identifyInputsAndOutputs(
4365 {op11, op21, op31},
4366 {op41});
4367 // Phase 4: set relaxed execution
4368 model->relaxComputationFloat32toFloat16(true);
4369 assert(model->isValid());
4370 }
4371
is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i)4372 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i) {
4373 static std::set<int> ignore = {};
4374 return ignore.find(i) != ignore.end();
4375 }
4376
CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model * model)4377 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model *model) {
4378 OperandType type0(Type::BOOL, {});
4379 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
4380 OperandType type17(Type::TENSOR_FLOAT16, {4});
4381 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
4382 OperandType type4(Type::INT32, {});
4383 OperandType type48(Type::TENSOR_FLOAT16, {1, 2, 3, 2});
4384 // Phase 1, operands
4385 auto op11 = model->addOperand(&type48);
4386 auto op21 = model->addOperand(&type16);
4387 auto op31 = model->addOperand(&type17);
4388 auto param8 = model->addOperand(&type4);
4389 auto param9 = model->addOperand(&type4);
4390 auto param10 = model->addOperand(&type4);
4391 auto param11 = model->addOperand(&type4);
4392 auto param12 = model->addOperand(&type4);
4393 auto layout = model->addOperand(&type0);
4394 auto op41 = model->addOperand(&type35);
4395 // Phase 2, operations
4396 static int32_t param8_init[] = {2};
4397 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4398 static int32_t param9_init[] = {1};
4399 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4400 static int32_t param10_init[] = {1};
4401 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4402 static int32_t param11_init[] = {2};
4403 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4404 static int32_t param12_init[] = {0};
4405 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4406 static bool8 layout_init[] = {true};
4407 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4408 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4409 // Phase 3, inputs and outputs
4410 model->identifyInputsAndOutputs(
4411 {op11, op21, op31},
4412 {op41});
4413 assert(model->isValid());
4414 }
4415
is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i)4416 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i) {
4417 static std::set<int> ignore = {};
4418 return ignore.find(i) != ignore.end();
4419 }
4420
CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model * model)4421 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model *model) {
4422 OperandType type0(Type::BOOL, {});
4423 OperandType type4(Type::INT32, {});
4424 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
4425 OperandType type42(Type::TENSOR_INT32, {4}, 0.25f, 0);
4426 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
4427 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
4428 // Phase 1, operands
4429 auto op11 = model->addOperand(&type50);
4430 auto op21 = model->addOperand(&type41);
4431 auto op31 = model->addOperand(&type42);
4432 auto param8 = model->addOperand(&type4);
4433 auto param9 = model->addOperand(&type4);
4434 auto param10 = model->addOperand(&type4);
4435 auto param11 = model->addOperand(&type4);
4436 auto param12 = model->addOperand(&type4);
4437 auto layout = model->addOperand(&type0);
4438 auto op41 = model->addOperand(&type52);
4439 // Phase 2, operations
4440 static int32_t param8_init[] = {2};
4441 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4442 static int32_t param9_init[] = {1};
4443 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4444 static int32_t param10_init[] = {1};
4445 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4446 static int32_t param11_init[] = {2};
4447 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4448 static int32_t param12_init[] = {0};
4449 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4450 static bool8 layout_init[] = {true};
4451 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4452 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4453 // Phase 3, inputs and outputs
4454 model->identifyInputsAndOutputs(
4455 {op11, op21, op31},
4456 {op41});
4457 assert(model->isValid());
4458 }
4459
is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i)4460 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i) {
4461 static std::set<int> ignore = {};
4462 return ignore.find(i) != ignore.end();
4463 }
4464
CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8_3(Model * model)4465 void CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8_3(Model *model) {
4466 OperandType type0(Type::BOOL, {});
4467 OperandType type4(Type::INT32, {});
4468 OperandType type44(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.25f, 0.5f, 0.25f},3));
4469 OperandType type45(Type::TENSOR_INT32, {4}, 0.0f, 0);
4470 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 2}, 0.5f, 128);
4471 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 100);
4472 // Phase 1, operands
4473 auto op11 = model->addOperand(&type50);
4474 auto op21 = model->addOperand(&type44);
4475 auto op31 = model->addOperand(&type45);
4476 auto param8 = model->addOperand(&type4);
4477 auto param9 = model->addOperand(&type4);
4478 auto param10 = model->addOperand(&type4);
4479 auto param11 = model->addOperand(&type4);
4480 auto param12 = model->addOperand(&type4);
4481 auto layout = model->addOperand(&type0);
4482 auto op41 = model->addOperand(&type52);
4483 // Phase 2, operations
4484 static int32_t param8_init[] = {2};
4485 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1);
4486 static int32_t param9_init[] = {1};
4487 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1);
4488 static int32_t param10_init[] = {1};
4489 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1);
4490 static int32_t param11_init[] = {2};
4491 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1);
4492 static int32_t param12_init[] = {0};
4493 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1);
4494 static bool8 layout_init[] = {true};
4495 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4496 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op11, op21, op31, param8, param9, param10, param11, param12, layout}, {op41});
4497 // Phase 3, inputs and outputs
4498 model->identifyInputsAndOutputs(
4499 {op11, op21, op31},
4500 {op41});
4501 assert(model->isValid());
4502 }
4503
is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8_3(int i)4504 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8_3(int i) {
4505 static std::set<int> ignore = {};
4506 return ignore.find(i) != ignore.end();
4507 }
4508
CreateModel_large_nhwc(Model * model)4509 void CreateModel_large_nhwc(Model *model) {
4510 OperandType type0(Type::BOOL, {});
4511 OperandType type4(Type::INT32, {});
4512 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
4513 OperandType type8(Type::TENSOR_FLOAT32, {2});
4514 OperandType type9(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
4515 // Phase 1, operands
4516 auto op12 = model->addOperand(&type7);
4517 auto op22 = model->addOperand(&type7);
4518 auto op32 = model->addOperand(&type8);
4519 auto param13 = model->addOperand(&type4);
4520 auto param14 = model->addOperand(&type4);
4521 auto param15 = model->addOperand(&type4);
4522 auto param16 = model->addOperand(&type4);
4523 auto param17 = model->addOperand(&type4);
4524 auto param18 = model->addOperand(&type4);
4525 auto param19 = model->addOperand(&type4);
4526 auto param20 = model->addOperand(&type4);
4527 auto layout = model->addOperand(&type0);
4528 auto op42 = model->addOperand(&type9);
4529 // Phase 2, operations
4530 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
4531 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
4532 static float op32_init[] = {100.0f, 200.0f};
4533 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
4534 static int32_t param13_init[] = {0};
4535 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4536 static int32_t param14_init[] = {0};
4537 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4538 static int32_t param15_init[] = {0};
4539 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4540 static int32_t param16_init[] = {0};
4541 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4542 static int32_t param17_init[] = {1};
4543 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4544 static int32_t param18_init[] = {1};
4545 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4546 static int32_t param19_init[] = {1};
4547 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4548 static int32_t param20_init[] = {0};
4549 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4550 static bool8 layout_init[] = {false};
4551 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4552 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4553 // Phase 3, inputs and outputs
4554 model->identifyInputsAndOutputs(
4555 {op12},
4556 {op42});
4557 assert(model->isValid());
4558 }
4559
is_ignored_large_nhwc(int i)4560 inline bool is_ignored_large_nhwc(int i) {
4561 static std::set<int> ignore = {};
4562 return ignore.find(i) != ignore.end();
4563 }
4564
CreateModel_large_nhwc_relaxed(Model * model)4565 void CreateModel_large_nhwc_relaxed(Model *model) {
4566 OperandType type0(Type::BOOL, {});
4567 OperandType type4(Type::INT32, {});
4568 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
4569 OperandType type8(Type::TENSOR_FLOAT32, {2});
4570 OperandType type9(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
4571 // Phase 1, operands
4572 auto op12 = model->addOperand(&type7);
4573 auto op22 = model->addOperand(&type7);
4574 auto op32 = model->addOperand(&type8);
4575 auto param13 = model->addOperand(&type4);
4576 auto param14 = model->addOperand(&type4);
4577 auto param15 = model->addOperand(&type4);
4578 auto param16 = model->addOperand(&type4);
4579 auto param17 = model->addOperand(&type4);
4580 auto param18 = model->addOperand(&type4);
4581 auto param19 = model->addOperand(&type4);
4582 auto param20 = model->addOperand(&type4);
4583 auto layout = model->addOperand(&type0);
4584 auto op42 = model->addOperand(&type9);
4585 // Phase 2, operations
4586 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
4587 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
4588 static float op32_init[] = {100.0f, 200.0f};
4589 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
4590 static int32_t param13_init[] = {0};
4591 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4592 static int32_t param14_init[] = {0};
4593 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4594 static int32_t param15_init[] = {0};
4595 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4596 static int32_t param16_init[] = {0};
4597 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4598 static int32_t param17_init[] = {1};
4599 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4600 static int32_t param18_init[] = {1};
4601 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4602 static int32_t param19_init[] = {1};
4603 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4604 static int32_t param20_init[] = {0};
4605 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4606 static bool8 layout_init[] = {false};
4607 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4608 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4609 // Phase 3, inputs and outputs
4610 model->identifyInputsAndOutputs(
4611 {op12},
4612 {op42});
4613 // Phase 4: set relaxed execution
4614 model->relaxComputationFloat32toFloat16(true);
4615 assert(model->isValid());
4616 }
4617
is_ignored_large_nhwc_relaxed(int i)4618 inline bool is_ignored_large_nhwc_relaxed(int i) {
4619 static std::set<int> ignore = {};
4620 return ignore.find(i) != ignore.end();
4621 }
4622
CreateModel_large_nhwc_float16(Model * model)4623 void CreateModel_large_nhwc_float16(Model *model) {
4624 OperandType type0(Type::BOOL, {});
4625 OperandType type4(Type::INT32, {});
4626 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
4627 OperandType type54(Type::TENSOR_FLOAT16, {2});
4628 OperandType type55(Type::TENSOR_FLOAT16, {1, 1, 1, 2});
4629 // Phase 1, operands
4630 auto op12 = model->addOperand(&type53);
4631 auto op22 = model->addOperand(&type53);
4632 auto op32 = model->addOperand(&type54);
4633 auto param13 = model->addOperand(&type4);
4634 auto param14 = model->addOperand(&type4);
4635 auto param15 = model->addOperand(&type4);
4636 auto param16 = model->addOperand(&type4);
4637 auto param17 = model->addOperand(&type4);
4638 auto param18 = model->addOperand(&type4);
4639 auto param19 = model->addOperand(&type4);
4640 auto param20 = model->addOperand(&type4);
4641 auto layout = model->addOperand(&type0);
4642 auto op42 = model->addOperand(&type55);
4643 // Phase 2, operations
4644 static _Float16 op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
4645 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 8);
4646 static _Float16 op32_init[] = {100.0f, 200.0f};
4647 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 2);
4648 static int32_t param13_init[] = {0};
4649 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4650 static int32_t param14_init[] = {0};
4651 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4652 static int32_t param15_init[] = {0};
4653 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4654 static int32_t param16_init[] = {0};
4655 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4656 static int32_t param17_init[] = {1};
4657 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4658 static int32_t param18_init[] = {1};
4659 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4660 static int32_t param19_init[] = {1};
4661 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4662 static int32_t param20_init[] = {0};
4663 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4664 static bool8 layout_init[] = {false};
4665 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4666 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4667 // Phase 3, inputs and outputs
4668 model->identifyInputsAndOutputs(
4669 {op12},
4670 {op42});
4671 assert(model->isValid());
4672 }
4673
is_ignored_large_nhwc_float16(int i)4674 inline bool is_ignored_large_nhwc_float16(int i) {
4675 static std::set<int> ignore = {};
4676 return ignore.find(i) != ignore.end();
4677 }
4678
CreateModel_large_nhwc_quant8(Model * model)4679 void CreateModel_large_nhwc_quant8(Model *model) {
4680 OperandType type0(Type::BOOL, {});
4681 OperandType type4(Type::INT32, {});
4682 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
4683 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
4684 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
4685 OperandType type59(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 128);
4686 // Phase 1, operands
4687 auto op12 = model->addOperand(&type56);
4688 auto op22 = model->addOperand(&type57);
4689 auto op32 = model->addOperand(&type58);
4690 auto param13 = model->addOperand(&type4);
4691 auto param14 = model->addOperand(&type4);
4692 auto param15 = model->addOperand(&type4);
4693 auto param16 = model->addOperand(&type4);
4694 auto param17 = model->addOperand(&type4);
4695 auto param18 = model->addOperand(&type4);
4696 auto param19 = model->addOperand(&type4);
4697 auto param20 = model->addOperand(&type4);
4698 auto layout = model->addOperand(&type0);
4699 auto op42 = model->addOperand(&type59);
4700 // Phase 2, operations
4701 static uint8_t op22_init[] = {130, 128, 130, 136, 130, 128, 130, 136};
4702 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 8);
4703 static int32_t op32_init[] = {1600, 3200};
4704 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
4705 static int32_t param13_init[] = {0};
4706 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4707 static int32_t param14_init[] = {0};
4708 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4709 static int32_t param15_init[] = {0};
4710 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4711 static int32_t param16_init[] = {0};
4712 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4713 static int32_t param17_init[] = {1};
4714 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4715 static int32_t param18_init[] = {1};
4716 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4717 static int32_t param19_init[] = {1};
4718 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4719 static int32_t param20_init[] = {0};
4720 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4721 static bool8 layout_init[] = {false};
4722 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4723 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4724 // Phase 3, inputs and outputs
4725 model->identifyInputsAndOutputs(
4726 {op12},
4727 {op42});
4728 assert(model->isValid());
4729 }
4730
is_ignored_large_nhwc_quant8(int i)4731 inline bool is_ignored_large_nhwc_quant8(int i) {
4732 static std::set<int> ignore = {};
4733 return ignore.find(i) != ignore.end();
4734 }
4735
CreateModel_large_nhwc_channelQuant8(Model * model)4736 void CreateModel_large_nhwc_channelQuant8(Model *model) {
4737 OperandType type0(Type::BOOL, {});
4738 OperandType type4(Type::INT32, {});
4739 OperandType type59(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 128);
4740 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
4741 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
4742 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
4743 // Phase 1, operands
4744 auto op12 = model->addOperand(&type60);
4745 auto op22 = model->addOperand(&type61);
4746 auto op32 = model->addOperand(&type62);
4747 auto param13 = model->addOperand(&type4);
4748 auto param14 = model->addOperand(&type4);
4749 auto param15 = model->addOperand(&type4);
4750 auto param16 = model->addOperand(&type4);
4751 auto param17 = model->addOperand(&type4);
4752 auto param18 = model->addOperand(&type4);
4753 auto param19 = model->addOperand(&type4);
4754 auto param20 = model->addOperand(&type4);
4755 auto layout = model->addOperand(&type0);
4756 auto op42 = model->addOperand(&type59);
4757 // Phase 2, operations
4758 static int8_t op22_init[] = {2, 0, 2, 4, 2, 0, 2, 4};
4759 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 8);
4760 static int32_t op32_init[] = {1600, 1600};
4761 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
4762 static int32_t param13_init[] = {0};
4763 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4764 static int32_t param14_init[] = {0};
4765 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4766 static int32_t param15_init[] = {0};
4767 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4768 static int32_t param16_init[] = {0};
4769 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4770 static int32_t param17_init[] = {1};
4771 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4772 static int32_t param18_init[] = {1};
4773 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4774 static int32_t param19_init[] = {1};
4775 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4776 static int32_t param20_init[] = {0};
4777 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4778 static bool8 layout_init[] = {false};
4779 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4780 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4781 // Phase 3, inputs and outputs
4782 model->identifyInputsAndOutputs(
4783 {op12},
4784 {op42});
4785 assert(model->isValid());
4786 }
4787
is_ignored_large_nhwc_channelQuant8(int i)4788 inline bool is_ignored_large_nhwc_channelQuant8(int i) {
4789 static std::set<int> ignore = {};
4790 return ignore.find(i) != ignore.end();
4791 }
4792
CreateModel_large_nhwc_weight_as_input(Model * model)4793 void CreateModel_large_nhwc_weight_as_input(Model *model) {
4794 OperandType type0(Type::BOOL, {});
4795 OperandType type4(Type::INT32, {});
4796 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
4797 OperandType type8(Type::TENSOR_FLOAT32, {2});
4798 OperandType type9(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
4799 // Phase 1, operands
4800 auto op12 = model->addOperand(&type7);
4801 auto op22 = model->addOperand(&type7);
4802 auto op32 = model->addOperand(&type8);
4803 auto param13 = model->addOperand(&type4);
4804 auto param14 = model->addOperand(&type4);
4805 auto param15 = model->addOperand(&type4);
4806 auto param16 = model->addOperand(&type4);
4807 auto param17 = model->addOperand(&type4);
4808 auto param18 = model->addOperand(&type4);
4809 auto param19 = model->addOperand(&type4);
4810 auto param20 = model->addOperand(&type4);
4811 auto layout = model->addOperand(&type0);
4812 auto op42 = model->addOperand(&type9);
4813 // Phase 2, operations
4814 static int32_t param13_init[] = {0};
4815 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4816 static int32_t param14_init[] = {0};
4817 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4818 static int32_t param15_init[] = {0};
4819 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4820 static int32_t param16_init[] = {0};
4821 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4822 static int32_t param17_init[] = {1};
4823 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4824 static int32_t param18_init[] = {1};
4825 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4826 static int32_t param19_init[] = {1};
4827 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4828 static int32_t param20_init[] = {0};
4829 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4830 static bool8 layout_init[] = {false};
4831 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4832 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4833 // Phase 3, inputs and outputs
4834 model->identifyInputsAndOutputs(
4835 {op12, op22, op32},
4836 {op42});
4837 assert(model->isValid());
4838 }
4839
is_ignored_large_nhwc_weight_as_input(int i)4840 inline bool is_ignored_large_nhwc_weight_as_input(int i) {
4841 static std::set<int> ignore = {};
4842 return ignore.find(i) != ignore.end();
4843 }
4844
CreateModel_large_nhwc_weight_as_input_relaxed(Model * model)4845 void CreateModel_large_nhwc_weight_as_input_relaxed(Model *model) {
4846 OperandType type0(Type::BOOL, {});
4847 OperandType type4(Type::INT32, {});
4848 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
4849 OperandType type8(Type::TENSOR_FLOAT32, {2});
4850 OperandType type9(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
4851 // Phase 1, operands
4852 auto op12 = model->addOperand(&type7);
4853 auto op22 = model->addOperand(&type7);
4854 auto op32 = model->addOperand(&type8);
4855 auto param13 = model->addOperand(&type4);
4856 auto param14 = model->addOperand(&type4);
4857 auto param15 = model->addOperand(&type4);
4858 auto param16 = model->addOperand(&type4);
4859 auto param17 = model->addOperand(&type4);
4860 auto param18 = model->addOperand(&type4);
4861 auto param19 = model->addOperand(&type4);
4862 auto param20 = model->addOperand(&type4);
4863 auto layout = model->addOperand(&type0);
4864 auto op42 = model->addOperand(&type9);
4865 // Phase 2, operations
4866 static int32_t param13_init[] = {0};
4867 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4868 static int32_t param14_init[] = {0};
4869 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4870 static int32_t param15_init[] = {0};
4871 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4872 static int32_t param16_init[] = {0};
4873 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4874 static int32_t param17_init[] = {1};
4875 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4876 static int32_t param18_init[] = {1};
4877 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4878 static int32_t param19_init[] = {1};
4879 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4880 static int32_t param20_init[] = {0};
4881 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4882 static bool8 layout_init[] = {false};
4883 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4884 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4885 // Phase 3, inputs and outputs
4886 model->identifyInputsAndOutputs(
4887 {op12, op22, op32},
4888 {op42});
4889 // Phase 4: set relaxed execution
4890 model->relaxComputationFloat32toFloat16(true);
4891 assert(model->isValid());
4892 }
4893
is_ignored_large_nhwc_weight_as_input_relaxed(int i)4894 inline bool is_ignored_large_nhwc_weight_as_input_relaxed(int i) {
4895 static std::set<int> ignore = {};
4896 return ignore.find(i) != ignore.end();
4897 }
4898
CreateModel_large_nhwc_weight_as_input_float16(Model * model)4899 void CreateModel_large_nhwc_weight_as_input_float16(Model *model) {
4900 OperandType type0(Type::BOOL, {});
4901 OperandType type4(Type::INT32, {});
4902 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
4903 OperandType type54(Type::TENSOR_FLOAT16, {2});
4904 OperandType type55(Type::TENSOR_FLOAT16, {1, 1, 1, 2});
4905 // Phase 1, operands
4906 auto op12 = model->addOperand(&type53);
4907 auto op22 = model->addOperand(&type53);
4908 auto op32 = model->addOperand(&type54);
4909 auto param13 = model->addOperand(&type4);
4910 auto param14 = model->addOperand(&type4);
4911 auto param15 = model->addOperand(&type4);
4912 auto param16 = model->addOperand(&type4);
4913 auto param17 = model->addOperand(&type4);
4914 auto param18 = model->addOperand(&type4);
4915 auto param19 = model->addOperand(&type4);
4916 auto param20 = model->addOperand(&type4);
4917 auto layout = model->addOperand(&type0);
4918 auto op42 = model->addOperand(&type55);
4919 // Phase 2, operations
4920 static int32_t param13_init[] = {0};
4921 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4922 static int32_t param14_init[] = {0};
4923 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4924 static int32_t param15_init[] = {0};
4925 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4926 static int32_t param16_init[] = {0};
4927 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4928 static int32_t param17_init[] = {1};
4929 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4930 static int32_t param18_init[] = {1};
4931 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4932 static int32_t param19_init[] = {1};
4933 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4934 static int32_t param20_init[] = {0};
4935 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4936 static bool8 layout_init[] = {false};
4937 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4938 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4939 // Phase 3, inputs and outputs
4940 model->identifyInputsAndOutputs(
4941 {op12, op22, op32},
4942 {op42});
4943 assert(model->isValid());
4944 }
4945
is_ignored_large_nhwc_weight_as_input_float16(int i)4946 inline bool is_ignored_large_nhwc_weight_as_input_float16(int i) {
4947 static std::set<int> ignore = {};
4948 return ignore.find(i) != ignore.end();
4949 }
4950
CreateModel_large_nhwc_weight_as_input_quant8(Model * model)4951 void CreateModel_large_nhwc_weight_as_input_quant8(Model *model) {
4952 OperandType type0(Type::BOOL, {});
4953 OperandType type4(Type::INT32, {});
4954 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
4955 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
4956 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
4957 OperandType type59(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 128);
4958 // Phase 1, operands
4959 auto op12 = model->addOperand(&type56);
4960 auto op22 = model->addOperand(&type57);
4961 auto op32 = model->addOperand(&type58);
4962 auto param13 = model->addOperand(&type4);
4963 auto param14 = model->addOperand(&type4);
4964 auto param15 = model->addOperand(&type4);
4965 auto param16 = model->addOperand(&type4);
4966 auto param17 = model->addOperand(&type4);
4967 auto param18 = model->addOperand(&type4);
4968 auto param19 = model->addOperand(&type4);
4969 auto param20 = model->addOperand(&type4);
4970 auto layout = model->addOperand(&type0);
4971 auto op42 = model->addOperand(&type59);
4972 // Phase 2, operations
4973 static int32_t param13_init[] = {0};
4974 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
4975 static int32_t param14_init[] = {0};
4976 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
4977 static int32_t param15_init[] = {0};
4978 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
4979 static int32_t param16_init[] = {0};
4980 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
4981 static int32_t param17_init[] = {1};
4982 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
4983 static int32_t param18_init[] = {1};
4984 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
4985 static int32_t param19_init[] = {1};
4986 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
4987 static int32_t param20_init[] = {0};
4988 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
4989 static bool8 layout_init[] = {false};
4990 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
4991 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
4992 // Phase 3, inputs and outputs
4993 model->identifyInputsAndOutputs(
4994 {op12, op22, op32},
4995 {op42});
4996 assert(model->isValid());
4997 }
4998
is_ignored_large_nhwc_weight_as_input_quant8(int i)4999 inline bool is_ignored_large_nhwc_weight_as_input_quant8(int i) {
5000 static std::set<int> ignore = {};
5001 return ignore.find(i) != ignore.end();
5002 }
5003
CreateModel_large_nhwc_weight_as_input_channelQuant8(Model * model)5004 void CreateModel_large_nhwc_weight_as_input_channelQuant8(Model *model) {
5005 OperandType type0(Type::BOOL, {});
5006 OperandType type4(Type::INT32, {});
5007 OperandType type59(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 128);
5008 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
5009 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
5010 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
5011 // Phase 1, operands
5012 auto op12 = model->addOperand(&type60);
5013 auto op22 = model->addOperand(&type61);
5014 auto op32 = model->addOperand(&type62);
5015 auto param13 = model->addOperand(&type4);
5016 auto param14 = model->addOperand(&type4);
5017 auto param15 = model->addOperand(&type4);
5018 auto param16 = model->addOperand(&type4);
5019 auto param17 = model->addOperand(&type4);
5020 auto param18 = model->addOperand(&type4);
5021 auto param19 = model->addOperand(&type4);
5022 auto param20 = model->addOperand(&type4);
5023 auto layout = model->addOperand(&type0);
5024 auto op42 = model->addOperand(&type59);
5025 // Phase 2, operations
5026 static int32_t param13_init[] = {0};
5027 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5028 static int32_t param14_init[] = {0};
5029 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5030 static int32_t param15_init[] = {0};
5031 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5032 static int32_t param16_init[] = {0};
5033 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5034 static int32_t param17_init[] = {1};
5035 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5036 static int32_t param18_init[] = {1};
5037 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5038 static int32_t param19_init[] = {1};
5039 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5040 static int32_t param20_init[] = {0};
5041 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5042 static bool8 layout_init[] = {false};
5043 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5044 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5045 // Phase 3, inputs and outputs
5046 model->identifyInputsAndOutputs(
5047 {op12, op22, op32},
5048 {op42});
5049 assert(model->isValid());
5050 }
5051
is_ignored_large_nhwc_weight_as_input_channelQuant8(int i)5052 inline bool is_ignored_large_nhwc_weight_as_input_channelQuant8(int i) {
5053 static std::set<int> ignore = {};
5054 return ignore.find(i) != ignore.end();
5055 }
5056
CreateModel_large_nchw(Model * model)5057 void CreateModel_large_nchw(Model *model) {
5058 OperandType type0(Type::BOOL, {});
5059 OperandType type4(Type::INT32, {});
5060 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 1, 1});
5061 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5062 OperandType type8(Type::TENSOR_FLOAT32, {2});
5063 // Phase 1, operands
5064 auto op12 = model->addOperand(&type7);
5065 auto op22 = model->addOperand(&type7);
5066 auto op32 = model->addOperand(&type8);
5067 auto param13 = model->addOperand(&type4);
5068 auto param14 = model->addOperand(&type4);
5069 auto param15 = model->addOperand(&type4);
5070 auto param16 = model->addOperand(&type4);
5071 auto param17 = model->addOperand(&type4);
5072 auto param18 = model->addOperand(&type4);
5073 auto param19 = model->addOperand(&type4);
5074 auto param20 = model->addOperand(&type4);
5075 auto layout = model->addOperand(&type0);
5076 auto op42 = model->addOperand(&type63);
5077 // Phase 2, operations
5078 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5079 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
5080 static float op32_init[] = {100.0f, 200.0f};
5081 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
5082 static int32_t param13_init[] = {0};
5083 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5084 static int32_t param14_init[] = {0};
5085 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5086 static int32_t param15_init[] = {0};
5087 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5088 static int32_t param16_init[] = {0};
5089 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5090 static int32_t param17_init[] = {1};
5091 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5092 static int32_t param18_init[] = {1};
5093 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5094 static int32_t param19_init[] = {1};
5095 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5096 static int32_t param20_init[] = {0};
5097 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5098 static bool8 layout_init[] = {true};
5099 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5100 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5101 // Phase 3, inputs and outputs
5102 model->identifyInputsAndOutputs(
5103 {op12},
5104 {op42});
5105 assert(model->isValid());
5106 }
5107
is_ignored_large_nchw(int i)5108 inline bool is_ignored_large_nchw(int i) {
5109 static std::set<int> ignore = {};
5110 return ignore.find(i) != ignore.end();
5111 }
5112
CreateModel_large_nchw_relaxed(Model * model)5113 void CreateModel_large_nchw_relaxed(Model *model) {
5114 OperandType type0(Type::BOOL, {});
5115 OperandType type4(Type::INT32, {});
5116 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 1, 1});
5117 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5118 OperandType type8(Type::TENSOR_FLOAT32, {2});
5119 // Phase 1, operands
5120 auto op12 = model->addOperand(&type7);
5121 auto op22 = model->addOperand(&type7);
5122 auto op32 = model->addOperand(&type8);
5123 auto param13 = model->addOperand(&type4);
5124 auto param14 = model->addOperand(&type4);
5125 auto param15 = model->addOperand(&type4);
5126 auto param16 = model->addOperand(&type4);
5127 auto param17 = model->addOperand(&type4);
5128 auto param18 = model->addOperand(&type4);
5129 auto param19 = model->addOperand(&type4);
5130 auto param20 = model->addOperand(&type4);
5131 auto layout = model->addOperand(&type0);
5132 auto op42 = model->addOperand(&type63);
5133 // Phase 2, operations
5134 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5135 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
5136 static float op32_init[] = {100.0f, 200.0f};
5137 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
5138 static int32_t param13_init[] = {0};
5139 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5140 static int32_t param14_init[] = {0};
5141 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5142 static int32_t param15_init[] = {0};
5143 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5144 static int32_t param16_init[] = {0};
5145 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5146 static int32_t param17_init[] = {1};
5147 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5148 static int32_t param18_init[] = {1};
5149 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5150 static int32_t param19_init[] = {1};
5151 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5152 static int32_t param20_init[] = {0};
5153 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5154 static bool8 layout_init[] = {true};
5155 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5156 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5157 // Phase 3, inputs and outputs
5158 model->identifyInputsAndOutputs(
5159 {op12},
5160 {op42});
5161 // Phase 4: set relaxed execution
5162 model->relaxComputationFloat32toFloat16(true);
5163 assert(model->isValid());
5164 }
5165
is_ignored_large_nchw_relaxed(int i)5166 inline bool is_ignored_large_nchw_relaxed(int i) {
5167 static std::set<int> ignore = {};
5168 return ignore.find(i) != ignore.end();
5169 }
5170
CreateModel_large_nchw_float16(Model * model)5171 void CreateModel_large_nchw_float16(Model *model) {
5172 OperandType type0(Type::BOOL, {});
5173 OperandType type4(Type::INT32, {});
5174 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
5175 OperandType type54(Type::TENSOR_FLOAT16, {2});
5176 OperandType type64(Type::TENSOR_FLOAT16, {1, 2, 1, 1});
5177 // Phase 1, operands
5178 auto op12 = model->addOperand(&type53);
5179 auto op22 = model->addOperand(&type53);
5180 auto op32 = model->addOperand(&type54);
5181 auto param13 = model->addOperand(&type4);
5182 auto param14 = model->addOperand(&type4);
5183 auto param15 = model->addOperand(&type4);
5184 auto param16 = model->addOperand(&type4);
5185 auto param17 = model->addOperand(&type4);
5186 auto param18 = model->addOperand(&type4);
5187 auto param19 = model->addOperand(&type4);
5188 auto param20 = model->addOperand(&type4);
5189 auto layout = model->addOperand(&type0);
5190 auto op42 = model->addOperand(&type64);
5191 // Phase 2, operations
5192 static _Float16 op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5193 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 8);
5194 static _Float16 op32_init[] = {100.0f, 200.0f};
5195 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 2);
5196 static int32_t param13_init[] = {0};
5197 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5198 static int32_t param14_init[] = {0};
5199 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5200 static int32_t param15_init[] = {0};
5201 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5202 static int32_t param16_init[] = {0};
5203 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5204 static int32_t param17_init[] = {1};
5205 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5206 static int32_t param18_init[] = {1};
5207 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5208 static int32_t param19_init[] = {1};
5209 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5210 static int32_t param20_init[] = {0};
5211 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5212 static bool8 layout_init[] = {true};
5213 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5214 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5215 // Phase 3, inputs and outputs
5216 model->identifyInputsAndOutputs(
5217 {op12},
5218 {op42});
5219 assert(model->isValid());
5220 }
5221
is_ignored_large_nchw_float16(int i)5222 inline bool is_ignored_large_nchw_float16(int i) {
5223 static std::set<int> ignore = {};
5224 return ignore.find(i) != ignore.end();
5225 }
5226
CreateModel_large_nchw_quant8(Model * model)5227 void CreateModel_large_nchw_quant8(Model *model) {
5228 OperandType type0(Type::BOOL, {});
5229 OperandType type4(Type::INT32, {});
5230 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
5231 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
5232 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
5233 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 1}, 2.0f, 128);
5234 // Phase 1, operands
5235 auto op12 = model->addOperand(&type56);
5236 auto op22 = model->addOperand(&type57);
5237 auto op32 = model->addOperand(&type58);
5238 auto param13 = model->addOperand(&type4);
5239 auto param14 = model->addOperand(&type4);
5240 auto param15 = model->addOperand(&type4);
5241 auto param16 = model->addOperand(&type4);
5242 auto param17 = model->addOperand(&type4);
5243 auto param18 = model->addOperand(&type4);
5244 auto param19 = model->addOperand(&type4);
5245 auto param20 = model->addOperand(&type4);
5246 auto layout = model->addOperand(&type0);
5247 auto op42 = model->addOperand(&type65);
5248 // Phase 2, operations
5249 static uint8_t op22_init[] = {130, 128, 130, 136, 130, 128, 130, 136};
5250 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 8);
5251 static int32_t op32_init[] = {1600, 3200};
5252 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
5253 static int32_t param13_init[] = {0};
5254 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5255 static int32_t param14_init[] = {0};
5256 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5257 static int32_t param15_init[] = {0};
5258 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5259 static int32_t param16_init[] = {0};
5260 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5261 static int32_t param17_init[] = {1};
5262 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5263 static int32_t param18_init[] = {1};
5264 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5265 static int32_t param19_init[] = {1};
5266 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5267 static int32_t param20_init[] = {0};
5268 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5269 static bool8 layout_init[] = {true};
5270 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5271 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5272 // Phase 3, inputs and outputs
5273 model->identifyInputsAndOutputs(
5274 {op12},
5275 {op42});
5276 assert(model->isValid());
5277 }
5278
is_ignored_large_nchw_quant8(int i)5279 inline bool is_ignored_large_nchw_quant8(int i) {
5280 static std::set<int> ignore = {};
5281 return ignore.find(i) != ignore.end();
5282 }
5283
CreateModel_large_nchw_channelQuant8(Model * model)5284 void CreateModel_large_nchw_channelQuant8(Model *model) {
5285 OperandType type0(Type::BOOL, {});
5286 OperandType type4(Type::INT32, {});
5287 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
5288 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
5289 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
5290 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 1}, 2.0f, 128);
5291 // Phase 1, operands
5292 auto op12 = model->addOperand(&type60);
5293 auto op22 = model->addOperand(&type61);
5294 auto op32 = model->addOperand(&type62);
5295 auto param13 = model->addOperand(&type4);
5296 auto param14 = model->addOperand(&type4);
5297 auto param15 = model->addOperand(&type4);
5298 auto param16 = model->addOperand(&type4);
5299 auto param17 = model->addOperand(&type4);
5300 auto param18 = model->addOperand(&type4);
5301 auto param19 = model->addOperand(&type4);
5302 auto param20 = model->addOperand(&type4);
5303 auto layout = model->addOperand(&type0);
5304 auto op42 = model->addOperand(&type65);
5305 // Phase 2, operations
5306 static int8_t op22_init[] = {2, 0, 2, 4, 2, 0, 2, 4};
5307 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 8);
5308 static int32_t op32_init[] = {1600, 1600};
5309 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
5310 static int32_t param13_init[] = {0};
5311 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5312 static int32_t param14_init[] = {0};
5313 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5314 static int32_t param15_init[] = {0};
5315 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5316 static int32_t param16_init[] = {0};
5317 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5318 static int32_t param17_init[] = {1};
5319 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5320 static int32_t param18_init[] = {1};
5321 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5322 static int32_t param19_init[] = {1};
5323 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5324 static int32_t param20_init[] = {0};
5325 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5326 static bool8 layout_init[] = {true};
5327 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5328 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5329 // Phase 3, inputs and outputs
5330 model->identifyInputsAndOutputs(
5331 {op12},
5332 {op42});
5333 assert(model->isValid());
5334 }
5335
is_ignored_large_nchw_channelQuant8(int i)5336 inline bool is_ignored_large_nchw_channelQuant8(int i) {
5337 static std::set<int> ignore = {};
5338 return ignore.find(i) != ignore.end();
5339 }
5340
CreateModel_large_nchw_weight_as_input(Model * model)5341 void CreateModel_large_nchw_weight_as_input(Model *model) {
5342 OperandType type0(Type::BOOL, {});
5343 OperandType type4(Type::INT32, {});
5344 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 1, 1});
5345 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5346 OperandType type8(Type::TENSOR_FLOAT32, {2});
5347 // Phase 1, operands
5348 auto op12 = model->addOperand(&type7);
5349 auto op22 = model->addOperand(&type7);
5350 auto op32 = model->addOperand(&type8);
5351 auto param13 = model->addOperand(&type4);
5352 auto param14 = model->addOperand(&type4);
5353 auto param15 = model->addOperand(&type4);
5354 auto param16 = model->addOperand(&type4);
5355 auto param17 = model->addOperand(&type4);
5356 auto param18 = model->addOperand(&type4);
5357 auto param19 = model->addOperand(&type4);
5358 auto param20 = model->addOperand(&type4);
5359 auto layout = model->addOperand(&type0);
5360 auto op42 = model->addOperand(&type63);
5361 // Phase 2, operations
5362 static int32_t param13_init[] = {0};
5363 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5364 static int32_t param14_init[] = {0};
5365 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5366 static int32_t param15_init[] = {0};
5367 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5368 static int32_t param16_init[] = {0};
5369 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5370 static int32_t param17_init[] = {1};
5371 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5372 static int32_t param18_init[] = {1};
5373 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5374 static int32_t param19_init[] = {1};
5375 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5376 static int32_t param20_init[] = {0};
5377 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5378 static bool8 layout_init[] = {true};
5379 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5380 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5381 // Phase 3, inputs and outputs
5382 model->identifyInputsAndOutputs(
5383 {op12, op22, op32},
5384 {op42});
5385 assert(model->isValid());
5386 }
5387
is_ignored_large_nchw_weight_as_input(int i)5388 inline bool is_ignored_large_nchw_weight_as_input(int i) {
5389 static std::set<int> ignore = {};
5390 return ignore.find(i) != ignore.end();
5391 }
5392
CreateModel_large_nchw_weight_as_input_relaxed(Model * model)5393 void CreateModel_large_nchw_weight_as_input_relaxed(Model *model) {
5394 OperandType type0(Type::BOOL, {});
5395 OperandType type4(Type::INT32, {});
5396 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 1, 1});
5397 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5398 OperandType type8(Type::TENSOR_FLOAT32, {2});
5399 // Phase 1, operands
5400 auto op12 = model->addOperand(&type7);
5401 auto op22 = model->addOperand(&type7);
5402 auto op32 = model->addOperand(&type8);
5403 auto param13 = model->addOperand(&type4);
5404 auto param14 = model->addOperand(&type4);
5405 auto param15 = model->addOperand(&type4);
5406 auto param16 = model->addOperand(&type4);
5407 auto param17 = model->addOperand(&type4);
5408 auto param18 = model->addOperand(&type4);
5409 auto param19 = model->addOperand(&type4);
5410 auto param20 = model->addOperand(&type4);
5411 auto layout = model->addOperand(&type0);
5412 auto op42 = model->addOperand(&type63);
5413 // Phase 2, operations
5414 static int32_t param13_init[] = {0};
5415 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5416 static int32_t param14_init[] = {0};
5417 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5418 static int32_t param15_init[] = {0};
5419 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5420 static int32_t param16_init[] = {0};
5421 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5422 static int32_t param17_init[] = {1};
5423 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5424 static int32_t param18_init[] = {1};
5425 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5426 static int32_t param19_init[] = {1};
5427 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5428 static int32_t param20_init[] = {0};
5429 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5430 static bool8 layout_init[] = {true};
5431 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5432 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5433 // Phase 3, inputs and outputs
5434 model->identifyInputsAndOutputs(
5435 {op12, op22, op32},
5436 {op42});
5437 // Phase 4: set relaxed execution
5438 model->relaxComputationFloat32toFloat16(true);
5439 assert(model->isValid());
5440 }
5441
is_ignored_large_nchw_weight_as_input_relaxed(int i)5442 inline bool is_ignored_large_nchw_weight_as_input_relaxed(int i) {
5443 static std::set<int> ignore = {};
5444 return ignore.find(i) != ignore.end();
5445 }
5446
CreateModel_large_nchw_weight_as_input_float16(Model * model)5447 void CreateModel_large_nchw_weight_as_input_float16(Model *model) {
5448 OperandType type0(Type::BOOL, {});
5449 OperandType type4(Type::INT32, {});
5450 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
5451 OperandType type54(Type::TENSOR_FLOAT16, {2});
5452 OperandType type64(Type::TENSOR_FLOAT16, {1, 2, 1, 1});
5453 // Phase 1, operands
5454 auto op12 = model->addOperand(&type53);
5455 auto op22 = model->addOperand(&type53);
5456 auto op32 = model->addOperand(&type54);
5457 auto param13 = model->addOperand(&type4);
5458 auto param14 = model->addOperand(&type4);
5459 auto param15 = model->addOperand(&type4);
5460 auto param16 = model->addOperand(&type4);
5461 auto param17 = model->addOperand(&type4);
5462 auto param18 = model->addOperand(&type4);
5463 auto param19 = model->addOperand(&type4);
5464 auto param20 = model->addOperand(&type4);
5465 auto layout = model->addOperand(&type0);
5466 auto op42 = model->addOperand(&type64);
5467 // Phase 2, operations
5468 static int32_t param13_init[] = {0};
5469 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5470 static int32_t param14_init[] = {0};
5471 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5472 static int32_t param15_init[] = {0};
5473 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5474 static int32_t param16_init[] = {0};
5475 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5476 static int32_t param17_init[] = {1};
5477 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5478 static int32_t param18_init[] = {1};
5479 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5480 static int32_t param19_init[] = {1};
5481 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5482 static int32_t param20_init[] = {0};
5483 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5484 static bool8 layout_init[] = {true};
5485 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5486 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5487 // Phase 3, inputs and outputs
5488 model->identifyInputsAndOutputs(
5489 {op12, op22, op32},
5490 {op42});
5491 assert(model->isValid());
5492 }
5493
is_ignored_large_nchw_weight_as_input_float16(int i)5494 inline bool is_ignored_large_nchw_weight_as_input_float16(int i) {
5495 static std::set<int> ignore = {};
5496 return ignore.find(i) != ignore.end();
5497 }
5498
CreateModel_large_nchw_weight_as_input_quant8(Model * model)5499 void CreateModel_large_nchw_weight_as_input_quant8(Model *model) {
5500 OperandType type0(Type::BOOL, {});
5501 OperandType type4(Type::INT32, {});
5502 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
5503 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
5504 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
5505 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 1}, 2.0f, 128);
5506 // Phase 1, operands
5507 auto op12 = model->addOperand(&type56);
5508 auto op22 = model->addOperand(&type57);
5509 auto op32 = model->addOperand(&type58);
5510 auto param13 = model->addOperand(&type4);
5511 auto param14 = model->addOperand(&type4);
5512 auto param15 = model->addOperand(&type4);
5513 auto param16 = model->addOperand(&type4);
5514 auto param17 = model->addOperand(&type4);
5515 auto param18 = model->addOperand(&type4);
5516 auto param19 = model->addOperand(&type4);
5517 auto param20 = model->addOperand(&type4);
5518 auto layout = model->addOperand(&type0);
5519 auto op42 = model->addOperand(&type65);
5520 // Phase 2, operations
5521 static int32_t param13_init[] = {0};
5522 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5523 static int32_t param14_init[] = {0};
5524 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5525 static int32_t param15_init[] = {0};
5526 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5527 static int32_t param16_init[] = {0};
5528 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5529 static int32_t param17_init[] = {1};
5530 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5531 static int32_t param18_init[] = {1};
5532 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5533 static int32_t param19_init[] = {1};
5534 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5535 static int32_t param20_init[] = {0};
5536 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5537 static bool8 layout_init[] = {true};
5538 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5539 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5540 // Phase 3, inputs and outputs
5541 model->identifyInputsAndOutputs(
5542 {op12, op22, op32},
5543 {op42});
5544 assert(model->isValid());
5545 }
5546
is_ignored_large_nchw_weight_as_input_quant8(int i)5547 inline bool is_ignored_large_nchw_weight_as_input_quant8(int i) {
5548 static std::set<int> ignore = {};
5549 return ignore.find(i) != ignore.end();
5550 }
5551
CreateModel_large_nchw_weight_as_input_channelQuant8(Model * model)5552 void CreateModel_large_nchw_weight_as_input_channelQuant8(Model *model) {
5553 OperandType type0(Type::BOOL, {});
5554 OperandType type4(Type::INT32, {});
5555 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
5556 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
5557 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
5558 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 1}, 2.0f, 128);
5559 // Phase 1, operands
5560 auto op12 = model->addOperand(&type60);
5561 auto op22 = model->addOperand(&type61);
5562 auto op32 = model->addOperand(&type62);
5563 auto param13 = model->addOperand(&type4);
5564 auto param14 = model->addOperand(&type4);
5565 auto param15 = model->addOperand(&type4);
5566 auto param16 = model->addOperand(&type4);
5567 auto param17 = model->addOperand(&type4);
5568 auto param18 = model->addOperand(&type4);
5569 auto param19 = model->addOperand(&type4);
5570 auto param20 = model->addOperand(&type4);
5571 auto layout = model->addOperand(&type0);
5572 auto op42 = model->addOperand(&type65);
5573 // Phase 2, operations
5574 static int32_t param13_init[] = {0};
5575 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5576 static int32_t param14_init[] = {0};
5577 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5578 static int32_t param15_init[] = {0};
5579 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5580 static int32_t param16_init[] = {0};
5581 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5582 static int32_t param17_init[] = {1};
5583 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5584 static int32_t param18_init[] = {1};
5585 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5586 static int32_t param19_init[] = {1};
5587 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5588 static int32_t param20_init[] = {0};
5589 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5590 static bool8 layout_init[] = {true};
5591 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5592 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5593 // Phase 3, inputs and outputs
5594 model->identifyInputsAndOutputs(
5595 {op12, op22, op32},
5596 {op42});
5597 assert(model->isValid());
5598 }
5599
is_ignored_large_nchw_weight_as_input_channelQuant8(int i)5600 inline bool is_ignored_large_nchw_weight_as_input_channelQuant8(int i) {
5601 static std::set<int> ignore = {};
5602 return ignore.find(i) != ignore.end();
5603 }
5604
CreateModel_large_dynamic_output_shape_nhwc(Model * model)5605 void CreateModel_large_dynamic_output_shape_nhwc(Model *model) {
5606 OperandType type0(Type::BOOL, {});
5607 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5608 OperandType type4(Type::INT32, {});
5609 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5610 OperandType type8(Type::TENSOR_FLOAT32, {2});
5611 // Phase 1, operands
5612 auto op12 = model->addOperand(&type7);
5613 auto op22 = model->addOperand(&type7);
5614 auto op32 = model->addOperand(&type8);
5615 auto param13 = model->addOperand(&type4);
5616 auto param14 = model->addOperand(&type4);
5617 auto param15 = model->addOperand(&type4);
5618 auto param16 = model->addOperand(&type4);
5619 auto param17 = model->addOperand(&type4);
5620 auto param18 = model->addOperand(&type4);
5621 auto param19 = model->addOperand(&type4);
5622 auto param20 = model->addOperand(&type4);
5623 auto layout = model->addOperand(&type0);
5624 auto op42 = model->addOperand(&type34);
5625 // Phase 2, operations
5626 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5627 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
5628 static float op32_init[] = {100.0f, 200.0f};
5629 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
5630 static int32_t param13_init[] = {0};
5631 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5632 static int32_t param14_init[] = {0};
5633 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5634 static int32_t param15_init[] = {0};
5635 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5636 static int32_t param16_init[] = {0};
5637 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5638 static int32_t param17_init[] = {1};
5639 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5640 static int32_t param18_init[] = {1};
5641 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5642 static int32_t param19_init[] = {1};
5643 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5644 static int32_t param20_init[] = {0};
5645 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5646 static bool8 layout_init[] = {false};
5647 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5648 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5649 // Phase 3, inputs and outputs
5650 model->identifyInputsAndOutputs(
5651 {op12},
5652 {op42});
5653 assert(model->isValid());
5654 }
5655
is_ignored_large_dynamic_output_shape_nhwc(int i)5656 inline bool is_ignored_large_dynamic_output_shape_nhwc(int i) {
5657 static std::set<int> ignore = {};
5658 return ignore.find(i) != ignore.end();
5659 }
5660
CreateModel_large_dynamic_output_shape_nhwc_relaxed(Model * model)5661 void CreateModel_large_dynamic_output_shape_nhwc_relaxed(Model *model) {
5662 OperandType type0(Type::BOOL, {});
5663 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5664 OperandType type4(Type::INT32, {});
5665 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5666 OperandType type8(Type::TENSOR_FLOAT32, {2});
5667 // Phase 1, operands
5668 auto op12 = model->addOperand(&type7);
5669 auto op22 = model->addOperand(&type7);
5670 auto op32 = model->addOperand(&type8);
5671 auto param13 = model->addOperand(&type4);
5672 auto param14 = model->addOperand(&type4);
5673 auto param15 = model->addOperand(&type4);
5674 auto param16 = model->addOperand(&type4);
5675 auto param17 = model->addOperand(&type4);
5676 auto param18 = model->addOperand(&type4);
5677 auto param19 = model->addOperand(&type4);
5678 auto param20 = model->addOperand(&type4);
5679 auto layout = model->addOperand(&type0);
5680 auto op42 = model->addOperand(&type34);
5681 // Phase 2, operations
5682 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5683 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
5684 static float op32_init[] = {100.0f, 200.0f};
5685 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
5686 static int32_t param13_init[] = {0};
5687 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5688 static int32_t param14_init[] = {0};
5689 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5690 static int32_t param15_init[] = {0};
5691 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5692 static int32_t param16_init[] = {0};
5693 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5694 static int32_t param17_init[] = {1};
5695 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5696 static int32_t param18_init[] = {1};
5697 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5698 static int32_t param19_init[] = {1};
5699 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5700 static int32_t param20_init[] = {0};
5701 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5702 static bool8 layout_init[] = {false};
5703 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5704 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5705 // Phase 3, inputs and outputs
5706 model->identifyInputsAndOutputs(
5707 {op12},
5708 {op42});
5709 // Phase 4: set relaxed execution
5710 model->relaxComputationFloat32toFloat16(true);
5711 assert(model->isValid());
5712 }
5713
is_ignored_large_dynamic_output_shape_nhwc_relaxed(int i)5714 inline bool is_ignored_large_dynamic_output_shape_nhwc_relaxed(int i) {
5715 static std::set<int> ignore = {};
5716 return ignore.find(i) != ignore.end();
5717 }
5718
CreateModel_large_dynamic_output_shape_nhwc_float16(Model * model)5719 void CreateModel_large_dynamic_output_shape_nhwc_float16(Model *model) {
5720 OperandType type0(Type::BOOL, {});
5721 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5722 OperandType type4(Type::INT32, {});
5723 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
5724 OperandType type54(Type::TENSOR_FLOAT16, {2});
5725 // Phase 1, operands
5726 auto op12 = model->addOperand(&type53);
5727 auto op22 = model->addOperand(&type53);
5728 auto op32 = model->addOperand(&type54);
5729 auto param13 = model->addOperand(&type4);
5730 auto param14 = model->addOperand(&type4);
5731 auto param15 = model->addOperand(&type4);
5732 auto param16 = model->addOperand(&type4);
5733 auto param17 = model->addOperand(&type4);
5734 auto param18 = model->addOperand(&type4);
5735 auto param19 = model->addOperand(&type4);
5736 auto param20 = model->addOperand(&type4);
5737 auto layout = model->addOperand(&type0);
5738 auto op42 = model->addOperand(&type35);
5739 // Phase 2, operations
5740 static _Float16 op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
5741 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 8);
5742 static _Float16 op32_init[] = {100.0f, 200.0f};
5743 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 2);
5744 static int32_t param13_init[] = {0};
5745 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5746 static int32_t param14_init[] = {0};
5747 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5748 static int32_t param15_init[] = {0};
5749 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5750 static int32_t param16_init[] = {0};
5751 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5752 static int32_t param17_init[] = {1};
5753 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5754 static int32_t param18_init[] = {1};
5755 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5756 static int32_t param19_init[] = {1};
5757 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5758 static int32_t param20_init[] = {0};
5759 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5760 static bool8 layout_init[] = {false};
5761 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5762 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5763 // Phase 3, inputs and outputs
5764 model->identifyInputsAndOutputs(
5765 {op12},
5766 {op42});
5767 assert(model->isValid());
5768 }
5769
is_ignored_large_dynamic_output_shape_nhwc_float16(int i)5770 inline bool is_ignored_large_dynamic_output_shape_nhwc_float16(int i) {
5771 static std::set<int> ignore = {};
5772 return ignore.find(i) != ignore.end();
5773 }
5774
CreateModel_large_dynamic_output_shape_nhwc_quant8(Model * model)5775 void CreateModel_large_dynamic_output_shape_nhwc_quant8(Model *model) {
5776 OperandType type0(Type::BOOL, {});
5777 OperandType type4(Type::INT32, {});
5778 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
5779 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
5780 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
5781 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
5782 // Phase 1, operands
5783 auto op12 = model->addOperand(&type56);
5784 auto op22 = model->addOperand(&type57);
5785 auto op32 = model->addOperand(&type58);
5786 auto param13 = model->addOperand(&type4);
5787 auto param14 = model->addOperand(&type4);
5788 auto param15 = model->addOperand(&type4);
5789 auto param16 = model->addOperand(&type4);
5790 auto param17 = model->addOperand(&type4);
5791 auto param18 = model->addOperand(&type4);
5792 auto param19 = model->addOperand(&type4);
5793 auto param20 = model->addOperand(&type4);
5794 auto layout = model->addOperand(&type0);
5795 auto op42 = model->addOperand(&type66);
5796 // Phase 2, operations
5797 static uint8_t op22_init[] = {130, 128, 130, 136, 130, 128, 130, 136};
5798 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 8);
5799 static int32_t op32_init[] = {1600, 3200};
5800 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
5801 static int32_t param13_init[] = {0};
5802 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5803 static int32_t param14_init[] = {0};
5804 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5805 static int32_t param15_init[] = {0};
5806 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5807 static int32_t param16_init[] = {0};
5808 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5809 static int32_t param17_init[] = {1};
5810 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5811 static int32_t param18_init[] = {1};
5812 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5813 static int32_t param19_init[] = {1};
5814 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5815 static int32_t param20_init[] = {0};
5816 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5817 static bool8 layout_init[] = {false};
5818 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5819 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5820 // Phase 3, inputs and outputs
5821 model->identifyInputsAndOutputs(
5822 {op12},
5823 {op42});
5824 assert(model->isValid());
5825 }
5826
is_ignored_large_dynamic_output_shape_nhwc_quant8(int i)5827 inline bool is_ignored_large_dynamic_output_shape_nhwc_quant8(int i) {
5828 static std::set<int> ignore = {};
5829 return ignore.find(i) != ignore.end();
5830 }
5831
CreateModel_large_dynamic_output_shape_nhwc_channelQuant8(Model * model)5832 void CreateModel_large_dynamic_output_shape_nhwc_channelQuant8(Model *model) {
5833 OperandType type0(Type::BOOL, {});
5834 OperandType type4(Type::INT32, {});
5835 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
5836 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
5837 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
5838 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
5839 // Phase 1, operands
5840 auto op12 = model->addOperand(&type60);
5841 auto op22 = model->addOperand(&type61);
5842 auto op32 = model->addOperand(&type62);
5843 auto param13 = model->addOperand(&type4);
5844 auto param14 = model->addOperand(&type4);
5845 auto param15 = model->addOperand(&type4);
5846 auto param16 = model->addOperand(&type4);
5847 auto param17 = model->addOperand(&type4);
5848 auto param18 = model->addOperand(&type4);
5849 auto param19 = model->addOperand(&type4);
5850 auto param20 = model->addOperand(&type4);
5851 auto layout = model->addOperand(&type0);
5852 auto op42 = model->addOperand(&type66);
5853 // Phase 2, operations
5854 static int8_t op22_init[] = {2, 0, 2, 4, 2, 0, 2, 4};
5855 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 8);
5856 static int32_t op32_init[] = {1600, 1600};
5857 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
5858 static int32_t param13_init[] = {0};
5859 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5860 static int32_t param14_init[] = {0};
5861 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5862 static int32_t param15_init[] = {0};
5863 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5864 static int32_t param16_init[] = {0};
5865 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5866 static int32_t param17_init[] = {1};
5867 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5868 static int32_t param18_init[] = {1};
5869 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5870 static int32_t param19_init[] = {1};
5871 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5872 static int32_t param20_init[] = {0};
5873 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5874 static bool8 layout_init[] = {false};
5875 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5876 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5877 // Phase 3, inputs and outputs
5878 model->identifyInputsAndOutputs(
5879 {op12},
5880 {op42});
5881 assert(model->isValid());
5882 }
5883
is_ignored_large_dynamic_output_shape_nhwc_channelQuant8(int i)5884 inline bool is_ignored_large_dynamic_output_shape_nhwc_channelQuant8(int i) {
5885 static std::set<int> ignore = {};
5886 return ignore.find(i) != ignore.end();
5887 }
5888
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input(Model * model)5889 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input(Model *model) {
5890 OperandType type0(Type::BOOL, {});
5891 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5892 OperandType type4(Type::INT32, {});
5893 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5894 OperandType type8(Type::TENSOR_FLOAT32, {2});
5895 // Phase 1, operands
5896 auto op12 = model->addOperand(&type7);
5897 auto op22 = model->addOperand(&type7);
5898 auto op32 = model->addOperand(&type8);
5899 auto param13 = model->addOperand(&type4);
5900 auto param14 = model->addOperand(&type4);
5901 auto param15 = model->addOperand(&type4);
5902 auto param16 = model->addOperand(&type4);
5903 auto param17 = model->addOperand(&type4);
5904 auto param18 = model->addOperand(&type4);
5905 auto param19 = model->addOperand(&type4);
5906 auto param20 = model->addOperand(&type4);
5907 auto layout = model->addOperand(&type0);
5908 auto op42 = model->addOperand(&type34);
5909 // Phase 2, operations
5910 static int32_t param13_init[] = {0};
5911 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5912 static int32_t param14_init[] = {0};
5913 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5914 static int32_t param15_init[] = {0};
5915 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5916 static int32_t param16_init[] = {0};
5917 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5918 static int32_t param17_init[] = {1};
5919 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5920 static int32_t param18_init[] = {1};
5921 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5922 static int32_t param19_init[] = {1};
5923 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5924 static int32_t param20_init[] = {0};
5925 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5926 static bool8 layout_init[] = {false};
5927 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5928 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5929 // Phase 3, inputs and outputs
5930 model->identifyInputsAndOutputs(
5931 {op12, op22, op32},
5932 {op42});
5933 assert(model->isValid());
5934 }
5935
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input(int i)5936 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input(int i) {
5937 static std::set<int> ignore = {};
5938 return ignore.find(i) != ignore.end();
5939 }
5940
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model * model)5941 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) {
5942 OperandType type0(Type::BOOL, {});
5943 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
5944 OperandType type4(Type::INT32, {});
5945 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5946 OperandType type8(Type::TENSOR_FLOAT32, {2});
5947 // Phase 1, operands
5948 auto op12 = model->addOperand(&type7);
5949 auto op22 = model->addOperand(&type7);
5950 auto op32 = model->addOperand(&type8);
5951 auto param13 = model->addOperand(&type4);
5952 auto param14 = model->addOperand(&type4);
5953 auto param15 = model->addOperand(&type4);
5954 auto param16 = model->addOperand(&type4);
5955 auto param17 = model->addOperand(&type4);
5956 auto param18 = model->addOperand(&type4);
5957 auto param19 = model->addOperand(&type4);
5958 auto param20 = model->addOperand(&type4);
5959 auto layout = model->addOperand(&type0);
5960 auto op42 = model->addOperand(&type34);
5961 // Phase 2, operations
5962 static int32_t param13_init[] = {0};
5963 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
5964 static int32_t param14_init[] = {0};
5965 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
5966 static int32_t param15_init[] = {0};
5967 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
5968 static int32_t param16_init[] = {0};
5969 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
5970 static int32_t param17_init[] = {1};
5971 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
5972 static int32_t param18_init[] = {1};
5973 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
5974 static int32_t param19_init[] = {1};
5975 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
5976 static int32_t param20_init[] = {0};
5977 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
5978 static bool8 layout_init[] = {false};
5979 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
5980 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
5981 // Phase 3, inputs and outputs
5982 model->identifyInputsAndOutputs(
5983 {op12, op22, op32},
5984 {op42});
5985 // Phase 4: set relaxed execution
5986 model->relaxComputationFloat32toFloat16(true);
5987 assert(model->isValid());
5988 }
5989
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i)5990 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) {
5991 static std::set<int> ignore = {};
5992 return ignore.find(i) != ignore.end();
5993 }
5994
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_float16(Model * model)5995 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) {
5996 OperandType type0(Type::BOOL, {});
5997 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
5998 OperandType type4(Type::INT32, {});
5999 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
6000 OperandType type54(Type::TENSOR_FLOAT16, {2});
6001 // Phase 1, operands
6002 auto op12 = model->addOperand(&type53);
6003 auto op22 = model->addOperand(&type53);
6004 auto op32 = model->addOperand(&type54);
6005 auto param13 = model->addOperand(&type4);
6006 auto param14 = model->addOperand(&type4);
6007 auto param15 = model->addOperand(&type4);
6008 auto param16 = model->addOperand(&type4);
6009 auto param17 = model->addOperand(&type4);
6010 auto param18 = model->addOperand(&type4);
6011 auto param19 = model->addOperand(&type4);
6012 auto param20 = model->addOperand(&type4);
6013 auto layout = model->addOperand(&type0);
6014 auto op42 = model->addOperand(&type35);
6015 // Phase 2, operations
6016 static int32_t param13_init[] = {0};
6017 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6018 static int32_t param14_init[] = {0};
6019 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6020 static int32_t param15_init[] = {0};
6021 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6022 static int32_t param16_init[] = {0};
6023 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6024 static int32_t param17_init[] = {1};
6025 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6026 static int32_t param18_init[] = {1};
6027 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6028 static int32_t param19_init[] = {1};
6029 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6030 static int32_t param20_init[] = {0};
6031 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6032 static bool8 layout_init[] = {false};
6033 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6034 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6035 // Phase 3, inputs and outputs
6036 model->identifyInputsAndOutputs(
6037 {op12, op22, op32},
6038 {op42});
6039 assert(model->isValid());
6040 }
6041
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_float16(int i)6042 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_float16(int i) {
6043 static std::set<int> ignore = {};
6044 return ignore.find(i) != ignore.end();
6045 }
6046
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_quant8(Model * model)6047 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) {
6048 OperandType type0(Type::BOOL, {});
6049 OperandType type4(Type::INT32, {});
6050 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
6051 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
6052 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
6053 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6054 // Phase 1, operands
6055 auto op12 = model->addOperand(&type56);
6056 auto op22 = model->addOperand(&type57);
6057 auto op32 = model->addOperand(&type58);
6058 auto param13 = model->addOperand(&type4);
6059 auto param14 = model->addOperand(&type4);
6060 auto param15 = model->addOperand(&type4);
6061 auto param16 = model->addOperand(&type4);
6062 auto param17 = model->addOperand(&type4);
6063 auto param18 = model->addOperand(&type4);
6064 auto param19 = model->addOperand(&type4);
6065 auto param20 = model->addOperand(&type4);
6066 auto layout = model->addOperand(&type0);
6067 auto op42 = model->addOperand(&type66);
6068 // Phase 2, operations
6069 static int32_t param13_init[] = {0};
6070 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6071 static int32_t param14_init[] = {0};
6072 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6073 static int32_t param15_init[] = {0};
6074 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6075 static int32_t param16_init[] = {0};
6076 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6077 static int32_t param17_init[] = {1};
6078 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6079 static int32_t param18_init[] = {1};
6080 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6081 static int32_t param19_init[] = {1};
6082 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6083 static int32_t param20_init[] = {0};
6084 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6085 static bool8 layout_init[] = {false};
6086 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6087 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6088 // Phase 3, inputs and outputs
6089 model->identifyInputsAndOutputs(
6090 {op12, op22, op32},
6091 {op42});
6092 assert(model->isValid());
6093 }
6094
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_quant8(int i)6095 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) {
6096 static std::set<int> ignore = {};
6097 return ignore.find(i) != ignore.end();
6098 }
6099
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model * model)6100 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model *model) {
6101 OperandType type0(Type::BOOL, {});
6102 OperandType type4(Type::INT32, {});
6103 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
6104 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
6105 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
6106 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6107 // Phase 1, operands
6108 auto op12 = model->addOperand(&type60);
6109 auto op22 = model->addOperand(&type61);
6110 auto op32 = model->addOperand(&type62);
6111 auto param13 = model->addOperand(&type4);
6112 auto param14 = model->addOperand(&type4);
6113 auto param15 = model->addOperand(&type4);
6114 auto param16 = model->addOperand(&type4);
6115 auto param17 = model->addOperand(&type4);
6116 auto param18 = model->addOperand(&type4);
6117 auto param19 = model->addOperand(&type4);
6118 auto param20 = model->addOperand(&type4);
6119 auto layout = model->addOperand(&type0);
6120 auto op42 = model->addOperand(&type66);
6121 // Phase 2, operations
6122 static int32_t param13_init[] = {0};
6123 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6124 static int32_t param14_init[] = {0};
6125 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6126 static int32_t param15_init[] = {0};
6127 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6128 static int32_t param16_init[] = {0};
6129 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6130 static int32_t param17_init[] = {1};
6131 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6132 static int32_t param18_init[] = {1};
6133 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6134 static int32_t param19_init[] = {1};
6135 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6136 static int32_t param20_init[] = {0};
6137 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6138 static bool8 layout_init[] = {false};
6139 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6140 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6141 // Phase 3, inputs and outputs
6142 model->identifyInputsAndOutputs(
6143 {op12, op22, op32},
6144 {op42});
6145 assert(model->isValid());
6146 }
6147
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i)6148 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i) {
6149 static std::set<int> ignore = {};
6150 return ignore.find(i) != ignore.end();
6151 }
6152
CreateModel_large_dynamic_output_shape_nchw(Model * model)6153 void CreateModel_large_dynamic_output_shape_nchw(Model *model) {
6154 OperandType type0(Type::BOOL, {});
6155 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6156 OperandType type4(Type::INT32, {});
6157 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
6158 OperandType type8(Type::TENSOR_FLOAT32, {2});
6159 // Phase 1, operands
6160 auto op12 = model->addOperand(&type7);
6161 auto op22 = model->addOperand(&type7);
6162 auto op32 = model->addOperand(&type8);
6163 auto param13 = model->addOperand(&type4);
6164 auto param14 = model->addOperand(&type4);
6165 auto param15 = model->addOperand(&type4);
6166 auto param16 = model->addOperand(&type4);
6167 auto param17 = model->addOperand(&type4);
6168 auto param18 = model->addOperand(&type4);
6169 auto param19 = model->addOperand(&type4);
6170 auto param20 = model->addOperand(&type4);
6171 auto layout = model->addOperand(&type0);
6172 auto op42 = model->addOperand(&type34);
6173 // Phase 2, operations
6174 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
6175 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
6176 static float op32_init[] = {100.0f, 200.0f};
6177 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
6178 static int32_t param13_init[] = {0};
6179 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6180 static int32_t param14_init[] = {0};
6181 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6182 static int32_t param15_init[] = {0};
6183 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6184 static int32_t param16_init[] = {0};
6185 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6186 static int32_t param17_init[] = {1};
6187 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6188 static int32_t param18_init[] = {1};
6189 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6190 static int32_t param19_init[] = {1};
6191 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6192 static int32_t param20_init[] = {0};
6193 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6194 static bool8 layout_init[] = {true};
6195 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6196 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6197 // Phase 3, inputs and outputs
6198 model->identifyInputsAndOutputs(
6199 {op12},
6200 {op42});
6201 assert(model->isValid());
6202 }
6203
is_ignored_large_dynamic_output_shape_nchw(int i)6204 inline bool is_ignored_large_dynamic_output_shape_nchw(int i) {
6205 static std::set<int> ignore = {};
6206 return ignore.find(i) != ignore.end();
6207 }
6208
CreateModel_large_dynamic_output_shape_nchw_relaxed(Model * model)6209 void CreateModel_large_dynamic_output_shape_nchw_relaxed(Model *model) {
6210 OperandType type0(Type::BOOL, {});
6211 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6212 OperandType type4(Type::INT32, {});
6213 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
6214 OperandType type8(Type::TENSOR_FLOAT32, {2});
6215 // Phase 1, operands
6216 auto op12 = model->addOperand(&type7);
6217 auto op22 = model->addOperand(&type7);
6218 auto op32 = model->addOperand(&type8);
6219 auto param13 = model->addOperand(&type4);
6220 auto param14 = model->addOperand(&type4);
6221 auto param15 = model->addOperand(&type4);
6222 auto param16 = model->addOperand(&type4);
6223 auto param17 = model->addOperand(&type4);
6224 auto param18 = model->addOperand(&type4);
6225 auto param19 = model->addOperand(&type4);
6226 auto param20 = model->addOperand(&type4);
6227 auto layout = model->addOperand(&type0);
6228 auto op42 = model->addOperand(&type34);
6229 // Phase 2, operations
6230 static float op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
6231 model->setOperandValue(op22, op22_init, sizeof(float) * 8);
6232 static float op32_init[] = {100.0f, 200.0f};
6233 model->setOperandValue(op32, op32_init, sizeof(float) * 2);
6234 static int32_t param13_init[] = {0};
6235 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6236 static int32_t param14_init[] = {0};
6237 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6238 static int32_t param15_init[] = {0};
6239 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6240 static int32_t param16_init[] = {0};
6241 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6242 static int32_t param17_init[] = {1};
6243 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6244 static int32_t param18_init[] = {1};
6245 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6246 static int32_t param19_init[] = {1};
6247 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6248 static int32_t param20_init[] = {0};
6249 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6250 static bool8 layout_init[] = {true};
6251 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6252 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6253 // Phase 3, inputs and outputs
6254 model->identifyInputsAndOutputs(
6255 {op12},
6256 {op42});
6257 // Phase 4: set relaxed execution
6258 model->relaxComputationFloat32toFloat16(true);
6259 assert(model->isValid());
6260 }
6261
is_ignored_large_dynamic_output_shape_nchw_relaxed(int i)6262 inline bool is_ignored_large_dynamic_output_shape_nchw_relaxed(int i) {
6263 static std::set<int> ignore = {};
6264 return ignore.find(i) != ignore.end();
6265 }
6266
CreateModel_large_dynamic_output_shape_nchw_float16(Model * model)6267 void CreateModel_large_dynamic_output_shape_nchw_float16(Model *model) {
6268 OperandType type0(Type::BOOL, {});
6269 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6270 OperandType type4(Type::INT32, {});
6271 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
6272 OperandType type54(Type::TENSOR_FLOAT16, {2});
6273 // Phase 1, operands
6274 auto op12 = model->addOperand(&type53);
6275 auto op22 = model->addOperand(&type53);
6276 auto op32 = model->addOperand(&type54);
6277 auto param13 = model->addOperand(&type4);
6278 auto param14 = model->addOperand(&type4);
6279 auto param15 = model->addOperand(&type4);
6280 auto param16 = model->addOperand(&type4);
6281 auto param17 = model->addOperand(&type4);
6282 auto param18 = model->addOperand(&type4);
6283 auto param19 = model->addOperand(&type4);
6284 auto param20 = model->addOperand(&type4);
6285 auto layout = model->addOperand(&type0);
6286 auto op42 = model->addOperand(&type35);
6287 // Phase 2, operations
6288 static _Float16 op22_init[] = {0.25f, 0.0f, 0.25f, 1.0f, 0.25f, 0.0f, 0.25f, 1.0f};
6289 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 8);
6290 static _Float16 op32_init[] = {100.0f, 200.0f};
6291 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 2);
6292 static int32_t param13_init[] = {0};
6293 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6294 static int32_t param14_init[] = {0};
6295 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6296 static int32_t param15_init[] = {0};
6297 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6298 static int32_t param16_init[] = {0};
6299 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6300 static int32_t param17_init[] = {1};
6301 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6302 static int32_t param18_init[] = {1};
6303 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6304 static int32_t param19_init[] = {1};
6305 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6306 static int32_t param20_init[] = {0};
6307 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6308 static bool8 layout_init[] = {true};
6309 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6310 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6311 // Phase 3, inputs and outputs
6312 model->identifyInputsAndOutputs(
6313 {op12},
6314 {op42});
6315 assert(model->isValid());
6316 }
6317
is_ignored_large_dynamic_output_shape_nchw_float16(int i)6318 inline bool is_ignored_large_dynamic_output_shape_nchw_float16(int i) {
6319 static std::set<int> ignore = {};
6320 return ignore.find(i) != ignore.end();
6321 }
6322
CreateModel_large_dynamic_output_shape_nchw_quant8(Model * model)6323 void CreateModel_large_dynamic_output_shape_nchw_quant8(Model *model) {
6324 OperandType type0(Type::BOOL, {});
6325 OperandType type4(Type::INT32, {});
6326 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
6327 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
6328 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
6329 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6330 // Phase 1, operands
6331 auto op12 = model->addOperand(&type56);
6332 auto op22 = model->addOperand(&type57);
6333 auto op32 = model->addOperand(&type58);
6334 auto param13 = model->addOperand(&type4);
6335 auto param14 = model->addOperand(&type4);
6336 auto param15 = model->addOperand(&type4);
6337 auto param16 = model->addOperand(&type4);
6338 auto param17 = model->addOperand(&type4);
6339 auto param18 = model->addOperand(&type4);
6340 auto param19 = model->addOperand(&type4);
6341 auto param20 = model->addOperand(&type4);
6342 auto layout = model->addOperand(&type0);
6343 auto op42 = model->addOperand(&type66);
6344 // Phase 2, operations
6345 static uint8_t op22_init[] = {130, 128, 130, 136, 130, 128, 130, 136};
6346 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 8);
6347 static int32_t op32_init[] = {1600, 3200};
6348 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
6349 static int32_t param13_init[] = {0};
6350 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6351 static int32_t param14_init[] = {0};
6352 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6353 static int32_t param15_init[] = {0};
6354 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6355 static int32_t param16_init[] = {0};
6356 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6357 static int32_t param17_init[] = {1};
6358 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6359 static int32_t param18_init[] = {1};
6360 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6361 static int32_t param19_init[] = {1};
6362 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6363 static int32_t param20_init[] = {0};
6364 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6365 static bool8 layout_init[] = {true};
6366 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6367 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6368 // Phase 3, inputs and outputs
6369 model->identifyInputsAndOutputs(
6370 {op12},
6371 {op42});
6372 assert(model->isValid());
6373 }
6374
is_ignored_large_dynamic_output_shape_nchw_quant8(int i)6375 inline bool is_ignored_large_dynamic_output_shape_nchw_quant8(int i) {
6376 static std::set<int> ignore = {};
6377 return ignore.find(i) != ignore.end();
6378 }
6379
CreateModel_large_dynamic_output_shape_nchw_channelQuant8(Model * model)6380 void CreateModel_large_dynamic_output_shape_nchw_channelQuant8(Model *model) {
6381 OperandType type0(Type::BOOL, {});
6382 OperandType type4(Type::INT32, {});
6383 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
6384 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
6385 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
6386 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6387 // Phase 1, operands
6388 auto op12 = model->addOperand(&type60);
6389 auto op22 = model->addOperand(&type61);
6390 auto op32 = model->addOperand(&type62);
6391 auto param13 = model->addOperand(&type4);
6392 auto param14 = model->addOperand(&type4);
6393 auto param15 = model->addOperand(&type4);
6394 auto param16 = model->addOperand(&type4);
6395 auto param17 = model->addOperand(&type4);
6396 auto param18 = model->addOperand(&type4);
6397 auto param19 = model->addOperand(&type4);
6398 auto param20 = model->addOperand(&type4);
6399 auto layout = model->addOperand(&type0);
6400 auto op42 = model->addOperand(&type66);
6401 // Phase 2, operations
6402 static int8_t op22_init[] = {2, 0, 2, 4, 2, 0, 2, 4};
6403 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 8);
6404 static int32_t op32_init[] = {1600, 1600};
6405 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 2);
6406 static int32_t param13_init[] = {0};
6407 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6408 static int32_t param14_init[] = {0};
6409 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6410 static int32_t param15_init[] = {0};
6411 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6412 static int32_t param16_init[] = {0};
6413 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6414 static int32_t param17_init[] = {1};
6415 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6416 static int32_t param18_init[] = {1};
6417 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6418 static int32_t param19_init[] = {1};
6419 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6420 static int32_t param20_init[] = {0};
6421 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6422 static bool8 layout_init[] = {true};
6423 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6424 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6425 // Phase 3, inputs and outputs
6426 model->identifyInputsAndOutputs(
6427 {op12},
6428 {op42});
6429 assert(model->isValid());
6430 }
6431
is_ignored_large_dynamic_output_shape_nchw_channelQuant8(int i)6432 inline bool is_ignored_large_dynamic_output_shape_nchw_channelQuant8(int i) {
6433 static std::set<int> ignore = {};
6434 return ignore.find(i) != ignore.end();
6435 }
6436
CreateModel_large_dynamic_output_shape_nchw_weight_as_input(Model * model)6437 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input(Model *model) {
6438 OperandType type0(Type::BOOL, {});
6439 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6440 OperandType type4(Type::INT32, {});
6441 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
6442 OperandType type8(Type::TENSOR_FLOAT32, {2});
6443 // Phase 1, operands
6444 auto op12 = model->addOperand(&type7);
6445 auto op22 = model->addOperand(&type7);
6446 auto op32 = model->addOperand(&type8);
6447 auto param13 = model->addOperand(&type4);
6448 auto param14 = model->addOperand(&type4);
6449 auto param15 = model->addOperand(&type4);
6450 auto param16 = model->addOperand(&type4);
6451 auto param17 = model->addOperand(&type4);
6452 auto param18 = model->addOperand(&type4);
6453 auto param19 = model->addOperand(&type4);
6454 auto param20 = model->addOperand(&type4);
6455 auto layout = model->addOperand(&type0);
6456 auto op42 = model->addOperand(&type34);
6457 // Phase 2, operations
6458 static int32_t param13_init[] = {0};
6459 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6460 static int32_t param14_init[] = {0};
6461 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6462 static int32_t param15_init[] = {0};
6463 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6464 static int32_t param16_init[] = {0};
6465 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6466 static int32_t param17_init[] = {1};
6467 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6468 static int32_t param18_init[] = {1};
6469 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6470 static int32_t param19_init[] = {1};
6471 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6472 static int32_t param20_init[] = {0};
6473 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6474 static bool8 layout_init[] = {true};
6475 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6476 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6477 // Phase 3, inputs and outputs
6478 model->identifyInputsAndOutputs(
6479 {op12, op22, op32},
6480 {op42});
6481 assert(model->isValid());
6482 }
6483
is_ignored_large_dynamic_output_shape_nchw_weight_as_input(int i)6484 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input(int i) {
6485 static std::set<int> ignore = {};
6486 return ignore.find(i) != ignore.end();
6487 }
6488
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_relaxed(Model * model)6489 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) {
6490 OperandType type0(Type::BOOL, {});
6491 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
6492 OperandType type4(Type::INT32, {});
6493 OperandType type7(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
6494 OperandType type8(Type::TENSOR_FLOAT32, {2});
6495 // Phase 1, operands
6496 auto op12 = model->addOperand(&type7);
6497 auto op22 = model->addOperand(&type7);
6498 auto op32 = model->addOperand(&type8);
6499 auto param13 = model->addOperand(&type4);
6500 auto param14 = model->addOperand(&type4);
6501 auto param15 = model->addOperand(&type4);
6502 auto param16 = model->addOperand(&type4);
6503 auto param17 = model->addOperand(&type4);
6504 auto param18 = model->addOperand(&type4);
6505 auto param19 = model->addOperand(&type4);
6506 auto param20 = model->addOperand(&type4);
6507 auto layout = model->addOperand(&type0);
6508 auto op42 = model->addOperand(&type34);
6509 // Phase 2, operations
6510 static int32_t param13_init[] = {0};
6511 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6512 static int32_t param14_init[] = {0};
6513 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6514 static int32_t param15_init[] = {0};
6515 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6516 static int32_t param16_init[] = {0};
6517 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6518 static int32_t param17_init[] = {1};
6519 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6520 static int32_t param18_init[] = {1};
6521 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6522 static int32_t param19_init[] = {1};
6523 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6524 static int32_t param20_init[] = {0};
6525 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6526 static bool8 layout_init[] = {true};
6527 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6528 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6529 // Phase 3, inputs and outputs
6530 model->identifyInputsAndOutputs(
6531 {op12, op22, op32},
6532 {op42});
6533 // Phase 4: set relaxed execution
6534 model->relaxComputationFloat32toFloat16(true);
6535 assert(model->isValid());
6536 }
6537
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_relaxed(int i)6538 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) {
6539 static std::set<int> ignore = {};
6540 return ignore.find(i) != ignore.end();
6541 }
6542
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_float16(Model * model)6543 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) {
6544 OperandType type0(Type::BOOL, {});
6545 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
6546 OperandType type4(Type::INT32, {});
6547 OperandType type53(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
6548 OperandType type54(Type::TENSOR_FLOAT16, {2});
6549 // Phase 1, operands
6550 auto op12 = model->addOperand(&type53);
6551 auto op22 = model->addOperand(&type53);
6552 auto op32 = model->addOperand(&type54);
6553 auto param13 = model->addOperand(&type4);
6554 auto param14 = model->addOperand(&type4);
6555 auto param15 = model->addOperand(&type4);
6556 auto param16 = model->addOperand(&type4);
6557 auto param17 = model->addOperand(&type4);
6558 auto param18 = model->addOperand(&type4);
6559 auto param19 = model->addOperand(&type4);
6560 auto param20 = model->addOperand(&type4);
6561 auto layout = model->addOperand(&type0);
6562 auto op42 = model->addOperand(&type35);
6563 // Phase 2, operations
6564 static int32_t param13_init[] = {0};
6565 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6566 static int32_t param14_init[] = {0};
6567 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6568 static int32_t param15_init[] = {0};
6569 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6570 static int32_t param16_init[] = {0};
6571 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6572 static int32_t param17_init[] = {1};
6573 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6574 static int32_t param18_init[] = {1};
6575 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6576 static int32_t param19_init[] = {1};
6577 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6578 static int32_t param20_init[] = {0};
6579 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6580 static bool8 layout_init[] = {true};
6581 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6582 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6583 // Phase 3, inputs and outputs
6584 model->identifyInputsAndOutputs(
6585 {op12, op22, op32},
6586 {op42});
6587 assert(model->isValid());
6588 }
6589
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_float16(int i)6590 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_float16(int i) {
6591 static std::set<int> ignore = {};
6592 return ignore.find(i) != ignore.end();
6593 }
6594
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_quant8(Model * model)6595 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) {
6596 OperandType type0(Type::BOOL, {});
6597 OperandType type4(Type::INT32, {});
6598 OperandType type56(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 100);
6599 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.125f, 128);
6600 OperandType type58(Type::TENSOR_INT32, {2}, 0.0625f, 0);
6601 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6602 // Phase 1, operands
6603 auto op12 = model->addOperand(&type56);
6604 auto op22 = model->addOperand(&type57);
6605 auto op32 = model->addOperand(&type58);
6606 auto param13 = model->addOperand(&type4);
6607 auto param14 = model->addOperand(&type4);
6608 auto param15 = model->addOperand(&type4);
6609 auto param16 = model->addOperand(&type4);
6610 auto param17 = model->addOperand(&type4);
6611 auto param18 = model->addOperand(&type4);
6612 auto param19 = model->addOperand(&type4);
6613 auto param20 = model->addOperand(&type4);
6614 auto layout = model->addOperand(&type0);
6615 auto op42 = model->addOperand(&type66);
6616 // Phase 2, operations
6617 static int32_t param13_init[] = {0};
6618 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6619 static int32_t param14_init[] = {0};
6620 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6621 static int32_t param15_init[] = {0};
6622 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6623 static int32_t param16_init[] = {0};
6624 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6625 static int32_t param17_init[] = {1};
6626 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6627 static int32_t param18_init[] = {1};
6628 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6629 static int32_t param19_init[] = {1};
6630 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6631 static int32_t param20_init[] = {0};
6632 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6633 static bool8 layout_init[] = {true};
6634 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6635 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6636 // Phase 3, inputs and outputs
6637 model->identifyInputsAndOutputs(
6638 {op12, op22, op32},
6639 {op42});
6640 assert(model->isValid());
6641 }
6642
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_quant8(int i)6643 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_quant8(int i) {
6644 static std::set<int> ignore = {};
6645 return ignore.find(i) != ignore.end();
6646 }
6647
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model * model)6648 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model *model) {
6649 OperandType type0(Type::BOOL, {});
6650 OperandType type4(Type::INT32, {});
6651 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.5f, 128);
6652 OperandType type61(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 2}, 0.0f, 0, SymmPerChannelQuantParams({0.125f, 0.25f},3));
6653 OperandType type62(Type::TENSOR_INT32, {2}, 0.0f, 0);
6654 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 128);
6655 // Phase 1, operands
6656 auto op12 = model->addOperand(&type60);
6657 auto op22 = model->addOperand(&type61);
6658 auto op32 = model->addOperand(&type62);
6659 auto param13 = model->addOperand(&type4);
6660 auto param14 = model->addOperand(&type4);
6661 auto param15 = model->addOperand(&type4);
6662 auto param16 = model->addOperand(&type4);
6663 auto param17 = model->addOperand(&type4);
6664 auto param18 = model->addOperand(&type4);
6665 auto param19 = model->addOperand(&type4);
6666 auto param20 = model->addOperand(&type4);
6667 auto layout = model->addOperand(&type0);
6668 auto op42 = model->addOperand(&type66);
6669 // Phase 2, operations
6670 static int32_t param13_init[] = {0};
6671 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1);
6672 static int32_t param14_init[] = {0};
6673 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1);
6674 static int32_t param15_init[] = {0};
6675 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1);
6676 static int32_t param16_init[] = {0};
6677 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1);
6678 static int32_t param17_init[] = {1};
6679 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1);
6680 static int32_t param18_init[] = {1};
6681 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1);
6682 static int32_t param19_init[] = {1};
6683 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1);
6684 static int32_t param20_init[] = {0};
6685 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1);
6686 static bool8 layout_init[] = {true};
6687 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6688 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op12, op22, op32, param13, param14, param15, param16, param17, param18, param19, param20, layout}, {op42});
6689 // Phase 3, inputs and outputs
6690 model->identifyInputsAndOutputs(
6691 {op12, op22, op32},
6692 {op42});
6693 assert(model->isValid());
6694 }
6695
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i)6696 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i) {
6697 static std::set<int> ignore = {};
6698 return ignore.find(i) != ignore.end();
6699 }
6700
CreateModel_large_nhwc_2(Model * model)6701 void CreateModel_large_nhwc_2(Model *model) {
6702 OperandType type0(Type::BOOL, {});
6703 OperandType type10(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
6704 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
6705 OperandType type3(Type::TENSOR_FLOAT32, {4});
6706 OperandType type4(Type::INT32, {});
6707 // Phase 1, operands
6708 auto op13 = model->addOperand(&type2);
6709 auto op23 = model->addOperand(&type2);
6710 auto op33 = model->addOperand(&type3);
6711 auto param21 = model->addOperand(&type4);
6712 auto param22 = model->addOperand(&type4);
6713 auto param23 = model->addOperand(&type4);
6714 auto param24 = model->addOperand(&type4);
6715 auto param25 = model->addOperand(&type4);
6716 auto param26 = model->addOperand(&type4);
6717 auto param27 = model->addOperand(&type4);
6718 auto param28 = model->addOperand(&type4);
6719 auto layout = model->addOperand(&type0);
6720 auto op43 = model->addOperand(&type10);
6721 // Phase 2, operations
6722 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
6723 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
6724 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
6725 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
6726 static int32_t param21_init[] = {0};
6727 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
6728 static int32_t param22_init[] = {0};
6729 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
6730 static int32_t param23_init[] = {0};
6731 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
6732 static int32_t param24_init[] = {0};
6733 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6734 static int32_t param25_init[] = {1};
6735 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6736 static int32_t param26_init[] = {1};
6737 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6738 static int32_t param27_init[] = {1};
6739 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6740 static int32_t param28_init[] = {0};
6741 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6742 static bool8 layout_init[] = {false};
6743 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6744 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
6745 // Phase 3, inputs and outputs
6746 model->identifyInputsAndOutputs(
6747 {op13},
6748 {op43});
6749 assert(model->isValid());
6750 }
6751
is_ignored_large_nhwc_2(int i)6752 inline bool is_ignored_large_nhwc_2(int i) {
6753 static std::set<int> ignore = {};
6754 return ignore.find(i) != ignore.end();
6755 }
6756
CreateModel_large_nhwc_relaxed_2(Model * model)6757 void CreateModel_large_nhwc_relaxed_2(Model *model) {
6758 OperandType type0(Type::BOOL, {});
6759 OperandType type10(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
6760 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
6761 OperandType type3(Type::TENSOR_FLOAT32, {4});
6762 OperandType type4(Type::INT32, {});
6763 // Phase 1, operands
6764 auto op13 = model->addOperand(&type2);
6765 auto op23 = model->addOperand(&type2);
6766 auto op33 = model->addOperand(&type3);
6767 auto param21 = model->addOperand(&type4);
6768 auto param22 = model->addOperand(&type4);
6769 auto param23 = model->addOperand(&type4);
6770 auto param24 = model->addOperand(&type4);
6771 auto param25 = model->addOperand(&type4);
6772 auto param26 = model->addOperand(&type4);
6773 auto param27 = model->addOperand(&type4);
6774 auto param28 = model->addOperand(&type4);
6775 auto layout = model->addOperand(&type0);
6776 auto op43 = model->addOperand(&type10);
6777 // Phase 2, operations
6778 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
6779 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
6780 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
6781 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
6782 static int32_t param21_init[] = {0};
6783 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
6784 static int32_t param22_init[] = {0};
6785 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
6786 static int32_t param23_init[] = {0};
6787 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
6788 static int32_t param24_init[] = {0};
6789 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6790 static int32_t param25_init[] = {1};
6791 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6792 static int32_t param26_init[] = {1};
6793 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6794 static int32_t param27_init[] = {1};
6795 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6796 static int32_t param28_init[] = {0};
6797 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6798 static bool8 layout_init[] = {false};
6799 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6800 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
6801 // Phase 3, inputs and outputs
6802 model->identifyInputsAndOutputs(
6803 {op13},
6804 {op43});
6805 // Phase 4: set relaxed execution
6806 model->relaxComputationFloat32toFloat16(true);
6807 assert(model->isValid());
6808 }
6809
is_ignored_large_nhwc_relaxed_2(int i)6810 inline bool is_ignored_large_nhwc_relaxed_2(int i) {
6811 static std::set<int> ignore = {};
6812 return ignore.find(i) != ignore.end();
6813 }
6814
CreateModel_large_nhwc_float16_2(Model * model)6815 void CreateModel_large_nhwc_float16_2(Model *model) {
6816 OperandType type0(Type::BOOL, {});
6817 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
6818 OperandType type17(Type::TENSOR_FLOAT16, {4});
6819 OperandType type4(Type::INT32, {});
6820 OperandType type67(Type::TENSOR_FLOAT16, {1, 1, 1, 4});
6821 // Phase 1, operands
6822 auto op13 = model->addOperand(&type16);
6823 auto op23 = model->addOperand(&type16);
6824 auto op33 = model->addOperand(&type17);
6825 auto param21 = model->addOperand(&type4);
6826 auto param22 = model->addOperand(&type4);
6827 auto param23 = model->addOperand(&type4);
6828 auto param24 = model->addOperand(&type4);
6829 auto param25 = model->addOperand(&type4);
6830 auto param26 = model->addOperand(&type4);
6831 auto param27 = model->addOperand(&type4);
6832 auto param28 = model->addOperand(&type4);
6833 auto layout = model->addOperand(&type0);
6834 auto op43 = model->addOperand(&type67);
6835 // Phase 2, operations
6836 static _Float16 op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
6837 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 16);
6838 static _Float16 op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
6839 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 4);
6840 static int32_t param21_init[] = {0};
6841 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
6842 static int32_t param22_init[] = {0};
6843 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
6844 static int32_t param23_init[] = {0};
6845 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
6846 static int32_t param24_init[] = {0};
6847 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6848 static int32_t param25_init[] = {1};
6849 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6850 static int32_t param26_init[] = {1};
6851 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6852 static int32_t param27_init[] = {1};
6853 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6854 static int32_t param28_init[] = {0};
6855 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6856 static bool8 layout_init[] = {false};
6857 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6858 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
6859 // Phase 3, inputs and outputs
6860 model->identifyInputsAndOutputs(
6861 {op13},
6862 {op43});
6863 assert(model->isValid());
6864 }
6865
is_ignored_large_nhwc_float16_2(int i)6866 inline bool is_ignored_large_nhwc_float16_2(int i) {
6867 static std::set<int> ignore = {};
6868 return ignore.find(i) != ignore.end();
6869 }
6870
CreateModel_large_nhwc_quant8_2(Model * model)6871 void CreateModel_large_nhwc_quant8_2(Model *model) {
6872 OperandType type0(Type::BOOL, {});
6873 OperandType type4(Type::INT32, {});
6874 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
6875 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
6876 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
6877 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 50.0f, 0);
6878 // Phase 1, operands
6879 auto op13 = model->addOperand(&type41);
6880 auto op23 = model->addOperand(&type68);
6881 auto op33 = model->addOperand(&type69);
6882 auto param21 = model->addOperand(&type4);
6883 auto param22 = model->addOperand(&type4);
6884 auto param23 = model->addOperand(&type4);
6885 auto param24 = model->addOperand(&type4);
6886 auto param25 = model->addOperand(&type4);
6887 auto param26 = model->addOperand(&type4);
6888 auto param27 = model->addOperand(&type4);
6889 auto param28 = model->addOperand(&type4);
6890 auto layout = model->addOperand(&type0);
6891 auto op43 = model->addOperand(&type70);
6892 // Phase 2, operations
6893 static uint8_t op23_init[] = {1, 0, 40, 200, 1, 4, 80, 200, 1, 0, 120, 200, 1, 4, 160, 200};
6894 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 16);
6895 static int32_t op33_init[] = {48000, 56000, 64000, 72000};
6896 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
6897 static int32_t param21_init[] = {0};
6898 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
6899 static int32_t param22_init[] = {0};
6900 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
6901 static int32_t param23_init[] = {0};
6902 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
6903 static int32_t param24_init[] = {0};
6904 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6905 static int32_t param25_init[] = {1};
6906 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6907 static int32_t param26_init[] = {1};
6908 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6909 static int32_t param27_init[] = {1};
6910 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6911 static int32_t param28_init[] = {0};
6912 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6913 static bool8 layout_init[] = {false};
6914 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6915 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
6916 // Phase 3, inputs and outputs
6917 model->identifyInputsAndOutputs(
6918 {op13},
6919 {op43});
6920 assert(model->isValid());
6921 }
6922
is_ignored_large_nhwc_quant8_2(int i)6923 inline bool is_ignored_large_nhwc_quant8_2(int i) {
6924 static std::set<int> ignore = {};
6925 return ignore.find(i) != ignore.end();
6926 }
6927
CreateModel_large_nhwc_channelQuant8_2(Model * model)6928 void CreateModel_large_nhwc_channelQuant8_2(Model *model) {
6929 OperandType type0(Type::BOOL, {});
6930 OperandType type4(Type::INT32, {});
6931 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
6932 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 50.0f, 0);
6933 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
6934 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
6935 // Phase 1, operands
6936 auto op13 = model->addOperand(&type41);
6937 auto op23 = model->addOperand(&type71);
6938 auto op33 = model->addOperand(&type72);
6939 auto param21 = model->addOperand(&type4);
6940 auto param22 = model->addOperand(&type4);
6941 auto param23 = model->addOperand(&type4);
6942 auto param24 = model->addOperand(&type4);
6943 auto param25 = model->addOperand(&type4);
6944 auto param26 = model->addOperand(&type4);
6945 auto param27 = model->addOperand(&type4);
6946 auto param28 = model->addOperand(&type4);
6947 auto layout = model->addOperand(&type0);
6948 auto op43 = model->addOperand(&type70);
6949 // Phase 2, operations
6950 static int8_t op23_init[] = {0, 0, 10, 50, 0, 0, 20, 50, 0, 0, 30, 50, 0, 0, 40, 50};
6951 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 16);
6952 static int32_t op33_init[] = {12000, 7000, 16000, 18000};
6953 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
6954 static int32_t param21_init[] = {0};
6955 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
6956 static int32_t param22_init[] = {0};
6957 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
6958 static int32_t param23_init[] = {0};
6959 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
6960 static int32_t param24_init[] = {0};
6961 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
6962 static int32_t param25_init[] = {1};
6963 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
6964 static int32_t param26_init[] = {1};
6965 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
6966 static int32_t param27_init[] = {1};
6967 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
6968 static int32_t param28_init[] = {0};
6969 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
6970 static bool8 layout_init[] = {false};
6971 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
6972 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
6973 // Phase 3, inputs and outputs
6974 model->identifyInputsAndOutputs(
6975 {op13},
6976 {op43});
6977 assert(model->isValid());
6978 }
6979
is_ignored_large_nhwc_channelQuant8_2(int i)6980 inline bool is_ignored_large_nhwc_channelQuant8_2(int i) {
6981 static std::set<int> ignore = {};
6982 return ignore.find(i) != ignore.end();
6983 }
6984
CreateModel_large_nhwc_weight_as_input_2(Model * model)6985 void CreateModel_large_nhwc_weight_as_input_2(Model *model) {
6986 OperandType type0(Type::BOOL, {});
6987 OperandType type10(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
6988 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
6989 OperandType type3(Type::TENSOR_FLOAT32, {4});
6990 OperandType type4(Type::INT32, {});
6991 // Phase 1, operands
6992 auto op13 = model->addOperand(&type2);
6993 auto op23 = model->addOperand(&type2);
6994 auto op33 = model->addOperand(&type3);
6995 auto param21 = model->addOperand(&type4);
6996 auto param22 = model->addOperand(&type4);
6997 auto param23 = model->addOperand(&type4);
6998 auto param24 = model->addOperand(&type4);
6999 auto param25 = model->addOperand(&type4);
7000 auto param26 = model->addOperand(&type4);
7001 auto param27 = model->addOperand(&type4);
7002 auto param28 = model->addOperand(&type4);
7003 auto layout = model->addOperand(&type0);
7004 auto op43 = model->addOperand(&type10);
7005 // Phase 2, operations
7006 static int32_t param21_init[] = {0};
7007 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7008 static int32_t param22_init[] = {0};
7009 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7010 static int32_t param23_init[] = {0};
7011 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7012 static int32_t param24_init[] = {0};
7013 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7014 static int32_t param25_init[] = {1};
7015 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7016 static int32_t param26_init[] = {1};
7017 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7018 static int32_t param27_init[] = {1};
7019 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7020 static int32_t param28_init[] = {0};
7021 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7022 static bool8 layout_init[] = {false};
7023 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7024 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7025 // Phase 3, inputs and outputs
7026 model->identifyInputsAndOutputs(
7027 {op13, op23, op33},
7028 {op43});
7029 assert(model->isValid());
7030 }
7031
is_ignored_large_nhwc_weight_as_input_2(int i)7032 inline bool is_ignored_large_nhwc_weight_as_input_2(int i) {
7033 static std::set<int> ignore = {};
7034 return ignore.find(i) != ignore.end();
7035 }
7036
CreateModel_large_nhwc_weight_as_input_relaxed_2(Model * model)7037 void CreateModel_large_nhwc_weight_as_input_relaxed_2(Model *model) {
7038 OperandType type0(Type::BOOL, {});
7039 OperandType type10(Type::TENSOR_FLOAT32, {1, 1, 1, 4});
7040 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7041 OperandType type3(Type::TENSOR_FLOAT32, {4});
7042 OperandType type4(Type::INT32, {});
7043 // Phase 1, operands
7044 auto op13 = model->addOperand(&type2);
7045 auto op23 = model->addOperand(&type2);
7046 auto op33 = model->addOperand(&type3);
7047 auto param21 = model->addOperand(&type4);
7048 auto param22 = model->addOperand(&type4);
7049 auto param23 = model->addOperand(&type4);
7050 auto param24 = model->addOperand(&type4);
7051 auto param25 = model->addOperand(&type4);
7052 auto param26 = model->addOperand(&type4);
7053 auto param27 = model->addOperand(&type4);
7054 auto param28 = model->addOperand(&type4);
7055 auto layout = model->addOperand(&type0);
7056 auto op43 = model->addOperand(&type10);
7057 // Phase 2, operations
7058 static int32_t param21_init[] = {0};
7059 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7060 static int32_t param22_init[] = {0};
7061 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7062 static int32_t param23_init[] = {0};
7063 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7064 static int32_t param24_init[] = {0};
7065 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7066 static int32_t param25_init[] = {1};
7067 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7068 static int32_t param26_init[] = {1};
7069 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7070 static int32_t param27_init[] = {1};
7071 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7072 static int32_t param28_init[] = {0};
7073 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7074 static bool8 layout_init[] = {false};
7075 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7076 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7077 // Phase 3, inputs and outputs
7078 model->identifyInputsAndOutputs(
7079 {op13, op23, op33},
7080 {op43});
7081 // Phase 4: set relaxed execution
7082 model->relaxComputationFloat32toFloat16(true);
7083 assert(model->isValid());
7084 }
7085
is_ignored_large_nhwc_weight_as_input_relaxed_2(int i)7086 inline bool is_ignored_large_nhwc_weight_as_input_relaxed_2(int i) {
7087 static std::set<int> ignore = {};
7088 return ignore.find(i) != ignore.end();
7089 }
7090
CreateModel_large_nhwc_weight_as_input_float16_2(Model * model)7091 void CreateModel_large_nhwc_weight_as_input_float16_2(Model *model) {
7092 OperandType type0(Type::BOOL, {});
7093 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
7094 OperandType type17(Type::TENSOR_FLOAT16, {4});
7095 OperandType type4(Type::INT32, {});
7096 OperandType type67(Type::TENSOR_FLOAT16, {1, 1, 1, 4});
7097 // Phase 1, operands
7098 auto op13 = model->addOperand(&type16);
7099 auto op23 = model->addOperand(&type16);
7100 auto op33 = model->addOperand(&type17);
7101 auto param21 = model->addOperand(&type4);
7102 auto param22 = model->addOperand(&type4);
7103 auto param23 = model->addOperand(&type4);
7104 auto param24 = model->addOperand(&type4);
7105 auto param25 = model->addOperand(&type4);
7106 auto param26 = model->addOperand(&type4);
7107 auto param27 = model->addOperand(&type4);
7108 auto param28 = model->addOperand(&type4);
7109 auto layout = model->addOperand(&type0);
7110 auto op43 = model->addOperand(&type67);
7111 // Phase 2, operations
7112 static int32_t param21_init[] = {0};
7113 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7114 static int32_t param22_init[] = {0};
7115 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7116 static int32_t param23_init[] = {0};
7117 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7118 static int32_t param24_init[] = {0};
7119 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7120 static int32_t param25_init[] = {1};
7121 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7122 static int32_t param26_init[] = {1};
7123 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7124 static int32_t param27_init[] = {1};
7125 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7126 static int32_t param28_init[] = {0};
7127 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7128 static bool8 layout_init[] = {false};
7129 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7130 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7131 // Phase 3, inputs and outputs
7132 model->identifyInputsAndOutputs(
7133 {op13, op23, op33},
7134 {op43});
7135 assert(model->isValid());
7136 }
7137
is_ignored_large_nhwc_weight_as_input_float16_2(int i)7138 inline bool is_ignored_large_nhwc_weight_as_input_float16_2(int i) {
7139 static std::set<int> ignore = {};
7140 return ignore.find(i) != ignore.end();
7141 }
7142
CreateModel_large_nhwc_weight_as_input_quant8_2(Model * model)7143 void CreateModel_large_nhwc_weight_as_input_quant8_2(Model *model) {
7144 OperandType type0(Type::BOOL, {});
7145 OperandType type4(Type::INT32, {});
7146 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
7147 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
7148 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
7149 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 50.0f, 0);
7150 // Phase 1, operands
7151 auto op13 = model->addOperand(&type41);
7152 auto op23 = model->addOperand(&type68);
7153 auto op33 = model->addOperand(&type69);
7154 auto param21 = model->addOperand(&type4);
7155 auto param22 = model->addOperand(&type4);
7156 auto param23 = model->addOperand(&type4);
7157 auto param24 = model->addOperand(&type4);
7158 auto param25 = model->addOperand(&type4);
7159 auto param26 = model->addOperand(&type4);
7160 auto param27 = model->addOperand(&type4);
7161 auto param28 = model->addOperand(&type4);
7162 auto layout = model->addOperand(&type0);
7163 auto op43 = model->addOperand(&type70);
7164 // Phase 2, operations
7165 static int32_t param21_init[] = {0};
7166 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7167 static int32_t param22_init[] = {0};
7168 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7169 static int32_t param23_init[] = {0};
7170 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7171 static int32_t param24_init[] = {0};
7172 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7173 static int32_t param25_init[] = {1};
7174 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7175 static int32_t param26_init[] = {1};
7176 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7177 static int32_t param27_init[] = {1};
7178 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7179 static int32_t param28_init[] = {0};
7180 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7181 static bool8 layout_init[] = {false};
7182 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7183 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7184 // Phase 3, inputs and outputs
7185 model->identifyInputsAndOutputs(
7186 {op13, op23, op33},
7187 {op43});
7188 assert(model->isValid());
7189 }
7190
is_ignored_large_nhwc_weight_as_input_quant8_2(int i)7191 inline bool is_ignored_large_nhwc_weight_as_input_quant8_2(int i) {
7192 static std::set<int> ignore = {};
7193 return ignore.find(i) != ignore.end();
7194 }
7195
CreateModel_large_nhwc_weight_as_input_channelQuant8_2(Model * model)7196 void CreateModel_large_nhwc_weight_as_input_channelQuant8_2(Model *model) {
7197 OperandType type0(Type::BOOL, {});
7198 OperandType type4(Type::INT32, {});
7199 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
7200 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 4}, 50.0f, 0);
7201 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
7202 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
7203 // Phase 1, operands
7204 auto op13 = model->addOperand(&type41);
7205 auto op23 = model->addOperand(&type71);
7206 auto op33 = model->addOperand(&type72);
7207 auto param21 = model->addOperand(&type4);
7208 auto param22 = model->addOperand(&type4);
7209 auto param23 = model->addOperand(&type4);
7210 auto param24 = model->addOperand(&type4);
7211 auto param25 = model->addOperand(&type4);
7212 auto param26 = model->addOperand(&type4);
7213 auto param27 = model->addOperand(&type4);
7214 auto param28 = model->addOperand(&type4);
7215 auto layout = model->addOperand(&type0);
7216 auto op43 = model->addOperand(&type70);
7217 // Phase 2, operations
7218 static int32_t param21_init[] = {0};
7219 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7220 static int32_t param22_init[] = {0};
7221 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7222 static int32_t param23_init[] = {0};
7223 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7224 static int32_t param24_init[] = {0};
7225 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7226 static int32_t param25_init[] = {1};
7227 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7228 static int32_t param26_init[] = {1};
7229 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7230 static int32_t param27_init[] = {1};
7231 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7232 static int32_t param28_init[] = {0};
7233 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7234 static bool8 layout_init[] = {false};
7235 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7236 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7237 // Phase 3, inputs and outputs
7238 model->identifyInputsAndOutputs(
7239 {op13, op23, op33},
7240 {op43});
7241 assert(model->isValid());
7242 }
7243
is_ignored_large_nhwc_weight_as_input_channelQuant8_2(int i)7244 inline bool is_ignored_large_nhwc_weight_as_input_channelQuant8_2(int i) {
7245 static std::set<int> ignore = {};
7246 return ignore.find(i) != ignore.end();
7247 }
7248
CreateModel_large_nchw_2(Model * model)7249 void CreateModel_large_nchw_2(Model *model) {
7250 OperandType type0(Type::BOOL, {});
7251 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7252 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
7253 OperandType type3(Type::TENSOR_FLOAT32, {4});
7254 OperandType type4(Type::INT32, {});
7255 OperandType type73(Type::TENSOR_FLOAT32, {1, 4, 1, 1});
7256 // Phase 1, operands
7257 auto op13 = model->addOperand(&type28);
7258 auto op23 = model->addOperand(&type2);
7259 auto op33 = model->addOperand(&type3);
7260 auto param21 = model->addOperand(&type4);
7261 auto param22 = model->addOperand(&type4);
7262 auto param23 = model->addOperand(&type4);
7263 auto param24 = model->addOperand(&type4);
7264 auto param25 = model->addOperand(&type4);
7265 auto param26 = model->addOperand(&type4);
7266 auto param27 = model->addOperand(&type4);
7267 auto param28 = model->addOperand(&type4);
7268 auto layout = model->addOperand(&type0);
7269 auto op43 = model->addOperand(&type73);
7270 // Phase 2, operations
7271 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7272 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
7273 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7274 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
7275 static int32_t param21_init[] = {0};
7276 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7277 static int32_t param22_init[] = {0};
7278 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7279 static int32_t param23_init[] = {0};
7280 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7281 static int32_t param24_init[] = {0};
7282 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7283 static int32_t param25_init[] = {1};
7284 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7285 static int32_t param26_init[] = {1};
7286 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7287 static int32_t param27_init[] = {1};
7288 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7289 static int32_t param28_init[] = {0};
7290 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7291 static bool8 layout_init[] = {true};
7292 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7293 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7294 // Phase 3, inputs and outputs
7295 model->identifyInputsAndOutputs(
7296 {op13},
7297 {op43});
7298 assert(model->isValid());
7299 }
7300
is_ignored_large_nchw_2(int i)7301 inline bool is_ignored_large_nchw_2(int i) {
7302 static std::set<int> ignore = {};
7303 return ignore.find(i) != ignore.end();
7304 }
7305
CreateModel_large_nchw_relaxed_2(Model * model)7306 void CreateModel_large_nchw_relaxed_2(Model *model) {
7307 OperandType type0(Type::BOOL, {});
7308 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7309 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
7310 OperandType type3(Type::TENSOR_FLOAT32, {4});
7311 OperandType type4(Type::INT32, {});
7312 OperandType type73(Type::TENSOR_FLOAT32, {1, 4, 1, 1});
7313 // Phase 1, operands
7314 auto op13 = model->addOperand(&type28);
7315 auto op23 = model->addOperand(&type2);
7316 auto op33 = model->addOperand(&type3);
7317 auto param21 = model->addOperand(&type4);
7318 auto param22 = model->addOperand(&type4);
7319 auto param23 = model->addOperand(&type4);
7320 auto param24 = model->addOperand(&type4);
7321 auto param25 = model->addOperand(&type4);
7322 auto param26 = model->addOperand(&type4);
7323 auto param27 = model->addOperand(&type4);
7324 auto param28 = model->addOperand(&type4);
7325 auto layout = model->addOperand(&type0);
7326 auto op43 = model->addOperand(&type73);
7327 // Phase 2, operations
7328 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7329 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
7330 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7331 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
7332 static int32_t param21_init[] = {0};
7333 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7334 static int32_t param22_init[] = {0};
7335 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7336 static int32_t param23_init[] = {0};
7337 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7338 static int32_t param24_init[] = {0};
7339 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7340 static int32_t param25_init[] = {1};
7341 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7342 static int32_t param26_init[] = {1};
7343 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7344 static int32_t param27_init[] = {1};
7345 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7346 static int32_t param28_init[] = {0};
7347 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7348 static bool8 layout_init[] = {true};
7349 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7350 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7351 // Phase 3, inputs and outputs
7352 model->identifyInputsAndOutputs(
7353 {op13},
7354 {op43});
7355 // Phase 4: set relaxed execution
7356 model->relaxComputationFloat32toFloat16(true);
7357 assert(model->isValid());
7358 }
7359
is_ignored_large_nchw_relaxed_2(int i)7360 inline bool is_ignored_large_nchw_relaxed_2(int i) {
7361 static std::set<int> ignore = {};
7362 return ignore.find(i) != ignore.end();
7363 }
7364
CreateModel_large_nchw_float16_2(Model * model)7365 void CreateModel_large_nchw_float16_2(Model *model) {
7366 OperandType type0(Type::BOOL, {});
7367 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
7368 OperandType type17(Type::TENSOR_FLOAT16, {4});
7369 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
7370 OperandType type4(Type::INT32, {});
7371 OperandType type74(Type::TENSOR_FLOAT16, {1, 4, 1, 1});
7372 // Phase 1, operands
7373 auto op13 = model->addOperand(&type30);
7374 auto op23 = model->addOperand(&type16);
7375 auto op33 = model->addOperand(&type17);
7376 auto param21 = model->addOperand(&type4);
7377 auto param22 = model->addOperand(&type4);
7378 auto param23 = model->addOperand(&type4);
7379 auto param24 = model->addOperand(&type4);
7380 auto param25 = model->addOperand(&type4);
7381 auto param26 = model->addOperand(&type4);
7382 auto param27 = model->addOperand(&type4);
7383 auto param28 = model->addOperand(&type4);
7384 auto layout = model->addOperand(&type0);
7385 auto op43 = model->addOperand(&type74);
7386 // Phase 2, operations
7387 static _Float16 op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7388 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 16);
7389 static _Float16 op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7390 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 4);
7391 static int32_t param21_init[] = {0};
7392 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7393 static int32_t param22_init[] = {0};
7394 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7395 static int32_t param23_init[] = {0};
7396 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7397 static int32_t param24_init[] = {0};
7398 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7399 static int32_t param25_init[] = {1};
7400 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7401 static int32_t param26_init[] = {1};
7402 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7403 static int32_t param27_init[] = {1};
7404 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7405 static int32_t param28_init[] = {0};
7406 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7407 static bool8 layout_init[] = {true};
7408 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7409 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7410 // Phase 3, inputs and outputs
7411 model->identifyInputsAndOutputs(
7412 {op13},
7413 {op43});
7414 assert(model->isValid());
7415 }
7416
is_ignored_large_nchw_float16_2(int i)7417 inline bool is_ignored_large_nchw_float16_2(int i) {
7418 static std::set<int> ignore = {};
7419 return ignore.find(i) != ignore.end();
7420 }
7421
CreateModel_large_nchw_quant8_2(Model * model)7422 void CreateModel_large_nchw_quant8_2(Model *model) {
7423 OperandType type0(Type::BOOL, {});
7424 OperandType type4(Type::INT32, {});
7425 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
7426 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
7427 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
7428 OperandType type76(Type::TENSOR_QUANT8_ASYMM, {1, 4, 1, 1}, 50.0f, 0);
7429 // Phase 1, operands
7430 auto op13 = model->addOperand(&type75);
7431 auto op23 = model->addOperand(&type68);
7432 auto op33 = model->addOperand(&type69);
7433 auto param21 = model->addOperand(&type4);
7434 auto param22 = model->addOperand(&type4);
7435 auto param23 = model->addOperand(&type4);
7436 auto param24 = model->addOperand(&type4);
7437 auto param25 = model->addOperand(&type4);
7438 auto param26 = model->addOperand(&type4);
7439 auto param27 = model->addOperand(&type4);
7440 auto param28 = model->addOperand(&type4);
7441 auto layout = model->addOperand(&type0);
7442 auto op43 = model->addOperand(&type76);
7443 // Phase 2, operations
7444 static uint8_t op23_init[] = {1, 0, 40, 200, 1, 4, 80, 200, 1, 0, 120, 200, 1, 4, 160, 200};
7445 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 16);
7446 static int32_t op33_init[] = {48000, 56000, 64000, 72000};
7447 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
7448 static int32_t param21_init[] = {0};
7449 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7450 static int32_t param22_init[] = {0};
7451 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7452 static int32_t param23_init[] = {0};
7453 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7454 static int32_t param24_init[] = {0};
7455 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7456 static int32_t param25_init[] = {1};
7457 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7458 static int32_t param26_init[] = {1};
7459 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7460 static int32_t param27_init[] = {1};
7461 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7462 static int32_t param28_init[] = {0};
7463 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7464 static bool8 layout_init[] = {true};
7465 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7466 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7467 // Phase 3, inputs and outputs
7468 model->identifyInputsAndOutputs(
7469 {op13},
7470 {op43});
7471 assert(model->isValid());
7472 }
7473
is_ignored_large_nchw_quant8_2(int i)7474 inline bool is_ignored_large_nchw_quant8_2(int i) {
7475 static std::set<int> ignore = {};
7476 return ignore.find(i) != ignore.end();
7477 }
7478
CreateModel_large_nchw_channelQuant8_2(Model * model)7479 void CreateModel_large_nchw_channelQuant8_2(Model *model) {
7480 OperandType type0(Type::BOOL, {});
7481 OperandType type4(Type::INT32, {});
7482 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
7483 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
7484 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
7485 OperandType type76(Type::TENSOR_QUANT8_ASYMM, {1, 4, 1, 1}, 50.0f, 0);
7486 // Phase 1, operands
7487 auto op13 = model->addOperand(&type75);
7488 auto op23 = model->addOperand(&type71);
7489 auto op33 = model->addOperand(&type72);
7490 auto param21 = model->addOperand(&type4);
7491 auto param22 = model->addOperand(&type4);
7492 auto param23 = model->addOperand(&type4);
7493 auto param24 = model->addOperand(&type4);
7494 auto param25 = model->addOperand(&type4);
7495 auto param26 = model->addOperand(&type4);
7496 auto param27 = model->addOperand(&type4);
7497 auto param28 = model->addOperand(&type4);
7498 auto layout = model->addOperand(&type0);
7499 auto op43 = model->addOperand(&type76);
7500 // Phase 2, operations
7501 static int8_t op23_init[] = {0, 0, 10, 50, 0, 0, 20, 50, 0, 0, 30, 50, 0, 0, 40, 50};
7502 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 16);
7503 static int32_t op33_init[] = {12000, 7000, 16000, 18000};
7504 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
7505 static int32_t param21_init[] = {0};
7506 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7507 static int32_t param22_init[] = {0};
7508 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7509 static int32_t param23_init[] = {0};
7510 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7511 static int32_t param24_init[] = {0};
7512 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7513 static int32_t param25_init[] = {1};
7514 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7515 static int32_t param26_init[] = {1};
7516 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7517 static int32_t param27_init[] = {1};
7518 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7519 static int32_t param28_init[] = {0};
7520 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7521 static bool8 layout_init[] = {true};
7522 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7523 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7524 // Phase 3, inputs and outputs
7525 model->identifyInputsAndOutputs(
7526 {op13},
7527 {op43});
7528 assert(model->isValid());
7529 }
7530
is_ignored_large_nchw_channelQuant8_2(int i)7531 inline bool is_ignored_large_nchw_channelQuant8_2(int i) {
7532 static std::set<int> ignore = {};
7533 return ignore.find(i) != ignore.end();
7534 }
7535
CreateModel_large_nchw_weight_as_input_2(Model * model)7536 void CreateModel_large_nchw_weight_as_input_2(Model *model) {
7537 OperandType type0(Type::BOOL, {});
7538 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7539 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
7540 OperandType type3(Type::TENSOR_FLOAT32, {4});
7541 OperandType type4(Type::INT32, {});
7542 OperandType type73(Type::TENSOR_FLOAT32, {1, 4, 1, 1});
7543 // Phase 1, operands
7544 auto op13 = model->addOperand(&type28);
7545 auto op23 = model->addOperand(&type2);
7546 auto op33 = model->addOperand(&type3);
7547 auto param21 = model->addOperand(&type4);
7548 auto param22 = model->addOperand(&type4);
7549 auto param23 = model->addOperand(&type4);
7550 auto param24 = model->addOperand(&type4);
7551 auto param25 = model->addOperand(&type4);
7552 auto param26 = model->addOperand(&type4);
7553 auto param27 = model->addOperand(&type4);
7554 auto param28 = model->addOperand(&type4);
7555 auto layout = model->addOperand(&type0);
7556 auto op43 = model->addOperand(&type73);
7557 // Phase 2, operations
7558 static int32_t param21_init[] = {0};
7559 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7560 static int32_t param22_init[] = {0};
7561 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7562 static int32_t param23_init[] = {0};
7563 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7564 static int32_t param24_init[] = {0};
7565 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7566 static int32_t param25_init[] = {1};
7567 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7568 static int32_t param26_init[] = {1};
7569 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7570 static int32_t param27_init[] = {1};
7571 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7572 static int32_t param28_init[] = {0};
7573 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7574 static bool8 layout_init[] = {true};
7575 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7576 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7577 // Phase 3, inputs and outputs
7578 model->identifyInputsAndOutputs(
7579 {op13, op23, op33},
7580 {op43});
7581 assert(model->isValid());
7582 }
7583
is_ignored_large_nchw_weight_as_input_2(int i)7584 inline bool is_ignored_large_nchw_weight_as_input_2(int i) {
7585 static std::set<int> ignore = {};
7586 return ignore.find(i) != ignore.end();
7587 }
7588
CreateModel_large_nchw_weight_as_input_relaxed_2(Model * model)7589 void CreateModel_large_nchw_weight_as_input_relaxed_2(Model *model) {
7590 OperandType type0(Type::BOOL, {});
7591 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7592 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
7593 OperandType type3(Type::TENSOR_FLOAT32, {4});
7594 OperandType type4(Type::INT32, {});
7595 OperandType type73(Type::TENSOR_FLOAT32, {1, 4, 1, 1});
7596 // Phase 1, operands
7597 auto op13 = model->addOperand(&type28);
7598 auto op23 = model->addOperand(&type2);
7599 auto op33 = model->addOperand(&type3);
7600 auto param21 = model->addOperand(&type4);
7601 auto param22 = model->addOperand(&type4);
7602 auto param23 = model->addOperand(&type4);
7603 auto param24 = model->addOperand(&type4);
7604 auto param25 = model->addOperand(&type4);
7605 auto param26 = model->addOperand(&type4);
7606 auto param27 = model->addOperand(&type4);
7607 auto param28 = model->addOperand(&type4);
7608 auto layout = model->addOperand(&type0);
7609 auto op43 = model->addOperand(&type73);
7610 // Phase 2, operations
7611 static int32_t param21_init[] = {0};
7612 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7613 static int32_t param22_init[] = {0};
7614 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7615 static int32_t param23_init[] = {0};
7616 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7617 static int32_t param24_init[] = {0};
7618 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7619 static int32_t param25_init[] = {1};
7620 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7621 static int32_t param26_init[] = {1};
7622 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7623 static int32_t param27_init[] = {1};
7624 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7625 static int32_t param28_init[] = {0};
7626 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7627 static bool8 layout_init[] = {true};
7628 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7629 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7630 // Phase 3, inputs and outputs
7631 model->identifyInputsAndOutputs(
7632 {op13, op23, op33},
7633 {op43});
7634 // Phase 4: set relaxed execution
7635 model->relaxComputationFloat32toFloat16(true);
7636 assert(model->isValid());
7637 }
7638
is_ignored_large_nchw_weight_as_input_relaxed_2(int i)7639 inline bool is_ignored_large_nchw_weight_as_input_relaxed_2(int i) {
7640 static std::set<int> ignore = {};
7641 return ignore.find(i) != ignore.end();
7642 }
7643
CreateModel_large_nchw_weight_as_input_float16_2(Model * model)7644 void CreateModel_large_nchw_weight_as_input_float16_2(Model *model) {
7645 OperandType type0(Type::BOOL, {});
7646 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
7647 OperandType type17(Type::TENSOR_FLOAT16, {4});
7648 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
7649 OperandType type4(Type::INT32, {});
7650 OperandType type74(Type::TENSOR_FLOAT16, {1, 4, 1, 1});
7651 // Phase 1, operands
7652 auto op13 = model->addOperand(&type30);
7653 auto op23 = model->addOperand(&type16);
7654 auto op33 = model->addOperand(&type17);
7655 auto param21 = model->addOperand(&type4);
7656 auto param22 = model->addOperand(&type4);
7657 auto param23 = model->addOperand(&type4);
7658 auto param24 = model->addOperand(&type4);
7659 auto param25 = model->addOperand(&type4);
7660 auto param26 = model->addOperand(&type4);
7661 auto param27 = model->addOperand(&type4);
7662 auto param28 = model->addOperand(&type4);
7663 auto layout = model->addOperand(&type0);
7664 auto op43 = model->addOperand(&type74);
7665 // Phase 2, operations
7666 static int32_t param21_init[] = {0};
7667 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7668 static int32_t param22_init[] = {0};
7669 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7670 static int32_t param23_init[] = {0};
7671 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7672 static int32_t param24_init[] = {0};
7673 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7674 static int32_t param25_init[] = {1};
7675 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7676 static int32_t param26_init[] = {1};
7677 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7678 static int32_t param27_init[] = {1};
7679 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7680 static int32_t param28_init[] = {0};
7681 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7682 static bool8 layout_init[] = {true};
7683 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7684 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7685 // Phase 3, inputs and outputs
7686 model->identifyInputsAndOutputs(
7687 {op13, op23, op33},
7688 {op43});
7689 assert(model->isValid());
7690 }
7691
is_ignored_large_nchw_weight_as_input_float16_2(int i)7692 inline bool is_ignored_large_nchw_weight_as_input_float16_2(int i) {
7693 static std::set<int> ignore = {};
7694 return ignore.find(i) != ignore.end();
7695 }
7696
CreateModel_large_nchw_weight_as_input_quant8_2(Model * model)7697 void CreateModel_large_nchw_weight_as_input_quant8_2(Model *model) {
7698 OperandType type0(Type::BOOL, {});
7699 OperandType type4(Type::INT32, {});
7700 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
7701 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
7702 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
7703 OperandType type76(Type::TENSOR_QUANT8_ASYMM, {1, 4, 1, 1}, 50.0f, 0);
7704 // Phase 1, operands
7705 auto op13 = model->addOperand(&type75);
7706 auto op23 = model->addOperand(&type68);
7707 auto op33 = model->addOperand(&type69);
7708 auto param21 = model->addOperand(&type4);
7709 auto param22 = model->addOperand(&type4);
7710 auto param23 = model->addOperand(&type4);
7711 auto param24 = model->addOperand(&type4);
7712 auto param25 = model->addOperand(&type4);
7713 auto param26 = model->addOperand(&type4);
7714 auto param27 = model->addOperand(&type4);
7715 auto param28 = model->addOperand(&type4);
7716 auto layout = model->addOperand(&type0);
7717 auto op43 = model->addOperand(&type76);
7718 // Phase 2, operations
7719 static int32_t param21_init[] = {0};
7720 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7721 static int32_t param22_init[] = {0};
7722 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7723 static int32_t param23_init[] = {0};
7724 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7725 static int32_t param24_init[] = {0};
7726 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7727 static int32_t param25_init[] = {1};
7728 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7729 static int32_t param26_init[] = {1};
7730 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7731 static int32_t param27_init[] = {1};
7732 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7733 static int32_t param28_init[] = {0};
7734 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7735 static bool8 layout_init[] = {true};
7736 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7737 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7738 // Phase 3, inputs and outputs
7739 model->identifyInputsAndOutputs(
7740 {op13, op23, op33},
7741 {op43});
7742 assert(model->isValid());
7743 }
7744
is_ignored_large_nchw_weight_as_input_quant8_2(int i)7745 inline bool is_ignored_large_nchw_weight_as_input_quant8_2(int i) {
7746 static std::set<int> ignore = {};
7747 return ignore.find(i) != ignore.end();
7748 }
7749
CreateModel_large_nchw_weight_as_input_channelQuant8_2(Model * model)7750 void CreateModel_large_nchw_weight_as_input_channelQuant8_2(Model *model) {
7751 OperandType type0(Type::BOOL, {});
7752 OperandType type4(Type::INT32, {});
7753 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
7754 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
7755 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
7756 OperandType type76(Type::TENSOR_QUANT8_ASYMM, {1, 4, 1, 1}, 50.0f, 0);
7757 // Phase 1, operands
7758 auto op13 = model->addOperand(&type75);
7759 auto op23 = model->addOperand(&type71);
7760 auto op33 = model->addOperand(&type72);
7761 auto param21 = model->addOperand(&type4);
7762 auto param22 = model->addOperand(&type4);
7763 auto param23 = model->addOperand(&type4);
7764 auto param24 = model->addOperand(&type4);
7765 auto param25 = model->addOperand(&type4);
7766 auto param26 = model->addOperand(&type4);
7767 auto param27 = model->addOperand(&type4);
7768 auto param28 = model->addOperand(&type4);
7769 auto layout = model->addOperand(&type0);
7770 auto op43 = model->addOperand(&type76);
7771 // Phase 2, operations
7772 static int32_t param21_init[] = {0};
7773 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7774 static int32_t param22_init[] = {0};
7775 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7776 static int32_t param23_init[] = {0};
7777 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7778 static int32_t param24_init[] = {0};
7779 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7780 static int32_t param25_init[] = {1};
7781 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7782 static int32_t param26_init[] = {1};
7783 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7784 static int32_t param27_init[] = {1};
7785 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7786 static int32_t param28_init[] = {0};
7787 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7788 static bool8 layout_init[] = {true};
7789 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7790 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7791 // Phase 3, inputs and outputs
7792 model->identifyInputsAndOutputs(
7793 {op13, op23, op33},
7794 {op43});
7795 assert(model->isValid());
7796 }
7797
is_ignored_large_nchw_weight_as_input_channelQuant8_2(int i)7798 inline bool is_ignored_large_nchw_weight_as_input_channelQuant8_2(int i) {
7799 static std::set<int> ignore = {};
7800 return ignore.find(i) != ignore.end();
7801 }
7802
CreateModel_large_dynamic_output_shape_nhwc_2(Model * model)7803 void CreateModel_large_dynamic_output_shape_nhwc_2(Model *model) {
7804 OperandType type0(Type::BOOL, {});
7805 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7806 OperandType type3(Type::TENSOR_FLOAT32, {4});
7807 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7808 OperandType type4(Type::INT32, {});
7809 // Phase 1, operands
7810 auto op13 = model->addOperand(&type2);
7811 auto op23 = model->addOperand(&type2);
7812 auto op33 = model->addOperand(&type3);
7813 auto param21 = model->addOperand(&type4);
7814 auto param22 = model->addOperand(&type4);
7815 auto param23 = model->addOperand(&type4);
7816 auto param24 = model->addOperand(&type4);
7817 auto param25 = model->addOperand(&type4);
7818 auto param26 = model->addOperand(&type4);
7819 auto param27 = model->addOperand(&type4);
7820 auto param28 = model->addOperand(&type4);
7821 auto layout = model->addOperand(&type0);
7822 auto op43 = model->addOperand(&type34);
7823 // Phase 2, operations
7824 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7825 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
7826 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7827 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
7828 static int32_t param21_init[] = {0};
7829 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7830 static int32_t param22_init[] = {0};
7831 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7832 static int32_t param23_init[] = {0};
7833 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7834 static int32_t param24_init[] = {0};
7835 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7836 static int32_t param25_init[] = {1};
7837 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7838 static int32_t param26_init[] = {1};
7839 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7840 static int32_t param27_init[] = {1};
7841 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7842 static int32_t param28_init[] = {0};
7843 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7844 static bool8 layout_init[] = {false};
7845 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7846 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7847 // Phase 3, inputs and outputs
7848 model->identifyInputsAndOutputs(
7849 {op13},
7850 {op43});
7851 assert(model->isValid());
7852 }
7853
is_ignored_large_dynamic_output_shape_nhwc_2(int i)7854 inline bool is_ignored_large_dynamic_output_shape_nhwc_2(int i) {
7855 static std::set<int> ignore = {};
7856 return ignore.find(i) != ignore.end();
7857 }
7858
CreateModel_large_dynamic_output_shape_nhwc_relaxed_2(Model * model)7859 void CreateModel_large_dynamic_output_shape_nhwc_relaxed_2(Model *model) {
7860 OperandType type0(Type::BOOL, {});
7861 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
7862 OperandType type3(Type::TENSOR_FLOAT32, {4});
7863 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
7864 OperandType type4(Type::INT32, {});
7865 // Phase 1, operands
7866 auto op13 = model->addOperand(&type2);
7867 auto op23 = model->addOperand(&type2);
7868 auto op33 = model->addOperand(&type3);
7869 auto param21 = model->addOperand(&type4);
7870 auto param22 = model->addOperand(&type4);
7871 auto param23 = model->addOperand(&type4);
7872 auto param24 = model->addOperand(&type4);
7873 auto param25 = model->addOperand(&type4);
7874 auto param26 = model->addOperand(&type4);
7875 auto param27 = model->addOperand(&type4);
7876 auto param28 = model->addOperand(&type4);
7877 auto layout = model->addOperand(&type0);
7878 auto op43 = model->addOperand(&type34);
7879 // Phase 2, operations
7880 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7881 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
7882 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7883 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
7884 static int32_t param21_init[] = {0};
7885 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7886 static int32_t param22_init[] = {0};
7887 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7888 static int32_t param23_init[] = {0};
7889 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7890 static int32_t param24_init[] = {0};
7891 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7892 static int32_t param25_init[] = {1};
7893 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7894 static int32_t param26_init[] = {1};
7895 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7896 static int32_t param27_init[] = {1};
7897 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7898 static int32_t param28_init[] = {0};
7899 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7900 static bool8 layout_init[] = {false};
7901 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7902 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7903 // Phase 3, inputs and outputs
7904 model->identifyInputsAndOutputs(
7905 {op13},
7906 {op43});
7907 // Phase 4: set relaxed execution
7908 model->relaxComputationFloat32toFloat16(true);
7909 assert(model->isValid());
7910 }
7911
is_ignored_large_dynamic_output_shape_nhwc_relaxed_2(int i)7912 inline bool is_ignored_large_dynamic_output_shape_nhwc_relaxed_2(int i) {
7913 static std::set<int> ignore = {};
7914 return ignore.find(i) != ignore.end();
7915 }
7916
CreateModel_large_dynamic_output_shape_nhwc_float16_2(Model * model)7917 void CreateModel_large_dynamic_output_shape_nhwc_float16_2(Model *model) {
7918 OperandType type0(Type::BOOL, {});
7919 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
7920 OperandType type17(Type::TENSOR_FLOAT16, {4});
7921 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
7922 OperandType type4(Type::INT32, {});
7923 // Phase 1, operands
7924 auto op13 = model->addOperand(&type16);
7925 auto op23 = model->addOperand(&type16);
7926 auto op33 = model->addOperand(&type17);
7927 auto param21 = model->addOperand(&type4);
7928 auto param22 = model->addOperand(&type4);
7929 auto param23 = model->addOperand(&type4);
7930 auto param24 = model->addOperand(&type4);
7931 auto param25 = model->addOperand(&type4);
7932 auto param26 = model->addOperand(&type4);
7933 auto param27 = model->addOperand(&type4);
7934 auto param28 = model->addOperand(&type4);
7935 auto layout = model->addOperand(&type0);
7936 auto op43 = model->addOperand(&type35);
7937 // Phase 2, operations
7938 static _Float16 op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
7939 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 16);
7940 static _Float16 op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
7941 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 4);
7942 static int32_t param21_init[] = {0};
7943 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
7944 static int32_t param22_init[] = {0};
7945 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
7946 static int32_t param23_init[] = {0};
7947 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
7948 static int32_t param24_init[] = {0};
7949 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
7950 static int32_t param25_init[] = {1};
7951 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
7952 static int32_t param26_init[] = {1};
7953 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
7954 static int32_t param27_init[] = {1};
7955 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
7956 static int32_t param28_init[] = {0};
7957 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
7958 static bool8 layout_init[] = {false};
7959 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
7960 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
7961 // Phase 3, inputs and outputs
7962 model->identifyInputsAndOutputs(
7963 {op13},
7964 {op43});
7965 assert(model->isValid());
7966 }
7967
is_ignored_large_dynamic_output_shape_nhwc_float16_2(int i)7968 inline bool is_ignored_large_dynamic_output_shape_nhwc_float16_2(int i) {
7969 static std::set<int> ignore = {};
7970 return ignore.find(i) != ignore.end();
7971 }
7972
CreateModel_large_dynamic_output_shape_nhwc_quant8_2(Model * model)7973 void CreateModel_large_dynamic_output_shape_nhwc_quant8_2(Model *model) {
7974 OperandType type0(Type::BOOL, {});
7975 OperandType type4(Type::INT32, {});
7976 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
7977 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
7978 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
7979 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
7980 // Phase 1, operands
7981 auto op13 = model->addOperand(&type41);
7982 auto op23 = model->addOperand(&type68);
7983 auto op33 = model->addOperand(&type69);
7984 auto param21 = model->addOperand(&type4);
7985 auto param22 = model->addOperand(&type4);
7986 auto param23 = model->addOperand(&type4);
7987 auto param24 = model->addOperand(&type4);
7988 auto param25 = model->addOperand(&type4);
7989 auto param26 = model->addOperand(&type4);
7990 auto param27 = model->addOperand(&type4);
7991 auto param28 = model->addOperand(&type4);
7992 auto layout = model->addOperand(&type0);
7993 auto op43 = model->addOperand(&type77);
7994 // Phase 2, operations
7995 static uint8_t op23_init[] = {1, 0, 40, 200, 1, 4, 80, 200, 1, 0, 120, 200, 1, 4, 160, 200};
7996 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 16);
7997 static int32_t op33_init[] = {48000, 56000, 64000, 72000};
7998 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
7999 static int32_t param21_init[] = {0};
8000 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8001 static int32_t param22_init[] = {0};
8002 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8003 static int32_t param23_init[] = {0};
8004 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8005 static int32_t param24_init[] = {0};
8006 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8007 static int32_t param25_init[] = {1};
8008 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8009 static int32_t param26_init[] = {1};
8010 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8011 static int32_t param27_init[] = {1};
8012 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8013 static int32_t param28_init[] = {0};
8014 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8015 static bool8 layout_init[] = {false};
8016 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8017 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8018 // Phase 3, inputs and outputs
8019 model->identifyInputsAndOutputs(
8020 {op13},
8021 {op43});
8022 assert(model->isValid());
8023 }
8024
is_ignored_large_dynamic_output_shape_nhwc_quant8_2(int i)8025 inline bool is_ignored_large_dynamic_output_shape_nhwc_quant8_2(int i) {
8026 static std::set<int> ignore = {};
8027 return ignore.find(i) != ignore.end();
8028 }
8029
CreateModel_large_dynamic_output_shape_nhwc_channelQuant8_2(Model * model)8030 void CreateModel_large_dynamic_output_shape_nhwc_channelQuant8_2(Model *model) {
8031 OperandType type0(Type::BOOL, {});
8032 OperandType type4(Type::INT32, {});
8033 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
8034 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
8035 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
8036 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8037 // Phase 1, operands
8038 auto op13 = model->addOperand(&type41);
8039 auto op23 = model->addOperand(&type71);
8040 auto op33 = model->addOperand(&type72);
8041 auto param21 = model->addOperand(&type4);
8042 auto param22 = model->addOperand(&type4);
8043 auto param23 = model->addOperand(&type4);
8044 auto param24 = model->addOperand(&type4);
8045 auto param25 = model->addOperand(&type4);
8046 auto param26 = model->addOperand(&type4);
8047 auto param27 = model->addOperand(&type4);
8048 auto param28 = model->addOperand(&type4);
8049 auto layout = model->addOperand(&type0);
8050 auto op43 = model->addOperand(&type77);
8051 // Phase 2, operations
8052 static int8_t op23_init[] = {0, 0, 10, 50, 0, 0, 20, 50, 0, 0, 30, 50, 0, 0, 40, 50};
8053 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 16);
8054 static int32_t op33_init[] = {12000, 7000, 16000, 18000};
8055 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
8056 static int32_t param21_init[] = {0};
8057 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8058 static int32_t param22_init[] = {0};
8059 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8060 static int32_t param23_init[] = {0};
8061 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8062 static int32_t param24_init[] = {0};
8063 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8064 static int32_t param25_init[] = {1};
8065 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8066 static int32_t param26_init[] = {1};
8067 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8068 static int32_t param27_init[] = {1};
8069 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8070 static int32_t param28_init[] = {0};
8071 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8072 static bool8 layout_init[] = {false};
8073 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8074 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8075 // Phase 3, inputs and outputs
8076 model->identifyInputsAndOutputs(
8077 {op13},
8078 {op43});
8079 assert(model->isValid());
8080 }
8081
is_ignored_large_dynamic_output_shape_nhwc_channelQuant8_2(int i)8082 inline bool is_ignored_large_dynamic_output_shape_nhwc_channelQuant8_2(int i) {
8083 static std::set<int> ignore = {};
8084 return ignore.find(i) != ignore.end();
8085 }
8086
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_2(Model * model)8087 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) {
8088 OperandType type0(Type::BOOL, {});
8089 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8090 OperandType type3(Type::TENSOR_FLOAT32, {4});
8091 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8092 OperandType type4(Type::INT32, {});
8093 // Phase 1, operands
8094 auto op13 = model->addOperand(&type2);
8095 auto op23 = model->addOperand(&type2);
8096 auto op33 = model->addOperand(&type3);
8097 auto param21 = model->addOperand(&type4);
8098 auto param22 = model->addOperand(&type4);
8099 auto param23 = model->addOperand(&type4);
8100 auto param24 = model->addOperand(&type4);
8101 auto param25 = model->addOperand(&type4);
8102 auto param26 = model->addOperand(&type4);
8103 auto param27 = model->addOperand(&type4);
8104 auto param28 = model->addOperand(&type4);
8105 auto layout = model->addOperand(&type0);
8106 auto op43 = model->addOperand(&type34);
8107 // Phase 2, operations
8108 static int32_t param21_init[] = {0};
8109 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8110 static int32_t param22_init[] = {0};
8111 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8112 static int32_t param23_init[] = {0};
8113 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8114 static int32_t param24_init[] = {0};
8115 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8116 static int32_t param25_init[] = {1};
8117 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8118 static int32_t param26_init[] = {1};
8119 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8120 static int32_t param27_init[] = {1};
8121 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8122 static int32_t param28_init[] = {0};
8123 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8124 static bool8 layout_init[] = {false};
8125 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8126 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8127 // Phase 3, inputs and outputs
8128 model->identifyInputsAndOutputs(
8129 {op13, op23, op33},
8130 {op43});
8131 assert(model->isValid());
8132 }
8133
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_2(int i)8134 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_2(int i) {
8135 static std::set<int> ignore = {};
8136 return ignore.find(i) != ignore.end();
8137 }
8138
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model * model)8139 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model *model) {
8140 OperandType type0(Type::BOOL, {});
8141 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8142 OperandType type3(Type::TENSOR_FLOAT32, {4});
8143 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8144 OperandType type4(Type::INT32, {});
8145 // Phase 1, operands
8146 auto op13 = model->addOperand(&type2);
8147 auto op23 = model->addOperand(&type2);
8148 auto op33 = model->addOperand(&type3);
8149 auto param21 = model->addOperand(&type4);
8150 auto param22 = model->addOperand(&type4);
8151 auto param23 = model->addOperand(&type4);
8152 auto param24 = model->addOperand(&type4);
8153 auto param25 = model->addOperand(&type4);
8154 auto param26 = model->addOperand(&type4);
8155 auto param27 = model->addOperand(&type4);
8156 auto param28 = model->addOperand(&type4);
8157 auto layout = model->addOperand(&type0);
8158 auto op43 = model->addOperand(&type34);
8159 // Phase 2, operations
8160 static int32_t param21_init[] = {0};
8161 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8162 static int32_t param22_init[] = {0};
8163 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8164 static int32_t param23_init[] = {0};
8165 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8166 static int32_t param24_init[] = {0};
8167 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8168 static int32_t param25_init[] = {1};
8169 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8170 static int32_t param26_init[] = {1};
8171 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8172 static int32_t param27_init[] = {1};
8173 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8174 static int32_t param28_init[] = {0};
8175 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8176 static bool8 layout_init[] = {false};
8177 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8178 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8179 // Phase 3, inputs and outputs
8180 model->identifyInputsAndOutputs(
8181 {op13, op23, op33},
8182 {op43});
8183 // Phase 4: set relaxed execution
8184 model->relaxComputationFloat32toFloat16(true);
8185 assert(model->isValid());
8186 }
8187
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i)8188 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i) {
8189 static std::set<int> ignore = {};
8190 return ignore.find(i) != ignore.end();
8191 }
8192
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model * model)8193 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model *model) {
8194 OperandType type0(Type::BOOL, {});
8195 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
8196 OperandType type17(Type::TENSOR_FLOAT16, {4});
8197 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8198 OperandType type4(Type::INT32, {});
8199 // Phase 1, operands
8200 auto op13 = model->addOperand(&type16);
8201 auto op23 = model->addOperand(&type16);
8202 auto op33 = model->addOperand(&type17);
8203 auto param21 = model->addOperand(&type4);
8204 auto param22 = model->addOperand(&type4);
8205 auto param23 = model->addOperand(&type4);
8206 auto param24 = model->addOperand(&type4);
8207 auto param25 = model->addOperand(&type4);
8208 auto param26 = model->addOperand(&type4);
8209 auto param27 = model->addOperand(&type4);
8210 auto param28 = model->addOperand(&type4);
8211 auto layout = model->addOperand(&type0);
8212 auto op43 = model->addOperand(&type35);
8213 // Phase 2, operations
8214 static int32_t param21_init[] = {0};
8215 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8216 static int32_t param22_init[] = {0};
8217 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8218 static int32_t param23_init[] = {0};
8219 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8220 static int32_t param24_init[] = {0};
8221 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8222 static int32_t param25_init[] = {1};
8223 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8224 static int32_t param26_init[] = {1};
8225 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8226 static int32_t param27_init[] = {1};
8227 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8228 static int32_t param28_init[] = {0};
8229 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8230 static bool8 layout_init[] = {false};
8231 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8232 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8233 // Phase 3, inputs and outputs
8234 model->identifyInputsAndOutputs(
8235 {op13, op23, op33},
8236 {op43});
8237 assert(model->isValid());
8238 }
8239
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i)8240 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i) {
8241 static std::set<int> ignore = {};
8242 return ignore.find(i) != ignore.end();
8243 }
8244
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model * model)8245 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model *model) {
8246 OperandType type0(Type::BOOL, {});
8247 OperandType type4(Type::INT32, {});
8248 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
8249 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
8250 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
8251 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8252 // Phase 1, operands
8253 auto op13 = model->addOperand(&type41);
8254 auto op23 = model->addOperand(&type68);
8255 auto op33 = model->addOperand(&type69);
8256 auto param21 = model->addOperand(&type4);
8257 auto param22 = model->addOperand(&type4);
8258 auto param23 = model->addOperand(&type4);
8259 auto param24 = model->addOperand(&type4);
8260 auto param25 = model->addOperand(&type4);
8261 auto param26 = model->addOperand(&type4);
8262 auto param27 = model->addOperand(&type4);
8263 auto param28 = model->addOperand(&type4);
8264 auto layout = model->addOperand(&type0);
8265 auto op43 = model->addOperand(&type77);
8266 // Phase 2, operations
8267 static int32_t param21_init[] = {0};
8268 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8269 static int32_t param22_init[] = {0};
8270 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8271 static int32_t param23_init[] = {0};
8272 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8273 static int32_t param24_init[] = {0};
8274 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8275 static int32_t param25_init[] = {1};
8276 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8277 static int32_t param26_init[] = {1};
8278 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8279 static int32_t param27_init[] = {1};
8280 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8281 static int32_t param28_init[] = {0};
8282 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8283 static bool8 layout_init[] = {false};
8284 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8285 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8286 // Phase 3, inputs and outputs
8287 model->identifyInputsAndOutputs(
8288 {op13, op23, op33},
8289 {op43});
8290 assert(model->isValid());
8291 }
8292
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i)8293 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i) {
8294 static std::set<int> ignore = {};
8295 return ignore.find(i) != ignore.end();
8296 }
8297
CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model * model)8298 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model *model) {
8299 OperandType type0(Type::BOOL, {});
8300 OperandType type4(Type::INT32, {});
8301 OperandType type41(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
8302 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
8303 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
8304 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8305 // Phase 1, operands
8306 auto op13 = model->addOperand(&type41);
8307 auto op23 = model->addOperand(&type71);
8308 auto op33 = model->addOperand(&type72);
8309 auto param21 = model->addOperand(&type4);
8310 auto param22 = model->addOperand(&type4);
8311 auto param23 = model->addOperand(&type4);
8312 auto param24 = model->addOperand(&type4);
8313 auto param25 = model->addOperand(&type4);
8314 auto param26 = model->addOperand(&type4);
8315 auto param27 = model->addOperand(&type4);
8316 auto param28 = model->addOperand(&type4);
8317 auto layout = model->addOperand(&type0);
8318 auto op43 = model->addOperand(&type77);
8319 // Phase 2, operations
8320 static int32_t param21_init[] = {0};
8321 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8322 static int32_t param22_init[] = {0};
8323 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8324 static int32_t param23_init[] = {0};
8325 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8326 static int32_t param24_init[] = {0};
8327 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8328 static int32_t param25_init[] = {1};
8329 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8330 static int32_t param26_init[] = {1};
8331 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8332 static int32_t param27_init[] = {1};
8333 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8334 static int32_t param28_init[] = {0};
8335 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8336 static bool8 layout_init[] = {false};
8337 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8338 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8339 // Phase 3, inputs and outputs
8340 model->identifyInputsAndOutputs(
8341 {op13, op23, op33},
8342 {op43});
8343 assert(model->isValid());
8344 }
8345
is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i)8346 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i) {
8347 static std::set<int> ignore = {};
8348 return ignore.find(i) != ignore.end();
8349 }
8350
CreateModel_large_dynamic_output_shape_nchw_2(Model * model)8351 void CreateModel_large_dynamic_output_shape_nchw_2(Model *model) {
8352 OperandType type0(Type::BOOL, {});
8353 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8354 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
8355 OperandType type3(Type::TENSOR_FLOAT32, {4});
8356 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8357 OperandType type4(Type::INT32, {});
8358 // Phase 1, operands
8359 auto op13 = model->addOperand(&type28);
8360 auto op23 = model->addOperand(&type2);
8361 auto op33 = model->addOperand(&type3);
8362 auto param21 = model->addOperand(&type4);
8363 auto param22 = model->addOperand(&type4);
8364 auto param23 = model->addOperand(&type4);
8365 auto param24 = model->addOperand(&type4);
8366 auto param25 = model->addOperand(&type4);
8367 auto param26 = model->addOperand(&type4);
8368 auto param27 = model->addOperand(&type4);
8369 auto param28 = model->addOperand(&type4);
8370 auto layout = model->addOperand(&type0);
8371 auto op43 = model->addOperand(&type34);
8372 // Phase 2, operations
8373 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
8374 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
8375 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
8376 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
8377 static int32_t param21_init[] = {0};
8378 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8379 static int32_t param22_init[] = {0};
8380 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8381 static int32_t param23_init[] = {0};
8382 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8383 static int32_t param24_init[] = {0};
8384 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8385 static int32_t param25_init[] = {1};
8386 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8387 static int32_t param26_init[] = {1};
8388 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8389 static int32_t param27_init[] = {1};
8390 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8391 static int32_t param28_init[] = {0};
8392 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8393 static bool8 layout_init[] = {true};
8394 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8395 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8396 // Phase 3, inputs and outputs
8397 model->identifyInputsAndOutputs(
8398 {op13},
8399 {op43});
8400 assert(model->isValid());
8401 }
8402
is_ignored_large_dynamic_output_shape_nchw_2(int i)8403 inline bool is_ignored_large_dynamic_output_shape_nchw_2(int i) {
8404 static std::set<int> ignore = {};
8405 return ignore.find(i) != ignore.end();
8406 }
8407
CreateModel_large_dynamic_output_shape_nchw_relaxed_2(Model * model)8408 void CreateModel_large_dynamic_output_shape_nchw_relaxed_2(Model *model) {
8409 OperandType type0(Type::BOOL, {});
8410 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8411 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
8412 OperandType type3(Type::TENSOR_FLOAT32, {4});
8413 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8414 OperandType type4(Type::INT32, {});
8415 // Phase 1, operands
8416 auto op13 = model->addOperand(&type28);
8417 auto op23 = model->addOperand(&type2);
8418 auto op33 = model->addOperand(&type3);
8419 auto param21 = model->addOperand(&type4);
8420 auto param22 = model->addOperand(&type4);
8421 auto param23 = model->addOperand(&type4);
8422 auto param24 = model->addOperand(&type4);
8423 auto param25 = model->addOperand(&type4);
8424 auto param26 = model->addOperand(&type4);
8425 auto param27 = model->addOperand(&type4);
8426 auto param28 = model->addOperand(&type4);
8427 auto layout = model->addOperand(&type0);
8428 auto op43 = model->addOperand(&type34);
8429 // Phase 2, operations
8430 static float op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
8431 model->setOperandValue(op23, op23_init, sizeof(float) * 16);
8432 static float op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
8433 model->setOperandValue(op33, op33_init, sizeof(float) * 4);
8434 static int32_t param21_init[] = {0};
8435 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8436 static int32_t param22_init[] = {0};
8437 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8438 static int32_t param23_init[] = {0};
8439 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8440 static int32_t param24_init[] = {0};
8441 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8442 static int32_t param25_init[] = {1};
8443 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8444 static int32_t param26_init[] = {1};
8445 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8446 static int32_t param27_init[] = {1};
8447 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8448 static int32_t param28_init[] = {0};
8449 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8450 static bool8 layout_init[] = {true};
8451 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8452 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8453 // Phase 3, inputs and outputs
8454 model->identifyInputsAndOutputs(
8455 {op13},
8456 {op43});
8457 // Phase 4: set relaxed execution
8458 model->relaxComputationFloat32toFloat16(true);
8459 assert(model->isValid());
8460 }
8461
is_ignored_large_dynamic_output_shape_nchw_relaxed_2(int i)8462 inline bool is_ignored_large_dynamic_output_shape_nchw_relaxed_2(int i) {
8463 static std::set<int> ignore = {};
8464 return ignore.find(i) != ignore.end();
8465 }
8466
CreateModel_large_dynamic_output_shape_nchw_float16_2(Model * model)8467 void CreateModel_large_dynamic_output_shape_nchw_float16_2(Model *model) {
8468 OperandType type0(Type::BOOL, {});
8469 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
8470 OperandType type17(Type::TENSOR_FLOAT16, {4});
8471 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
8472 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8473 OperandType type4(Type::INT32, {});
8474 // Phase 1, operands
8475 auto op13 = model->addOperand(&type30);
8476 auto op23 = model->addOperand(&type16);
8477 auto op33 = model->addOperand(&type17);
8478 auto param21 = model->addOperand(&type4);
8479 auto param22 = model->addOperand(&type4);
8480 auto param23 = model->addOperand(&type4);
8481 auto param24 = model->addOperand(&type4);
8482 auto param25 = model->addOperand(&type4);
8483 auto param26 = model->addOperand(&type4);
8484 auto param27 = model->addOperand(&type4);
8485 auto param28 = model->addOperand(&type4);
8486 auto layout = model->addOperand(&type0);
8487 auto op43 = model->addOperand(&type35);
8488 // Phase 2, operations
8489 static _Float16 op23_init[] = {0.25f, 0.0f, 10.0f, 50.0f, 0.25f, 1.0f, 20.0f, 50.0f, 0.25f, 0.0f, 30.0f, 50.0f, 0.25f, 1.0f, 40.0f, 50.0f};
8490 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 16);
8491 static _Float16 op33_init[] = {6000.0f, 7000.0f, 8000.0f, 9000.0f};
8492 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 4);
8493 static int32_t param21_init[] = {0};
8494 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8495 static int32_t param22_init[] = {0};
8496 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8497 static int32_t param23_init[] = {0};
8498 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8499 static int32_t param24_init[] = {0};
8500 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8501 static int32_t param25_init[] = {1};
8502 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8503 static int32_t param26_init[] = {1};
8504 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8505 static int32_t param27_init[] = {1};
8506 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8507 static int32_t param28_init[] = {0};
8508 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8509 static bool8 layout_init[] = {true};
8510 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8511 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8512 // Phase 3, inputs and outputs
8513 model->identifyInputsAndOutputs(
8514 {op13},
8515 {op43});
8516 assert(model->isValid());
8517 }
8518
is_ignored_large_dynamic_output_shape_nchw_float16_2(int i)8519 inline bool is_ignored_large_dynamic_output_shape_nchw_float16_2(int i) {
8520 static std::set<int> ignore = {};
8521 return ignore.find(i) != ignore.end();
8522 }
8523
CreateModel_large_dynamic_output_shape_nchw_quant8_2(Model * model)8524 void CreateModel_large_dynamic_output_shape_nchw_quant8_2(Model *model) {
8525 OperandType type0(Type::BOOL, {});
8526 OperandType type4(Type::INT32, {});
8527 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
8528 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
8529 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
8530 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8531 // Phase 1, operands
8532 auto op13 = model->addOperand(&type75);
8533 auto op23 = model->addOperand(&type68);
8534 auto op33 = model->addOperand(&type69);
8535 auto param21 = model->addOperand(&type4);
8536 auto param22 = model->addOperand(&type4);
8537 auto param23 = model->addOperand(&type4);
8538 auto param24 = model->addOperand(&type4);
8539 auto param25 = model->addOperand(&type4);
8540 auto param26 = model->addOperand(&type4);
8541 auto param27 = model->addOperand(&type4);
8542 auto param28 = model->addOperand(&type4);
8543 auto layout = model->addOperand(&type0);
8544 auto op43 = model->addOperand(&type77);
8545 // Phase 2, operations
8546 static uint8_t op23_init[] = {1, 0, 40, 200, 1, 4, 80, 200, 1, 0, 120, 200, 1, 4, 160, 200};
8547 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 16);
8548 static int32_t op33_init[] = {48000, 56000, 64000, 72000};
8549 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
8550 static int32_t param21_init[] = {0};
8551 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8552 static int32_t param22_init[] = {0};
8553 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8554 static int32_t param23_init[] = {0};
8555 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8556 static int32_t param24_init[] = {0};
8557 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8558 static int32_t param25_init[] = {1};
8559 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8560 static int32_t param26_init[] = {1};
8561 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8562 static int32_t param27_init[] = {1};
8563 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8564 static int32_t param28_init[] = {0};
8565 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8566 static bool8 layout_init[] = {true};
8567 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8568 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8569 // Phase 3, inputs and outputs
8570 model->identifyInputsAndOutputs(
8571 {op13},
8572 {op43});
8573 assert(model->isValid());
8574 }
8575
is_ignored_large_dynamic_output_shape_nchw_quant8_2(int i)8576 inline bool is_ignored_large_dynamic_output_shape_nchw_quant8_2(int i) {
8577 static std::set<int> ignore = {};
8578 return ignore.find(i) != ignore.end();
8579 }
8580
CreateModel_large_dynamic_output_shape_nchw_channelQuant8_2(Model * model)8581 void CreateModel_large_dynamic_output_shape_nchw_channelQuant8_2(Model *model) {
8582 OperandType type0(Type::BOOL, {});
8583 OperandType type4(Type::INT32, {});
8584 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
8585 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
8586 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
8587 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8588 // Phase 1, operands
8589 auto op13 = model->addOperand(&type75);
8590 auto op23 = model->addOperand(&type71);
8591 auto op33 = model->addOperand(&type72);
8592 auto param21 = model->addOperand(&type4);
8593 auto param22 = model->addOperand(&type4);
8594 auto param23 = model->addOperand(&type4);
8595 auto param24 = model->addOperand(&type4);
8596 auto param25 = model->addOperand(&type4);
8597 auto param26 = model->addOperand(&type4);
8598 auto param27 = model->addOperand(&type4);
8599 auto param28 = model->addOperand(&type4);
8600 auto layout = model->addOperand(&type0);
8601 auto op43 = model->addOperand(&type77);
8602 // Phase 2, operations
8603 static int8_t op23_init[] = {0, 0, 10, 50, 0, 0, 20, 50, 0, 0, 30, 50, 0, 0, 40, 50};
8604 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 16);
8605 static int32_t op33_init[] = {12000, 7000, 16000, 18000};
8606 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 4);
8607 static int32_t param21_init[] = {0};
8608 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8609 static int32_t param22_init[] = {0};
8610 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8611 static int32_t param23_init[] = {0};
8612 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8613 static int32_t param24_init[] = {0};
8614 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8615 static int32_t param25_init[] = {1};
8616 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8617 static int32_t param26_init[] = {1};
8618 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8619 static int32_t param27_init[] = {1};
8620 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8621 static int32_t param28_init[] = {0};
8622 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8623 static bool8 layout_init[] = {true};
8624 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8625 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8626 // Phase 3, inputs and outputs
8627 model->identifyInputsAndOutputs(
8628 {op13},
8629 {op43});
8630 assert(model->isValid());
8631 }
8632
is_ignored_large_dynamic_output_shape_nchw_channelQuant8_2(int i)8633 inline bool is_ignored_large_dynamic_output_shape_nchw_channelQuant8_2(int i) {
8634 static std::set<int> ignore = {};
8635 return ignore.find(i) != ignore.end();
8636 }
8637
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_2(Model * model)8638 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_2(Model *model) {
8639 OperandType type0(Type::BOOL, {});
8640 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8641 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
8642 OperandType type3(Type::TENSOR_FLOAT32, {4});
8643 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8644 OperandType type4(Type::INT32, {});
8645 // Phase 1, operands
8646 auto op13 = model->addOperand(&type28);
8647 auto op23 = model->addOperand(&type2);
8648 auto op33 = model->addOperand(&type3);
8649 auto param21 = model->addOperand(&type4);
8650 auto param22 = model->addOperand(&type4);
8651 auto param23 = model->addOperand(&type4);
8652 auto param24 = model->addOperand(&type4);
8653 auto param25 = model->addOperand(&type4);
8654 auto param26 = model->addOperand(&type4);
8655 auto param27 = model->addOperand(&type4);
8656 auto param28 = model->addOperand(&type4);
8657 auto layout = model->addOperand(&type0);
8658 auto op43 = model->addOperand(&type34);
8659 // Phase 2, operations
8660 static int32_t param21_init[] = {0};
8661 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8662 static int32_t param22_init[] = {0};
8663 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8664 static int32_t param23_init[] = {0};
8665 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8666 static int32_t param24_init[] = {0};
8667 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8668 static int32_t param25_init[] = {1};
8669 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8670 static int32_t param26_init[] = {1};
8671 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8672 static int32_t param27_init[] = {1};
8673 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8674 static int32_t param28_init[] = {0};
8675 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8676 static bool8 layout_init[] = {true};
8677 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8678 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8679 // Phase 3, inputs and outputs
8680 model->identifyInputsAndOutputs(
8681 {op13, op23, op33},
8682 {op43});
8683 assert(model->isValid());
8684 }
8685
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_2(int i)8686 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_2(int i) {
8687 static std::set<int> ignore = {};
8688 return ignore.find(i) != ignore.end();
8689 }
8690
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model * model)8691 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model *model) {
8692 OperandType type0(Type::BOOL, {});
8693 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
8694 OperandType type28(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
8695 OperandType type3(Type::TENSOR_FLOAT32, {4});
8696 OperandType type34(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
8697 OperandType type4(Type::INT32, {});
8698 // Phase 1, operands
8699 auto op13 = model->addOperand(&type28);
8700 auto op23 = model->addOperand(&type2);
8701 auto op33 = model->addOperand(&type3);
8702 auto param21 = model->addOperand(&type4);
8703 auto param22 = model->addOperand(&type4);
8704 auto param23 = model->addOperand(&type4);
8705 auto param24 = model->addOperand(&type4);
8706 auto param25 = model->addOperand(&type4);
8707 auto param26 = model->addOperand(&type4);
8708 auto param27 = model->addOperand(&type4);
8709 auto param28 = model->addOperand(&type4);
8710 auto layout = model->addOperand(&type0);
8711 auto op43 = model->addOperand(&type34);
8712 // Phase 2, operations
8713 static int32_t param21_init[] = {0};
8714 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8715 static int32_t param22_init[] = {0};
8716 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8717 static int32_t param23_init[] = {0};
8718 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8719 static int32_t param24_init[] = {0};
8720 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8721 static int32_t param25_init[] = {1};
8722 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8723 static int32_t param26_init[] = {1};
8724 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8725 static int32_t param27_init[] = {1};
8726 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8727 static int32_t param28_init[] = {0};
8728 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8729 static bool8 layout_init[] = {true};
8730 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8731 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8732 // Phase 3, inputs and outputs
8733 model->identifyInputsAndOutputs(
8734 {op13, op23, op33},
8735 {op43});
8736 // Phase 4: set relaxed execution
8737 model->relaxComputationFloat32toFloat16(true);
8738 assert(model->isValid());
8739 }
8740
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i)8741 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i) {
8742 static std::set<int> ignore = {};
8743 return ignore.find(i) != ignore.end();
8744 }
8745
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_float16_2(Model * model)8746 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_float16_2(Model *model) {
8747 OperandType type0(Type::BOOL, {});
8748 OperandType type16(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
8749 OperandType type17(Type::TENSOR_FLOAT16, {4});
8750 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
8751 OperandType type35(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
8752 OperandType type4(Type::INT32, {});
8753 // Phase 1, operands
8754 auto op13 = model->addOperand(&type30);
8755 auto op23 = model->addOperand(&type16);
8756 auto op33 = model->addOperand(&type17);
8757 auto param21 = model->addOperand(&type4);
8758 auto param22 = model->addOperand(&type4);
8759 auto param23 = model->addOperand(&type4);
8760 auto param24 = model->addOperand(&type4);
8761 auto param25 = model->addOperand(&type4);
8762 auto param26 = model->addOperand(&type4);
8763 auto param27 = model->addOperand(&type4);
8764 auto param28 = model->addOperand(&type4);
8765 auto layout = model->addOperand(&type0);
8766 auto op43 = model->addOperand(&type35);
8767 // Phase 2, operations
8768 static int32_t param21_init[] = {0};
8769 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8770 static int32_t param22_init[] = {0};
8771 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8772 static int32_t param23_init[] = {0};
8773 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8774 static int32_t param24_init[] = {0};
8775 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8776 static int32_t param25_init[] = {1};
8777 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8778 static int32_t param26_init[] = {1};
8779 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8780 static int32_t param27_init[] = {1};
8781 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8782 static int32_t param28_init[] = {0};
8783 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8784 static bool8 layout_init[] = {true};
8785 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8786 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8787 // Phase 3, inputs and outputs
8788 model->identifyInputsAndOutputs(
8789 {op13, op23, op33},
8790 {op43});
8791 assert(model->isValid());
8792 }
8793
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_float16_2(int i)8794 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_float16_2(int i) {
8795 static std::set<int> ignore = {};
8796 return ignore.find(i) != ignore.end();
8797 }
8798
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model * model)8799 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model *model) {
8800 OperandType type0(Type::BOOL, {});
8801 OperandType type4(Type::INT32, {});
8802 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.25f, 0);
8803 OperandType type69(Type::TENSOR_INT32, {4}, 0.125f, 0);
8804 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
8805 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8806 // Phase 1, operands
8807 auto op13 = model->addOperand(&type75);
8808 auto op23 = model->addOperand(&type68);
8809 auto op33 = model->addOperand(&type69);
8810 auto param21 = model->addOperand(&type4);
8811 auto param22 = model->addOperand(&type4);
8812 auto param23 = model->addOperand(&type4);
8813 auto param24 = model->addOperand(&type4);
8814 auto param25 = model->addOperand(&type4);
8815 auto param26 = model->addOperand(&type4);
8816 auto param27 = model->addOperand(&type4);
8817 auto param28 = model->addOperand(&type4);
8818 auto layout = model->addOperand(&type0);
8819 auto op43 = model->addOperand(&type77);
8820 // Phase 2, operations
8821 static int32_t param21_init[] = {0};
8822 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8823 static int32_t param22_init[] = {0};
8824 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8825 static int32_t param23_init[] = {0};
8826 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8827 static int32_t param24_init[] = {0};
8828 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8829 static int32_t param25_init[] = {1};
8830 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8831 static int32_t param26_init[] = {1};
8832 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8833 static int32_t param27_init[] = {1};
8834 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8835 static int32_t param28_init[] = {0};
8836 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8837 static bool8 layout_init[] = {true};
8838 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8839 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8840 // Phase 3, inputs and outputs
8841 model->identifyInputsAndOutputs(
8842 {op13, op23, op33},
8843 {op43});
8844 assert(model->isValid());
8845 }
8846
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i)8847 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i) {
8848 static std::set<int> ignore = {};
8849 return ignore.find(i) != ignore.end();
8850 }
8851
CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model * model)8852 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model *model) {
8853 OperandType type0(Type::BOOL, {});
8854 OperandType type4(Type::INT32, {});
8855 OperandType type71(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 4}, 0.0f, 0, SymmPerChannelQuantParams({1.0f, 2.0f, 1.0f, 1.0f},3));
8856 OperandType type72(Type::TENSOR_INT32, {4}, 0.0f, 0);
8857 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
8858 OperandType type77(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 50.0f, 0);
8859 // Phase 1, operands
8860 auto op13 = model->addOperand(&type75);
8861 auto op23 = model->addOperand(&type71);
8862 auto op33 = model->addOperand(&type72);
8863 auto param21 = model->addOperand(&type4);
8864 auto param22 = model->addOperand(&type4);
8865 auto param23 = model->addOperand(&type4);
8866 auto param24 = model->addOperand(&type4);
8867 auto param25 = model->addOperand(&type4);
8868 auto param26 = model->addOperand(&type4);
8869 auto param27 = model->addOperand(&type4);
8870 auto param28 = model->addOperand(&type4);
8871 auto layout = model->addOperand(&type0);
8872 auto op43 = model->addOperand(&type77);
8873 // Phase 2, operations
8874 static int32_t param21_init[] = {0};
8875 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1);
8876 static int32_t param22_init[] = {0};
8877 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1);
8878 static int32_t param23_init[] = {0};
8879 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1);
8880 static int32_t param24_init[] = {0};
8881 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1);
8882 static int32_t param25_init[] = {1};
8883 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1);
8884 static int32_t param26_init[] = {1};
8885 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1);
8886 static int32_t param27_init[] = {1};
8887 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1);
8888 static int32_t param28_init[] = {0};
8889 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1);
8890 static bool8 layout_init[] = {true};
8891 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
8892 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op13, op23, op33, param21, param22, param23, param24, param25, param26, param27, param28, layout}, {op43});
8893 // Phase 3, inputs and outputs
8894 model->identifyInputsAndOutputs(
8895 {op13, op23, op33},
8896 {op43});
8897 assert(model->isValid());
8898 }
8899
is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i)8900 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i) {
8901 static std::set<int> ignore = {};
8902 return ignore.find(i) != ignore.end();
8903 }
8904
CreateModel_quant_output_multiplier_gt_1(Model * model)8905 void CreateModel_quant_output_multiplier_gt_1(Model *model) {
8906 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
8907 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
8908 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
8909 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 127);
8910 OperandType type4(Type::INT32, {});
8911 // Phase 1, operands
8912 auto op14 = model->addOperand(&type11);
8913 auto op24 = model->addOperand(&type12);
8914 auto op34 = model->addOperand(&type13);
8915 auto param29 = model->addOperand(&type4);
8916 auto param30 = model->addOperand(&type4);
8917 auto param31 = model->addOperand(&type4);
8918 auto param32 = model->addOperand(&type4);
8919 auto param33 = model->addOperand(&type4);
8920 auto op44 = model->addOperand(&type14);
8921 // Phase 2, operations
8922 static uint8_t op24_init[] = {129, 130, 131, 132, 119, 138, 117, 140, 133, 134, 135, 136, 141, 114, 143, 112};
8923 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 16);
8924 static int32_t op34_init[] = {2, 4, 6, 8};
8925 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 4);
8926 static int32_t param29_init[] = {2};
8927 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
8928 static int32_t param30_init[] = {1};
8929 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8930 static int32_t param31_init[] = {1};
8931 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8932 static int32_t param32_init[] = {2};
8933 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8934 static int32_t param33_init[] = {0};
8935 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8936 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
8937 // Phase 3, inputs and outputs
8938 model->identifyInputsAndOutputs(
8939 {op14},
8940 {op44});
8941 assert(model->isValid());
8942 }
8943
is_ignored_quant_output_multiplier_gt_1(int i)8944 inline bool is_ignored_quant_output_multiplier_gt_1(int i) {
8945 static std::set<int> ignore = {};
8946 return ignore.find(i) != ignore.end();
8947 }
8948
CreateModel_quant_output_multiplier_gt_1_relaxed(Model * model)8949 void CreateModel_quant_output_multiplier_gt_1_relaxed(Model *model) {
8950 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
8951 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
8952 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
8953 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 127);
8954 OperandType type4(Type::INT32, {});
8955 // Phase 1, operands
8956 auto op14 = model->addOperand(&type11);
8957 auto op24 = model->addOperand(&type12);
8958 auto op34 = model->addOperand(&type13);
8959 auto param29 = model->addOperand(&type4);
8960 auto param30 = model->addOperand(&type4);
8961 auto param31 = model->addOperand(&type4);
8962 auto param32 = model->addOperand(&type4);
8963 auto param33 = model->addOperand(&type4);
8964 auto op44 = model->addOperand(&type14);
8965 // Phase 2, operations
8966 static uint8_t op24_init[] = {129, 130, 131, 132, 119, 138, 117, 140, 133, 134, 135, 136, 141, 114, 143, 112};
8967 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 16);
8968 static int32_t op34_init[] = {2, 4, 6, 8};
8969 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 4);
8970 static int32_t param29_init[] = {2};
8971 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
8972 static int32_t param30_init[] = {1};
8973 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
8974 static int32_t param31_init[] = {1};
8975 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
8976 static int32_t param32_init[] = {2};
8977 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
8978 static int32_t param33_init[] = {0};
8979 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
8980 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
8981 // Phase 3, inputs and outputs
8982 model->identifyInputsAndOutputs(
8983 {op14},
8984 {op44});
8985 // Phase 4: set relaxed execution
8986 model->relaxComputationFloat32toFloat16(true);
8987 assert(model->isValid());
8988 }
8989
is_ignored_quant_output_multiplier_gt_1_relaxed(int i)8990 inline bool is_ignored_quant_output_multiplier_gt_1_relaxed(int i) {
8991 static std::set<int> ignore = {};
8992 return ignore.find(i) != ignore.end();
8993 }
8994
CreateModel_quant_output_multiplier_gt_1_weight_as_input(Model * model)8995 void CreateModel_quant_output_multiplier_gt_1_weight_as_input(Model *model) {
8996 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
8997 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
8998 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
8999 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 127);
9000 OperandType type4(Type::INT32, {});
9001 // Phase 1, operands
9002 auto op14 = model->addOperand(&type11);
9003 auto op24 = model->addOperand(&type12);
9004 auto op34 = model->addOperand(&type13);
9005 auto param29 = model->addOperand(&type4);
9006 auto param30 = model->addOperand(&type4);
9007 auto param31 = model->addOperand(&type4);
9008 auto param32 = model->addOperand(&type4);
9009 auto param33 = model->addOperand(&type4);
9010 auto op44 = model->addOperand(&type14);
9011 // Phase 2, operations
9012 static int32_t param29_init[] = {2};
9013 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9014 static int32_t param30_init[] = {1};
9015 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9016 static int32_t param31_init[] = {1};
9017 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9018 static int32_t param32_init[] = {2};
9019 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9020 static int32_t param33_init[] = {0};
9021 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9022 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9023 // Phase 3, inputs and outputs
9024 model->identifyInputsAndOutputs(
9025 {op14, op24, op34},
9026 {op44});
9027 assert(model->isValid());
9028 }
9029
is_ignored_quant_output_multiplier_gt_1_weight_as_input(int i)9030 inline bool is_ignored_quant_output_multiplier_gt_1_weight_as_input(int i) {
9031 static std::set<int> ignore = {};
9032 return ignore.find(i) != ignore.end();
9033 }
9034
CreateModel_quant_output_multiplier_gt_1_weight_as_input_relaxed(Model * model)9035 void CreateModel_quant_output_multiplier_gt_1_weight_as_input_relaxed(Model *model) {
9036 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
9037 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
9038 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
9039 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 2, 1, 4}, 1.0f, 127);
9040 OperandType type4(Type::INT32, {});
9041 // Phase 1, operands
9042 auto op14 = model->addOperand(&type11);
9043 auto op24 = model->addOperand(&type12);
9044 auto op34 = model->addOperand(&type13);
9045 auto param29 = model->addOperand(&type4);
9046 auto param30 = model->addOperand(&type4);
9047 auto param31 = model->addOperand(&type4);
9048 auto param32 = model->addOperand(&type4);
9049 auto param33 = model->addOperand(&type4);
9050 auto op44 = model->addOperand(&type14);
9051 // Phase 2, operations
9052 static int32_t param29_init[] = {2};
9053 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9054 static int32_t param30_init[] = {1};
9055 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9056 static int32_t param31_init[] = {1};
9057 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9058 static int32_t param32_init[] = {2};
9059 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9060 static int32_t param33_init[] = {0};
9061 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9062 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9063 // Phase 3, inputs and outputs
9064 model->identifyInputsAndOutputs(
9065 {op14, op24, op34},
9066 {op44});
9067 // Phase 4: set relaxed execution
9068 model->relaxComputationFloat32toFloat16(true);
9069 assert(model->isValid());
9070 }
9071
is_ignored_quant_output_multiplier_gt_1_weight_as_input_relaxed(int i)9072 inline bool is_ignored_quant_output_multiplier_gt_1_weight_as_input_relaxed(int i) {
9073 static std::set<int> ignore = {};
9074 return ignore.find(i) != ignore.end();
9075 }
9076
CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape(Model * model)9077 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape(Model *model) {
9078 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
9079 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
9080 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
9081 OperandType type4(Type::INT32, {});
9082 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127);
9083 // Phase 1, operands
9084 auto op14 = model->addOperand(&type11);
9085 auto op24 = model->addOperand(&type12);
9086 auto op34 = model->addOperand(&type13);
9087 auto param29 = model->addOperand(&type4);
9088 auto param30 = model->addOperand(&type4);
9089 auto param31 = model->addOperand(&type4);
9090 auto param32 = model->addOperand(&type4);
9091 auto param33 = model->addOperand(&type4);
9092 auto op44 = model->addOperand(&type78);
9093 // Phase 2, operations
9094 static uint8_t op24_init[] = {129, 130, 131, 132, 119, 138, 117, 140, 133, 134, 135, 136, 141, 114, 143, 112};
9095 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 16);
9096 static int32_t op34_init[] = {2, 4, 6, 8};
9097 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 4);
9098 static int32_t param29_init[] = {2};
9099 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9100 static int32_t param30_init[] = {1};
9101 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9102 static int32_t param31_init[] = {1};
9103 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9104 static int32_t param32_init[] = {2};
9105 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9106 static int32_t param33_init[] = {0};
9107 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9108 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9109 // Phase 3, inputs and outputs
9110 model->identifyInputsAndOutputs(
9111 {op14},
9112 {op44});
9113 assert(model->isValid());
9114 }
9115
is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape(int i)9116 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape(int i) {
9117 static std::set<int> ignore = {};
9118 return ignore.find(i) != ignore.end();
9119 }
9120
CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(Model * model)9121 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(Model *model) {
9122 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
9123 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
9124 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
9125 OperandType type4(Type::INT32, {});
9126 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127);
9127 // Phase 1, operands
9128 auto op14 = model->addOperand(&type11);
9129 auto op24 = model->addOperand(&type12);
9130 auto op34 = model->addOperand(&type13);
9131 auto param29 = model->addOperand(&type4);
9132 auto param30 = model->addOperand(&type4);
9133 auto param31 = model->addOperand(&type4);
9134 auto param32 = model->addOperand(&type4);
9135 auto param33 = model->addOperand(&type4);
9136 auto op44 = model->addOperand(&type78);
9137 // Phase 2, operations
9138 static uint8_t op24_init[] = {129, 130, 131, 132, 119, 138, 117, 140, 133, 134, 135, 136, 141, 114, 143, 112};
9139 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 16);
9140 static int32_t op34_init[] = {2, 4, 6, 8};
9141 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 4);
9142 static int32_t param29_init[] = {2};
9143 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9144 static int32_t param30_init[] = {1};
9145 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9146 static int32_t param31_init[] = {1};
9147 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9148 static int32_t param32_init[] = {2};
9149 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9150 static int32_t param33_init[] = {0};
9151 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9152 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9153 // Phase 3, inputs and outputs
9154 model->identifyInputsAndOutputs(
9155 {op14},
9156 {op44});
9157 // Phase 4: set relaxed execution
9158 model->relaxComputationFloat32toFloat16(true);
9159 assert(model->isValid());
9160 }
9161
is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(int i)9162 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(int i) {
9163 static std::set<int> ignore = {};
9164 return ignore.find(i) != ignore.end();
9165 }
9166
CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(Model * model)9167 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(Model *model) {
9168 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
9169 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
9170 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
9171 OperandType type4(Type::INT32, {});
9172 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127);
9173 // Phase 1, operands
9174 auto op14 = model->addOperand(&type11);
9175 auto op24 = model->addOperand(&type12);
9176 auto op34 = model->addOperand(&type13);
9177 auto param29 = model->addOperand(&type4);
9178 auto param30 = model->addOperand(&type4);
9179 auto param31 = model->addOperand(&type4);
9180 auto param32 = model->addOperand(&type4);
9181 auto param33 = model->addOperand(&type4);
9182 auto op44 = model->addOperand(&type78);
9183 // Phase 2, operations
9184 static int32_t param29_init[] = {2};
9185 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9186 static int32_t param30_init[] = {1};
9187 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9188 static int32_t param31_init[] = {1};
9189 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9190 static int32_t param32_init[] = {2};
9191 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9192 static int32_t param33_init[] = {0};
9193 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9194 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9195 // Phase 3, inputs and outputs
9196 model->identifyInputsAndOutputs(
9197 {op14, op24, op34},
9198 {op44});
9199 assert(model->isValid());
9200 }
9201
is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(int i)9202 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(int i) {
9203 static std::set<int> ignore = {};
9204 return ignore.find(i) != ignore.end();
9205 }
9206
CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(Model * model)9207 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(Model *model) {
9208 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 2}, 1.0058823529411764f, 127);
9209 OperandType type12(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 1.0058823529411764f, 128);
9210 OperandType type13(Type::TENSOR_INT32, {4}, 1.0117993079584775f, 0);
9211 OperandType type4(Type::INT32, {});
9212 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127);
9213 // Phase 1, operands
9214 auto op14 = model->addOperand(&type11);
9215 auto op24 = model->addOperand(&type12);
9216 auto op34 = model->addOperand(&type13);
9217 auto param29 = model->addOperand(&type4);
9218 auto param30 = model->addOperand(&type4);
9219 auto param31 = model->addOperand(&type4);
9220 auto param32 = model->addOperand(&type4);
9221 auto param33 = model->addOperand(&type4);
9222 auto op44 = model->addOperand(&type78);
9223 // Phase 2, operations
9224 static int32_t param29_init[] = {2};
9225 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1);
9226 static int32_t param30_init[] = {1};
9227 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1);
9228 static int32_t param31_init[] = {1};
9229 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1);
9230 static int32_t param32_init[] = {2};
9231 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1);
9232 static int32_t param33_init[] = {0};
9233 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1);
9234 model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, param33}, {op44});
9235 // Phase 3, inputs and outputs
9236 model->identifyInputsAndOutputs(
9237 {op14, op24, op34},
9238 {op44});
9239 // Phase 4: set relaxed execution
9240 model->relaxComputationFloat32toFloat16(true);
9241 assert(model->isValid());
9242 }
9243
is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(int i)9244 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(int i) {
9245 static std::set<int> ignore = {};
9246 return ignore.find(i) != ignore.end();
9247 }
9248
9249