1 // clang-format off
2 // Generated file (from: lstm_relaxed.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 .relaxComputationFloat32toFloat16 = true,
274 };
275 }
276
is_ignored(int i)277 inline bool is_ignored(int i) {
278 static std::set<int> ignore = {0};
279 return ignore.find(i) != ignore.end();
280 }
281
282 // Create the model
createTestModel_dynamic_output_shape()283 Model createTestModel_dynamic_output_shape() {
284 const std::vector<Operand> operands = {
285 {
286 .type = OperandType::TENSOR_FLOAT32,
287 .dimensions = {1, 2},
288 .numberOfConsumers = 1,
289 .scale = 0.0f,
290 .zeroPoint = 0,
291 .lifetime = OperandLifeTime::MODEL_INPUT,
292 .location = {.poolIndex = 0, .offset = 0, .length = 0},
293 },
294 {
295 .type = OperandType::TENSOR_FLOAT32,
296 .dimensions = {4, 2},
297 .numberOfConsumers = 1,
298 .scale = 0.0f,
299 .zeroPoint = 0,
300 .lifetime = OperandLifeTime::MODEL_INPUT,
301 .location = {.poolIndex = 0, .offset = 0, .length = 0},
302 },
303 {
304 .type = OperandType::TENSOR_FLOAT32,
305 .dimensions = {4, 2},
306 .numberOfConsumers = 1,
307 .scale = 0.0f,
308 .zeroPoint = 0,
309 .lifetime = OperandLifeTime::MODEL_INPUT,
310 .location = {.poolIndex = 0, .offset = 0, .length = 0},
311 },
312 {
313 .type = OperandType::TENSOR_FLOAT32,
314 .dimensions = {4, 2},
315 .numberOfConsumers = 1,
316 .scale = 0.0f,
317 .zeroPoint = 0,
318 .lifetime = OperandLifeTime::MODEL_INPUT,
319 .location = {.poolIndex = 0, .offset = 0, .length = 0},
320 },
321 {
322 .type = OperandType::TENSOR_FLOAT32,
323 .dimensions = {4, 2},
324 .numberOfConsumers = 1,
325 .scale = 0.0f,
326 .zeroPoint = 0,
327 .lifetime = OperandLifeTime::MODEL_INPUT,
328 .location = {.poolIndex = 0, .offset = 0, .length = 0},
329 },
330 {
331 .type = OperandType::TENSOR_FLOAT32,
332 .dimensions = {4, 4},
333 .numberOfConsumers = 1,
334 .scale = 0.0f,
335 .zeroPoint = 0,
336 .lifetime = OperandLifeTime::MODEL_INPUT,
337 .location = {.poolIndex = 0, .offset = 0, .length = 0},
338 },
339 {
340 .type = OperandType::TENSOR_FLOAT32,
341 .dimensions = {4, 4},
342 .numberOfConsumers = 1,
343 .scale = 0.0f,
344 .zeroPoint = 0,
345 .lifetime = OperandLifeTime::MODEL_INPUT,
346 .location = {.poolIndex = 0, .offset = 0, .length = 0},
347 },
348 {
349 .type = OperandType::TENSOR_FLOAT32,
350 .dimensions = {4, 4},
351 .numberOfConsumers = 1,
352 .scale = 0.0f,
353 .zeroPoint = 0,
354 .lifetime = OperandLifeTime::MODEL_INPUT,
355 .location = {.poolIndex = 0, .offset = 0, .length = 0},
356 },
357 {
358 .type = OperandType::TENSOR_FLOAT32,
359 .dimensions = {4, 4},
360 .numberOfConsumers = 1,
361 .scale = 0.0f,
362 .zeroPoint = 0,
363 .lifetime = OperandLifeTime::MODEL_INPUT,
364 .location = {.poolIndex = 0, .offset = 0, .length = 0},
365 },
366 {
367 .type = OperandType::TENSOR_FLOAT32,
368 .dimensions = {0},
369 .numberOfConsumers = 1,
370 .scale = 0.0f,
371 .zeroPoint = 0,
372 .lifetime = OperandLifeTime::MODEL_INPUT,
373 .location = {.poolIndex = 0, .offset = 0, .length = 0},
374 },
375 {
376 .type = OperandType::TENSOR_FLOAT32,
377 .dimensions = {0},
378 .numberOfConsumers = 1,
379 .scale = 0.0f,
380 .zeroPoint = 0,
381 .lifetime = OperandLifeTime::MODEL_INPUT,
382 .location = {.poolIndex = 0, .offset = 0, .length = 0},
383 },
384 {
385 .type = OperandType::TENSOR_FLOAT32,
386 .dimensions = {0},
387 .numberOfConsumers = 1,
388 .scale = 0.0f,
389 .zeroPoint = 0,
390 .lifetime = OperandLifeTime::MODEL_INPUT,
391 .location = {.poolIndex = 0, .offset = 0, .length = 0},
392 },
393 {
394 .type = OperandType::TENSOR_FLOAT32,
395 .dimensions = {4},
396 .numberOfConsumers = 1,
397 .scale = 0.0f,
398 .zeroPoint = 0,
399 .lifetime = OperandLifeTime::MODEL_INPUT,
400 .location = {.poolIndex = 0, .offset = 0, .length = 0},
401 },
402 {
403 .type = OperandType::TENSOR_FLOAT32,
404 .dimensions = {4},
405 .numberOfConsumers = 1,
406 .scale = 0.0f,
407 .zeroPoint = 0,
408 .lifetime = OperandLifeTime::MODEL_INPUT,
409 .location = {.poolIndex = 0, .offset = 0, .length = 0},
410 },
411 {
412 .type = OperandType::TENSOR_FLOAT32,
413 .dimensions = {4},
414 .numberOfConsumers = 1,
415 .scale = 0.0f,
416 .zeroPoint = 0,
417 .lifetime = OperandLifeTime::MODEL_INPUT,
418 .location = {.poolIndex = 0, .offset = 0, .length = 0},
419 },
420 {
421 .type = OperandType::TENSOR_FLOAT32,
422 .dimensions = {4},
423 .numberOfConsumers = 1,
424 .scale = 0.0f,
425 .zeroPoint = 0,
426 .lifetime = OperandLifeTime::MODEL_INPUT,
427 .location = {.poolIndex = 0, .offset = 0, .length = 0},
428 },
429 {
430 .type = OperandType::TENSOR_FLOAT32,
431 .dimensions = {0, 0},
432 .numberOfConsumers = 1,
433 .scale = 0.0f,
434 .zeroPoint = 0,
435 .lifetime = OperandLifeTime::MODEL_INPUT,
436 .location = {.poolIndex = 0, .offset = 0, .length = 0},
437 },
438 {
439 .type = OperandType::TENSOR_FLOAT32,
440 .dimensions = {0},
441 .numberOfConsumers = 1,
442 .scale = 0.0f,
443 .zeroPoint = 0,
444 .lifetime = OperandLifeTime::MODEL_INPUT,
445 .location = {.poolIndex = 0, .offset = 0, .length = 0},
446 },
447 {
448 .type = OperandType::TENSOR_FLOAT32,
449 .dimensions = {1, 4},
450 .numberOfConsumers = 1,
451 .scale = 0.0f,
452 .zeroPoint = 0,
453 .lifetime = OperandLifeTime::MODEL_INPUT,
454 .location = {.poolIndex = 0, .offset = 0, .length = 0},
455 },
456 {
457 .type = OperandType::TENSOR_FLOAT32,
458 .dimensions = {1, 4},
459 .numberOfConsumers = 1,
460 .scale = 0.0f,
461 .zeroPoint = 0,
462 .lifetime = OperandLifeTime::MODEL_INPUT,
463 .location = {.poolIndex = 0, .offset = 0, .length = 0},
464 },
465 {
466 .type = OperandType::INT32,
467 .dimensions = {},
468 .numberOfConsumers = 1,
469 .scale = 0.0f,
470 .zeroPoint = 0,
471 .lifetime = OperandLifeTime::CONSTANT_COPY,
472 .location = {.poolIndex = 0, .offset = 0, .length = 4},
473 },
474 {
475 .type = OperandType::FLOAT32,
476 .dimensions = {},
477 .numberOfConsumers = 1,
478 .scale = 0.0f,
479 .zeroPoint = 0,
480 .lifetime = OperandLifeTime::CONSTANT_COPY,
481 .location = {.poolIndex = 0, .offset = 4, .length = 4},
482 },
483 {
484 .type = OperandType::FLOAT32,
485 .dimensions = {},
486 .numberOfConsumers = 1,
487 .scale = 0.0f,
488 .zeroPoint = 0,
489 .lifetime = OperandLifeTime::CONSTANT_COPY,
490 .location = {.poolIndex = 0, .offset = 8, .length = 4},
491 },
492 {
493 .type = OperandType::TENSOR_FLOAT32,
494 .dimensions = {0, 0},
495 .numberOfConsumers = 0,
496 .scale = 0.0f,
497 .zeroPoint = 0,
498 .lifetime = OperandLifeTime::MODEL_OUTPUT,
499 .location = {.poolIndex = 0, .offset = 0, .length = 0},
500 },
501 {
502 .type = OperandType::TENSOR_FLOAT32,
503 .dimensions = {0, 0},
504 .numberOfConsumers = 0,
505 .scale = 0.0f,
506 .zeroPoint = 0,
507 .lifetime = OperandLifeTime::MODEL_OUTPUT,
508 .location = {.poolIndex = 0, .offset = 0, .length = 0},
509 },
510 {
511 .type = OperandType::TENSOR_FLOAT32,
512 .dimensions = {0, 0},
513 .numberOfConsumers = 0,
514 .scale = 0.0f,
515 .zeroPoint = 0,
516 .lifetime = OperandLifeTime::MODEL_OUTPUT,
517 .location = {.poolIndex = 0, .offset = 0, .length = 0},
518 },
519 {
520 .type = OperandType::TENSOR_FLOAT32,
521 .dimensions = {0, 0},
522 .numberOfConsumers = 0,
523 .scale = 0.0f,
524 .zeroPoint = 0,
525 .lifetime = OperandLifeTime::MODEL_OUTPUT,
526 .location = {.poolIndex = 0, .offset = 0, .length = 0},
527 }
528 };
529
530 const std::vector<Operation> operations = {
531 {
532 .type = OperationType::LSTM,
533 .inputs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
534 .outputs = {23, 24, 25, 26},
535 }
536 };
537
538 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};
539 const std::vector<uint32_t> outputIndexes = {23, 24, 25, 26};
540 std::vector<uint8_t> operandValues = {
541 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
542 };
543 const std::vector<hidl_memory> pools = {};
544
545 return {
546 .operands = operands,
547 .operations = operations,
548 .inputIndexes = inputIndexes,
549 .outputIndexes = outputIndexes,
550 .operandValues = operandValues,
551 .pools = pools,
552 .relaxComputationFloat32toFloat16 = true,
553 };
554 }
555
is_ignored_dynamic_output_shape(int i)556 inline bool is_ignored_dynamic_output_shape(int i) {
557 static std::set<int> ignore = {0};
558 return ignore.find(i) != ignore.end();
559 }
560
561