1 // clang-format off
2 // Generated file (from: layer_norm_lstm.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
5   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
6   OperandType type10(Type::TENSOR_FLOAT32, {2, 16});
7   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
8   OperandType type3(Type::TENSOR_FLOAT32, {4});
9   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
10   OperandType type5(Type::TENSOR_FLOAT32, {0});
11   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
12   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
13   OperandType type8(Type::INT32, {});
14   OperandType type9(Type::FLOAT32, {});
15   // Phase 1, operands
16   auto input = model->addOperand(&type0);
17   auto input_to_input_weights = model->addOperand(&type1);
18   auto input_to_forget_weights = model->addOperand(&type1);
19   auto input_to_cell_weights = model->addOperand(&type1);
20   auto input_to_output_weights = model->addOperand(&type1);
21   auto recurrent_to_intput_weights = model->addOperand(&type2);
22   auto recurrent_to_forget_weights = model->addOperand(&type2);
23   auto recurrent_to_cell_weights = model->addOperand(&type2);
24   auto recurrent_to_output_weights = model->addOperand(&type2);
25   auto cell_to_input_weights = model->addOperand(&type3);
26   auto cell_to_forget_weights = model->addOperand(&type3);
27   auto cell_to_output_weights = model->addOperand(&type3);
28   auto input_gate_bias = model->addOperand(&type3);
29   auto forget_gate_bias = model->addOperand(&type3);
30   auto cell_gate_bias = model->addOperand(&type3);
31   auto output_gate_bias = model->addOperand(&type3);
32   auto projection_weights = model->addOperand(&type4);
33   auto projection_bias = model->addOperand(&type5);
34   auto output_state_in = model->addOperand(&type6);
35   auto cell_state_in = model->addOperand(&type7);
36   auto activation_param = model->addOperand(&type8);
37   auto cell_clip_param = model->addOperand(&type9);
38   auto proj_clip_param = model->addOperand(&type9);
39   auto input_layer_norm_weights = model->addOperand(&type3);
40   auto forget_layer_norm_weights = model->addOperand(&type3);
41   auto cell_layer_norm_weights = model->addOperand(&type3);
42   auto output_layer_norm_weights = model->addOperand(&type3);
43   auto scratch_buffer = model->addOperand(&type10);
44   auto output_state_out = model->addOperand(&type6);
45   auto cell_state_out = model->addOperand(&type7);
46   auto output = model->addOperand(&type6);
47   // Phase 2, operations
48   static int32_t activation_param_init[] = {4};
49   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
50   static float cell_clip_param_init[] = {0.0f};
51   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
52   static float proj_clip_param_init[] = {0.0f};
53   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
54   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
55   // Phase 3, inputs and outputs
56   model->identifyInputsAndOutputs(
57     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
58     {scratch_buffer, output_state_out, cell_state_out, output});
59   assert(model->isValid());
60 }
61 
is_ignored(int i)62 inline bool is_ignored(int i) {
63   static std::set<int> ignore = {0};
64   return ignore.find(i) != ignore.end();
65 }
66 
CreateModel_dynamic_output_shape(Model * model)67 void CreateModel_dynamic_output_shape(Model *model) {
68   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
69   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
70   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
71   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
72   OperandType type3(Type::TENSOR_FLOAT32, {4});
73   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
74   OperandType type5(Type::TENSOR_FLOAT32, {0});
75   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
76   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
77   OperandType type8(Type::INT32, {});
78   OperandType type9(Type::FLOAT32, {});
79   // Phase 1, operands
80   auto input = model->addOperand(&type0);
81   auto input_to_input_weights = model->addOperand(&type1);
82   auto input_to_forget_weights = model->addOperand(&type1);
83   auto input_to_cell_weights = model->addOperand(&type1);
84   auto input_to_output_weights = model->addOperand(&type1);
85   auto recurrent_to_intput_weights = model->addOperand(&type2);
86   auto recurrent_to_forget_weights = model->addOperand(&type2);
87   auto recurrent_to_cell_weights = model->addOperand(&type2);
88   auto recurrent_to_output_weights = model->addOperand(&type2);
89   auto cell_to_input_weights = model->addOperand(&type3);
90   auto cell_to_forget_weights = model->addOperand(&type3);
91   auto cell_to_output_weights = model->addOperand(&type3);
92   auto input_gate_bias = model->addOperand(&type3);
93   auto forget_gate_bias = model->addOperand(&type3);
94   auto cell_gate_bias = model->addOperand(&type3);
95   auto output_gate_bias = model->addOperand(&type3);
96   auto projection_weights = model->addOperand(&type4);
97   auto projection_bias = model->addOperand(&type5);
98   auto output_state_in = model->addOperand(&type6);
99   auto cell_state_in = model->addOperand(&type7);
100   auto activation_param = model->addOperand(&type8);
101   auto cell_clip_param = model->addOperand(&type9);
102   auto proj_clip_param = model->addOperand(&type9);
103   auto input_layer_norm_weights = model->addOperand(&type3);
104   auto forget_layer_norm_weights = model->addOperand(&type3);
105   auto cell_layer_norm_weights = model->addOperand(&type3);
106   auto output_layer_norm_weights = model->addOperand(&type3);
107   auto scratch_buffer = model->addOperand(&type11);
108   auto output_state_out = model->addOperand(&type11);
109   auto cell_state_out = model->addOperand(&type11);
110   auto output = model->addOperand(&type11);
111   // Phase 2, operations
112   static int32_t activation_param_init[] = {4};
113   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
114   static float cell_clip_param_init[] = {0.0f};
115   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
116   static float proj_clip_param_init[] = {0.0f};
117   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
118   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
119   // Phase 3, inputs and outputs
120   model->identifyInputsAndOutputs(
121     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
122     {scratch_buffer, output_state_out, cell_state_out, output});
123   assert(model->isValid());
124 }
125 
is_ignored_dynamic_output_shape(int i)126 inline bool is_ignored_dynamic_output_shape(int i) {
127   static std::set<int> ignore = {0};
128   return ignore.find(i) != ignore.end();
129 }
130 
CreateModel_2(Model * model)131 void CreateModel_2(Model *model) {
132   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
133   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
134   OperandType type10(Type::TENSOR_FLOAT32, {2, 16});
135   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
136   OperandType type3(Type::TENSOR_FLOAT32, {4});
137   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
138   OperandType type5(Type::TENSOR_FLOAT32, {0});
139   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
140   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
141   OperandType type8(Type::INT32, {});
142   OperandType type9(Type::FLOAT32, {});
143   // Phase 1, operands
144   auto input = model->addOperand(&type0);
145   auto input_to_input_weights = model->addOperand(&type1);
146   auto input_to_forget_weights = model->addOperand(&type1);
147   auto input_to_cell_weights = model->addOperand(&type1);
148   auto input_to_output_weights = model->addOperand(&type1);
149   auto recurrent_to_intput_weights = model->addOperand(&type2);
150   auto recurrent_to_forget_weights = model->addOperand(&type2);
151   auto recurrent_to_cell_weights = model->addOperand(&type2);
152   auto recurrent_to_output_weights = model->addOperand(&type2);
153   auto cell_to_input_weights = model->addOperand(&type3);
154   auto cell_to_forget_weights = model->addOperand(&type3);
155   auto cell_to_output_weights = model->addOperand(&type3);
156   auto input_gate_bias = model->addOperand(&type3);
157   auto forget_gate_bias = model->addOperand(&type3);
158   auto cell_gate_bias = model->addOperand(&type3);
159   auto output_gate_bias = model->addOperand(&type3);
160   auto projection_weights = model->addOperand(&type4);
161   auto projection_bias = model->addOperand(&type5);
162   auto output_state_in = model->addOperand(&type6);
163   auto cell_state_in = model->addOperand(&type7);
164   auto activation_param = model->addOperand(&type8);
165   auto cell_clip_param = model->addOperand(&type9);
166   auto proj_clip_param = model->addOperand(&type9);
167   auto input_layer_norm_weights = model->addOperand(&type3);
168   auto forget_layer_norm_weights = model->addOperand(&type3);
169   auto cell_layer_norm_weights = model->addOperand(&type3);
170   auto output_layer_norm_weights = model->addOperand(&type3);
171   auto scratch_buffer = model->addOperand(&type10);
172   auto output_state_out = model->addOperand(&type6);
173   auto cell_state_out = model->addOperand(&type7);
174   auto output = model->addOperand(&type6);
175   // Phase 2, operations
176   static int32_t activation_param_init[] = {4};
177   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
178   static float cell_clip_param_init[] = {0.0f};
179   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
180   static float proj_clip_param_init[] = {0.0f};
181   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
182   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
183   // Phase 3, inputs and outputs
184   model->identifyInputsAndOutputs(
185     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
186     {scratch_buffer, output_state_out, cell_state_out, output});
187   assert(model->isValid());
188 }
189 
is_ignored_2(int i)190 inline bool is_ignored_2(int i) {
191   static std::set<int> ignore = {0};
192   return ignore.find(i) != ignore.end();
193 }
194 
CreateModel_dynamic_output_shape_2(Model * model)195 void CreateModel_dynamic_output_shape_2(Model *model) {
196   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
197   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
198   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
199   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
200   OperandType type3(Type::TENSOR_FLOAT32, {4});
201   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
202   OperandType type5(Type::TENSOR_FLOAT32, {0});
203   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
204   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
205   OperandType type8(Type::INT32, {});
206   OperandType type9(Type::FLOAT32, {});
207   // Phase 1, operands
208   auto input = model->addOperand(&type0);
209   auto input_to_input_weights = model->addOperand(&type1);
210   auto input_to_forget_weights = model->addOperand(&type1);
211   auto input_to_cell_weights = model->addOperand(&type1);
212   auto input_to_output_weights = model->addOperand(&type1);
213   auto recurrent_to_intput_weights = model->addOperand(&type2);
214   auto recurrent_to_forget_weights = model->addOperand(&type2);
215   auto recurrent_to_cell_weights = model->addOperand(&type2);
216   auto recurrent_to_output_weights = model->addOperand(&type2);
217   auto cell_to_input_weights = model->addOperand(&type3);
218   auto cell_to_forget_weights = model->addOperand(&type3);
219   auto cell_to_output_weights = model->addOperand(&type3);
220   auto input_gate_bias = model->addOperand(&type3);
221   auto forget_gate_bias = model->addOperand(&type3);
222   auto cell_gate_bias = model->addOperand(&type3);
223   auto output_gate_bias = model->addOperand(&type3);
224   auto projection_weights = model->addOperand(&type4);
225   auto projection_bias = model->addOperand(&type5);
226   auto output_state_in = model->addOperand(&type6);
227   auto cell_state_in = model->addOperand(&type7);
228   auto activation_param = model->addOperand(&type8);
229   auto cell_clip_param = model->addOperand(&type9);
230   auto proj_clip_param = model->addOperand(&type9);
231   auto input_layer_norm_weights = model->addOperand(&type3);
232   auto forget_layer_norm_weights = model->addOperand(&type3);
233   auto cell_layer_norm_weights = model->addOperand(&type3);
234   auto output_layer_norm_weights = model->addOperand(&type3);
235   auto scratch_buffer = model->addOperand(&type11);
236   auto output_state_out = model->addOperand(&type11);
237   auto cell_state_out = model->addOperand(&type11);
238   auto output = model->addOperand(&type11);
239   // Phase 2, operations
240   static int32_t activation_param_init[] = {4};
241   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
242   static float cell_clip_param_init[] = {0.0f};
243   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
244   static float proj_clip_param_init[] = {0.0f};
245   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
246   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
247   // Phase 3, inputs and outputs
248   model->identifyInputsAndOutputs(
249     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
250     {scratch_buffer, output_state_out, cell_state_out, output});
251   assert(model->isValid());
252 }
253 
is_ignored_dynamic_output_shape_2(int i)254 inline bool is_ignored_dynamic_output_shape_2(int i) {
255   static std::set<int> ignore = {0};
256   return ignore.find(i) != ignore.end();
257 }
258 
CreateModel_3(Model * model)259 void CreateModel_3(Model *model) {
260   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
261   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
262   OperandType type10(Type::TENSOR_FLOAT32, {2, 16});
263   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
264   OperandType type3(Type::TENSOR_FLOAT32, {4});
265   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
266   OperandType type5(Type::TENSOR_FLOAT32, {0});
267   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
268   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
269   OperandType type8(Type::INT32, {});
270   OperandType type9(Type::FLOAT32, {});
271   // Phase 1, operands
272   auto input = model->addOperand(&type0);
273   auto input_to_input_weights = model->addOperand(&type1);
274   auto input_to_forget_weights = model->addOperand(&type1);
275   auto input_to_cell_weights = model->addOperand(&type1);
276   auto input_to_output_weights = model->addOperand(&type1);
277   auto recurrent_to_intput_weights = model->addOperand(&type2);
278   auto recurrent_to_forget_weights = model->addOperand(&type2);
279   auto recurrent_to_cell_weights = model->addOperand(&type2);
280   auto recurrent_to_output_weights = model->addOperand(&type2);
281   auto cell_to_input_weights = model->addOperand(&type3);
282   auto cell_to_forget_weights = model->addOperand(&type3);
283   auto cell_to_output_weights = model->addOperand(&type3);
284   auto input_gate_bias = model->addOperand(&type3);
285   auto forget_gate_bias = model->addOperand(&type3);
286   auto cell_gate_bias = model->addOperand(&type3);
287   auto output_gate_bias = model->addOperand(&type3);
288   auto projection_weights = model->addOperand(&type4);
289   auto projection_bias = model->addOperand(&type5);
290   auto output_state_in = model->addOperand(&type6);
291   auto cell_state_in = model->addOperand(&type7);
292   auto activation_param = model->addOperand(&type8);
293   auto cell_clip_param = model->addOperand(&type9);
294   auto proj_clip_param = model->addOperand(&type9);
295   auto input_layer_norm_weights = model->addOperand(&type3);
296   auto forget_layer_norm_weights = model->addOperand(&type3);
297   auto cell_layer_norm_weights = model->addOperand(&type3);
298   auto output_layer_norm_weights = model->addOperand(&type3);
299   auto scratch_buffer = model->addOperand(&type10);
300   auto output_state_out = model->addOperand(&type6);
301   auto cell_state_out = model->addOperand(&type7);
302   auto output = model->addOperand(&type6);
303   // Phase 2, operations
304   static int32_t activation_param_init[] = {4};
305   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
306   static float cell_clip_param_init[] = {0.0f};
307   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
308   static float proj_clip_param_init[] = {0.0f};
309   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
310   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
311   // Phase 3, inputs and outputs
312   model->identifyInputsAndOutputs(
313     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
314     {scratch_buffer, output_state_out, cell_state_out, output});
315   assert(model->isValid());
316 }
317 
is_ignored_3(int i)318 inline bool is_ignored_3(int i) {
319   static std::set<int> ignore = {0};
320   return ignore.find(i) != ignore.end();
321 }
322 
CreateModel_dynamic_output_shape_3(Model * model)323 void CreateModel_dynamic_output_shape_3(Model *model) {
324   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
325   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
326   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
327   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
328   OperandType type3(Type::TENSOR_FLOAT32, {4});
329   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
330   OperandType type5(Type::TENSOR_FLOAT32, {0});
331   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
332   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
333   OperandType type8(Type::INT32, {});
334   OperandType type9(Type::FLOAT32, {});
335   // Phase 1, operands
336   auto input = model->addOperand(&type0);
337   auto input_to_input_weights = model->addOperand(&type1);
338   auto input_to_forget_weights = model->addOperand(&type1);
339   auto input_to_cell_weights = model->addOperand(&type1);
340   auto input_to_output_weights = model->addOperand(&type1);
341   auto recurrent_to_intput_weights = model->addOperand(&type2);
342   auto recurrent_to_forget_weights = model->addOperand(&type2);
343   auto recurrent_to_cell_weights = model->addOperand(&type2);
344   auto recurrent_to_output_weights = model->addOperand(&type2);
345   auto cell_to_input_weights = model->addOperand(&type3);
346   auto cell_to_forget_weights = model->addOperand(&type3);
347   auto cell_to_output_weights = model->addOperand(&type3);
348   auto input_gate_bias = model->addOperand(&type3);
349   auto forget_gate_bias = model->addOperand(&type3);
350   auto cell_gate_bias = model->addOperand(&type3);
351   auto output_gate_bias = model->addOperand(&type3);
352   auto projection_weights = model->addOperand(&type4);
353   auto projection_bias = model->addOperand(&type5);
354   auto output_state_in = model->addOperand(&type6);
355   auto cell_state_in = model->addOperand(&type7);
356   auto activation_param = model->addOperand(&type8);
357   auto cell_clip_param = model->addOperand(&type9);
358   auto proj_clip_param = model->addOperand(&type9);
359   auto input_layer_norm_weights = model->addOperand(&type3);
360   auto forget_layer_norm_weights = model->addOperand(&type3);
361   auto cell_layer_norm_weights = model->addOperand(&type3);
362   auto output_layer_norm_weights = model->addOperand(&type3);
363   auto scratch_buffer = model->addOperand(&type11);
364   auto output_state_out = model->addOperand(&type11);
365   auto cell_state_out = model->addOperand(&type11);
366   auto output = model->addOperand(&type11);
367   // Phase 2, operations
368   static int32_t activation_param_init[] = {4};
369   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
370   static float cell_clip_param_init[] = {0.0f};
371   model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
372   static float proj_clip_param_init[] = {0.0f};
373   model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
374   model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {scratch_buffer, output_state_out, cell_state_out, output});
375   // Phase 3, inputs and outputs
376   model->identifyInputsAndOutputs(
377     {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
378     {scratch_buffer, output_state_out, cell_state_out, output});
379   assert(model->isValid());
380 }
381 
is_ignored_dynamic_output_shape_3(int i)382 inline bool is_ignored_dynamic_output_shape_3(int i) {
383   static std::set<int> ignore = {0};
384   return ignore.find(i) != ignore.end();
385 }
386 
CreateModel_4(Model * model)387 void CreateModel_4(Model *model) {
388   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
389   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
390   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
391   OperandType type12(Type::TENSOR_FLOAT32, {2, 12});
392   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
393   OperandType type3(Type::TENSOR_FLOAT32, {4});
394   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
395   OperandType type5(Type::TENSOR_FLOAT32, {0});
396   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
397   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
398   OperandType type8(Type::INT32, {});
399   OperandType type9(Type::FLOAT32, {});
400   // Phase 1, operands
401   auto input1 = model->addOperand(&type0);
402   auto input_to_input_weights1 = model->addOperand(&type11);
403   auto input_to_forget_weights1 = model->addOperand(&type1);
404   auto input_to_cell_weights1 = model->addOperand(&type1);
405   auto input_to_output_weights1 = model->addOperand(&type1);
406   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
407   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
408   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
409   auto recurrent_to_output_weights1 = model->addOperand(&type2);
410   auto cell_to_input_weights1 = model->addOperand(&type5);
411   auto cell_to_forget_weights1 = model->addOperand(&type3);
412   auto cell_to_output_weights1 = model->addOperand(&type3);
413   auto input_gate_bias1 = model->addOperand(&type5);
414   auto forget_gate_bias1 = model->addOperand(&type3);
415   auto cell_gate_bias1 = model->addOperand(&type3);
416   auto output_gate_bias1 = model->addOperand(&type3);
417   auto projection_weights1 = model->addOperand(&type4);
418   auto projection_bias1 = model->addOperand(&type5);
419   auto output_state_in1 = model->addOperand(&type6);
420   auto cell_state_in1 = model->addOperand(&type7);
421   auto activation_param1 = model->addOperand(&type8);
422   auto cell_clip_param1 = model->addOperand(&type9);
423   auto proj_clip_param1 = model->addOperand(&type9);
424   auto input_layer_norm_weights1 = model->addOperand(&type5);
425   auto forget_layer_norm_weights1 = model->addOperand(&type3);
426   auto cell_layer_norm_weights1 = model->addOperand(&type3);
427   auto output_layer_norm_weights1 = model->addOperand(&type3);
428   auto scratch_buffer1 = model->addOperand(&type12);
429   auto output_state_out1 = model->addOperand(&type6);
430   auto cell_state_out1 = model->addOperand(&type7);
431   auto output1 = model->addOperand(&type6);
432   // Phase 2, operations
433   static int32_t activation_param1_init[] = {4};
434   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
435   static float cell_clip_param1_init[] = {0.0f};
436   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
437   static float proj_clip_param1_init[] = {0.0f};
438   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
439   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
440   // Phase 3, inputs and outputs
441   model->identifyInputsAndOutputs(
442     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
443     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
444   assert(model->isValid());
445 }
446 
is_ignored_4(int i)447 inline bool is_ignored_4(int i) {
448   static std::set<int> ignore = {0, 1};
449   return ignore.find(i) != ignore.end();
450 }
451 
CreateModel_dynamic_output_shape_4(Model * model)452 void CreateModel_dynamic_output_shape_4(Model *model) {
453   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
454   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
455   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
456   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
457   OperandType type3(Type::TENSOR_FLOAT32, {4});
458   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
459   OperandType type5(Type::TENSOR_FLOAT32, {0});
460   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
461   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
462   OperandType type8(Type::INT32, {});
463   OperandType type9(Type::FLOAT32, {});
464   // Phase 1, operands
465   auto input1 = model->addOperand(&type0);
466   auto input_to_input_weights1 = model->addOperand(&type11);
467   auto input_to_forget_weights1 = model->addOperand(&type1);
468   auto input_to_cell_weights1 = model->addOperand(&type1);
469   auto input_to_output_weights1 = model->addOperand(&type1);
470   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
471   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
472   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
473   auto recurrent_to_output_weights1 = model->addOperand(&type2);
474   auto cell_to_input_weights1 = model->addOperand(&type5);
475   auto cell_to_forget_weights1 = model->addOperand(&type3);
476   auto cell_to_output_weights1 = model->addOperand(&type3);
477   auto input_gate_bias1 = model->addOperand(&type5);
478   auto forget_gate_bias1 = model->addOperand(&type3);
479   auto cell_gate_bias1 = model->addOperand(&type3);
480   auto output_gate_bias1 = model->addOperand(&type3);
481   auto projection_weights1 = model->addOperand(&type4);
482   auto projection_bias1 = model->addOperand(&type5);
483   auto output_state_in1 = model->addOperand(&type6);
484   auto cell_state_in1 = model->addOperand(&type7);
485   auto activation_param1 = model->addOperand(&type8);
486   auto cell_clip_param1 = model->addOperand(&type9);
487   auto proj_clip_param1 = model->addOperand(&type9);
488   auto input_layer_norm_weights1 = model->addOperand(&type5);
489   auto forget_layer_norm_weights1 = model->addOperand(&type3);
490   auto cell_layer_norm_weights1 = model->addOperand(&type3);
491   auto output_layer_norm_weights1 = model->addOperand(&type3);
492   auto scratch_buffer1 = model->addOperand(&type11);
493   auto output_state_out1 = model->addOperand(&type11);
494   auto cell_state_out1 = model->addOperand(&type11);
495   auto output1 = model->addOperand(&type11);
496   // Phase 2, operations
497   static int32_t activation_param1_init[] = {4};
498   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
499   static float cell_clip_param1_init[] = {0.0f};
500   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
501   static float proj_clip_param1_init[] = {0.0f};
502   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
503   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
504   // Phase 3, inputs and outputs
505   model->identifyInputsAndOutputs(
506     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
507     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
508   assert(model->isValid());
509 }
510 
is_ignored_dynamic_output_shape_4(int i)511 inline bool is_ignored_dynamic_output_shape_4(int i) {
512   static std::set<int> ignore = {0, 1};
513   return ignore.find(i) != ignore.end();
514 }
515 
CreateModel_5(Model * model)516 void CreateModel_5(Model *model) {
517   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
518   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
519   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
520   OperandType type12(Type::TENSOR_FLOAT32, {2, 12});
521   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
522   OperandType type3(Type::TENSOR_FLOAT32, {4});
523   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
524   OperandType type5(Type::TENSOR_FLOAT32, {0});
525   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
526   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
527   OperandType type8(Type::INT32, {});
528   OperandType type9(Type::FLOAT32, {});
529   // Phase 1, operands
530   auto input1 = model->addOperand(&type0);
531   auto input_to_input_weights1 = model->addOperand(&type11);
532   auto input_to_forget_weights1 = model->addOperand(&type1);
533   auto input_to_cell_weights1 = model->addOperand(&type1);
534   auto input_to_output_weights1 = model->addOperand(&type1);
535   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
536   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
537   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
538   auto recurrent_to_output_weights1 = model->addOperand(&type2);
539   auto cell_to_input_weights1 = model->addOperand(&type5);
540   auto cell_to_forget_weights1 = model->addOperand(&type3);
541   auto cell_to_output_weights1 = model->addOperand(&type3);
542   auto input_gate_bias1 = model->addOperand(&type5);
543   auto forget_gate_bias1 = model->addOperand(&type3);
544   auto cell_gate_bias1 = model->addOperand(&type3);
545   auto output_gate_bias1 = model->addOperand(&type3);
546   auto projection_weights1 = model->addOperand(&type4);
547   auto projection_bias1 = model->addOperand(&type5);
548   auto output_state_in1 = model->addOperand(&type6);
549   auto cell_state_in1 = model->addOperand(&type7);
550   auto activation_param1 = model->addOperand(&type8);
551   auto cell_clip_param1 = model->addOperand(&type9);
552   auto proj_clip_param1 = model->addOperand(&type9);
553   auto input_layer_norm_weights1 = model->addOperand(&type5);
554   auto forget_layer_norm_weights1 = model->addOperand(&type3);
555   auto cell_layer_norm_weights1 = model->addOperand(&type3);
556   auto output_layer_norm_weights1 = model->addOperand(&type3);
557   auto scratch_buffer1 = model->addOperand(&type12);
558   auto output_state_out1 = model->addOperand(&type6);
559   auto cell_state_out1 = model->addOperand(&type7);
560   auto output1 = model->addOperand(&type6);
561   // Phase 2, operations
562   static int32_t activation_param1_init[] = {4};
563   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
564   static float cell_clip_param1_init[] = {0.0f};
565   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
566   static float proj_clip_param1_init[] = {0.0f};
567   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
568   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
569   // Phase 3, inputs and outputs
570   model->identifyInputsAndOutputs(
571     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
572     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
573   assert(model->isValid());
574 }
575 
is_ignored_5(int i)576 inline bool is_ignored_5(int i) {
577   static std::set<int> ignore = {0, 1};
578   return ignore.find(i) != ignore.end();
579 }
580 
CreateModel_dynamic_output_shape_5(Model * model)581 void CreateModel_dynamic_output_shape_5(Model *model) {
582   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
583   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
584   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
585   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
586   OperandType type3(Type::TENSOR_FLOAT32, {4});
587   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
588   OperandType type5(Type::TENSOR_FLOAT32, {0});
589   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
590   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
591   OperandType type8(Type::INT32, {});
592   OperandType type9(Type::FLOAT32, {});
593   // Phase 1, operands
594   auto input1 = model->addOperand(&type0);
595   auto input_to_input_weights1 = model->addOperand(&type11);
596   auto input_to_forget_weights1 = model->addOperand(&type1);
597   auto input_to_cell_weights1 = model->addOperand(&type1);
598   auto input_to_output_weights1 = model->addOperand(&type1);
599   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
600   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
601   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
602   auto recurrent_to_output_weights1 = model->addOperand(&type2);
603   auto cell_to_input_weights1 = model->addOperand(&type5);
604   auto cell_to_forget_weights1 = model->addOperand(&type3);
605   auto cell_to_output_weights1 = model->addOperand(&type3);
606   auto input_gate_bias1 = model->addOperand(&type5);
607   auto forget_gate_bias1 = model->addOperand(&type3);
608   auto cell_gate_bias1 = model->addOperand(&type3);
609   auto output_gate_bias1 = model->addOperand(&type3);
610   auto projection_weights1 = model->addOperand(&type4);
611   auto projection_bias1 = model->addOperand(&type5);
612   auto output_state_in1 = model->addOperand(&type6);
613   auto cell_state_in1 = model->addOperand(&type7);
614   auto activation_param1 = model->addOperand(&type8);
615   auto cell_clip_param1 = model->addOperand(&type9);
616   auto proj_clip_param1 = model->addOperand(&type9);
617   auto input_layer_norm_weights1 = model->addOperand(&type5);
618   auto forget_layer_norm_weights1 = model->addOperand(&type3);
619   auto cell_layer_norm_weights1 = model->addOperand(&type3);
620   auto output_layer_norm_weights1 = model->addOperand(&type3);
621   auto scratch_buffer1 = model->addOperand(&type11);
622   auto output_state_out1 = model->addOperand(&type11);
623   auto cell_state_out1 = model->addOperand(&type11);
624   auto output1 = model->addOperand(&type11);
625   // Phase 2, operations
626   static int32_t activation_param1_init[] = {4};
627   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
628   static float cell_clip_param1_init[] = {0.0f};
629   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
630   static float proj_clip_param1_init[] = {0.0f};
631   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
632   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
633   // Phase 3, inputs and outputs
634   model->identifyInputsAndOutputs(
635     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
636     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
637   assert(model->isValid());
638 }
639 
is_ignored_dynamic_output_shape_5(int i)640 inline bool is_ignored_dynamic_output_shape_5(int i) {
641   static std::set<int> ignore = {0, 1};
642   return ignore.find(i) != ignore.end();
643 }
644 
CreateModel_6(Model * model)645 void CreateModel_6(Model *model) {
646   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
647   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
648   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
649   OperandType type12(Type::TENSOR_FLOAT32, {2, 12});
650   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
651   OperandType type3(Type::TENSOR_FLOAT32, {4});
652   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
653   OperandType type5(Type::TENSOR_FLOAT32, {0});
654   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
655   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
656   OperandType type8(Type::INT32, {});
657   OperandType type9(Type::FLOAT32, {});
658   // Phase 1, operands
659   auto input1 = model->addOperand(&type0);
660   auto input_to_input_weights1 = model->addOperand(&type11);
661   auto input_to_forget_weights1 = model->addOperand(&type1);
662   auto input_to_cell_weights1 = model->addOperand(&type1);
663   auto input_to_output_weights1 = model->addOperand(&type1);
664   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
665   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
666   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
667   auto recurrent_to_output_weights1 = model->addOperand(&type2);
668   auto cell_to_input_weights1 = model->addOperand(&type5);
669   auto cell_to_forget_weights1 = model->addOperand(&type3);
670   auto cell_to_output_weights1 = model->addOperand(&type3);
671   auto input_gate_bias1 = model->addOperand(&type5);
672   auto forget_gate_bias1 = model->addOperand(&type3);
673   auto cell_gate_bias1 = model->addOperand(&type3);
674   auto output_gate_bias1 = model->addOperand(&type3);
675   auto projection_weights1 = model->addOperand(&type4);
676   auto projection_bias1 = model->addOperand(&type5);
677   auto output_state_in1 = model->addOperand(&type6);
678   auto cell_state_in1 = model->addOperand(&type7);
679   auto activation_param1 = model->addOperand(&type8);
680   auto cell_clip_param1 = model->addOperand(&type9);
681   auto proj_clip_param1 = model->addOperand(&type9);
682   auto input_layer_norm_weights1 = model->addOperand(&type5);
683   auto forget_layer_norm_weights1 = model->addOperand(&type3);
684   auto cell_layer_norm_weights1 = model->addOperand(&type3);
685   auto output_layer_norm_weights1 = model->addOperand(&type3);
686   auto scratch_buffer1 = model->addOperand(&type12);
687   auto output_state_out1 = model->addOperand(&type6);
688   auto cell_state_out1 = model->addOperand(&type7);
689   auto output1 = model->addOperand(&type6);
690   // Phase 2, operations
691   static int32_t activation_param1_init[] = {4};
692   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
693   static float cell_clip_param1_init[] = {0.0f};
694   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
695   static float proj_clip_param1_init[] = {0.0f};
696   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
697   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
698   // Phase 3, inputs and outputs
699   model->identifyInputsAndOutputs(
700     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
701     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
702   assert(model->isValid());
703 }
704 
is_ignored_6(int i)705 inline bool is_ignored_6(int i) {
706   static std::set<int> ignore = {0, 1};
707   return ignore.find(i) != ignore.end();
708 }
709 
CreateModel_dynamic_output_shape_6(Model * model)710 void CreateModel_dynamic_output_shape_6(Model *model) {
711   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
712   OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
713   OperandType type11(Type::TENSOR_FLOAT32, {0, 0});
714   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
715   OperandType type3(Type::TENSOR_FLOAT32, {4});
716   OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
717   OperandType type5(Type::TENSOR_FLOAT32, {0});
718   OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
719   OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
720   OperandType type8(Type::INT32, {});
721   OperandType type9(Type::FLOAT32, {});
722   // Phase 1, operands
723   auto input1 = model->addOperand(&type0);
724   auto input_to_input_weights1 = model->addOperand(&type11);
725   auto input_to_forget_weights1 = model->addOperand(&type1);
726   auto input_to_cell_weights1 = model->addOperand(&type1);
727   auto input_to_output_weights1 = model->addOperand(&type1);
728   auto recurrent_to_intput_weights1 = model->addOperand(&type11);
729   auto recurrent_to_forget_weights1 = model->addOperand(&type2);
730   auto recurrent_to_cell_weights1 = model->addOperand(&type2);
731   auto recurrent_to_output_weights1 = model->addOperand(&type2);
732   auto cell_to_input_weights1 = model->addOperand(&type5);
733   auto cell_to_forget_weights1 = model->addOperand(&type3);
734   auto cell_to_output_weights1 = model->addOperand(&type3);
735   auto input_gate_bias1 = model->addOperand(&type5);
736   auto forget_gate_bias1 = model->addOperand(&type3);
737   auto cell_gate_bias1 = model->addOperand(&type3);
738   auto output_gate_bias1 = model->addOperand(&type3);
739   auto projection_weights1 = model->addOperand(&type4);
740   auto projection_bias1 = model->addOperand(&type5);
741   auto output_state_in1 = model->addOperand(&type6);
742   auto cell_state_in1 = model->addOperand(&type7);
743   auto activation_param1 = model->addOperand(&type8);
744   auto cell_clip_param1 = model->addOperand(&type9);
745   auto proj_clip_param1 = model->addOperand(&type9);
746   auto input_layer_norm_weights1 = model->addOperand(&type5);
747   auto forget_layer_norm_weights1 = model->addOperand(&type3);
748   auto cell_layer_norm_weights1 = model->addOperand(&type3);
749   auto output_layer_norm_weights1 = model->addOperand(&type3);
750   auto scratch_buffer1 = model->addOperand(&type11);
751   auto output_state_out1 = model->addOperand(&type11);
752   auto cell_state_out1 = model->addOperand(&type11);
753   auto output1 = model->addOperand(&type11);
754   // Phase 2, operations
755   static int32_t activation_param1_init[] = {4};
756   model->setOperandValue(activation_param1, activation_param1_init, sizeof(int32_t) * 1);
757   static float cell_clip_param1_init[] = {0.0f};
758   model->setOperandValue(cell_clip_param1, cell_clip_param1_init, sizeof(float) * 1);
759   static float proj_clip_param1_init[] = {0.0f};
760   model->setOperandValue(proj_clip_param1, proj_clip_param1_init, sizeof(float) * 1);
761   model->addOperation(ANEURALNETWORKS_LSTM, {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, activation_param1, cell_clip_param1, proj_clip_param1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1}, {scratch_buffer1, output_state_out1, cell_state_out1, output1});
762   // Phase 3, inputs and outputs
763   model->identifyInputsAndOutputs(
764     {input1, input_to_input_weights1, input_to_forget_weights1, input_to_cell_weights1, input_to_output_weights1, recurrent_to_intput_weights1, recurrent_to_forget_weights1, recurrent_to_cell_weights1, recurrent_to_output_weights1, cell_to_input_weights1, cell_to_forget_weights1, cell_to_output_weights1, input_gate_bias1, forget_gate_bias1, cell_gate_bias1, output_gate_bias1, projection_weights1, projection_bias1, output_state_in1, cell_state_in1, input_layer_norm_weights1, forget_layer_norm_weights1, cell_layer_norm_weights1, output_layer_norm_weights1},
765     {scratch_buffer1, output_state_out1, cell_state_out1, output1});
766   assert(model->isValid());
767 }
768 
is_ignored_dynamic_output_shape_6(int i)769 inline bool is_ignored_dynamic_output_shape_6(int i) {
770   static std::set<int> ignore = {0, 1};
771   return ignore.find(i) != ignore.end();
772 }
773 
774