1 // clang-format off
2 // Generated file (from: conv_1_h3_w2_SAME_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::INT32, {});
5 OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
6 OperandType type2(Type::TENSOR_FLOAT32, {1, 8, 8, 1});
7 OperandType type3(Type::TENSOR_FLOAT32, {1, 3, 2, 3});
8 OperandType type4(Type::TENSOR_FLOAT32, {1});
9 // Phase 1, operands
10 auto op2 = model->addOperand(&type1);
11 auto op0 = model->addOperand(&type3);
12 auto op1 = model->addOperand(&type4);
13 auto b4 = model->addOperand(&type0);
14 auto b5 = model->addOperand(&type0);
15 auto b6 = model->addOperand(&type0);
16 auto b7 = model->addOperand(&type0);
17 auto op3 = model->addOperand(&type2);
18 // Phase 2, operations
19 static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
20 model->setOperandValue(op0, op0_init, sizeof(float) * 18);
21 static float op1_init[] = {0.0f};
22 model->setOperandValue(op1, op1_init, sizeof(float) * 1);
23 static int32_t b4_init[] = {1};
24 model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
25 static int32_t b5_init[] = {1};
26 model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
27 static int32_t b6_init[] = {1};
28 model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
29 static int32_t b7_init[] = {0};
30 model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
31 model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
32 // Phase 3, inputs and outputs
33 model->identifyInputsAndOutputs(
34 {op2},
35 {op3});
36 // Phase 4: set relaxed execution
37 model->relaxComputationFloat32toFloat16(true);
38 assert(model->isValid());
39 }
40
is_ignored(int i)41 inline bool is_ignored(int i) {
42 static std::set<int> ignore = {};
43 return ignore.find(i) != ignore.end();
44 }
45
CreateModel_dynamic_output_shape(Model * model)46 void CreateModel_dynamic_output_shape(Model *model) {
47 OperandType type0(Type::INT32, {});
48 OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
49 OperandType type3(Type::TENSOR_FLOAT32, {1, 3, 2, 3});
50 OperandType type4(Type::TENSOR_FLOAT32, {1});
51 OperandType type5(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
52 // Phase 1, operands
53 auto op2 = model->addOperand(&type1);
54 auto op0 = model->addOperand(&type3);
55 auto op1 = model->addOperand(&type4);
56 auto b4 = model->addOperand(&type0);
57 auto b5 = model->addOperand(&type0);
58 auto b6 = model->addOperand(&type0);
59 auto b7 = model->addOperand(&type0);
60 auto op3 = model->addOperand(&type5);
61 // Phase 2, operations
62 static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
63 model->setOperandValue(op0, op0_init, sizeof(float) * 18);
64 static float op1_init[] = {0.0f};
65 model->setOperandValue(op1, op1_init, sizeof(float) * 1);
66 static int32_t b4_init[] = {1};
67 model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
68 static int32_t b5_init[] = {1};
69 model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
70 static int32_t b6_init[] = {1};
71 model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
72 static int32_t b7_init[] = {0};
73 model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
74 model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
75 // Phase 3, inputs and outputs
76 model->identifyInputsAndOutputs(
77 {op2},
78 {op3});
79 // Phase 4: set relaxed execution
80 model->relaxComputationFloat32toFloat16(true);
81 assert(model->isValid());
82 }
83
is_ignored_dynamic_output_shape(int i)84 inline bool is_ignored_dynamic_output_shape(int i) {
85 static std::set<int> ignore = {};
86 return ignore.find(i) != ignore.end();
87 }
88
CreateModel_2(Model * model)89 void CreateModel_2(Model *model) {
90 OperandType type0(Type::INT32, {});
91 OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
92 OperandType type2(Type::TENSOR_FLOAT32, {1, 8, 8, 1});
93 OperandType type3(Type::TENSOR_FLOAT32, {1, 3, 2, 3});
94 OperandType type4(Type::TENSOR_FLOAT32, {1});
95 // Phase 1, operands
96 auto op2 = model->addOperand(&type1);
97 auto op0 = model->addOperand(&type3);
98 auto op1 = model->addOperand(&type4);
99 auto b4 = model->addOperand(&type0);
100 auto b5 = model->addOperand(&type0);
101 auto b6 = model->addOperand(&type0);
102 auto b7 = model->addOperand(&type0);
103 auto op3 = model->addOperand(&type2);
104 // Phase 2, operations
105 static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
106 model->setOperandValue(op0, op0_init, sizeof(float) * 18);
107 static float op1_init[] = {0.0f};
108 model->setOperandValue(op1, op1_init, sizeof(float) * 1);
109 static int32_t b4_init[] = {1};
110 model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
111 static int32_t b5_init[] = {1};
112 model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
113 static int32_t b6_init[] = {1};
114 model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
115 static int32_t b7_init[] = {0};
116 model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
117 model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
118 // Phase 3, inputs and outputs
119 model->identifyInputsAndOutputs(
120 {op2},
121 {op3});
122 // Phase 4: set relaxed execution
123 model->relaxComputationFloat32toFloat16(true);
124 assert(model->isValid());
125 }
126
is_ignored_2(int i)127 inline bool is_ignored_2(int i) {
128 static std::set<int> ignore = {};
129 return ignore.find(i) != ignore.end();
130 }
131
CreateModel_dynamic_output_shape_2(Model * model)132 void CreateModel_dynamic_output_shape_2(Model *model) {
133 OperandType type0(Type::INT32, {});
134 OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
135 OperandType type3(Type::TENSOR_FLOAT32, {1, 3, 2, 3});
136 OperandType type4(Type::TENSOR_FLOAT32, {1});
137 OperandType type5(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
138 // Phase 1, operands
139 auto op2 = model->addOperand(&type1);
140 auto op0 = model->addOperand(&type3);
141 auto op1 = model->addOperand(&type4);
142 auto b4 = model->addOperand(&type0);
143 auto b5 = model->addOperand(&type0);
144 auto b6 = model->addOperand(&type0);
145 auto b7 = model->addOperand(&type0);
146 auto op3 = model->addOperand(&type5);
147 // Phase 2, operations
148 static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
149 model->setOperandValue(op0, op0_init, sizeof(float) * 18);
150 static float op1_init[] = {0.0f};
151 model->setOperandValue(op1, op1_init, sizeof(float) * 1);
152 static int32_t b4_init[] = {1};
153 model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
154 static int32_t b5_init[] = {1};
155 model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
156 static int32_t b6_init[] = {1};
157 model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
158 static int32_t b7_init[] = {0};
159 model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
160 model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
161 // Phase 3, inputs and outputs
162 model->identifyInputsAndOutputs(
163 {op2},
164 {op3});
165 // Phase 4: set relaxed execution
166 model->relaxComputationFloat32toFloat16(true);
167 assert(model->isValid());
168 }
169
is_ignored_dynamic_output_shape_2(int i)170 inline bool is_ignored_dynamic_output_shape_2(int i) {
171 static std::set<int> ignore = {};
172 return ignore.find(i) != ignore.end();
173 }
174
175