1 // clang-format off
2 // Generated file (from: bidirectional_sequence_rnn.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
5 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
6 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
7 OperandType type3(Type::TENSOR_FLOAT32, {16});
8 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
9 OperandType type5(Type::TENSOR_FLOAT32, {0});
10 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
11 OperandType type7(Type::INT32, {});
12 OperandType type8(Type::BOOL, {});
13 // Phase 1, operands
14 auto input = model->addOperand(&type0);
15 auto fw_weights = model->addOperand(&type1);
16 auto fw_recurrent_weights = model->addOperand(&type2);
17 auto fw_bias = model->addOperand(&type3);
18 auto fw_hidden_state = model->addOperand(&type4);
19 auto bw_weights = model->addOperand(&type1);
20 auto bw_recurrent_weights = model->addOperand(&type2);
21 auto bw_bias = model->addOperand(&type3);
22 auto bw_hidden_state = model->addOperand(&type4);
23 auto aux_input = model->addOperand(&type5);
24 auto fw_aux_weights = model->addOperand(&type5);
25 auto bw_aux_weights = model->addOperand(&type5);
26 auto activation = model->addOperand(&type7);
27 auto time_major = model->addOperand(&type8);
28 auto merge_outputs = model->addOperand(&type8);
29 auto fw_output = model->addOperand(&type6);
30 auto bw_output = model->addOperand(&type6);
31 // Phase 2, operations
32 static int32_t activation_init[] = {1};
33 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
34 static bool8 time_major_init[] = {false};
35 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
36 static bool8 merge_outputs_init[] = {false};
37 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
38 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
39 // Phase 3, inputs and outputs
40 model->identifyInputsAndOutputs(
41 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
42 {fw_output, bw_output});
43 assert(model->isValid());
44 }
45
is_ignored(int i)46 inline bool is_ignored(int i) {
47 static std::set<int> ignore = {};
48 return ignore.find(i) != ignore.end();
49 }
50
CreateModel_relaxed(Model * model)51 void CreateModel_relaxed(Model *model) {
52 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
53 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
54 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
55 OperandType type3(Type::TENSOR_FLOAT32, {16});
56 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
57 OperandType type5(Type::TENSOR_FLOAT32, {0});
58 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
59 OperandType type7(Type::INT32, {});
60 OperandType type8(Type::BOOL, {});
61 // Phase 1, operands
62 auto input = model->addOperand(&type0);
63 auto fw_weights = model->addOperand(&type1);
64 auto fw_recurrent_weights = model->addOperand(&type2);
65 auto fw_bias = model->addOperand(&type3);
66 auto fw_hidden_state = model->addOperand(&type4);
67 auto bw_weights = model->addOperand(&type1);
68 auto bw_recurrent_weights = model->addOperand(&type2);
69 auto bw_bias = model->addOperand(&type3);
70 auto bw_hidden_state = model->addOperand(&type4);
71 auto aux_input = model->addOperand(&type5);
72 auto fw_aux_weights = model->addOperand(&type5);
73 auto bw_aux_weights = model->addOperand(&type5);
74 auto activation = model->addOperand(&type7);
75 auto time_major = model->addOperand(&type8);
76 auto merge_outputs = model->addOperand(&type8);
77 auto fw_output = model->addOperand(&type6);
78 auto bw_output = model->addOperand(&type6);
79 // Phase 2, operations
80 static int32_t activation_init[] = {1};
81 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
82 static bool8 time_major_init[] = {false};
83 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
84 static bool8 merge_outputs_init[] = {false};
85 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
86 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
87 // Phase 3, inputs and outputs
88 model->identifyInputsAndOutputs(
89 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
90 {fw_output, bw_output});
91 // Phase 4: set relaxed execution
92 model->relaxComputationFloat32toFloat16(true);
93 assert(model->isValid());
94 }
95
is_ignored_relaxed(int i)96 inline bool is_ignored_relaxed(int i) {
97 static std::set<int> ignore = {};
98 return ignore.find(i) != ignore.end();
99 }
100
CreateModel_float16(Model * model)101 void CreateModel_float16(Model *model) {
102 OperandType type14(Type::TENSOR_FLOAT16, {0});
103 OperandType type15(Type::TENSOR_FLOAT16, {16});
104 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
105 OperandType type17(Type::TENSOR_FLOAT16, {2, 16, 16});
106 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
107 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
108 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
109 OperandType type7(Type::INT32, {});
110 OperandType type8(Type::BOOL, {});
111 // Phase 1, operands
112 auto input = model->addOperand(&type20);
113 auto fw_weights = model->addOperand(&type19);
114 auto fw_recurrent_weights = model->addOperand(&type18);
115 auto fw_bias = model->addOperand(&type15);
116 auto fw_hidden_state = model->addOperand(&type16);
117 auto bw_weights = model->addOperand(&type19);
118 auto bw_recurrent_weights = model->addOperand(&type18);
119 auto bw_bias = model->addOperand(&type15);
120 auto bw_hidden_state = model->addOperand(&type16);
121 auto aux_input = model->addOperand(&type14);
122 auto fw_aux_weights = model->addOperand(&type14);
123 auto bw_aux_weights = model->addOperand(&type14);
124 auto activation = model->addOperand(&type7);
125 auto time_major = model->addOperand(&type8);
126 auto merge_outputs = model->addOperand(&type8);
127 auto fw_output = model->addOperand(&type17);
128 auto bw_output = model->addOperand(&type17);
129 // Phase 2, operations
130 static int32_t activation_init[] = {1};
131 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
132 static bool8 time_major_init[] = {false};
133 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
134 static bool8 merge_outputs_init[] = {false};
135 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
136 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
137 // Phase 3, inputs and outputs
138 model->identifyInputsAndOutputs(
139 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
140 {fw_output, bw_output});
141 assert(model->isValid());
142 }
143
is_ignored_float16(int i)144 inline bool is_ignored_float16(int i) {
145 static std::set<int> ignore = {};
146 return ignore.find(i) != ignore.end();
147 }
148
CreateModel_dynamic_output_shape(Model * model)149 void CreateModel_dynamic_output_shape(Model *model) {
150 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
151 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
152 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
153 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
154 OperandType type3(Type::TENSOR_FLOAT32, {16});
155 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
156 OperandType type5(Type::TENSOR_FLOAT32, {0});
157 OperandType type7(Type::INT32, {});
158 OperandType type8(Type::BOOL, {});
159 // Phase 1, operands
160 auto input = model->addOperand(&type0);
161 auto fw_weights = model->addOperand(&type1);
162 auto fw_recurrent_weights = model->addOperand(&type2);
163 auto fw_bias = model->addOperand(&type3);
164 auto fw_hidden_state = model->addOperand(&type4);
165 auto bw_weights = model->addOperand(&type1);
166 auto bw_recurrent_weights = model->addOperand(&type2);
167 auto bw_bias = model->addOperand(&type3);
168 auto bw_hidden_state = model->addOperand(&type4);
169 auto aux_input = model->addOperand(&type5);
170 auto fw_aux_weights = model->addOperand(&type5);
171 auto bw_aux_weights = model->addOperand(&type5);
172 auto activation = model->addOperand(&type7);
173 auto time_major = model->addOperand(&type8);
174 auto merge_outputs = model->addOperand(&type8);
175 auto fw_output = model->addOperand(&type21);
176 auto bw_output = model->addOperand(&type21);
177 // Phase 2, operations
178 static int32_t activation_init[] = {1};
179 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
180 static bool8 time_major_init[] = {false};
181 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
182 static bool8 merge_outputs_init[] = {false};
183 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
184 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
185 // Phase 3, inputs and outputs
186 model->identifyInputsAndOutputs(
187 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
188 {fw_output, bw_output});
189 assert(model->isValid());
190 }
191
is_ignored_dynamic_output_shape(int i)192 inline bool is_ignored_dynamic_output_shape(int i) {
193 static std::set<int> ignore = {};
194 return ignore.find(i) != ignore.end();
195 }
196
CreateModel_dynamic_output_shape_relaxed(Model * model)197 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
198 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
199 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
200 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
201 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
202 OperandType type3(Type::TENSOR_FLOAT32, {16});
203 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
204 OperandType type5(Type::TENSOR_FLOAT32, {0});
205 OperandType type7(Type::INT32, {});
206 OperandType type8(Type::BOOL, {});
207 // Phase 1, operands
208 auto input = model->addOperand(&type0);
209 auto fw_weights = model->addOperand(&type1);
210 auto fw_recurrent_weights = model->addOperand(&type2);
211 auto fw_bias = model->addOperand(&type3);
212 auto fw_hidden_state = model->addOperand(&type4);
213 auto bw_weights = model->addOperand(&type1);
214 auto bw_recurrent_weights = model->addOperand(&type2);
215 auto bw_bias = model->addOperand(&type3);
216 auto bw_hidden_state = model->addOperand(&type4);
217 auto aux_input = model->addOperand(&type5);
218 auto fw_aux_weights = model->addOperand(&type5);
219 auto bw_aux_weights = model->addOperand(&type5);
220 auto activation = model->addOperand(&type7);
221 auto time_major = model->addOperand(&type8);
222 auto merge_outputs = model->addOperand(&type8);
223 auto fw_output = model->addOperand(&type21);
224 auto bw_output = model->addOperand(&type21);
225 // Phase 2, operations
226 static int32_t activation_init[] = {1};
227 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
228 static bool8 time_major_init[] = {false};
229 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
230 static bool8 merge_outputs_init[] = {false};
231 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
232 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
233 // Phase 3, inputs and outputs
234 model->identifyInputsAndOutputs(
235 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
236 {fw_output, bw_output});
237 // Phase 4: set relaxed execution
238 model->relaxComputationFloat32toFloat16(true);
239 assert(model->isValid());
240 }
241
is_ignored_dynamic_output_shape_relaxed(int i)242 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
243 static std::set<int> ignore = {};
244 return ignore.find(i) != ignore.end();
245 }
246
CreateModel_dynamic_output_shape_float16(Model * model)247 void CreateModel_dynamic_output_shape_float16(Model *model) {
248 OperandType type14(Type::TENSOR_FLOAT16, {0});
249 OperandType type15(Type::TENSOR_FLOAT16, {16});
250 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
251 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
252 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
253 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
254 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
255 OperandType type7(Type::INT32, {});
256 OperandType type8(Type::BOOL, {});
257 // Phase 1, operands
258 auto input = model->addOperand(&type20);
259 auto fw_weights = model->addOperand(&type19);
260 auto fw_recurrent_weights = model->addOperand(&type18);
261 auto fw_bias = model->addOperand(&type15);
262 auto fw_hidden_state = model->addOperand(&type16);
263 auto bw_weights = model->addOperand(&type19);
264 auto bw_recurrent_weights = model->addOperand(&type18);
265 auto bw_bias = model->addOperand(&type15);
266 auto bw_hidden_state = model->addOperand(&type16);
267 auto aux_input = model->addOperand(&type14);
268 auto fw_aux_weights = model->addOperand(&type14);
269 auto bw_aux_weights = model->addOperand(&type14);
270 auto activation = model->addOperand(&type7);
271 auto time_major = model->addOperand(&type8);
272 auto merge_outputs = model->addOperand(&type8);
273 auto fw_output = model->addOperand(&type22);
274 auto bw_output = model->addOperand(&type22);
275 // Phase 2, operations
276 static int32_t activation_init[] = {1};
277 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
278 static bool8 time_major_init[] = {false};
279 model->setOperandValue(time_major, time_major_init, sizeof(bool8) * 1);
280 static bool8 merge_outputs_init[] = {false};
281 model->setOperandValue(merge_outputs, merge_outputs_init, sizeof(bool8) * 1);
282 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights, activation, time_major, merge_outputs}, {fw_output, bw_output});
283 // Phase 3, inputs and outputs
284 model->identifyInputsAndOutputs(
285 {input, fw_weights, fw_recurrent_weights, fw_bias, fw_hidden_state, bw_weights, bw_recurrent_weights, bw_bias, bw_hidden_state, aux_input, fw_aux_weights, bw_aux_weights},
286 {fw_output, bw_output});
287 assert(model->isValid());
288 }
289
is_ignored_dynamic_output_shape_float16(int i)290 inline bool is_ignored_dynamic_output_shape_float16(int i) {
291 static std::set<int> ignore = {};
292 return ignore.find(i) != ignore.end();
293 }
294
CreateModel_2(Model * model)295 void CreateModel_2(Model *model) {
296 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
297 OperandType type10(Type::TENSOR_FLOAT32, {16, 2, 16});
298 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
299 OperandType type3(Type::TENSOR_FLOAT32, {16});
300 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
301 OperandType type5(Type::TENSOR_FLOAT32, {0});
302 OperandType type7(Type::INT32, {});
303 OperandType type8(Type::BOOL, {});
304 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
305 // Phase 1, operands
306 auto input1 = model->addOperand(&type9);
307 auto fw_weights1 = model->addOperand(&type1);
308 auto fw_recurrent_weights1 = model->addOperand(&type2);
309 auto fw_bias1 = model->addOperand(&type3);
310 auto fw_hidden_state1 = model->addOperand(&type4);
311 auto bw_weights1 = model->addOperand(&type1);
312 auto bw_recurrent_weights1 = model->addOperand(&type2);
313 auto bw_bias1 = model->addOperand(&type3);
314 auto bw_hidden_state1 = model->addOperand(&type4);
315 auto aux_input1 = model->addOperand(&type5);
316 auto fw_aux_weights1 = model->addOperand(&type5);
317 auto bw_aux_weights1 = model->addOperand(&type5);
318 auto activation1 = model->addOperand(&type7);
319 auto time_major1 = model->addOperand(&type8);
320 auto merge_outputs1 = model->addOperand(&type8);
321 auto fw_output1 = model->addOperand(&type10);
322 auto bw_output1 = model->addOperand(&type10);
323 // Phase 2, operations
324 static int32_t activation1_init[] = {1};
325 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
326 static bool8 time_major1_init[] = {true};
327 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
328 static bool8 merge_outputs1_init[] = {false};
329 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
330 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
331 // Phase 3, inputs and outputs
332 model->identifyInputsAndOutputs(
333 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
334 {fw_output1, bw_output1});
335 assert(model->isValid());
336 }
337
is_ignored_2(int i)338 inline bool is_ignored_2(int i) {
339 static std::set<int> ignore = {};
340 return ignore.find(i) != ignore.end();
341 }
342
CreateModel_relaxed_2(Model * model)343 void CreateModel_relaxed_2(Model *model) {
344 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
345 OperandType type10(Type::TENSOR_FLOAT32, {16, 2, 16});
346 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
347 OperandType type3(Type::TENSOR_FLOAT32, {16});
348 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
349 OperandType type5(Type::TENSOR_FLOAT32, {0});
350 OperandType type7(Type::INT32, {});
351 OperandType type8(Type::BOOL, {});
352 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
353 // Phase 1, operands
354 auto input1 = model->addOperand(&type9);
355 auto fw_weights1 = model->addOperand(&type1);
356 auto fw_recurrent_weights1 = model->addOperand(&type2);
357 auto fw_bias1 = model->addOperand(&type3);
358 auto fw_hidden_state1 = model->addOperand(&type4);
359 auto bw_weights1 = model->addOperand(&type1);
360 auto bw_recurrent_weights1 = model->addOperand(&type2);
361 auto bw_bias1 = model->addOperand(&type3);
362 auto bw_hidden_state1 = model->addOperand(&type4);
363 auto aux_input1 = model->addOperand(&type5);
364 auto fw_aux_weights1 = model->addOperand(&type5);
365 auto bw_aux_weights1 = model->addOperand(&type5);
366 auto activation1 = model->addOperand(&type7);
367 auto time_major1 = model->addOperand(&type8);
368 auto merge_outputs1 = model->addOperand(&type8);
369 auto fw_output1 = model->addOperand(&type10);
370 auto bw_output1 = model->addOperand(&type10);
371 // Phase 2, operations
372 static int32_t activation1_init[] = {1};
373 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
374 static bool8 time_major1_init[] = {true};
375 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
376 static bool8 merge_outputs1_init[] = {false};
377 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
378 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
379 // Phase 3, inputs and outputs
380 model->identifyInputsAndOutputs(
381 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
382 {fw_output1, bw_output1});
383 // Phase 4: set relaxed execution
384 model->relaxComputationFloat32toFloat16(true);
385 assert(model->isValid());
386 }
387
is_ignored_relaxed_2(int i)388 inline bool is_ignored_relaxed_2(int i) {
389 static std::set<int> ignore = {};
390 return ignore.find(i) != ignore.end();
391 }
392
CreateModel_float16_2(Model * model)393 void CreateModel_float16_2(Model *model) {
394 OperandType type14(Type::TENSOR_FLOAT16, {0});
395 OperandType type15(Type::TENSOR_FLOAT16, {16});
396 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
397 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
398 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
399 OperandType type23(Type::TENSOR_FLOAT16, {16, 2, 16});
400 OperandType type24(Type::TENSOR_FLOAT16, {16, 2, 8});
401 OperandType type7(Type::INT32, {});
402 OperandType type8(Type::BOOL, {});
403 // Phase 1, operands
404 auto input1 = model->addOperand(&type24);
405 auto fw_weights1 = model->addOperand(&type19);
406 auto fw_recurrent_weights1 = model->addOperand(&type18);
407 auto fw_bias1 = model->addOperand(&type15);
408 auto fw_hidden_state1 = model->addOperand(&type16);
409 auto bw_weights1 = model->addOperand(&type19);
410 auto bw_recurrent_weights1 = model->addOperand(&type18);
411 auto bw_bias1 = model->addOperand(&type15);
412 auto bw_hidden_state1 = model->addOperand(&type16);
413 auto aux_input1 = model->addOperand(&type14);
414 auto fw_aux_weights1 = model->addOperand(&type14);
415 auto bw_aux_weights1 = model->addOperand(&type14);
416 auto activation1 = model->addOperand(&type7);
417 auto time_major1 = model->addOperand(&type8);
418 auto merge_outputs1 = model->addOperand(&type8);
419 auto fw_output1 = model->addOperand(&type23);
420 auto bw_output1 = model->addOperand(&type23);
421 // Phase 2, operations
422 static int32_t activation1_init[] = {1};
423 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
424 static bool8 time_major1_init[] = {true};
425 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
426 static bool8 merge_outputs1_init[] = {false};
427 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
428 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
429 // Phase 3, inputs and outputs
430 model->identifyInputsAndOutputs(
431 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
432 {fw_output1, bw_output1});
433 assert(model->isValid());
434 }
435
is_ignored_float16_2(int i)436 inline bool is_ignored_float16_2(int i) {
437 static std::set<int> ignore = {};
438 return ignore.find(i) != ignore.end();
439 }
440
CreateModel_dynamic_output_shape_2(Model * model)441 void CreateModel_dynamic_output_shape_2(Model *model) {
442 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
443 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
444 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
445 OperandType type3(Type::TENSOR_FLOAT32, {16});
446 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
447 OperandType type5(Type::TENSOR_FLOAT32, {0});
448 OperandType type7(Type::INT32, {});
449 OperandType type8(Type::BOOL, {});
450 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
451 // Phase 1, operands
452 auto input1 = model->addOperand(&type9);
453 auto fw_weights1 = model->addOperand(&type1);
454 auto fw_recurrent_weights1 = model->addOperand(&type2);
455 auto fw_bias1 = model->addOperand(&type3);
456 auto fw_hidden_state1 = model->addOperand(&type4);
457 auto bw_weights1 = model->addOperand(&type1);
458 auto bw_recurrent_weights1 = model->addOperand(&type2);
459 auto bw_bias1 = model->addOperand(&type3);
460 auto bw_hidden_state1 = model->addOperand(&type4);
461 auto aux_input1 = model->addOperand(&type5);
462 auto fw_aux_weights1 = model->addOperand(&type5);
463 auto bw_aux_weights1 = model->addOperand(&type5);
464 auto activation1 = model->addOperand(&type7);
465 auto time_major1 = model->addOperand(&type8);
466 auto merge_outputs1 = model->addOperand(&type8);
467 auto fw_output1 = model->addOperand(&type21);
468 auto bw_output1 = model->addOperand(&type21);
469 // Phase 2, operations
470 static int32_t activation1_init[] = {1};
471 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
472 static bool8 time_major1_init[] = {true};
473 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
474 static bool8 merge_outputs1_init[] = {false};
475 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
476 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
477 // Phase 3, inputs and outputs
478 model->identifyInputsAndOutputs(
479 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
480 {fw_output1, bw_output1});
481 assert(model->isValid());
482 }
483
is_ignored_dynamic_output_shape_2(int i)484 inline bool is_ignored_dynamic_output_shape_2(int i) {
485 static std::set<int> ignore = {};
486 return ignore.find(i) != ignore.end();
487 }
488
CreateModel_dynamic_output_shape_relaxed_2(Model * model)489 void CreateModel_dynamic_output_shape_relaxed_2(Model *model) {
490 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
491 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
492 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
493 OperandType type3(Type::TENSOR_FLOAT32, {16});
494 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
495 OperandType type5(Type::TENSOR_FLOAT32, {0});
496 OperandType type7(Type::INT32, {});
497 OperandType type8(Type::BOOL, {});
498 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
499 // Phase 1, operands
500 auto input1 = model->addOperand(&type9);
501 auto fw_weights1 = model->addOperand(&type1);
502 auto fw_recurrent_weights1 = model->addOperand(&type2);
503 auto fw_bias1 = model->addOperand(&type3);
504 auto fw_hidden_state1 = model->addOperand(&type4);
505 auto bw_weights1 = model->addOperand(&type1);
506 auto bw_recurrent_weights1 = model->addOperand(&type2);
507 auto bw_bias1 = model->addOperand(&type3);
508 auto bw_hidden_state1 = model->addOperand(&type4);
509 auto aux_input1 = model->addOperand(&type5);
510 auto fw_aux_weights1 = model->addOperand(&type5);
511 auto bw_aux_weights1 = model->addOperand(&type5);
512 auto activation1 = model->addOperand(&type7);
513 auto time_major1 = model->addOperand(&type8);
514 auto merge_outputs1 = model->addOperand(&type8);
515 auto fw_output1 = model->addOperand(&type21);
516 auto bw_output1 = model->addOperand(&type21);
517 // Phase 2, operations
518 static int32_t activation1_init[] = {1};
519 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
520 static bool8 time_major1_init[] = {true};
521 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
522 static bool8 merge_outputs1_init[] = {false};
523 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
524 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
525 // Phase 3, inputs and outputs
526 model->identifyInputsAndOutputs(
527 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
528 {fw_output1, bw_output1});
529 // Phase 4: set relaxed execution
530 model->relaxComputationFloat32toFloat16(true);
531 assert(model->isValid());
532 }
533
is_ignored_dynamic_output_shape_relaxed_2(int i)534 inline bool is_ignored_dynamic_output_shape_relaxed_2(int i) {
535 static std::set<int> ignore = {};
536 return ignore.find(i) != ignore.end();
537 }
538
CreateModel_dynamic_output_shape_float16_2(Model * model)539 void CreateModel_dynamic_output_shape_float16_2(Model *model) {
540 OperandType type14(Type::TENSOR_FLOAT16, {0});
541 OperandType type15(Type::TENSOR_FLOAT16, {16});
542 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
543 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
544 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
545 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
546 OperandType type24(Type::TENSOR_FLOAT16, {16, 2, 8});
547 OperandType type7(Type::INT32, {});
548 OperandType type8(Type::BOOL, {});
549 // Phase 1, operands
550 auto input1 = model->addOperand(&type24);
551 auto fw_weights1 = model->addOperand(&type19);
552 auto fw_recurrent_weights1 = model->addOperand(&type18);
553 auto fw_bias1 = model->addOperand(&type15);
554 auto fw_hidden_state1 = model->addOperand(&type16);
555 auto bw_weights1 = model->addOperand(&type19);
556 auto bw_recurrent_weights1 = model->addOperand(&type18);
557 auto bw_bias1 = model->addOperand(&type15);
558 auto bw_hidden_state1 = model->addOperand(&type16);
559 auto aux_input1 = model->addOperand(&type14);
560 auto fw_aux_weights1 = model->addOperand(&type14);
561 auto bw_aux_weights1 = model->addOperand(&type14);
562 auto activation1 = model->addOperand(&type7);
563 auto time_major1 = model->addOperand(&type8);
564 auto merge_outputs1 = model->addOperand(&type8);
565 auto fw_output1 = model->addOperand(&type22);
566 auto bw_output1 = model->addOperand(&type22);
567 // Phase 2, operations
568 static int32_t activation1_init[] = {1};
569 model->setOperandValue(activation1, activation1_init, sizeof(int32_t) * 1);
570 static bool8 time_major1_init[] = {true};
571 model->setOperandValue(time_major1, time_major1_init, sizeof(bool8) * 1);
572 static bool8 merge_outputs1_init[] = {false};
573 model->setOperandValue(merge_outputs1, merge_outputs1_init, sizeof(bool8) * 1);
574 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1, activation1, time_major1, merge_outputs1}, {fw_output1, bw_output1});
575 // Phase 3, inputs and outputs
576 model->identifyInputsAndOutputs(
577 {input1, fw_weights1, fw_recurrent_weights1, fw_bias1, fw_hidden_state1, bw_weights1, bw_recurrent_weights1, bw_bias1, bw_hidden_state1, aux_input1, fw_aux_weights1, bw_aux_weights1},
578 {fw_output1, bw_output1});
579 assert(model->isValid());
580 }
581
is_ignored_dynamic_output_shape_float16_2(int i)582 inline bool is_ignored_dynamic_output_shape_float16_2(int i) {
583 static std::set<int> ignore = {};
584 return ignore.find(i) != ignore.end();
585 }
586
CreateModel_3(Model * model)587 void CreateModel_3(Model *model) {
588 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
589 OperandType type11(Type::TENSOR_FLOAT32, {16, 2, 32});
590 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
591 OperandType type3(Type::TENSOR_FLOAT32, {16});
592 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
593 OperandType type5(Type::TENSOR_FLOAT32, {0});
594 OperandType type7(Type::INT32, {});
595 OperandType type8(Type::BOOL, {});
596 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
597 // Phase 1, operands
598 auto input2 = model->addOperand(&type9);
599 auto fw_weights2 = model->addOperand(&type1);
600 auto fw_recurrent_weights2 = model->addOperand(&type2);
601 auto fw_bias2 = model->addOperand(&type3);
602 auto fw_hidden_state2 = model->addOperand(&type4);
603 auto bw_weights2 = model->addOperand(&type1);
604 auto bw_recurrent_weights2 = model->addOperand(&type2);
605 auto bw_bias2 = model->addOperand(&type3);
606 auto bw_hidden_state2 = model->addOperand(&type4);
607 auto aux_input2 = model->addOperand(&type5);
608 auto fw_aux_weights2 = model->addOperand(&type5);
609 auto bw_aux_weights2 = model->addOperand(&type5);
610 auto activation2 = model->addOperand(&type7);
611 auto time_major2 = model->addOperand(&type8);
612 auto merge_outputs2 = model->addOperand(&type8);
613 auto fw_output2 = model->addOperand(&type11);
614 // Phase 2, operations
615 static int32_t activation2_init[] = {1};
616 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
617 static bool8 time_major2_init[] = {true};
618 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
619 static bool8 merge_outputs2_init[] = {true};
620 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
621 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
622 // Phase 3, inputs and outputs
623 model->identifyInputsAndOutputs(
624 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
625 {fw_output2});
626 assert(model->isValid());
627 }
628
is_ignored_3(int i)629 inline bool is_ignored_3(int i) {
630 static std::set<int> ignore = {};
631 return ignore.find(i) != ignore.end();
632 }
633
CreateModel_relaxed_3(Model * model)634 void CreateModel_relaxed_3(Model *model) {
635 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
636 OperandType type11(Type::TENSOR_FLOAT32, {16, 2, 32});
637 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
638 OperandType type3(Type::TENSOR_FLOAT32, {16});
639 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
640 OperandType type5(Type::TENSOR_FLOAT32, {0});
641 OperandType type7(Type::INT32, {});
642 OperandType type8(Type::BOOL, {});
643 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
644 // Phase 1, operands
645 auto input2 = model->addOperand(&type9);
646 auto fw_weights2 = model->addOperand(&type1);
647 auto fw_recurrent_weights2 = model->addOperand(&type2);
648 auto fw_bias2 = model->addOperand(&type3);
649 auto fw_hidden_state2 = model->addOperand(&type4);
650 auto bw_weights2 = model->addOperand(&type1);
651 auto bw_recurrent_weights2 = model->addOperand(&type2);
652 auto bw_bias2 = model->addOperand(&type3);
653 auto bw_hidden_state2 = model->addOperand(&type4);
654 auto aux_input2 = model->addOperand(&type5);
655 auto fw_aux_weights2 = model->addOperand(&type5);
656 auto bw_aux_weights2 = model->addOperand(&type5);
657 auto activation2 = model->addOperand(&type7);
658 auto time_major2 = model->addOperand(&type8);
659 auto merge_outputs2 = model->addOperand(&type8);
660 auto fw_output2 = model->addOperand(&type11);
661 // Phase 2, operations
662 static int32_t activation2_init[] = {1};
663 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
664 static bool8 time_major2_init[] = {true};
665 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
666 static bool8 merge_outputs2_init[] = {true};
667 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
668 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
669 // Phase 3, inputs and outputs
670 model->identifyInputsAndOutputs(
671 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
672 {fw_output2});
673 // Phase 4: set relaxed execution
674 model->relaxComputationFloat32toFloat16(true);
675 assert(model->isValid());
676 }
677
is_ignored_relaxed_3(int i)678 inline bool is_ignored_relaxed_3(int i) {
679 static std::set<int> ignore = {};
680 return ignore.find(i) != ignore.end();
681 }
682
CreateModel_float16_3(Model * model)683 void CreateModel_float16_3(Model *model) {
684 OperandType type14(Type::TENSOR_FLOAT16, {0});
685 OperandType type15(Type::TENSOR_FLOAT16, {16});
686 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
687 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
688 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
689 OperandType type24(Type::TENSOR_FLOAT16, {16, 2, 8});
690 OperandType type25(Type::TENSOR_FLOAT16, {16, 2, 32});
691 OperandType type7(Type::INT32, {});
692 OperandType type8(Type::BOOL, {});
693 // Phase 1, operands
694 auto input2 = model->addOperand(&type24);
695 auto fw_weights2 = model->addOperand(&type19);
696 auto fw_recurrent_weights2 = model->addOperand(&type18);
697 auto fw_bias2 = model->addOperand(&type15);
698 auto fw_hidden_state2 = model->addOperand(&type16);
699 auto bw_weights2 = model->addOperand(&type19);
700 auto bw_recurrent_weights2 = model->addOperand(&type18);
701 auto bw_bias2 = model->addOperand(&type15);
702 auto bw_hidden_state2 = model->addOperand(&type16);
703 auto aux_input2 = model->addOperand(&type14);
704 auto fw_aux_weights2 = model->addOperand(&type14);
705 auto bw_aux_weights2 = model->addOperand(&type14);
706 auto activation2 = model->addOperand(&type7);
707 auto time_major2 = model->addOperand(&type8);
708 auto merge_outputs2 = model->addOperand(&type8);
709 auto fw_output2 = model->addOperand(&type25);
710 // Phase 2, operations
711 static int32_t activation2_init[] = {1};
712 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
713 static bool8 time_major2_init[] = {true};
714 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
715 static bool8 merge_outputs2_init[] = {true};
716 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
717 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
718 // Phase 3, inputs and outputs
719 model->identifyInputsAndOutputs(
720 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
721 {fw_output2});
722 assert(model->isValid());
723 }
724
is_ignored_float16_3(int i)725 inline bool is_ignored_float16_3(int i) {
726 static std::set<int> ignore = {};
727 return ignore.find(i) != ignore.end();
728 }
729
CreateModel_dynamic_output_shape_3(Model * model)730 void CreateModel_dynamic_output_shape_3(Model *model) {
731 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
732 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
733 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
734 OperandType type3(Type::TENSOR_FLOAT32, {16});
735 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
736 OperandType type5(Type::TENSOR_FLOAT32, {0});
737 OperandType type7(Type::INT32, {});
738 OperandType type8(Type::BOOL, {});
739 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
740 // Phase 1, operands
741 auto input2 = model->addOperand(&type9);
742 auto fw_weights2 = model->addOperand(&type1);
743 auto fw_recurrent_weights2 = model->addOperand(&type2);
744 auto fw_bias2 = model->addOperand(&type3);
745 auto fw_hidden_state2 = model->addOperand(&type4);
746 auto bw_weights2 = model->addOperand(&type1);
747 auto bw_recurrent_weights2 = model->addOperand(&type2);
748 auto bw_bias2 = model->addOperand(&type3);
749 auto bw_hidden_state2 = model->addOperand(&type4);
750 auto aux_input2 = model->addOperand(&type5);
751 auto fw_aux_weights2 = model->addOperand(&type5);
752 auto bw_aux_weights2 = model->addOperand(&type5);
753 auto activation2 = model->addOperand(&type7);
754 auto time_major2 = model->addOperand(&type8);
755 auto merge_outputs2 = model->addOperand(&type8);
756 auto fw_output2 = model->addOperand(&type21);
757 // Phase 2, operations
758 static int32_t activation2_init[] = {1};
759 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
760 static bool8 time_major2_init[] = {true};
761 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
762 static bool8 merge_outputs2_init[] = {true};
763 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
764 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
765 // Phase 3, inputs and outputs
766 model->identifyInputsAndOutputs(
767 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
768 {fw_output2});
769 assert(model->isValid());
770 }
771
is_ignored_dynamic_output_shape_3(int i)772 inline bool is_ignored_dynamic_output_shape_3(int i) {
773 static std::set<int> ignore = {};
774 return ignore.find(i) != ignore.end();
775 }
776
CreateModel_dynamic_output_shape_relaxed_3(Model * model)777 void CreateModel_dynamic_output_shape_relaxed_3(Model *model) {
778 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
779 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
780 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
781 OperandType type3(Type::TENSOR_FLOAT32, {16});
782 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
783 OperandType type5(Type::TENSOR_FLOAT32, {0});
784 OperandType type7(Type::INT32, {});
785 OperandType type8(Type::BOOL, {});
786 OperandType type9(Type::TENSOR_FLOAT32, {16, 2, 8});
787 // Phase 1, operands
788 auto input2 = model->addOperand(&type9);
789 auto fw_weights2 = model->addOperand(&type1);
790 auto fw_recurrent_weights2 = model->addOperand(&type2);
791 auto fw_bias2 = model->addOperand(&type3);
792 auto fw_hidden_state2 = model->addOperand(&type4);
793 auto bw_weights2 = model->addOperand(&type1);
794 auto bw_recurrent_weights2 = model->addOperand(&type2);
795 auto bw_bias2 = model->addOperand(&type3);
796 auto bw_hidden_state2 = model->addOperand(&type4);
797 auto aux_input2 = model->addOperand(&type5);
798 auto fw_aux_weights2 = model->addOperand(&type5);
799 auto bw_aux_weights2 = model->addOperand(&type5);
800 auto activation2 = model->addOperand(&type7);
801 auto time_major2 = model->addOperand(&type8);
802 auto merge_outputs2 = model->addOperand(&type8);
803 auto fw_output2 = model->addOperand(&type21);
804 // Phase 2, operations
805 static int32_t activation2_init[] = {1};
806 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
807 static bool8 time_major2_init[] = {true};
808 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
809 static bool8 merge_outputs2_init[] = {true};
810 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
811 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
812 // Phase 3, inputs and outputs
813 model->identifyInputsAndOutputs(
814 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
815 {fw_output2});
816 // Phase 4: set relaxed execution
817 model->relaxComputationFloat32toFloat16(true);
818 assert(model->isValid());
819 }
820
is_ignored_dynamic_output_shape_relaxed_3(int i)821 inline bool is_ignored_dynamic_output_shape_relaxed_3(int i) {
822 static std::set<int> ignore = {};
823 return ignore.find(i) != ignore.end();
824 }
825
CreateModel_dynamic_output_shape_float16_3(Model * model)826 void CreateModel_dynamic_output_shape_float16_3(Model *model) {
827 OperandType type14(Type::TENSOR_FLOAT16, {0});
828 OperandType type15(Type::TENSOR_FLOAT16, {16});
829 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
830 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
831 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
832 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
833 OperandType type24(Type::TENSOR_FLOAT16, {16, 2, 8});
834 OperandType type7(Type::INT32, {});
835 OperandType type8(Type::BOOL, {});
836 // Phase 1, operands
837 auto input2 = model->addOperand(&type24);
838 auto fw_weights2 = model->addOperand(&type19);
839 auto fw_recurrent_weights2 = model->addOperand(&type18);
840 auto fw_bias2 = model->addOperand(&type15);
841 auto fw_hidden_state2 = model->addOperand(&type16);
842 auto bw_weights2 = model->addOperand(&type19);
843 auto bw_recurrent_weights2 = model->addOperand(&type18);
844 auto bw_bias2 = model->addOperand(&type15);
845 auto bw_hidden_state2 = model->addOperand(&type16);
846 auto aux_input2 = model->addOperand(&type14);
847 auto fw_aux_weights2 = model->addOperand(&type14);
848 auto bw_aux_weights2 = model->addOperand(&type14);
849 auto activation2 = model->addOperand(&type7);
850 auto time_major2 = model->addOperand(&type8);
851 auto merge_outputs2 = model->addOperand(&type8);
852 auto fw_output2 = model->addOperand(&type22);
853 // Phase 2, operations
854 static int32_t activation2_init[] = {1};
855 model->setOperandValue(activation2, activation2_init, sizeof(int32_t) * 1);
856 static bool8 time_major2_init[] = {true};
857 model->setOperandValue(time_major2, time_major2_init, sizeof(bool8) * 1);
858 static bool8 merge_outputs2_init[] = {true};
859 model->setOperandValue(merge_outputs2, merge_outputs2_init, sizeof(bool8) * 1);
860 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2, activation2, time_major2, merge_outputs2}, {fw_output2});
861 // Phase 3, inputs and outputs
862 model->identifyInputsAndOutputs(
863 {input2, fw_weights2, fw_recurrent_weights2, fw_bias2, fw_hidden_state2, bw_weights2, bw_recurrent_weights2, bw_bias2, bw_hidden_state2, aux_input2, fw_aux_weights2, bw_aux_weights2},
864 {fw_output2});
865 assert(model->isValid());
866 }
867
is_ignored_dynamic_output_shape_float16_3(int i)868 inline bool is_ignored_dynamic_output_shape_float16_3(int i) {
869 static std::set<int> ignore = {};
870 return ignore.find(i) != ignore.end();
871 }
872
CreateModel_4(Model * model)873 void CreateModel_4(Model *model) {
874 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
875 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
876 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
877 OperandType type3(Type::TENSOR_FLOAT32, {16});
878 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
879 OperandType type5(Type::TENSOR_FLOAT32, {0});
880 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
881 OperandType type7(Type::INT32, {});
882 OperandType type8(Type::BOOL, {});
883 // Phase 1, operands
884 auto input3 = model->addOperand(&type0);
885 auto fw_weights3 = model->addOperand(&type1);
886 auto fw_recurrent_weights3 = model->addOperand(&type2);
887 auto fw_bias3 = model->addOperand(&type3);
888 auto fw_hidden_state3 = model->addOperand(&type4);
889 auto bw_weights3 = model->addOperand(&type1);
890 auto bw_recurrent_weights3 = model->addOperand(&type2);
891 auto bw_bias3 = model->addOperand(&type3);
892 auto bw_hidden_state3 = model->addOperand(&type4);
893 auto aux_input3 = model->addOperand(&type5);
894 auto fw_aux_weights3 = model->addOperand(&type5);
895 auto bw_aux_weights3 = model->addOperand(&type5);
896 auto activation3 = model->addOperand(&type7);
897 auto time_major3 = model->addOperand(&type8);
898 auto merge_outputs3 = model->addOperand(&type8);
899 auto fw_output3 = model->addOperand(&type6);
900 auto bw_output2 = model->addOperand(&type6);
901 // Phase 2, operations
902 static int32_t activation3_init[] = {1};
903 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
904 static bool8 time_major3_init[] = {false};
905 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
906 static bool8 merge_outputs3_init[] = {false};
907 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
908 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
909 // Phase 3, inputs and outputs
910 model->identifyInputsAndOutputs(
911 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
912 {fw_output3, bw_output2});
913 assert(model->isValid());
914 }
915
is_ignored_4(int i)916 inline bool is_ignored_4(int i) {
917 static std::set<int> ignore = {};
918 return ignore.find(i) != ignore.end();
919 }
920
CreateModel_relaxed_4(Model * model)921 void CreateModel_relaxed_4(Model *model) {
922 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
923 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
924 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
925 OperandType type3(Type::TENSOR_FLOAT32, {16});
926 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
927 OperandType type5(Type::TENSOR_FLOAT32, {0});
928 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
929 OperandType type7(Type::INT32, {});
930 OperandType type8(Type::BOOL, {});
931 // Phase 1, operands
932 auto input3 = model->addOperand(&type0);
933 auto fw_weights3 = model->addOperand(&type1);
934 auto fw_recurrent_weights3 = model->addOperand(&type2);
935 auto fw_bias3 = model->addOperand(&type3);
936 auto fw_hidden_state3 = model->addOperand(&type4);
937 auto bw_weights3 = model->addOperand(&type1);
938 auto bw_recurrent_weights3 = model->addOperand(&type2);
939 auto bw_bias3 = model->addOperand(&type3);
940 auto bw_hidden_state3 = model->addOperand(&type4);
941 auto aux_input3 = model->addOperand(&type5);
942 auto fw_aux_weights3 = model->addOperand(&type5);
943 auto bw_aux_weights3 = model->addOperand(&type5);
944 auto activation3 = model->addOperand(&type7);
945 auto time_major3 = model->addOperand(&type8);
946 auto merge_outputs3 = model->addOperand(&type8);
947 auto fw_output3 = model->addOperand(&type6);
948 auto bw_output2 = model->addOperand(&type6);
949 // Phase 2, operations
950 static int32_t activation3_init[] = {1};
951 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
952 static bool8 time_major3_init[] = {false};
953 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
954 static bool8 merge_outputs3_init[] = {false};
955 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
956 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
957 // Phase 3, inputs and outputs
958 model->identifyInputsAndOutputs(
959 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
960 {fw_output3, bw_output2});
961 // Phase 4: set relaxed execution
962 model->relaxComputationFloat32toFloat16(true);
963 assert(model->isValid());
964 }
965
is_ignored_relaxed_4(int i)966 inline bool is_ignored_relaxed_4(int i) {
967 static std::set<int> ignore = {};
968 return ignore.find(i) != ignore.end();
969 }
970
CreateModel_float16_4(Model * model)971 void CreateModel_float16_4(Model *model) {
972 OperandType type14(Type::TENSOR_FLOAT16, {0});
973 OperandType type15(Type::TENSOR_FLOAT16, {16});
974 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
975 OperandType type17(Type::TENSOR_FLOAT16, {2, 16, 16});
976 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
977 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
978 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
979 OperandType type7(Type::INT32, {});
980 OperandType type8(Type::BOOL, {});
981 // Phase 1, operands
982 auto input3 = model->addOperand(&type20);
983 auto fw_weights3 = model->addOperand(&type19);
984 auto fw_recurrent_weights3 = model->addOperand(&type18);
985 auto fw_bias3 = model->addOperand(&type15);
986 auto fw_hidden_state3 = model->addOperand(&type16);
987 auto bw_weights3 = model->addOperand(&type19);
988 auto bw_recurrent_weights3 = model->addOperand(&type18);
989 auto bw_bias3 = model->addOperand(&type15);
990 auto bw_hidden_state3 = model->addOperand(&type16);
991 auto aux_input3 = model->addOperand(&type14);
992 auto fw_aux_weights3 = model->addOperand(&type14);
993 auto bw_aux_weights3 = model->addOperand(&type14);
994 auto activation3 = model->addOperand(&type7);
995 auto time_major3 = model->addOperand(&type8);
996 auto merge_outputs3 = model->addOperand(&type8);
997 auto fw_output3 = model->addOperand(&type17);
998 auto bw_output2 = model->addOperand(&type17);
999 // Phase 2, operations
1000 static int32_t activation3_init[] = {1};
1001 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
1002 static bool8 time_major3_init[] = {false};
1003 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
1004 static bool8 merge_outputs3_init[] = {false};
1005 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
1006 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
1007 // Phase 3, inputs and outputs
1008 model->identifyInputsAndOutputs(
1009 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
1010 {fw_output3, bw_output2});
1011 assert(model->isValid());
1012 }
1013
is_ignored_float16_4(int i)1014 inline bool is_ignored_float16_4(int i) {
1015 static std::set<int> ignore = {};
1016 return ignore.find(i) != ignore.end();
1017 }
1018
CreateModel_dynamic_output_shape_4(Model * model)1019 void CreateModel_dynamic_output_shape_4(Model *model) {
1020 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1021 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1022 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1023 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1024 OperandType type3(Type::TENSOR_FLOAT32, {16});
1025 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1026 OperandType type5(Type::TENSOR_FLOAT32, {0});
1027 OperandType type7(Type::INT32, {});
1028 OperandType type8(Type::BOOL, {});
1029 // Phase 1, operands
1030 auto input3 = model->addOperand(&type0);
1031 auto fw_weights3 = model->addOperand(&type1);
1032 auto fw_recurrent_weights3 = model->addOperand(&type2);
1033 auto fw_bias3 = model->addOperand(&type3);
1034 auto fw_hidden_state3 = model->addOperand(&type4);
1035 auto bw_weights3 = model->addOperand(&type1);
1036 auto bw_recurrent_weights3 = model->addOperand(&type2);
1037 auto bw_bias3 = model->addOperand(&type3);
1038 auto bw_hidden_state3 = model->addOperand(&type4);
1039 auto aux_input3 = model->addOperand(&type5);
1040 auto fw_aux_weights3 = model->addOperand(&type5);
1041 auto bw_aux_weights3 = model->addOperand(&type5);
1042 auto activation3 = model->addOperand(&type7);
1043 auto time_major3 = model->addOperand(&type8);
1044 auto merge_outputs3 = model->addOperand(&type8);
1045 auto fw_output3 = model->addOperand(&type21);
1046 auto bw_output2 = model->addOperand(&type21);
1047 // Phase 2, operations
1048 static int32_t activation3_init[] = {1};
1049 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
1050 static bool8 time_major3_init[] = {false};
1051 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
1052 static bool8 merge_outputs3_init[] = {false};
1053 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
1054 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
1055 // Phase 3, inputs and outputs
1056 model->identifyInputsAndOutputs(
1057 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
1058 {fw_output3, bw_output2});
1059 assert(model->isValid());
1060 }
1061
is_ignored_dynamic_output_shape_4(int i)1062 inline bool is_ignored_dynamic_output_shape_4(int i) {
1063 static std::set<int> ignore = {};
1064 return ignore.find(i) != ignore.end();
1065 }
1066
CreateModel_dynamic_output_shape_relaxed_4(Model * model)1067 void CreateModel_dynamic_output_shape_relaxed_4(Model *model) {
1068 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1069 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1070 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1071 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1072 OperandType type3(Type::TENSOR_FLOAT32, {16});
1073 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1074 OperandType type5(Type::TENSOR_FLOAT32, {0});
1075 OperandType type7(Type::INT32, {});
1076 OperandType type8(Type::BOOL, {});
1077 // Phase 1, operands
1078 auto input3 = model->addOperand(&type0);
1079 auto fw_weights3 = model->addOperand(&type1);
1080 auto fw_recurrent_weights3 = model->addOperand(&type2);
1081 auto fw_bias3 = model->addOperand(&type3);
1082 auto fw_hidden_state3 = model->addOperand(&type4);
1083 auto bw_weights3 = model->addOperand(&type1);
1084 auto bw_recurrent_weights3 = model->addOperand(&type2);
1085 auto bw_bias3 = model->addOperand(&type3);
1086 auto bw_hidden_state3 = model->addOperand(&type4);
1087 auto aux_input3 = model->addOperand(&type5);
1088 auto fw_aux_weights3 = model->addOperand(&type5);
1089 auto bw_aux_weights3 = model->addOperand(&type5);
1090 auto activation3 = model->addOperand(&type7);
1091 auto time_major3 = model->addOperand(&type8);
1092 auto merge_outputs3 = model->addOperand(&type8);
1093 auto fw_output3 = model->addOperand(&type21);
1094 auto bw_output2 = model->addOperand(&type21);
1095 // Phase 2, operations
1096 static int32_t activation3_init[] = {1};
1097 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
1098 static bool8 time_major3_init[] = {false};
1099 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
1100 static bool8 merge_outputs3_init[] = {false};
1101 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
1102 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
1103 // Phase 3, inputs and outputs
1104 model->identifyInputsAndOutputs(
1105 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
1106 {fw_output3, bw_output2});
1107 // Phase 4: set relaxed execution
1108 model->relaxComputationFloat32toFloat16(true);
1109 assert(model->isValid());
1110 }
1111
is_ignored_dynamic_output_shape_relaxed_4(int i)1112 inline bool is_ignored_dynamic_output_shape_relaxed_4(int i) {
1113 static std::set<int> ignore = {};
1114 return ignore.find(i) != ignore.end();
1115 }
1116
CreateModel_dynamic_output_shape_float16_4(Model * model)1117 void CreateModel_dynamic_output_shape_float16_4(Model *model) {
1118 OperandType type14(Type::TENSOR_FLOAT16, {0});
1119 OperandType type15(Type::TENSOR_FLOAT16, {16});
1120 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
1121 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
1122 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
1123 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
1124 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
1125 OperandType type7(Type::INT32, {});
1126 OperandType type8(Type::BOOL, {});
1127 // Phase 1, operands
1128 auto input3 = model->addOperand(&type20);
1129 auto fw_weights3 = model->addOperand(&type19);
1130 auto fw_recurrent_weights3 = model->addOperand(&type18);
1131 auto fw_bias3 = model->addOperand(&type15);
1132 auto fw_hidden_state3 = model->addOperand(&type16);
1133 auto bw_weights3 = model->addOperand(&type19);
1134 auto bw_recurrent_weights3 = model->addOperand(&type18);
1135 auto bw_bias3 = model->addOperand(&type15);
1136 auto bw_hidden_state3 = model->addOperand(&type16);
1137 auto aux_input3 = model->addOperand(&type14);
1138 auto fw_aux_weights3 = model->addOperand(&type14);
1139 auto bw_aux_weights3 = model->addOperand(&type14);
1140 auto activation3 = model->addOperand(&type7);
1141 auto time_major3 = model->addOperand(&type8);
1142 auto merge_outputs3 = model->addOperand(&type8);
1143 auto fw_output3 = model->addOperand(&type22);
1144 auto bw_output2 = model->addOperand(&type22);
1145 // Phase 2, operations
1146 static int32_t activation3_init[] = {1};
1147 model->setOperandValue(activation3, activation3_init, sizeof(int32_t) * 1);
1148 static bool8 time_major3_init[] = {false};
1149 model->setOperandValue(time_major3, time_major3_init, sizeof(bool8) * 1);
1150 static bool8 merge_outputs3_init[] = {false};
1151 model->setOperandValue(merge_outputs3, merge_outputs3_init, sizeof(bool8) * 1);
1152 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3, activation3, time_major3, merge_outputs3}, {fw_output3, bw_output2});
1153 // Phase 3, inputs and outputs
1154 model->identifyInputsAndOutputs(
1155 {input3, fw_weights3, fw_recurrent_weights3, fw_bias3, fw_hidden_state3, bw_weights3, bw_recurrent_weights3, bw_bias3, bw_hidden_state3, aux_input3, fw_aux_weights3, bw_aux_weights3},
1156 {fw_output3, bw_output2});
1157 assert(model->isValid());
1158 }
1159
is_ignored_dynamic_output_shape_float16_4(int i)1160 inline bool is_ignored_dynamic_output_shape_float16_4(int i) {
1161 static std::set<int> ignore = {};
1162 return ignore.find(i) != ignore.end();
1163 }
1164
CreateModel_5(Model * model)1165 void CreateModel_5(Model *model) {
1166 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1167 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1168 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1169 OperandType type3(Type::TENSOR_FLOAT32, {16});
1170 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1171 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
1172 OperandType type7(Type::INT32, {});
1173 OperandType type8(Type::BOOL, {});
1174 // Phase 1, operands
1175 auto input4 = model->addOperand(&type0);
1176 auto fw_weights4 = model->addOperand(&type1);
1177 auto fw_recurrent_weights4 = model->addOperand(&type2);
1178 auto fw_bias4 = model->addOperand(&type3);
1179 auto fw_hidden_state4 = model->addOperand(&type4);
1180 auto bw_weights4 = model->addOperand(&type1);
1181 auto bw_recurrent_weights4 = model->addOperand(&type2);
1182 auto bw_bias4 = model->addOperand(&type3);
1183 auto bw_hidden_state4 = model->addOperand(&type4);
1184 auto aux_input4 = model->addOperand(&type0);
1185 auto fw_aux_weights4 = model->addOperand(&type1);
1186 auto bw_aux_weights4 = model->addOperand(&type1);
1187 auto activation4 = model->addOperand(&type7);
1188 auto time_major4 = model->addOperand(&type8);
1189 auto merge_outputs4 = model->addOperand(&type8);
1190 auto fw_output4 = model->addOperand(&type6);
1191 auto bw_output3 = model->addOperand(&type6);
1192 // Phase 2, operations
1193 static int32_t activation4_init[] = {1};
1194 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1195 static bool8 time_major4_init[] = {false};
1196 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1197 static bool8 merge_outputs4_init[] = {false};
1198 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1199 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1200 // Phase 3, inputs and outputs
1201 model->identifyInputsAndOutputs(
1202 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1203 {fw_output4, bw_output3});
1204 assert(model->isValid());
1205 }
1206
is_ignored_5(int i)1207 inline bool is_ignored_5(int i) {
1208 static std::set<int> ignore = {};
1209 return ignore.find(i) != ignore.end();
1210 }
1211
CreateModel_relaxed_5(Model * model)1212 void CreateModel_relaxed_5(Model *model) {
1213 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1214 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1215 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1216 OperandType type3(Type::TENSOR_FLOAT32, {16});
1217 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1218 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
1219 OperandType type7(Type::INT32, {});
1220 OperandType type8(Type::BOOL, {});
1221 // Phase 1, operands
1222 auto input4 = model->addOperand(&type0);
1223 auto fw_weights4 = model->addOperand(&type1);
1224 auto fw_recurrent_weights4 = model->addOperand(&type2);
1225 auto fw_bias4 = model->addOperand(&type3);
1226 auto fw_hidden_state4 = model->addOperand(&type4);
1227 auto bw_weights4 = model->addOperand(&type1);
1228 auto bw_recurrent_weights4 = model->addOperand(&type2);
1229 auto bw_bias4 = model->addOperand(&type3);
1230 auto bw_hidden_state4 = model->addOperand(&type4);
1231 auto aux_input4 = model->addOperand(&type0);
1232 auto fw_aux_weights4 = model->addOperand(&type1);
1233 auto bw_aux_weights4 = model->addOperand(&type1);
1234 auto activation4 = model->addOperand(&type7);
1235 auto time_major4 = model->addOperand(&type8);
1236 auto merge_outputs4 = model->addOperand(&type8);
1237 auto fw_output4 = model->addOperand(&type6);
1238 auto bw_output3 = model->addOperand(&type6);
1239 // Phase 2, operations
1240 static int32_t activation4_init[] = {1};
1241 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1242 static bool8 time_major4_init[] = {false};
1243 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1244 static bool8 merge_outputs4_init[] = {false};
1245 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1246 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1247 // Phase 3, inputs and outputs
1248 model->identifyInputsAndOutputs(
1249 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1250 {fw_output4, bw_output3});
1251 // Phase 4: set relaxed execution
1252 model->relaxComputationFloat32toFloat16(true);
1253 assert(model->isValid());
1254 }
1255
is_ignored_relaxed_5(int i)1256 inline bool is_ignored_relaxed_5(int i) {
1257 static std::set<int> ignore = {};
1258 return ignore.find(i) != ignore.end();
1259 }
1260
CreateModel_float16_5(Model * model)1261 void CreateModel_float16_5(Model *model) {
1262 OperandType type15(Type::TENSOR_FLOAT16, {16});
1263 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
1264 OperandType type17(Type::TENSOR_FLOAT16, {2, 16, 16});
1265 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
1266 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
1267 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
1268 OperandType type7(Type::INT32, {});
1269 OperandType type8(Type::BOOL, {});
1270 // Phase 1, operands
1271 auto input4 = model->addOperand(&type20);
1272 auto fw_weights4 = model->addOperand(&type19);
1273 auto fw_recurrent_weights4 = model->addOperand(&type18);
1274 auto fw_bias4 = model->addOperand(&type15);
1275 auto fw_hidden_state4 = model->addOperand(&type16);
1276 auto bw_weights4 = model->addOperand(&type19);
1277 auto bw_recurrent_weights4 = model->addOperand(&type18);
1278 auto bw_bias4 = model->addOperand(&type15);
1279 auto bw_hidden_state4 = model->addOperand(&type16);
1280 auto aux_input4 = model->addOperand(&type20);
1281 auto fw_aux_weights4 = model->addOperand(&type19);
1282 auto bw_aux_weights4 = model->addOperand(&type19);
1283 auto activation4 = model->addOperand(&type7);
1284 auto time_major4 = model->addOperand(&type8);
1285 auto merge_outputs4 = model->addOperand(&type8);
1286 auto fw_output4 = model->addOperand(&type17);
1287 auto bw_output3 = model->addOperand(&type17);
1288 // Phase 2, operations
1289 static int32_t activation4_init[] = {1};
1290 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1291 static bool8 time_major4_init[] = {false};
1292 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1293 static bool8 merge_outputs4_init[] = {false};
1294 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1295 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1296 // Phase 3, inputs and outputs
1297 model->identifyInputsAndOutputs(
1298 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1299 {fw_output4, bw_output3});
1300 assert(model->isValid());
1301 }
1302
is_ignored_float16_5(int i)1303 inline bool is_ignored_float16_5(int i) {
1304 static std::set<int> ignore = {};
1305 return ignore.find(i) != ignore.end();
1306 }
1307
CreateModel_dynamic_output_shape_5(Model * model)1308 void CreateModel_dynamic_output_shape_5(Model *model) {
1309 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1310 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1311 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1312 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1313 OperandType type3(Type::TENSOR_FLOAT32, {16});
1314 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1315 OperandType type7(Type::INT32, {});
1316 OperandType type8(Type::BOOL, {});
1317 // Phase 1, operands
1318 auto input4 = model->addOperand(&type0);
1319 auto fw_weights4 = model->addOperand(&type1);
1320 auto fw_recurrent_weights4 = model->addOperand(&type2);
1321 auto fw_bias4 = model->addOperand(&type3);
1322 auto fw_hidden_state4 = model->addOperand(&type4);
1323 auto bw_weights4 = model->addOperand(&type1);
1324 auto bw_recurrent_weights4 = model->addOperand(&type2);
1325 auto bw_bias4 = model->addOperand(&type3);
1326 auto bw_hidden_state4 = model->addOperand(&type4);
1327 auto aux_input4 = model->addOperand(&type0);
1328 auto fw_aux_weights4 = model->addOperand(&type1);
1329 auto bw_aux_weights4 = model->addOperand(&type1);
1330 auto activation4 = model->addOperand(&type7);
1331 auto time_major4 = model->addOperand(&type8);
1332 auto merge_outputs4 = model->addOperand(&type8);
1333 auto fw_output4 = model->addOperand(&type21);
1334 auto bw_output3 = model->addOperand(&type21);
1335 // Phase 2, operations
1336 static int32_t activation4_init[] = {1};
1337 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1338 static bool8 time_major4_init[] = {false};
1339 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1340 static bool8 merge_outputs4_init[] = {false};
1341 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1342 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1343 // Phase 3, inputs and outputs
1344 model->identifyInputsAndOutputs(
1345 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1346 {fw_output4, bw_output3});
1347 assert(model->isValid());
1348 }
1349
is_ignored_dynamic_output_shape_5(int i)1350 inline bool is_ignored_dynamic_output_shape_5(int i) {
1351 static std::set<int> ignore = {};
1352 return ignore.find(i) != ignore.end();
1353 }
1354
CreateModel_dynamic_output_shape_relaxed_5(Model * model)1355 void CreateModel_dynamic_output_shape_relaxed_5(Model *model) {
1356 OperandType type0(Type::TENSOR_FLOAT32, {2, 16, 8});
1357 OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
1358 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1359 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1360 OperandType type3(Type::TENSOR_FLOAT32, {16});
1361 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1362 OperandType type7(Type::INT32, {});
1363 OperandType type8(Type::BOOL, {});
1364 // Phase 1, operands
1365 auto input4 = model->addOperand(&type0);
1366 auto fw_weights4 = model->addOperand(&type1);
1367 auto fw_recurrent_weights4 = model->addOperand(&type2);
1368 auto fw_bias4 = model->addOperand(&type3);
1369 auto fw_hidden_state4 = model->addOperand(&type4);
1370 auto bw_weights4 = model->addOperand(&type1);
1371 auto bw_recurrent_weights4 = model->addOperand(&type2);
1372 auto bw_bias4 = model->addOperand(&type3);
1373 auto bw_hidden_state4 = model->addOperand(&type4);
1374 auto aux_input4 = model->addOperand(&type0);
1375 auto fw_aux_weights4 = model->addOperand(&type1);
1376 auto bw_aux_weights4 = model->addOperand(&type1);
1377 auto activation4 = model->addOperand(&type7);
1378 auto time_major4 = model->addOperand(&type8);
1379 auto merge_outputs4 = model->addOperand(&type8);
1380 auto fw_output4 = model->addOperand(&type21);
1381 auto bw_output3 = model->addOperand(&type21);
1382 // Phase 2, operations
1383 static int32_t activation4_init[] = {1};
1384 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1385 static bool8 time_major4_init[] = {false};
1386 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1387 static bool8 merge_outputs4_init[] = {false};
1388 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1389 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1390 // Phase 3, inputs and outputs
1391 model->identifyInputsAndOutputs(
1392 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1393 {fw_output4, bw_output3});
1394 // Phase 4: set relaxed execution
1395 model->relaxComputationFloat32toFloat16(true);
1396 assert(model->isValid());
1397 }
1398
is_ignored_dynamic_output_shape_relaxed_5(int i)1399 inline bool is_ignored_dynamic_output_shape_relaxed_5(int i) {
1400 static std::set<int> ignore = {};
1401 return ignore.find(i) != ignore.end();
1402 }
1403
CreateModel_dynamic_output_shape_float16_5(Model * model)1404 void CreateModel_dynamic_output_shape_float16_5(Model *model) {
1405 OperandType type15(Type::TENSOR_FLOAT16, {16});
1406 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
1407 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
1408 OperandType type19(Type::TENSOR_FLOAT16, {16, 8});
1409 OperandType type20(Type::TENSOR_FLOAT16, {2, 16, 8});
1410 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
1411 OperandType type7(Type::INT32, {});
1412 OperandType type8(Type::BOOL, {});
1413 // Phase 1, operands
1414 auto input4 = model->addOperand(&type20);
1415 auto fw_weights4 = model->addOperand(&type19);
1416 auto fw_recurrent_weights4 = model->addOperand(&type18);
1417 auto fw_bias4 = model->addOperand(&type15);
1418 auto fw_hidden_state4 = model->addOperand(&type16);
1419 auto bw_weights4 = model->addOperand(&type19);
1420 auto bw_recurrent_weights4 = model->addOperand(&type18);
1421 auto bw_bias4 = model->addOperand(&type15);
1422 auto bw_hidden_state4 = model->addOperand(&type16);
1423 auto aux_input4 = model->addOperand(&type20);
1424 auto fw_aux_weights4 = model->addOperand(&type19);
1425 auto bw_aux_weights4 = model->addOperand(&type19);
1426 auto activation4 = model->addOperand(&type7);
1427 auto time_major4 = model->addOperand(&type8);
1428 auto merge_outputs4 = model->addOperand(&type8);
1429 auto fw_output4 = model->addOperand(&type22);
1430 auto bw_output3 = model->addOperand(&type22);
1431 // Phase 2, operations
1432 static int32_t activation4_init[] = {1};
1433 model->setOperandValue(activation4, activation4_init, sizeof(int32_t) * 1);
1434 static bool8 time_major4_init[] = {false};
1435 model->setOperandValue(time_major4, time_major4_init, sizeof(bool8) * 1);
1436 static bool8 merge_outputs4_init[] = {false};
1437 model->setOperandValue(merge_outputs4, merge_outputs4_init, sizeof(bool8) * 1);
1438 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4, activation4, time_major4, merge_outputs4}, {fw_output4, bw_output3});
1439 // Phase 3, inputs and outputs
1440 model->identifyInputsAndOutputs(
1441 {input4, fw_weights4, fw_recurrent_weights4, fw_bias4, fw_hidden_state4, bw_weights4, bw_recurrent_weights4, bw_bias4, bw_hidden_state4, aux_input4, fw_aux_weights4, bw_aux_weights4},
1442 {fw_output4, bw_output3});
1443 assert(model->isValid());
1444 }
1445
is_ignored_dynamic_output_shape_float16_5(int i)1446 inline bool is_ignored_dynamic_output_shape_float16_5(int i) {
1447 static std::set<int> ignore = {};
1448 return ignore.find(i) != ignore.end();
1449 }
1450
CreateModel_6(Model * model)1451 void CreateModel_6(Model *model) {
1452 OperandType type12(Type::TENSOR_FLOAT32, {2, 16, 4});
1453 OperandType type13(Type::TENSOR_FLOAT32, {16, 4});
1454 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1455 OperandType type3(Type::TENSOR_FLOAT32, {16});
1456 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1457 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
1458 OperandType type7(Type::INT32, {});
1459 OperandType type8(Type::BOOL, {});
1460 // Phase 1, operands
1461 auto input5 = model->addOperand(&type12);
1462 auto fw_weights5 = model->addOperand(&type13);
1463 auto fw_recurrent_weights5 = model->addOperand(&type2);
1464 auto fw_bias5 = model->addOperand(&type3);
1465 auto fw_hidden_state5 = model->addOperand(&type4);
1466 auto bw_weights5 = model->addOperand(&type13);
1467 auto bw_recurrent_weights5 = model->addOperand(&type2);
1468 auto bw_bias5 = model->addOperand(&type3);
1469 auto bw_hidden_state5 = model->addOperand(&type4);
1470 auto aux_input5 = model->addOperand(&type12);
1471 auto fw_aux_weights5 = model->addOperand(&type13);
1472 auto bw_aux_weights5 = model->addOperand(&type13);
1473 auto activation5 = model->addOperand(&type7);
1474 auto time_major5 = model->addOperand(&type8);
1475 auto merge_outputs5 = model->addOperand(&type8);
1476 auto fw_output5 = model->addOperand(&type6);
1477 auto bw_output4 = model->addOperand(&type6);
1478 // Phase 2, operations
1479 static int32_t activation5_init[] = {1};
1480 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1481 static bool8 time_major5_init[] = {false};
1482 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1483 static bool8 merge_outputs5_init[] = {false};
1484 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1485 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1486 // Phase 3, inputs and outputs
1487 model->identifyInputsAndOutputs(
1488 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1489 {fw_output5, bw_output4});
1490 assert(model->isValid());
1491 }
1492
is_ignored_6(int i)1493 inline bool is_ignored_6(int i) {
1494 static std::set<int> ignore = {};
1495 return ignore.find(i) != ignore.end();
1496 }
1497
CreateModel_relaxed_6(Model * model)1498 void CreateModel_relaxed_6(Model *model) {
1499 OperandType type12(Type::TENSOR_FLOAT32, {2, 16, 4});
1500 OperandType type13(Type::TENSOR_FLOAT32, {16, 4});
1501 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1502 OperandType type3(Type::TENSOR_FLOAT32, {16});
1503 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1504 OperandType type6(Type::TENSOR_FLOAT32, {2, 16, 16});
1505 OperandType type7(Type::INT32, {});
1506 OperandType type8(Type::BOOL, {});
1507 // Phase 1, operands
1508 auto input5 = model->addOperand(&type12);
1509 auto fw_weights5 = model->addOperand(&type13);
1510 auto fw_recurrent_weights5 = model->addOperand(&type2);
1511 auto fw_bias5 = model->addOperand(&type3);
1512 auto fw_hidden_state5 = model->addOperand(&type4);
1513 auto bw_weights5 = model->addOperand(&type13);
1514 auto bw_recurrent_weights5 = model->addOperand(&type2);
1515 auto bw_bias5 = model->addOperand(&type3);
1516 auto bw_hidden_state5 = model->addOperand(&type4);
1517 auto aux_input5 = model->addOperand(&type12);
1518 auto fw_aux_weights5 = model->addOperand(&type13);
1519 auto bw_aux_weights5 = model->addOperand(&type13);
1520 auto activation5 = model->addOperand(&type7);
1521 auto time_major5 = model->addOperand(&type8);
1522 auto merge_outputs5 = model->addOperand(&type8);
1523 auto fw_output5 = model->addOperand(&type6);
1524 auto bw_output4 = model->addOperand(&type6);
1525 // Phase 2, operations
1526 static int32_t activation5_init[] = {1};
1527 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1528 static bool8 time_major5_init[] = {false};
1529 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1530 static bool8 merge_outputs5_init[] = {false};
1531 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1532 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1533 // Phase 3, inputs and outputs
1534 model->identifyInputsAndOutputs(
1535 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1536 {fw_output5, bw_output4});
1537 // Phase 4: set relaxed execution
1538 model->relaxComputationFloat32toFloat16(true);
1539 assert(model->isValid());
1540 }
1541
is_ignored_relaxed_6(int i)1542 inline bool is_ignored_relaxed_6(int i) {
1543 static std::set<int> ignore = {};
1544 return ignore.find(i) != ignore.end();
1545 }
1546
CreateModel_float16_6(Model * model)1547 void CreateModel_float16_6(Model *model) {
1548 OperandType type15(Type::TENSOR_FLOAT16, {16});
1549 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
1550 OperandType type17(Type::TENSOR_FLOAT16, {2, 16, 16});
1551 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
1552 OperandType type26(Type::TENSOR_FLOAT16, {2, 16, 4});
1553 OperandType type27(Type::TENSOR_FLOAT16, {16, 4});
1554 OperandType type7(Type::INT32, {});
1555 OperandType type8(Type::BOOL, {});
1556 // Phase 1, operands
1557 auto input5 = model->addOperand(&type26);
1558 auto fw_weights5 = model->addOperand(&type27);
1559 auto fw_recurrent_weights5 = model->addOperand(&type18);
1560 auto fw_bias5 = model->addOperand(&type15);
1561 auto fw_hidden_state5 = model->addOperand(&type16);
1562 auto bw_weights5 = model->addOperand(&type27);
1563 auto bw_recurrent_weights5 = model->addOperand(&type18);
1564 auto bw_bias5 = model->addOperand(&type15);
1565 auto bw_hidden_state5 = model->addOperand(&type16);
1566 auto aux_input5 = model->addOperand(&type26);
1567 auto fw_aux_weights5 = model->addOperand(&type27);
1568 auto bw_aux_weights5 = model->addOperand(&type27);
1569 auto activation5 = model->addOperand(&type7);
1570 auto time_major5 = model->addOperand(&type8);
1571 auto merge_outputs5 = model->addOperand(&type8);
1572 auto fw_output5 = model->addOperand(&type17);
1573 auto bw_output4 = model->addOperand(&type17);
1574 // Phase 2, operations
1575 static int32_t activation5_init[] = {1};
1576 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1577 static bool8 time_major5_init[] = {false};
1578 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1579 static bool8 merge_outputs5_init[] = {false};
1580 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1581 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1582 // Phase 3, inputs and outputs
1583 model->identifyInputsAndOutputs(
1584 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1585 {fw_output5, bw_output4});
1586 assert(model->isValid());
1587 }
1588
is_ignored_float16_6(int i)1589 inline bool is_ignored_float16_6(int i) {
1590 static std::set<int> ignore = {};
1591 return ignore.find(i) != ignore.end();
1592 }
1593
CreateModel_dynamic_output_shape_6(Model * model)1594 void CreateModel_dynamic_output_shape_6(Model *model) {
1595 OperandType type12(Type::TENSOR_FLOAT32, {2, 16, 4});
1596 OperandType type13(Type::TENSOR_FLOAT32, {16, 4});
1597 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1598 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1599 OperandType type3(Type::TENSOR_FLOAT32, {16});
1600 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1601 OperandType type7(Type::INT32, {});
1602 OperandType type8(Type::BOOL, {});
1603 // Phase 1, operands
1604 auto input5 = model->addOperand(&type12);
1605 auto fw_weights5 = model->addOperand(&type13);
1606 auto fw_recurrent_weights5 = model->addOperand(&type2);
1607 auto fw_bias5 = model->addOperand(&type3);
1608 auto fw_hidden_state5 = model->addOperand(&type4);
1609 auto bw_weights5 = model->addOperand(&type13);
1610 auto bw_recurrent_weights5 = model->addOperand(&type2);
1611 auto bw_bias5 = model->addOperand(&type3);
1612 auto bw_hidden_state5 = model->addOperand(&type4);
1613 auto aux_input5 = model->addOperand(&type12);
1614 auto fw_aux_weights5 = model->addOperand(&type13);
1615 auto bw_aux_weights5 = model->addOperand(&type13);
1616 auto activation5 = model->addOperand(&type7);
1617 auto time_major5 = model->addOperand(&type8);
1618 auto merge_outputs5 = model->addOperand(&type8);
1619 auto fw_output5 = model->addOperand(&type21);
1620 auto bw_output4 = model->addOperand(&type21);
1621 // Phase 2, operations
1622 static int32_t activation5_init[] = {1};
1623 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1624 static bool8 time_major5_init[] = {false};
1625 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1626 static bool8 merge_outputs5_init[] = {false};
1627 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1628 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1629 // Phase 3, inputs and outputs
1630 model->identifyInputsAndOutputs(
1631 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1632 {fw_output5, bw_output4});
1633 assert(model->isValid());
1634 }
1635
is_ignored_dynamic_output_shape_6(int i)1636 inline bool is_ignored_dynamic_output_shape_6(int i) {
1637 static std::set<int> ignore = {};
1638 return ignore.find(i) != ignore.end();
1639 }
1640
CreateModel_dynamic_output_shape_relaxed_6(Model * model)1641 void CreateModel_dynamic_output_shape_relaxed_6(Model *model) {
1642 OperandType type12(Type::TENSOR_FLOAT32, {2, 16, 4});
1643 OperandType type13(Type::TENSOR_FLOAT32, {16, 4});
1644 OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
1645 OperandType type21(Type::TENSOR_FLOAT32, {0, 0, 0});
1646 OperandType type3(Type::TENSOR_FLOAT32, {16});
1647 OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
1648 OperandType type7(Type::INT32, {});
1649 OperandType type8(Type::BOOL, {});
1650 // Phase 1, operands
1651 auto input5 = model->addOperand(&type12);
1652 auto fw_weights5 = model->addOperand(&type13);
1653 auto fw_recurrent_weights5 = model->addOperand(&type2);
1654 auto fw_bias5 = model->addOperand(&type3);
1655 auto fw_hidden_state5 = model->addOperand(&type4);
1656 auto bw_weights5 = model->addOperand(&type13);
1657 auto bw_recurrent_weights5 = model->addOperand(&type2);
1658 auto bw_bias5 = model->addOperand(&type3);
1659 auto bw_hidden_state5 = model->addOperand(&type4);
1660 auto aux_input5 = model->addOperand(&type12);
1661 auto fw_aux_weights5 = model->addOperand(&type13);
1662 auto bw_aux_weights5 = model->addOperand(&type13);
1663 auto activation5 = model->addOperand(&type7);
1664 auto time_major5 = model->addOperand(&type8);
1665 auto merge_outputs5 = model->addOperand(&type8);
1666 auto fw_output5 = model->addOperand(&type21);
1667 auto bw_output4 = model->addOperand(&type21);
1668 // Phase 2, operations
1669 static int32_t activation5_init[] = {1};
1670 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1671 static bool8 time_major5_init[] = {false};
1672 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1673 static bool8 merge_outputs5_init[] = {false};
1674 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1675 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1676 // Phase 3, inputs and outputs
1677 model->identifyInputsAndOutputs(
1678 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1679 {fw_output5, bw_output4});
1680 // Phase 4: set relaxed execution
1681 model->relaxComputationFloat32toFloat16(true);
1682 assert(model->isValid());
1683 }
1684
is_ignored_dynamic_output_shape_relaxed_6(int i)1685 inline bool is_ignored_dynamic_output_shape_relaxed_6(int i) {
1686 static std::set<int> ignore = {};
1687 return ignore.find(i) != ignore.end();
1688 }
1689
CreateModel_dynamic_output_shape_float16_6(Model * model)1690 void CreateModel_dynamic_output_shape_float16_6(Model *model) {
1691 OperandType type15(Type::TENSOR_FLOAT16, {16});
1692 OperandType type16(Type::TENSOR_FLOAT16, {2, 16});
1693 OperandType type18(Type::TENSOR_FLOAT16, {16, 16});
1694 OperandType type22(Type::TENSOR_FLOAT16, {0, 0, 0});
1695 OperandType type26(Type::TENSOR_FLOAT16, {2, 16, 4});
1696 OperandType type27(Type::TENSOR_FLOAT16, {16, 4});
1697 OperandType type7(Type::INT32, {});
1698 OperandType type8(Type::BOOL, {});
1699 // Phase 1, operands
1700 auto input5 = model->addOperand(&type26);
1701 auto fw_weights5 = model->addOperand(&type27);
1702 auto fw_recurrent_weights5 = model->addOperand(&type18);
1703 auto fw_bias5 = model->addOperand(&type15);
1704 auto fw_hidden_state5 = model->addOperand(&type16);
1705 auto bw_weights5 = model->addOperand(&type27);
1706 auto bw_recurrent_weights5 = model->addOperand(&type18);
1707 auto bw_bias5 = model->addOperand(&type15);
1708 auto bw_hidden_state5 = model->addOperand(&type16);
1709 auto aux_input5 = model->addOperand(&type26);
1710 auto fw_aux_weights5 = model->addOperand(&type27);
1711 auto bw_aux_weights5 = model->addOperand(&type27);
1712 auto activation5 = model->addOperand(&type7);
1713 auto time_major5 = model->addOperand(&type8);
1714 auto merge_outputs5 = model->addOperand(&type8);
1715 auto fw_output5 = model->addOperand(&type22);
1716 auto bw_output4 = model->addOperand(&type22);
1717 // Phase 2, operations
1718 static int32_t activation5_init[] = {1};
1719 model->setOperandValue(activation5, activation5_init, sizeof(int32_t) * 1);
1720 static bool8 time_major5_init[] = {false};
1721 model->setOperandValue(time_major5, time_major5_init, sizeof(bool8) * 1);
1722 static bool8 merge_outputs5_init[] = {false};
1723 model->setOperandValue(merge_outputs5, merge_outputs5_init, sizeof(bool8) * 1);
1724 model->addOperation(ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN, {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5, activation5, time_major5, merge_outputs5}, {fw_output5, bw_output4});
1725 // Phase 3, inputs and outputs
1726 model->identifyInputsAndOutputs(
1727 {input5, fw_weights5, fw_recurrent_weights5, fw_bias5, fw_hidden_state5, bw_weights5, bw_recurrent_weights5, bw_bias5, bw_hidden_state5, aux_input5, fw_aux_weights5, bw_aux_weights5},
1728 {fw_output5, bw_output4});
1729 assert(model->isValid());
1730 }
1731
is_ignored_dynamic_output_shape_float16_6(int i)1732 inline bool is_ignored_dynamic_output_shape_float16_6(int i) {
1733 static std::set<int> ignore = {};
1734 return ignore.find(i) != ignore.end();
1735 }
1736
1737