1 // clang-format off
2 // Generated file (from: resize_bilinear_2_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
5 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 2});
6 OperandType type2(Type::INT32, {});
7 // Phase 1, operands
8 auto op1 = model->addOperand(&type0);
9 auto width = model->addOperand(&type2);
10 auto height = model->addOperand(&type2);
11 auto op2 = model->addOperand(&type1);
12 // Phase 2, operations
13 static int32_t width_init[] = {3};
14 model->setOperandValue(width, width_init, sizeof(int32_t) * 1);
15 static int32_t height_init[] = {3};
16 model->setOperandValue(height, height_init, sizeof(int32_t) * 1);
17 model->addOperation(ANEURALNETWORKS_RESIZE_BILINEAR, {op1, width, height}, {op2});
18 // Phase 3, inputs and outputs
19 model->identifyInputsAndOutputs(
20 {op1},
21 {op2});
22 // Phase 4: set relaxed execution
23 model->relaxComputationFloat32toFloat16(true);
24 assert(model->isValid());
25 }
26
is_ignored(int i)27 inline bool is_ignored(int i) {
28 static std::set<int> ignore = {};
29 return ignore.find(i) != ignore.end();
30 }
31
CreateModel_dynamic_output_shape(Model * model)32 void CreateModel_dynamic_output_shape(Model *model) {
33 OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
34 OperandType type2(Type::INT32, {});
35 OperandType type3(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
36 // Phase 1, operands
37 auto op1 = model->addOperand(&type0);
38 auto width = model->addOperand(&type2);
39 auto height = model->addOperand(&type2);
40 auto op2 = model->addOperand(&type3);
41 // Phase 2, operations
42 static int32_t width_init[] = {3};
43 model->setOperandValue(width, width_init, sizeof(int32_t) * 1);
44 static int32_t height_init[] = {3};
45 model->setOperandValue(height, height_init, sizeof(int32_t) * 1);
46 model->addOperation(ANEURALNETWORKS_RESIZE_BILINEAR, {op1, width, height}, {op2});
47 // Phase 3, inputs and outputs
48 model->identifyInputsAndOutputs(
49 {op1},
50 {op2});
51 // Phase 4: set relaxed execution
52 model->relaxComputationFloat32toFloat16(true);
53 assert(model->isValid());
54 }
55
is_ignored_dynamic_output_shape(int i)56 inline bool is_ignored_dynamic_output_shape(int i) {
57 static std::set<int> ignore = {};
58 return ignore.find(i) != ignore.end();
59 }
60
61