1 // clang-format off
2 // Generated file (from: lstm_state2.mod.py). Do not edit
3 // Create the model
createTestModel()4 Model createTestModel() {
5 const std::vector<Operand> operands = {
6 {
7 .type = OperandType::TENSOR_FLOAT32,
8 .dimensions = {1, 2},
9 .numberOfConsumers = 1,
10 .scale = 0.0f,
11 .zeroPoint = 0,
12 .lifetime = OperandLifeTime::MODEL_INPUT,
13 .location = {.poolIndex = 0, .offset = 0, .length = 0},
14 },
15 {
16 .type = OperandType::TENSOR_FLOAT32,
17 .dimensions = {4, 2},
18 .numberOfConsumers = 1,
19 .scale = 0.0f,
20 .zeroPoint = 0,
21 .lifetime = OperandLifeTime::MODEL_INPUT,
22 .location = {.poolIndex = 0, .offset = 0, .length = 0},
23 },
24 {
25 .type = OperandType::TENSOR_FLOAT32,
26 .dimensions = {4, 2},
27 .numberOfConsumers = 1,
28 .scale = 0.0f,
29 .zeroPoint = 0,
30 .lifetime = OperandLifeTime::MODEL_INPUT,
31 .location = {.poolIndex = 0, .offset = 0, .length = 0},
32 },
33 {
34 .type = OperandType::TENSOR_FLOAT32,
35 .dimensions = {4, 2},
36 .numberOfConsumers = 1,
37 .scale = 0.0f,
38 .zeroPoint = 0,
39 .lifetime = OperandLifeTime::MODEL_INPUT,
40 .location = {.poolIndex = 0, .offset = 0, .length = 0},
41 },
42 {
43 .type = OperandType::TENSOR_FLOAT32,
44 .dimensions = {4, 2},
45 .numberOfConsumers = 1,
46 .scale = 0.0f,
47 .zeroPoint = 0,
48 .lifetime = OperandLifeTime::MODEL_INPUT,
49 .location = {.poolIndex = 0, .offset = 0, .length = 0},
50 },
51 {
52 .type = OperandType::TENSOR_FLOAT32,
53 .dimensions = {4, 4},
54 .numberOfConsumers = 1,
55 .scale = 0.0f,
56 .zeroPoint = 0,
57 .lifetime = OperandLifeTime::MODEL_INPUT,
58 .location = {.poolIndex = 0, .offset = 0, .length = 0},
59 },
60 {
61 .type = OperandType::TENSOR_FLOAT32,
62 .dimensions = {4, 4},
63 .numberOfConsumers = 1,
64 .scale = 0.0f,
65 .zeroPoint = 0,
66 .lifetime = OperandLifeTime::MODEL_INPUT,
67 .location = {.poolIndex = 0, .offset = 0, .length = 0},
68 },
69 {
70 .type = OperandType::TENSOR_FLOAT32,
71 .dimensions = {4, 4},
72 .numberOfConsumers = 1,
73 .scale = 0.0f,
74 .zeroPoint = 0,
75 .lifetime = OperandLifeTime::MODEL_INPUT,
76 .location = {.poolIndex = 0, .offset = 0, .length = 0},
77 },
78 {
79 .type = OperandType::TENSOR_FLOAT32,
80 .dimensions = {4, 4},
81 .numberOfConsumers = 1,
82 .scale = 0.0f,
83 .zeroPoint = 0,
84 .lifetime = OperandLifeTime::MODEL_INPUT,
85 .location = {.poolIndex = 0, .offset = 0, .length = 0},
86 },
87 {
88 .type = OperandType::TENSOR_FLOAT32,
89 .dimensions = {0},
90 .numberOfConsumers = 1,
91 .scale = 0.0f,
92 .zeroPoint = 0,
93 .lifetime = OperandLifeTime::MODEL_INPUT,
94 .location = {.poolIndex = 0, .offset = 0, .length = 0},
95 },
96 {
97 .type = OperandType::TENSOR_FLOAT32,
98 .dimensions = {0},
99 .numberOfConsumers = 1,
100 .scale = 0.0f,
101 .zeroPoint = 0,
102 .lifetime = OperandLifeTime::MODEL_INPUT,
103 .location = {.poolIndex = 0, .offset = 0, .length = 0},
104 },
105 {
106 .type = OperandType::TENSOR_FLOAT32,
107 .dimensions = {0},
108 .numberOfConsumers = 1,
109 .scale = 0.0f,
110 .zeroPoint = 0,
111 .lifetime = OperandLifeTime::MODEL_INPUT,
112 .location = {.poolIndex = 0, .offset = 0, .length = 0},
113 },
114 {
115 .type = OperandType::TENSOR_FLOAT32,
116 .dimensions = {4},
117 .numberOfConsumers = 1,
118 .scale = 0.0f,
119 .zeroPoint = 0,
120 .lifetime = OperandLifeTime::MODEL_INPUT,
121 .location = {.poolIndex = 0, .offset = 0, .length = 0},
122 },
123 {
124 .type = OperandType::TENSOR_FLOAT32,
125 .dimensions = {4},
126 .numberOfConsumers = 1,
127 .scale = 0.0f,
128 .zeroPoint = 0,
129 .lifetime = OperandLifeTime::MODEL_INPUT,
130 .location = {.poolIndex = 0, .offset = 0, .length = 0},
131 },
132 {
133 .type = OperandType::TENSOR_FLOAT32,
134 .dimensions = {4},
135 .numberOfConsumers = 1,
136 .scale = 0.0f,
137 .zeroPoint = 0,
138 .lifetime = OperandLifeTime::MODEL_INPUT,
139 .location = {.poolIndex = 0, .offset = 0, .length = 0},
140 },
141 {
142 .type = OperandType::TENSOR_FLOAT32,
143 .dimensions = {4},
144 .numberOfConsumers = 1,
145 .scale = 0.0f,
146 .zeroPoint = 0,
147 .lifetime = OperandLifeTime::MODEL_INPUT,
148 .location = {.poolIndex = 0, .offset = 0, .length = 0},
149 },
150 {
151 .type = OperandType::TENSOR_FLOAT32,
152 .dimensions = {0, 0},
153 .numberOfConsumers = 1,
154 .scale = 0.0f,
155 .zeroPoint = 0,
156 .lifetime = OperandLifeTime::MODEL_INPUT,
157 .location = {.poolIndex = 0, .offset = 0, .length = 0},
158 },
159 {
160 .type = OperandType::TENSOR_FLOAT32,
161 .dimensions = {0},
162 .numberOfConsumers = 1,
163 .scale = 0.0f,
164 .zeroPoint = 0,
165 .lifetime = OperandLifeTime::MODEL_INPUT,
166 .location = {.poolIndex = 0, .offset = 0, .length = 0},
167 },
168 {
169 .type = OperandType::TENSOR_FLOAT32,
170 .dimensions = {1, 4},
171 .numberOfConsumers = 1,
172 .scale = 0.0f,
173 .zeroPoint = 0,
174 .lifetime = OperandLifeTime::MODEL_INPUT,
175 .location = {.poolIndex = 0, .offset = 0, .length = 0},
176 },
177 {
178 .type = OperandType::TENSOR_FLOAT32,
179 .dimensions = {1, 4},
180 .numberOfConsumers = 1,
181 .scale = 0.0f,
182 .zeroPoint = 0,
183 .lifetime = OperandLifeTime::MODEL_INPUT,
184 .location = {.poolIndex = 0, .offset = 0, .length = 0},
185 },
186 {
187 .type = OperandType::INT32,
188 .dimensions = {},
189 .numberOfConsumers = 1,
190 .scale = 0.0f,
191 .zeroPoint = 0,
192 .lifetime = OperandLifeTime::CONSTANT_COPY,
193 .location = {.poolIndex = 0, .offset = 0, .length = 4},
194 },
195 {
196 .type = OperandType::FLOAT32,
197 .dimensions = {},
198 .numberOfConsumers = 1,
199 .scale = 0.0f,
200 .zeroPoint = 0,
201 .lifetime = OperandLifeTime::CONSTANT_COPY,
202 .location = {.poolIndex = 0, .offset = 4, .length = 4},
203 },
204 {
205 .type = OperandType::FLOAT32,
206 .dimensions = {},
207 .numberOfConsumers = 1,
208 .scale = 0.0f,
209 .zeroPoint = 0,
210 .lifetime = OperandLifeTime::CONSTANT_COPY,
211 .location = {.poolIndex = 0, .offset = 8, .length = 4},
212 },
213 {
214 .type = OperandType::TENSOR_FLOAT32,
215 .dimensions = {1, 16},
216 .numberOfConsumers = 0,
217 .scale = 0.0f,
218 .zeroPoint = 0,
219 .lifetime = OperandLifeTime::MODEL_OUTPUT,
220 .location = {.poolIndex = 0, .offset = 0, .length = 0},
221 },
222 {
223 .type = OperandType::TENSOR_FLOAT32,
224 .dimensions = {1, 4},
225 .numberOfConsumers = 0,
226 .scale = 0.0f,
227 .zeroPoint = 0,
228 .lifetime = OperandLifeTime::MODEL_OUTPUT,
229 .location = {.poolIndex = 0, .offset = 0, .length = 0},
230 },
231 {
232 .type = OperandType::TENSOR_FLOAT32,
233 .dimensions = {1, 4},
234 .numberOfConsumers = 0,
235 .scale = 0.0f,
236 .zeroPoint = 0,
237 .lifetime = OperandLifeTime::MODEL_OUTPUT,
238 .location = {.poolIndex = 0, .offset = 0, .length = 0},
239 },
240 {
241 .type = OperandType::TENSOR_FLOAT32,
242 .dimensions = {1, 4},
243 .numberOfConsumers = 0,
244 .scale = 0.0f,
245 .zeroPoint = 0,
246 .lifetime = OperandLifeTime::MODEL_OUTPUT,
247 .location = {.poolIndex = 0, .offset = 0, .length = 0},
248 }
249 };
250
251 const std::vector<Operation> operations = {
252 {
253 .type = OperationType::LSTM,
254 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
255 .outputs = {23, 24, 25, 26},
256 }
257 };
258
259 const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
260 const std::vector<uint32_t> outputIndexes = {23, 24, 25, 26};
261 std::vector<uint8_t> operandValues = {
262 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
263 };
264 const std::vector<hidl_memory> pools = {};
265
266 return {
267 .operands = operands,
268 .operations = operations,
269 .inputIndexes = inputIndexes,
270 .outputIndexes = outputIndexes,
271 .operandValues = operandValues,
272 .pools = pools,
273 };
274 }
275
is_ignored(int i)276 inline bool is_ignored(int i) {
277 static std::set<int> ignore = {0, 1, 2};
278 return ignore.find(i) != ignore.end();
279 }
280
281 // Create the model
createTestModel_dynamic_output_shape()282 Model createTestModel_dynamic_output_shape() {
283 const std::vector<Operand> operands = {
284 {
285 .type = OperandType::TENSOR_FLOAT32,
286 .dimensions = {1, 2},
287 .numberOfConsumers = 1,
288 .scale = 0.0f,
289 .zeroPoint = 0,
290 .lifetime = OperandLifeTime::MODEL_INPUT,
291 .location = {.poolIndex = 0, .offset = 0, .length = 0},
292 },
293 {
294 .type = OperandType::TENSOR_FLOAT32,
295 .dimensions = {4, 2},
296 .numberOfConsumers = 1,
297 .scale = 0.0f,
298 .zeroPoint = 0,
299 .lifetime = OperandLifeTime::MODEL_INPUT,
300 .location = {.poolIndex = 0, .offset = 0, .length = 0},
301 },
302 {
303 .type = OperandType::TENSOR_FLOAT32,
304 .dimensions = {4, 2},
305 .numberOfConsumers = 1,
306 .scale = 0.0f,
307 .zeroPoint = 0,
308 .lifetime = OperandLifeTime::MODEL_INPUT,
309 .location = {.poolIndex = 0, .offset = 0, .length = 0},
310 },
311 {
312 .type = OperandType::TENSOR_FLOAT32,
313 .dimensions = {4, 2},
314 .numberOfConsumers = 1,
315 .scale = 0.0f,
316 .zeroPoint = 0,
317 .lifetime = OperandLifeTime::MODEL_INPUT,
318 .location = {.poolIndex = 0, .offset = 0, .length = 0},
319 },
320 {
321 .type = OperandType::TENSOR_FLOAT32,
322 .dimensions = {4, 2},
323 .numberOfConsumers = 1,
324 .scale = 0.0f,
325 .zeroPoint = 0,
326 .lifetime = OperandLifeTime::MODEL_INPUT,
327 .location = {.poolIndex = 0, .offset = 0, .length = 0},
328 },
329 {
330 .type = OperandType::TENSOR_FLOAT32,
331 .dimensions = {4, 4},
332 .numberOfConsumers = 1,
333 .scale = 0.0f,
334 .zeroPoint = 0,
335 .lifetime = OperandLifeTime::MODEL_INPUT,
336 .location = {.poolIndex = 0, .offset = 0, .length = 0},
337 },
338 {
339 .type = OperandType::TENSOR_FLOAT32,
340 .dimensions = {4, 4},
341 .numberOfConsumers = 1,
342 .scale = 0.0f,
343 .zeroPoint = 0,
344 .lifetime = OperandLifeTime::MODEL_INPUT,
345 .location = {.poolIndex = 0, .offset = 0, .length = 0},
346 },
347 {
348 .type = OperandType::TENSOR_FLOAT32,
349 .dimensions = {4, 4},
350 .numberOfConsumers = 1,
351 .scale = 0.0f,
352 .zeroPoint = 0,
353 .lifetime = OperandLifeTime::MODEL_INPUT,
354 .location = {.poolIndex = 0, .offset = 0, .length = 0},
355 },
356 {
357 .type = OperandType::TENSOR_FLOAT32,
358 .dimensions = {4, 4},
359 .numberOfConsumers = 1,
360 .scale = 0.0f,
361 .zeroPoint = 0,
362 .lifetime = OperandLifeTime::MODEL_INPUT,
363 .location = {.poolIndex = 0, .offset = 0, .length = 0},
364 },
365 {
366 .type = OperandType::TENSOR_FLOAT32,
367 .dimensions = {0},
368 .numberOfConsumers = 1,
369 .scale = 0.0f,
370 .zeroPoint = 0,
371 .lifetime = OperandLifeTime::MODEL_INPUT,
372 .location = {.poolIndex = 0, .offset = 0, .length = 0},
373 },
374 {
375 .type = OperandType::TENSOR_FLOAT32,
376 .dimensions = {0},
377 .numberOfConsumers = 1,
378 .scale = 0.0f,
379 .zeroPoint = 0,
380 .lifetime = OperandLifeTime::MODEL_INPUT,
381 .location = {.poolIndex = 0, .offset = 0, .length = 0},
382 },
383 {
384 .type = OperandType::TENSOR_FLOAT32,
385 .dimensions = {0},
386 .numberOfConsumers = 1,
387 .scale = 0.0f,
388 .zeroPoint = 0,
389 .lifetime = OperandLifeTime::MODEL_INPUT,
390 .location = {.poolIndex = 0, .offset = 0, .length = 0},
391 },
392 {
393 .type = OperandType::TENSOR_FLOAT32,
394 .dimensions = {4},
395 .numberOfConsumers = 1,
396 .scale = 0.0f,
397 .zeroPoint = 0,
398 .lifetime = OperandLifeTime::MODEL_INPUT,
399 .location = {.poolIndex = 0, .offset = 0, .length = 0},
400 },
401 {
402 .type = OperandType::TENSOR_FLOAT32,
403 .dimensions = {4},
404 .numberOfConsumers = 1,
405 .scale = 0.0f,
406 .zeroPoint = 0,
407 .lifetime = OperandLifeTime::MODEL_INPUT,
408 .location = {.poolIndex = 0, .offset = 0, .length = 0},
409 },
410 {
411 .type = OperandType::TENSOR_FLOAT32,
412 .dimensions = {4},
413 .numberOfConsumers = 1,
414 .scale = 0.0f,
415 .zeroPoint = 0,
416 .lifetime = OperandLifeTime::MODEL_INPUT,
417 .location = {.poolIndex = 0, .offset = 0, .length = 0},
418 },
419 {
420 .type = OperandType::TENSOR_FLOAT32,
421 .dimensions = {4},
422 .numberOfConsumers = 1,
423 .scale = 0.0f,
424 .zeroPoint = 0,
425 .lifetime = OperandLifeTime::MODEL_INPUT,
426 .location = {.poolIndex = 0, .offset = 0, .length = 0},
427 },
428 {
429 .type = OperandType::TENSOR_FLOAT32,
430 .dimensions = {0, 0},
431 .numberOfConsumers = 1,
432 .scale = 0.0f,
433 .zeroPoint = 0,
434 .lifetime = OperandLifeTime::MODEL_INPUT,
435 .location = {.poolIndex = 0, .offset = 0, .length = 0},
436 },
437 {
438 .type = OperandType::TENSOR_FLOAT32,
439 .dimensions = {0},
440 .numberOfConsumers = 1,
441 .scale = 0.0f,
442 .zeroPoint = 0,
443 .lifetime = OperandLifeTime::MODEL_INPUT,
444 .location = {.poolIndex = 0, .offset = 0, .length = 0},
445 },
446 {
447 .type = OperandType::TENSOR_FLOAT32,
448 .dimensions = {1, 4},
449 .numberOfConsumers = 1,
450 .scale = 0.0f,
451 .zeroPoint = 0,
452 .lifetime = OperandLifeTime::MODEL_INPUT,
453 .location = {.poolIndex = 0, .offset = 0, .length = 0},
454 },
455 {
456 .type = OperandType::TENSOR_FLOAT32,
457 .dimensions = {1, 4},
458 .numberOfConsumers = 1,
459 .scale = 0.0f,
460 .zeroPoint = 0,
461 .lifetime = OperandLifeTime::MODEL_INPUT,
462 .location = {.poolIndex = 0, .offset = 0, .length = 0},
463 },
464 {
465 .type = OperandType::INT32,
466 .dimensions = {},
467 .numberOfConsumers = 1,
468 .scale = 0.0f,
469 .zeroPoint = 0,
470 .lifetime = OperandLifeTime::CONSTANT_COPY,
471 .location = {.poolIndex = 0, .offset = 0, .length = 4},
472 },
473 {
474 .type = OperandType::FLOAT32,
475 .dimensions = {},
476 .numberOfConsumers = 1,
477 .scale = 0.0f,
478 .zeroPoint = 0,
479 .lifetime = OperandLifeTime::CONSTANT_COPY,
480 .location = {.poolIndex = 0, .offset = 4, .length = 4},
481 },
482 {
483 .type = OperandType::FLOAT32,
484 .dimensions = {},
485 .numberOfConsumers = 1,
486 .scale = 0.0f,
487 .zeroPoint = 0,
488 .lifetime = OperandLifeTime::CONSTANT_COPY,
489 .location = {.poolIndex = 0, .offset = 8, .length = 4},
490 },
491 {
492 .type = OperandType::TENSOR_FLOAT32,
493 .dimensions = {0, 0},
494 .numberOfConsumers = 0,
495 .scale = 0.0f,
496 .zeroPoint = 0,
497 .lifetime = OperandLifeTime::MODEL_OUTPUT,
498 .location = {.poolIndex = 0, .offset = 0, .length = 0},
499 },
500 {
501 .type = OperandType::TENSOR_FLOAT32,
502 .dimensions = {0, 0},
503 .numberOfConsumers = 0,
504 .scale = 0.0f,
505 .zeroPoint = 0,
506 .lifetime = OperandLifeTime::MODEL_OUTPUT,
507 .location = {.poolIndex = 0, .offset = 0, .length = 0},
508 },
509 {
510 .type = OperandType::TENSOR_FLOAT32,
511 .dimensions = {0, 0},
512 .numberOfConsumers = 0,
513 .scale = 0.0f,
514 .zeroPoint = 0,
515 .lifetime = OperandLifeTime::MODEL_OUTPUT,
516 .location = {.poolIndex = 0, .offset = 0, .length = 0},
517 },
518 {
519 .type = OperandType::TENSOR_FLOAT32,
520 .dimensions = {0, 0},
521 .numberOfConsumers = 0,
522 .scale = 0.0f,
523 .zeroPoint = 0,
524 .lifetime = OperandLifeTime::MODEL_OUTPUT,
525 .location = {.poolIndex = 0, .offset = 0, .length = 0},
526 }
527 };
528
529 const std::vector<Operation> operations = {
530 {
531 .type = OperationType::LSTM,
532 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
533 .outputs = {23, 24, 25, 26},
534 }
535 };
536
537 const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
538 const std::vector<uint32_t> outputIndexes = {23, 24, 25, 26};
539 std::vector<uint8_t> operandValues = {
540 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
541 };
542 const std::vector<hidl_memory> pools = {};
543
544 return {
545 .operands = operands,
546 .operations = operations,
547 .inputIndexes = inputIndexes,
548 .outputIndexes = outputIndexes,
549 .operandValues = operandValues,
550 .pools = pools,
551 };
552 }
553
is_ignored_dynamic_output_shape(int i)554 inline bool is_ignored_dynamic_output_shape(int i) {
555 static std::set<int> ignore = {0, 1, 2};
556 return ignore.find(i) != ignore.end();
557 }
558
559