1 // clang-format off
2 // Generated file (from: depth_to_space_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, 1, 1, 8});
6 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
7 OperandType type3(Type::INT32, {});
8 // Phase 1, operands
9 auto op1 = model->addOperand(&type1);
10 auto param = model->addOperand(&type3);
11 auto layout = model->addOperand(&type0);
12 auto op4 = model->addOperand(&type2);
13 // Phase 2, operations
14 static int32_t param_init[] = {2};
15 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
16 static bool8 layout_init[] = {false};
17 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
18 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
19 // Phase 3, inputs and outputs
20 model->identifyInputsAndOutputs(
21 {op1},
22 {op4});
23 assert(model->isValid());
24 }
25
is_ignored_nhwc(int i)26 inline bool is_ignored_nhwc(int i) {
27 static std::set<int> ignore = {};
28 return ignore.find(i) != ignore.end();
29 }
30
CreateModel_nhwc_relaxed(Model * model)31 void CreateModel_nhwc_relaxed(Model *model) {
32 OperandType type0(Type::BOOL, {});
33 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 8});
34 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
35 OperandType type3(Type::INT32, {});
36 // Phase 1, operands
37 auto op1 = model->addOperand(&type1);
38 auto param = model->addOperand(&type3);
39 auto layout = model->addOperand(&type0);
40 auto op4 = model->addOperand(&type2);
41 // Phase 2, operations
42 static int32_t param_init[] = {2};
43 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
44 static bool8 layout_init[] = {false};
45 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
46 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
47 // Phase 3, inputs and outputs
48 model->identifyInputsAndOutputs(
49 {op1},
50 {op4});
51 // Phase 4: set relaxed execution
52 model->relaxComputationFloat32toFloat16(true);
53 assert(model->isValid());
54 }
55
is_ignored_nhwc_relaxed(int i)56 inline bool is_ignored_nhwc_relaxed(int i) {
57 static std::set<int> ignore = {};
58 return ignore.find(i) != ignore.end();
59 }
60
CreateModel_nhwc_float16(Model * model)61 void CreateModel_nhwc_float16(Model *model) {
62 OperandType type0(Type::BOOL, {});
63 OperandType type3(Type::INT32, {});
64 OperandType type8(Type::TENSOR_FLOAT16, {1, 1, 1, 8});
65 OperandType type9(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
66 // Phase 1, operands
67 auto op1 = model->addOperand(&type8);
68 auto param = model->addOperand(&type3);
69 auto layout = model->addOperand(&type0);
70 auto op4 = model->addOperand(&type9);
71 // Phase 2, operations
72 static int32_t param_init[] = {2};
73 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
74 static bool8 layout_init[] = {false};
75 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
76 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
77 // Phase 3, inputs and outputs
78 model->identifyInputsAndOutputs(
79 {op1},
80 {op4});
81 assert(model->isValid());
82 }
83
is_ignored_nhwc_float16(int i)84 inline bool is_ignored_nhwc_float16(int i) {
85 static std::set<int> ignore = {};
86 return ignore.find(i) != ignore.end();
87 }
88
CreateModel_nhwc_quant8(Model * model)89 void CreateModel_nhwc_quant8(Model *model) {
90 OperandType type0(Type::BOOL, {});
91 OperandType type10(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 8}, 0.1f, 0);
92 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.1f, 0);
93 OperandType type3(Type::INT32, {});
94 // Phase 1, operands
95 auto op1 = model->addOperand(&type10);
96 auto param = model->addOperand(&type3);
97 auto layout = model->addOperand(&type0);
98 auto op4 = model->addOperand(&type11);
99 // Phase 2, operations
100 static int32_t param_init[] = {2};
101 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
102 static bool8 layout_init[] = {false};
103 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
104 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
105 // Phase 3, inputs and outputs
106 model->identifyInputsAndOutputs(
107 {op1},
108 {op4});
109 assert(model->isValid());
110 }
111
is_ignored_nhwc_quant8(int i)112 inline bool is_ignored_nhwc_quant8(int i) {
113 static std::set<int> ignore = {};
114 return ignore.find(i) != ignore.end();
115 }
116
CreateModel_nchw(Model * model)117 void CreateModel_nchw(Model *model) {
118 OperandType type0(Type::BOOL, {});
119 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 1, 1});
120 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
121 OperandType type3(Type::INT32, {});
122 // Phase 1, operands
123 auto op1 = model->addOperand(&type12);
124 auto param = model->addOperand(&type3);
125 auto layout = model->addOperand(&type0);
126 auto op4 = model->addOperand(&type2);
127 // Phase 2, operations
128 static int32_t param_init[] = {2};
129 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
130 static bool8 layout_init[] = {true};
131 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
132 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
133 // Phase 3, inputs and outputs
134 model->identifyInputsAndOutputs(
135 {op1},
136 {op4});
137 assert(model->isValid());
138 }
139
is_ignored_nchw(int i)140 inline bool is_ignored_nchw(int i) {
141 static std::set<int> ignore = {};
142 return ignore.find(i) != ignore.end();
143 }
144
CreateModel_nchw_relaxed(Model * model)145 void CreateModel_nchw_relaxed(Model *model) {
146 OperandType type0(Type::BOOL, {});
147 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 1, 1});
148 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
149 OperandType type3(Type::INT32, {});
150 // Phase 1, operands
151 auto op1 = model->addOperand(&type12);
152 auto param = model->addOperand(&type3);
153 auto layout = model->addOperand(&type0);
154 auto op4 = model->addOperand(&type2);
155 // Phase 2, operations
156 static int32_t param_init[] = {2};
157 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
158 static bool8 layout_init[] = {true};
159 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
160 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
161 // Phase 3, inputs and outputs
162 model->identifyInputsAndOutputs(
163 {op1},
164 {op4});
165 // Phase 4: set relaxed execution
166 model->relaxComputationFloat32toFloat16(true);
167 assert(model->isValid());
168 }
169
is_ignored_nchw_relaxed(int i)170 inline bool is_ignored_nchw_relaxed(int i) {
171 static std::set<int> ignore = {};
172 return ignore.find(i) != ignore.end();
173 }
174
CreateModel_nchw_float16(Model * model)175 void CreateModel_nchw_float16(Model *model) {
176 OperandType type0(Type::BOOL, {});
177 OperandType type13(Type::TENSOR_FLOAT16, {1, 8, 1, 1});
178 OperandType type3(Type::INT32, {});
179 OperandType type9(Type::TENSOR_FLOAT16, {1, 2, 2, 2});
180 // Phase 1, operands
181 auto op1 = model->addOperand(&type13);
182 auto param = model->addOperand(&type3);
183 auto layout = model->addOperand(&type0);
184 auto op4 = model->addOperand(&type9);
185 // Phase 2, operations
186 static int32_t param_init[] = {2};
187 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
188 static bool8 layout_init[] = {true};
189 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
190 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
191 // Phase 3, inputs and outputs
192 model->identifyInputsAndOutputs(
193 {op1},
194 {op4});
195 assert(model->isValid());
196 }
197
is_ignored_nchw_float16(int i)198 inline bool is_ignored_nchw_float16(int i) {
199 static std::set<int> ignore = {};
200 return ignore.find(i) != ignore.end();
201 }
202
CreateModel_nchw_quant8(Model * model)203 void CreateModel_nchw_quant8(Model *model) {
204 OperandType type0(Type::BOOL, {});
205 OperandType type11(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 2}, 0.1f, 0);
206 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 8, 1, 1}, 0.1f, 0);
207 OperandType type3(Type::INT32, {});
208 // Phase 1, operands
209 auto op1 = model->addOperand(&type14);
210 auto param = model->addOperand(&type3);
211 auto layout = model->addOperand(&type0);
212 auto op4 = model->addOperand(&type11);
213 // Phase 2, operations
214 static int32_t param_init[] = {2};
215 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
216 static bool8 layout_init[] = {true};
217 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
218 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
219 // Phase 3, inputs and outputs
220 model->identifyInputsAndOutputs(
221 {op1},
222 {op4});
223 assert(model->isValid());
224 }
225
is_ignored_nchw_quant8(int i)226 inline bool is_ignored_nchw_quant8(int i) {
227 static std::set<int> ignore = {};
228 return ignore.find(i) != ignore.end();
229 }
230
CreateModel_dynamic_output_shape_nhwc(Model * model)231 void CreateModel_dynamic_output_shape_nhwc(Model *model) {
232 OperandType type0(Type::BOOL, {});
233 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 8});
234 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
235 OperandType type3(Type::INT32, {});
236 // Phase 1, operands
237 auto op1 = model->addOperand(&type1);
238 auto param = model->addOperand(&type3);
239 auto layout = model->addOperand(&type0);
240 auto op4 = model->addOperand(&type15);
241 // Phase 2, operations
242 static int32_t param_init[] = {2};
243 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
244 static bool8 layout_init[] = {false};
245 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
246 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
247 // Phase 3, inputs and outputs
248 model->identifyInputsAndOutputs(
249 {op1},
250 {op4});
251 assert(model->isValid());
252 }
253
is_ignored_dynamic_output_shape_nhwc(int i)254 inline bool is_ignored_dynamic_output_shape_nhwc(int i) {
255 static std::set<int> ignore = {};
256 return ignore.find(i) != ignore.end();
257 }
258
CreateModel_dynamic_output_shape_nhwc_relaxed(Model * model)259 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) {
260 OperandType type0(Type::BOOL, {});
261 OperandType type1(Type::TENSOR_FLOAT32, {1, 1, 1, 8});
262 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
263 OperandType type3(Type::INT32, {});
264 // Phase 1, operands
265 auto op1 = model->addOperand(&type1);
266 auto param = model->addOperand(&type3);
267 auto layout = model->addOperand(&type0);
268 auto op4 = model->addOperand(&type15);
269 // Phase 2, operations
270 static int32_t param_init[] = {2};
271 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
272 static bool8 layout_init[] = {false};
273 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
274 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
275 // Phase 3, inputs and outputs
276 model->identifyInputsAndOutputs(
277 {op1},
278 {op4});
279 // Phase 4: set relaxed execution
280 model->relaxComputationFloat32toFloat16(true);
281 assert(model->isValid());
282 }
283
is_ignored_dynamic_output_shape_nhwc_relaxed(int i)284 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) {
285 static std::set<int> ignore = {};
286 return ignore.find(i) != ignore.end();
287 }
288
CreateModel_dynamic_output_shape_nhwc_float16(Model * model)289 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) {
290 OperandType type0(Type::BOOL, {});
291 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
292 OperandType type3(Type::INT32, {});
293 OperandType type8(Type::TENSOR_FLOAT16, {1, 1, 1, 8});
294 // Phase 1, operands
295 auto op1 = model->addOperand(&type8);
296 auto param = model->addOperand(&type3);
297 auto layout = model->addOperand(&type0);
298 auto op4 = model->addOperand(&type16);
299 // Phase 2, operations
300 static int32_t param_init[] = {2};
301 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
302 static bool8 layout_init[] = {false};
303 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
304 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
305 // Phase 3, inputs and outputs
306 model->identifyInputsAndOutputs(
307 {op1},
308 {op4});
309 assert(model->isValid());
310 }
311
is_ignored_dynamic_output_shape_nhwc_float16(int i)312 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) {
313 static std::set<int> ignore = {};
314 return ignore.find(i) != ignore.end();
315 }
316
CreateModel_dynamic_output_shape_nhwc_quant8(Model * model)317 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) {
318 OperandType type0(Type::BOOL, {});
319 OperandType type10(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 8}, 0.1f, 0);
320 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
321 OperandType type3(Type::INT32, {});
322 // Phase 1, operands
323 auto op1 = model->addOperand(&type10);
324 auto param = model->addOperand(&type3);
325 auto layout = model->addOperand(&type0);
326 auto op4 = model->addOperand(&type17);
327 // Phase 2, operations
328 static int32_t param_init[] = {2};
329 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
330 static bool8 layout_init[] = {false};
331 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
332 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
333 // Phase 3, inputs and outputs
334 model->identifyInputsAndOutputs(
335 {op1},
336 {op4});
337 assert(model->isValid());
338 }
339
is_ignored_dynamic_output_shape_nhwc_quant8(int i)340 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) {
341 static std::set<int> ignore = {};
342 return ignore.find(i) != ignore.end();
343 }
344
CreateModel_dynamic_output_shape_nchw(Model * model)345 void CreateModel_dynamic_output_shape_nchw(Model *model) {
346 OperandType type0(Type::BOOL, {});
347 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 1, 1});
348 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
349 OperandType type3(Type::INT32, {});
350 // Phase 1, operands
351 auto op1 = model->addOperand(&type12);
352 auto param = model->addOperand(&type3);
353 auto layout = model->addOperand(&type0);
354 auto op4 = model->addOperand(&type15);
355 // Phase 2, operations
356 static int32_t param_init[] = {2};
357 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
358 static bool8 layout_init[] = {true};
359 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
360 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
361 // Phase 3, inputs and outputs
362 model->identifyInputsAndOutputs(
363 {op1},
364 {op4});
365 assert(model->isValid());
366 }
367
is_ignored_dynamic_output_shape_nchw(int i)368 inline bool is_ignored_dynamic_output_shape_nchw(int i) {
369 static std::set<int> ignore = {};
370 return ignore.find(i) != ignore.end();
371 }
372
CreateModel_dynamic_output_shape_nchw_relaxed(Model * model)373 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) {
374 OperandType type0(Type::BOOL, {});
375 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 1, 1});
376 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
377 OperandType type3(Type::INT32, {});
378 // Phase 1, operands
379 auto op1 = model->addOperand(&type12);
380 auto param = model->addOperand(&type3);
381 auto layout = model->addOperand(&type0);
382 auto op4 = model->addOperand(&type15);
383 // Phase 2, operations
384 static int32_t param_init[] = {2};
385 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
386 static bool8 layout_init[] = {true};
387 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
388 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
389 // Phase 3, inputs and outputs
390 model->identifyInputsAndOutputs(
391 {op1},
392 {op4});
393 // Phase 4: set relaxed execution
394 model->relaxComputationFloat32toFloat16(true);
395 assert(model->isValid());
396 }
397
is_ignored_dynamic_output_shape_nchw_relaxed(int i)398 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) {
399 static std::set<int> ignore = {};
400 return ignore.find(i) != ignore.end();
401 }
402
CreateModel_dynamic_output_shape_nchw_float16(Model * model)403 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) {
404 OperandType type0(Type::BOOL, {});
405 OperandType type13(Type::TENSOR_FLOAT16, {1, 8, 1, 1});
406 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
407 OperandType type3(Type::INT32, {});
408 // Phase 1, operands
409 auto op1 = model->addOperand(&type13);
410 auto param = model->addOperand(&type3);
411 auto layout = model->addOperand(&type0);
412 auto op4 = model->addOperand(&type16);
413 // Phase 2, operations
414 static int32_t param_init[] = {2};
415 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
416 static bool8 layout_init[] = {true};
417 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
418 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
419 // Phase 3, inputs and outputs
420 model->identifyInputsAndOutputs(
421 {op1},
422 {op4});
423 assert(model->isValid());
424 }
425
is_ignored_dynamic_output_shape_nchw_float16(int i)426 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) {
427 static std::set<int> ignore = {};
428 return ignore.find(i) != ignore.end();
429 }
430
CreateModel_dynamic_output_shape_nchw_quant8(Model * model)431 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) {
432 OperandType type0(Type::BOOL, {});
433 OperandType type14(Type::TENSOR_QUANT8_ASYMM, {1, 8, 1, 1}, 0.1f, 0);
434 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 0);
435 OperandType type3(Type::INT32, {});
436 // Phase 1, operands
437 auto op1 = model->addOperand(&type14);
438 auto param = model->addOperand(&type3);
439 auto layout = model->addOperand(&type0);
440 auto op4 = model->addOperand(&type17);
441 // Phase 2, operations
442 static int32_t param_init[] = {2};
443 model->setOperandValue(param, param_init, sizeof(int32_t) * 1);
444 static bool8 layout_init[] = {true};
445 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
446 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op1, param, layout}, {op4});
447 // Phase 3, inputs and outputs
448 model->identifyInputsAndOutputs(
449 {op1},
450 {op4});
451 assert(model->isValid());
452 }
453
is_ignored_dynamic_output_shape_nchw_quant8(int i)454 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) {
455 static std::set<int> ignore = {};
456 return ignore.find(i) != ignore.end();
457 }
458
CreateModel_nhwc_2(Model * model)459 void CreateModel_nhwc_2(Model *model) {
460 OperandType type0(Type::BOOL, {});
461 OperandType type3(Type::INT32, {});
462 OperandType type4(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
463 OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
464 // Phase 1, operands
465 auto op11 = model->addOperand(&type4);
466 auto param1 = model->addOperand(&type3);
467 auto layout = model->addOperand(&type0);
468 auto op41 = model->addOperand(&type5);
469 // Phase 2, operations
470 static int32_t param1_init[] = {2};
471 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
472 static bool8 layout_init[] = {false};
473 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
474 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
475 // Phase 3, inputs and outputs
476 model->identifyInputsAndOutputs(
477 {op11},
478 {op41});
479 assert(model->isValid());
480 }
481
is_ignored_nhwc_2(int i)482 inline bool is_ignored_nhwc_2(int i) {
483 static std::set<int> ignore = {};
484 return ignore.find(i) != ignore.end();
485 }
486
CreateModel_nhwc_relaxed_2(Model * model)487 void CreateModel_nhwc_relaxed_2(Model *model) {
488 OperandType type0(Type::BOOL, {});
489 OperandType type3(Type::INT32, {});
490 OperandType type4(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
491 OperandType type5(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
492 // Phase 1, operands
493 auto op11 = model->addOperand(&type4);
494 auto param1 = model->addOperand(&type3);
495 auto layout = model->addOperand(&type0);
496 auto op41 = model->addOperand(&type5);
497 // Phase 2, operations
498 static int32_t param1_init[] = {2};
499 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
500 static bool8 layout_init[] = {false};
501 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
502 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
503 // Phase 3, inputs and outputs
504 model->identifyInputsAndOutputs(
505 {op11},
506 {op41});
507 // Phase 4: set relaxed execution
508 model->relaxComputationFloat32toFloat16(true);
509 assert(model->isValid());
510 }
511
is_ignored_nhwc_relaxed_2(int i)512 inline bool is_ignored_nhwc_relaxed_2(int i) {
513 static std::set<int> ignore = {};
514 return ignore.find(i) != ignore.end();
515 }
516
CreateModel_nhwc_float16_2(Model * model)517 void CreateModel_nhwc_float16_2(Model *model) {
518 OperandType type0(Type::BOOL, {});
519 OperandType type18(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
520 OperandType type19(Type::TENSOR_FLOAT16, {1, 4, 4, 1});
521 OperandType type3(Type::INT32, {});
522 // Phase 1, operands
523 auto op11 = model->addOperand(&type18);
524 auto param1 = model->addOperand(&type3);
525 auto layout = model->addOperand(&type0);
526 auto op41 = model->addOperand(&type19);
527 // Phase 2, operations
528 static int32_t param1_init[] = {2};
529 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
530 static bool8 layout_init[] = {false};
531 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
532 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
533 // Phase 3, inputs and outputs
534 model->identifyInputsAndOutputs(
535 {op11},
536 {op41});
537 assert(model->isValid());
538 }
539
is_ignored_nhwc_float16_2(int i)540 inline bool is_ignored_nhwc_float16_2(int i) {
541 static std::set<int> ignore = {};
542 return ignore.find(i) != ignore.end();
543 }
544
CreateModel_nhwc_quant8_2(Model * model)545 void CreateModel_nhwc_quant8_2(Model *model) {
546 OperandType type0(Type::BOOL, {});
547 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
548 OperandType type21(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 0.5f, 128);
549 OperandType type3(Type::INT32, {});
550 // Phase 1, operands
551 auto op11 = model->addOperand(&type20);
552 auto param1 = model->addOperand(&type3);
553 auto layout = model->addOperand(&type0);
554 auto op41 = model->addOperand(&type21);
555 // Phase 2, operations
556 static int32_t param1_init[] = {2};
557 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
558 static bool8 layout_init[] = {false};
559 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
560 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
561 // Phase 3, inputs and outputs
562 model->identifyInputsAndOutputs(
563 {op11},
564 {op41});
565 assert(model->isValid());
566 }
567
is_ignored_nhwc_quant8_2(int i)568 inline bool is_ignored_nhwc_quant8_2(int i) {
569 static std::set<int> ignore = {};
570 return ignore.find(i) != ignore.end();
571 }
572
CreateModel_nchw_2(Model * model)573 void CreateModel_nchw_2(Model *model) {
574 OperandType type0(Type::BOOL, {});
575 OperandType type22(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
576 OperandType type23(Type::TENSOR_FLOAT32, {1, 1, 4, 4});
577 OperandType type3(Type::INT32, {});
578 // Phase 1, operands
579 auto op11 = model->addOperand(&type22);
580 auto param1 = model->addOperand(&type3);
581 auto layout = model->addOperand(&type0);
582 auto op41 = model->addOperand(&type23);
583 // Phase 2, operations
584 static int32_t param1_init[] = {2};
585 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
586 static bool8 layout_init[] = {true};
587 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
588 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
589 // Phase 3, inputs and outputs
590 model->identifyInputsAndOutputs(
591 {op11},
592 {op41});
593 assert(model->isValid());
594 }
595
is_ignored_nchw_2(int i)596 inline bool is_ignored_nchw_2(int i) {
597 static std::set<int> ignore = {};
598 return ignore.find(i) != ignore.end();
599 }
600
CreateModel_nchw_relaxed_2(Model * model)601 void CreateModel_nchw_relaxed_2(Model *model) {
602 OperandType type0(Type::BOOL, {});
603 OperandType type22(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
604 OperandType type23(Type::TENSOR_FLOAT32, {1, 1, 4, 4});
605 OperandType type3(Type::INT32, {});
606 // Phase 1, operands
607 auto op11 = model->addOperand(&type22);
608 auto param1 = model->addOperand(&type3);
609 auto layout = model->addOperand(&type0);
610 auto op41 = model->addOperand(&type23);
611 // Phase 2, operations
612 static int32_t param1_init[] = {2};
613 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
614 static bool8 layout_init[] = {true};
615 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
616 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
617 // Phase 3, inputs and outputs
618 model->identifyInputsAndOutputs(
619 {op11},
620 {op41});
621 // Phase 4: set relaxed execution
622 model->relaxComputationFloat32toFloat16(true);
623 assert(model->isValid());
624 }
625
is_ignored_nchw_relaxed_2(int i)626 inline bool is_ignored_nchw_relaxed_2(int i) {
627 static std::set<int> ignore = {};
628 return ignore.find(i) != ignore.end();
629 }
630
CreateModel_nchw_float16_2(Model * model)631 void CreateModel_nchw_float16_2(Model *model) {
632 OperandType type0(Type::BOOL, {});
633 OperandType type24(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
634 OperandType type25(Type::TENSOR_FLOAT16, {1, 1, 4, 4});
635 OperandType type3(Type::INT32, {});
636 // Phase 1, operands
637 auto op11 = model->addOperand(&type24);
638 auto param1 = model->addOperand(&type3);
639 auto layout = model->addOperand(&type0);
640 auto op41 = model->addOperand(&type25);
641 // Phase 2, operations
642 static int32_t param1_init[] = {2};
643 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
644 static bool8 layout_init[] = {true};
645 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
646 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
647 // Phase 3, inputs and outputs
648 model->identifyInputsAndOutputs(
649 {op11},
650 {op41});
651 assert(model->isValid());
652 }
653
is_ignored_nchw_float16_2(int i)654 inline bool is_ignored_nchw_float16_2(int i) {
655 static std::set<int> ignore = {};
656 return ignore.find(i) != ignore.end();
657 }
658
CreateModel_nchw_quant8_2(Model * model)659 void CreateModel_nchw_quant8_2(Model *model) {
660 OperandType type0(Type::BOOL, {});
661 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
662 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 0.5f, 128);
663 OperandType type3(Type::INT32, {});
664 // Phase 1, operands
665 auto op11 = model->addOperand(&type26);
666 auto param1 = model->addOperand(&type3);
667 auto layout = model->addOperand(&type0);
668 auto op41 = model->addOperand(&type27);
669 // Phase 2, operations
670 static int32_t param1_init[] = {2};
671 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
672 static bool8 layout_init[] = {true};
673 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
674 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
675 // Phase 3, inputs and outputs
676 model->identifyInputsAndOutputs(
677 {op11},
678 {op41});
679 assert(model->isValid());
680 }
681
is_ignored_nchw_quant8_2(int i)682 inline bool is_ignored_nchw_quant8_2(int i) {
683 static std::set<int> ignore = {};
684 return ignore.find(i) != ignore.end();
685 }
686
CreateModel_dynamic_output_shape_nhwc_2(Model * model)687 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) {
688 OperandType type0(Type::BOOL, {});
689 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
690 OperandType type3(Type::INT32, {});
691 OperandType type4(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
692 // Phase 1, operands
693 auto op11 = model->addOperand(&type4);
694 auto param1 = model->addOperand(&type3);
695 auto layout = model->addOperand(&type0);
696 auto op41 = model->addOperand(&type15);
697 // Phase 2, operations
698 static int32_t param1_init[] = {2};
699 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
700 static bool8 layout_init[] = {false};
701 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
702 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
703 // Phase 3, inputs and outputs
704 model->identifyInputsAndOutputs(
705 {op11},
706 {op41});
707 assert(model->isValid());
708 }
709
is_ignored_dynamic_output_shape_nhwc_2(int i)710 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) {
711 static std::set<int> ignore = {};
712 return ignore.find(i) != ignore.end();
713 }
714
CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model * model)715 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) {
716 OperandType type0(Type::BOOL, {});
717 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
718 OperandType type3(Type::INT32, {});
719 OperandType type4(Type::TENSOR_FLOAT32, {1, 2, 2, 4});
720 // Phase 1, operands
721 auto op11 = model->addOperand(&type4);
722 auto param1 = model->addOperand(&type3);
723 auto layout = model->addOperand(&type0);
724 auto op41 = model->addOperand(&type15);
725 // Phase 2, operations
726 static int32_t param1_init[] = {2};
727 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
728 static bool8 layout_init[] = {false};
729 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
730 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
731 // Phase 3, inputs and outputs
732 model->identifyInputsAndOutputs(
733 {op11},
734 {op41});
735 // Phase 4: set relaxed execution
736 model->relaxComputationFloat32toFloat16(true);
737 assert(model->isValid());
738 }
739
is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i)740 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) {
741 static std::set<int> ignore = {};
742 return ignore.find(i) != ignore.end();
743 }
744
CreateModel_dynamic_output_shape_nhwc_float16_2(Model * model)745 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) {
746 OperandType type0(Type::BOOL, {});
747 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
748 OperandType type18(Type::TENSOR_FLOAT16, {1, 2, 2, 4});
749 OperandType type3(Type::INT32, {});
750 // Phase 1, operands
751 auto op11 = model->addOperand(&type18);
752 auto param1 = model->addOperand(&type3);
753 auto layout = model->addOperand(&type0);
754 auto op41 = model->addOperand(&type16);
755 // Phase 2, operations
756 static int32_t param1_init[] = {2};
757 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
758 static bool8 layout_init[] = {false};
759 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
760 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
761 // Phase 3, inputs and outputs
762 model->identifyInputsAndOutputs(
763 {op11},
764 {op41});
765 assert(model->isValid());
766 }
767
is_ignored_dynamic_output_shape_nhwc_float16_2(int i)768 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) {
769 static std::set<int> ignore = {};
770 return ignore.find(i) != ignore.end();
771 }
772
CreateModel_dynamic_output_shape_nhwc_quant8_2(Model * model)773 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) {
774 OperandType type0(Type::BOOL, {});
775 OperandType type20(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 128);
776 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 128);
777 OperandType type3(Type::INT32, {});
778 // Phase 1, operands
779 auto op11 = model->addOperand(&type20);
780 auto param1 = model->addOperand(&type3);
781 auto layout = model->addOperand(&type0);
782 auto op41 = model->addOperand(&type28);
783 // Phase 2, operations
784 static int32_t param1_init[] = {2};
785 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
786 static bool8 layout_init[] = {false};
787 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
788 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
789 // Phase 3, inputs and outputs
790 model->identifyInputsAndOutputs(
791 {op11},
792 {op41});
793 assert(model->isValid());
794 }
795
is_ignored_dynamic_output_shape_nhwc_quant8_2(int i)796 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) {
797 static std::set<int> ignore = {};
798 return ignore.find(i) != ignore.end();
799 }
800
CreateModel_dynamic_output_shape_nchw_2(Model * model)801 void CreateModel_dynamic_output_shape_nchw_2(Model *model) {
802 OperandType type0(Type::BOOL, {});
803 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
804 OperandType type22(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
805 OperandType type3(Type::INT32, {});
806 // Phase 1, operands
807 auto op11 = model->addOperand(&type22);
808 auto param1 = model->addOperand(&type3);
809 auto layout = model->addOperand(&type0);
810 auto op41 = model->addOperand(&type15);
811 // Phase 2, operations
812 static int32_t param1_init[] = {2};
813 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
814 static bool8 layout_init[] = {true};
815 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
816 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
817 // Phase 3, inputs and outputs
818 model->identifyInputsAndOutputs(
819 {op11},
820 {op41});
821 assert(model->isValid());
822 }
823
is_ignored_dynamic_output_shape_nchw_2(int i)824 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) {
825 static std::set<int> ignore = {};
826 return ignore.find(i) != ignore.end();
827 }
828
CreateModel_dynamic_output_shape_nchw_relaxed_2(Model * model)829 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) {
830 OperandType type0(Type::BOOL, {});
831 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
832 OperandType type22(Type::TENSOR_FLOAT32, {1, 4, 2, 2});
833 OperandType type3(Type::INT32, {});
834 // Phase 1, operands
835 auto op11 = model->addOperand(&type22);
836 auto param1 = model->addOperand(&type3);
837 auto layout = model->addOperand(&type0);
838 auto op41 = model->addOperand(&type15);
839 // Phase 2, operations
840 static int32_t param1_init[] = {2};
841 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
842 static bool8 layout_init[] = {true};
843 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
844 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
845 // Phase 3, inputs and outputs
846 model->identifyInputsAndOutputs(
847 {op11},
848 {op41});
849 // Phase 4: set relaxed execution
850 model->relaxComputationFloat32toFloat16(true);
851 assert(model->isValid());
852 }
853
is_ignored_dynamic_output_shape_nchw_relaxed_2(int i)854 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) {
855 static std::set<int> ignore = {};
856 return ignore.find(i) != ignore.end();
857 }
858
CreateModel_dynamic_output_shape_nchw_float16_2(Model * model)859 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) {
860 OperandType type0(Type::BOOL, {});
861 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
862 OperandType type24(Type::TENSOR_FLOAT16, {1, 4, 2, 2});
863 OperandType type3(Type::INT32, {});
864 // Phase 1, operands
865 auto op11 = model->addOperand(&type24);
866 auto param1 = model->addOperand(&type3);
867 auto layout = model->addOperand(&type0);
868 auto op41 = model->addOperand(&type16);
869 // Phase 2, operations
870 static int32_t param1_init[] = {2};
871 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
872 static bool8 layout_init[] = {true};
873 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
874 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
875 // Phase 3, inputs and outputs
876 model->identifyInputsAndOutputs(
877 {op11},
878 {op41});
879 assert(model->isValid());
880 }
881
is_ignored_dynamic_output_shape_nchw_float16_2(int i)882 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) {
883 static std::set<int> ignore = {};
884 return ignore.find(i) != ignore.end();
885 }
886
CreateModel_dynamic_output_shape_nchw_quant8_2(Model * model)887 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) {
888 OperandType type0(Type::BOOL, {});
889 OperandType type26(Type::TENSOR_QUANT8_ASYMM, {1, 4, 2, 2}, 0.5f, 128);
890 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 128);
891 OperandType type3(Type::INT32, {});
892 // Phase 1, operands
893 auto op11 = model->addOperand(&type26);
894 auto param1 = model->addOperand(&type3);
895 auto layout = model->addOperand(&type0);
896 auto op41 = model->addOperand(&type28);
897 // Phase 2, operations
898 static int32_t param1_init[] = {2};
899 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1);
900 static bool8 layout_init[] = {true};
901 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
902 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op11, param1, layout}, {op41});
903 // Phase 3, inputs and outputs
904 model->identifyInputsAndOutputs(
905 {op11},
906 {op41});
907 assert(model->isValid());
908 }
909
is_ignored_dynamic_output_shape_nchw_quant8_2(int i)910 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) {
911 static std::set<int> ignore = {};
912 return ignore.find(i) != ignore.end();
913 }
914
CreateModel_nhwc_3(Model * model)915 void CreateModel_nhwc_3(Model *model) {
916 OperandType type0(Type::BOOL, {});
917 OperandType type3(Type::INT32, {});
918 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
919 OperandType type7(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
920 // Phase 1, operands
921 auto op12 = model->addOperand(&type6);
922 auto param2 = model->addOperand(&type3);
923 auto layout = model->addOperand(&type0);
924 auto op42 = model->addOperand(&type7);
925 // Phase 2, operations
926 static int32_t param2_init[] = {2};
927 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
928 static bool8 layout_init[] = {false};
929 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
930 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
931 // Phase 3, inputs and outputs
932 model->identifyInputsAndOutputs(
933 {op12},
934 {op42});
935 assert(model->isValid());
936 }
937
is_ignored_nhwc_3(int i)938 inline bool is_ignored_nhwc_3(int i) {
939 static std::set<int> ignore = {};
940 return ignore.find(i) != ignore.end();
941 }
942
CreateModel_nhwc_relaxed_3(Model * model)943 void CreateModel_nhwc_relaxed_3(Model *model) {
944 OperandType type0(Type::BOOL, {});
945 OperandType type3(Type::INT32, {});
946 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
947 OperandType type7(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
948 // Phase 1, operands
949 auto op12 = model->addOperand(&type6);
950 auto param2 = model->addOperand(&type3);
951 auto layout = model->addOperand(&type0);
952 auto op42 = model->addOperand(&type7);
953 // Phase 2, operations
954 static int32_t param2_init[] = {2};
955 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
956 static bool8 layout_init[] = {false};
957 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
958 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
959 // Phase 3, inputs and outputs
960 model->identifyInputsAndOutputs(
961 {op12},
962 {op42});
963 // Phase 4: set relaxed execution
964 model->relaxComputationFloat32toFloat16(true);
965 assert(model->isValid());
966 }
967
is_ignored_nhwc_relaxed_3(int i)968 inline bool is_ignored_nhwc_relaxed_3(int i) {
969 static std::set<int> ignore = {};
970 return ignore.find(i) != ignore.end();
971 }
972
CreateModel_nhwc_float16_3(Model * model)973 void CreateModel_nhwc_float16_3(Model *model) {
974 OperandType type0(Type::BOOL, {});
975 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 2, 8});
976 OperandType type3(Type::INT32, {});
977 OperandType type30(Type::TENSOR_FLOAT16, {1, 4, 4, 2});
978 // Phase 1, operands
979 auto op12 = model->addOperand(&type29);
980 auto param2 = model->addOperand(&type3);
981 auto layout = model->addOperand(&type0);
982 auto op42 = model->addOperand(&type30);
983 // Phase 2, operations
984 static int32_t param2_init[] = {2};
985 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
986 static bool8 layout_init[] = {false};
987 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
988 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
989 // Phase 3, inputs and outputs
990 model->identifyInputsAndOutputs(
991 {op12},
992 {op42});
993 assert(model->isValid());
994 }
995
is_ignored_nhwc_float16_3(int i)996 inline bool is_ignored_nhwc_float16_3(int i) {
997 static std::set<int> ignore = {};
998 return ignore.find(i) != ignore.end();
999 }
1000
CreateModel_nhwc_quant8_3(Model * model)1001 void CreateModel_nhwc_quant8_3(Model *model) {
1002 OperandType type0(Type::BOOL, {});
1003 OperandType type3(Type::INT32, {});
1004 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 8}, 1.0f, 0);
1005 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 1.0f, 0);
1006 // Phase 1, operands
1007 auto op12 = model->addOperand(&type31);
1008 auto param2 = model->addOperand(&type3);
1009 auto layout = model->addOperand(&type0);
1010 auto op42 = model->addOperand(&type32);
1011 // Phase 2, operations
1012 static int32_t param2_init[] = {2};
1013 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1014 static bool8 layout_init[] = {false};
1015 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1016 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1017 // Phase 3, inputs and outputs
1018 model->identifyInputsAndOutputs(
1019 {op12},
1020 {op42});
1021 assert(model->isValid());
1022 }
1023
is_ignored_nhwc_quant8_3(int i)1024 inline bool is_ignored_nhwc_quant8_3(int i) {
1025 static std::set<int> ignore = {};
1026 return ignore.find(i) != ignore.end();
1027 }
1028
CreateModel_nchw_3(Model * model)1029 void CreateModel_nchw_3(Model *model) {
1030 OperandType type0(Type::BOOL, {});
1031 OperandType type3(Type::INT32, {});
1032 OperandType type33(Type::TENSOR_FLOAT32, {1, 8, 2, 2});
1033 OperandType type34(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
1034 // Phase 1, operands
1035 auto op12 = model->addOperand(&type33);
1036 auto param2 = model->addOperand(&type3);
1037 auto layout = model->addOperand(&type0);
1038 auto op42 = model->addOperand(&type34);
1039 // Phase 2, operations
1040 static int32_t param2_init[] = {2};
1041 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1042 static bool8 layout_init[] = {true};
1043 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1044 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1045 // Phase 3, inputs and outputs
1046 model->identifyInputsAndOutputs(
1047 {op12},
1048 {op42});
1049 assert(model->isValid());
1050 }
1051
is_ignored_nchw_3(int i)1052 inline bool is_ignored_nchw_3(int i) {
1053 static std::set<int> ignore = {};
1054 return ignore.find(i) != ignore.end();
1055 }
1056
CreateModel_nchw_relaxed_3(Model * model)1057 void CreateModel_nchw_relaxed_3(Model *model) {
1058 OperandType type0(Type::BOOL, {});
1059 OperandType type3(Type::INT32, {});
1060 OperandType type33(Type::TENSOR_FLOAT32, {1, 8, 2, 2});
1061 OperandType type34(Type::TENSOR_FLOAT32, {1, 2, 4, 4});
1062 // Phase 1, operands
1063 auto op12 = model->addOperand(&type33);
1064 auto param2 = model->addOperand(&type3);
1065 auto layout = model->addOperand(&type0);
1066 auto op42 = model->addOperand(&type34);
1067 // Phase 2, operations
1068 static int32_t param2_init[] = {2};
1069 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1070 static bool8 layout_init[] = {true};
1071 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1072 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1073 // Phase 3, inputs and outputs
1074 model->identifyInputsAndOutputs(
1075 {op12},
1076 {op42});
1077 // Phase 4: set relaxed execution
1078 model->relaxComputationFloat32toFloat16(true);
1079 assert(model->isValid());
1080 }
1081
is_ignored_nchw_relaxed_3(int i)1082 inline bool is_ignored_nchw_relaxed_3(int i) {
1083 static std::set<int> ignore = {};
1084 return ignore.find(i) != ignore.end();
1085 }
1086
CreateModel_nchw_float16_3(Model * model)1087 void CreateModel_nchw_float16_3(Model *model) {
1088 OperandType type0(Type::BOOL, {});
1089 OperandType type3(Type::INT32, {});
1090 OperandType type35(Type::TENSOR_FLOAT16, {1, 8, 2, 2});
1091 OperandType type36(Type::TENSOR_FLOAT16, {1, 2, 4, 4});
1092 // Phase 1, operands
1093 auto op12 = model->addOperand(&type35);
1094 auto param2 = model->addOperand(&type3);
1095 auto layout = model->addOperand(&type0);
1096 auto op42 = model->addOperand(&type36);
1097 // Phase 2, operations
1098 static int32_t param2_init[] = {2};
1099 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1100 static bool8 layout_init[] = {true};
1101 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1102 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1103 // Phase 3, inputs and outputs
1104 model->identifyInputsAndOutputs(
1105 {op12},
1106 {op42});
1107 assert(model->isValid());
1108 }
1109
is_ignored_nchw_float16_3(int i)1110 inline bool is_ignored_nchw_float16_3(int i) {
1111 static std::set<int> ignore = {};
1112 return ignore.find(i) != ignore.end();
1113 }
1114
CreateModel_nchw_quant8_3(Model * model)1115 void CreateModel_nchw_quant8_3(Model *model) {
1116 OperandType type0(Type::BOOL, {});
1117 OperandType type3(Type::INT32, {});
1118 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 8, 2, 2}, 1.0f, 0);
1119 OperandType type38(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 1.0f, 0);
1120 // Phase 1, operands
1121 auto op12 = model->addOperand(&type37);
1122 auto param2 = model->addOperand(&type3);
1123 auto layout = model->addOperand(&type0);
1124 auto op42 = model->addOperand(&type38);
1125 // Phase 2, operations
1126 static int32_t param2_init[] = {2};
1127 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1128 static bool8 layout_init[] = {true};
1129 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1130 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1131 // Phase 3, inputs and outputs
1132 model->identifyInputsAndOutputs(
1133 {op12},
1134 {op42});
1135 assert(model->isValid());
1136 }
1137
is_ignored_nchw_quant8_3(int i)1138 inline bool is_ignored_nchw_quant8_3(int i) {
1139 static std::set<int> ignore = {};
1140 return ignore.find(i) != ignore.end();
1141 }
1142
CreateModel_dynamic_output_shape_nhwc_3(Model * model)1143 void CreateModel_dynamic_output_shape_nhwc_3(Model *model) {
1144 OperandType type0(Type::BOOL, {});
1145 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1146 OperandType type3(Type::INT32, {});
1147 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
1148 // Phase 1, operands
1149 auto op12 = model->addOperand(&type6);
1150 auto param2 = model->addOperand(&type3);
1151 auto layout = model->addOperand(&type0);
1152 auto op42 = model->addOperand(&type15);
1153 // Phase 2, operations
1154 static int32_t param2_init[] = {2};
1155 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1156 static bool8 layout_init[] = {false};
1157 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1158 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1159 // Phase 3, inputs and outputs
1160 model->identifyInputsAndOutputs(
1161 {op12},
1162 {op42});
1163 assert(model->isValid());
1164 }
1165
is_ignored_dynamic_output_shape_nhwc_3(int i)1166 inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) {
1167 static std::set<int> ignore = {};
1168 return ignore.find(i) != ignore.end();
1169 }
1170
CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model * model)1171 void CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model *model) {
1172 OperandType type0(Type::BOOL, {});
1173 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1174 OperandType type3(Type::INT32, {});
1175 OperandType type6(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
1176 // Phase 1, operands
1177 auto op12 = model->addOperand(&type6);
1178 auto param2 = model->addOperand(&type3);
1179 auto layout = model->addOperand(&type0);
1180 auto op42 = model->addOperand(&type15);
1181 // Phase 2, operations
1182 static int32_t param2_init[] = {2};
1183 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1184 static bool8 layout_init[] = {false};
1185 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1186 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1187 // Phase 3, inputs and outputs
1188 model->identifyInputsAndOutputs(
1189 {op12},
1190 {op42});
1191 // Phase 4: set relaxed execution
1192 model->relaxComputationFloat32toFloat16(true);
1193 assert(model->isValid());
1194 }
1195
is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i)1196 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) {
1197 static std::set<int> ignore = {};
1198 return ignore.find(i) != ignore.end();
1199 }
1200
CreateModel_dynamic_output_shape_nhwc_float16_3(Model * model)1201 void CreateModel_dynamic_output_shape_nhwc_float16_3(Model *model) {
1202 OperandType type0(Type::BOOL, {});
1203 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1204 OperandType type29(Type::TENSOR_FLOAT16, {1, 2, 2, 8});
1205 OperandType type3(Type::INT32, {});
1206 // Phase 1, operands
1207 auto op12 = model->addOperand(&type29);
1208 auto param2 = model->addOperand(&type3);
1209 auto layout = model->addOperand(&type0);
1210 auto op42 = model->addOperand(&type16);
1211 // Phase 2, operations
1212 static int32_t param2_init[] = {2};
1213 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1214 static bool8 layout_init[] = {false};
1215 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1216 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1217 // Phase 3, inputs and outputs
1218 model->identifyInputsAndOutputs(
1219 {op12},
1220 {op42});
1221 assert(model->isValid());
1222 }
1223
is_ignored_dynamic_output_shape_nhwc_float16_3(int i)1224 inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) {
1225 static std::set<int> ignore = {};
1226 return ignore.find(i) != ignore.end();
1227 }
1228
CreateModel_dynamic_output_shape_nhwc_quant8_3(Model * model)1229 void CreateModel_dynamic_output_shape_nhwc_quant8_3(Model *model) {
1230 OperandType type0(Type::BOOL, {});
1231 OperandType type3(Type::INT32, {});
1232 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 8}, 1.0f, 0);
1233 OperandType type39(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 0);
1234 // Phase 1, operands
1235 auto op12 = model->addOperand(&type31);
1236 auto param2 = model->addOperand(&type3);
1237 auto layout = model->addOperand(&type0);
1238 auto op42 = model->addOperand(&type39);
1239 // Phase 2, operations
1240 static int32_t param2_init[] = {2};
1241 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1242 static bool8 layout_init[] = {false};
1243 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1244 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1245 // Phase 3, inputs and outputs
1246 model->identifyInputsAndOutputs(
1247 {op12},
1248 {op42});
1249 assert(model->isValid());
1250 }
1251
is_ignored_dynamic_output_shape_nhwc_quant8_3(int i)1252 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) {
1253 static std::set<int> ignore = {};
1254 return ignore.find(i) != ignore.end();
1255 }
1256
CreateModel_dynamic_output_shape_nchw_3(Model * model)1257 void CreateModel_dynamic_output_shape_nchw_3(Model *model) {
1258 OperandType type0(Type::BOOL, {});
1259 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1260 OperandType type3(Type::INT32, {});
1261 OperandType type33(Type::TENSOR_FLOAT32, {1, 8, 2, 2});
1262 // Phase 1, operands
1263 auto op12 = model->addOperand(&type33);
1264 auto param2 = model->addOperand(&type3);
1265 auto layout = model->addOperand(&type0);
1266 auto op42 = model->addOperand(&type15);
1267 // Phase 2, operations
1268 static int32_t param2_init[] = {2};
1269 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1270 static bool8 layout_init[] = {true};
1271 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1272 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1273 // Phase 3, inputs and outputs
1274 model->identifyInputsAndOutputs(
1275 {op12},
1276 {op42});
1277 assert(model->isValid());
1278 }
1279
is_ignored_dynamic_output_shape_nchw_3(int i)1280 inline bool is_ignored_dynamic_output_shape_nchw_3(int i) {
1281 static std::set<int> ignore = {};
1282 return ignore.find(i) != ignore.end();
1283 }
1284
CreateModel_dynamic_output_shape_nchw_relaxed_3(Model * model)1285 void CreateModel_dynamic_output_shape_nchw_relaxed_3(Model *model) {
1286 OperandType type0(Type::BOOL, {});
1287 OperandType type15(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
1288 OperandType type3(Type::INT32, {});
1289 OperandType type33(Type::TENSOR_FLOAT32, {1, 8, 2, 2});
1290 // Phase 1, operands
1291 auto op12 = model->addOperand(&type33);
1292 auto param2 = model->addOperand(&type3);
1293 auto layout = model->addOperand(&type0);
1294 auto op42 = model->addOperand(&type15);
1295 // Phase 2, operations
1296 static int32_t param2_init[] = {2};
1297 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1298 static bool8 layout_init[] = {true};
1299 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1300 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1301 // Phase 3, inputs and outputs
1302 model->identifyInputsAndOutputs(
1303 {op12},
1304 {op42});
1305 // Phase 4: set relaxed execution
1306 model->relaxComputationFloat32toFloat16(true);
1307 assert(model->isValid());
1308 }
1309
is_ignored_dynamic_output_shape_nchw_relaxed_3(int i)1310 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) {
1311 static std::set<int> ignore = {};
1312 return ignore.find(i) != ignore.end();
1313 }
1314
CreateModel_dynamic_output_shape_nchw_float16_3(Model * model)1315 void CreateModel_dynamic_output_shape_nchw_float16_3(Model *model) {
1316 OperandType type0(Type::BOOL, {});
1317 OperandType type16(Type::TENSOR_FLOAT16, {0, 0, 0, 0});
1318 OperandType type3(Type::INT32, {});
1319 OperandType type35(Type::TENSOR_FLOAT16, {1, 8, 2, 2});
1320 // Phase 1, operands
1321 auto op12 = model->addOperand(&type35);
1322 auto param2 = model->addOperand(&type3);
1323 auto layout = model->addOperand(&type0);
1324 auto op42 = model->addOperand(&type16);
1325 // Phase 2, operations
1326 static int32_t param2_init[] = {2};
1327 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1328 static bool8 layout_init[] = {true};
1329 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1330 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1331 // Phase 3, inputs and outputs
1332 model->identifyInputsAndOutputs(
1333 {op12},
1334 {op42});
1335 assert(model->isValid());
1336 }
1337
is_ignored_dynamic_output_shape_nchw_float16_3(int i)1338 inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) {
1339 static std::set<int> ignore = {};
1340 return ignore.find(i) != ignore.end();
1341 }
1342
CreateModel_dynamic_output_shape_nchw_quant8_3(Model * model)1343 void CreateModel_dynamic_output_shape_nchw_quant8_3(Model *model) {
1344 OperandType type0(Type::BOOL, {});
1345 OperandType type3(Type::INT32, {});
1346 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 8, 2, 2}, 1.0f, 0);
1347 OperandType type39(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 0);
1348 // Phase 1, operands
1349 auto op12 = model->addOperand(&type37);
1350 auto param2 = model->addOperand(&type3);
1351 auto layout = model->addOperand(&type0);
1352 auto op42 = model->addOperand(&type39);
1353 // Phase 2, operations
1354 static int32_t param2_init[] = {2};
1355 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1);
1356 static bool8 layout_init[] = {true};
1357 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1);
1358 model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {op12, param2, layout}, {op42});
1359 // Phase 3, inputs and outputs
1360 model->identifyInputsAndOutputs(
1361 {op12},
1362 {op42});
1363 assert(model->isValid());
1364 }
1365
is_ignored_dynamic_output_shape_nchw_quant8_3(int i)1366 inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) {
1367 static std::set<int> ignore = {};
1368 return ignore.find(i) != ignore.end();
1369 }
1370
1371