• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: svdf.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 = {2, 3},
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, 3},
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, 10},
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},
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 = {2, 40},
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::INT32,
53             .dimensions = {},
54             .numberOfConsumers = 1,
55             .scale = 0.0f,
56             .zeroPoint = 0,
57             .lifetime = OperandLifeTime::CONSTANT_COPY,
58             .location = {.poolIndex = 0, .offset = 0, .length = 4},
59         },
60         {
61             .type = OperandType::INT32,
62             .dimensions = {},
63             .numberOfConsumers = 1,
64             .scale = 0.0f,
65             .zeroPoint = 0,
66             .lifetime = OperandLifeTime::CONSTANT_COPY,
67             .location = {.poolIndex = 0, .offset = 4, .length = 4},
68         },
69         {
70             .type = OperandType::TENSOR_FLOAT32,
71             .dimensions = {2, 40},
72             .numberOfConsumers = 0,
73             .scale = 0.0f,
74             .zeroPoint = 0,
75             .lifetime = OperandLifeTime::MODEL_OUTPUT,
76             .location = {.poolIndex = 0, .offset = 0, .length = 0},
77         },
78         {
79             .type = OperandType::TENSOR_FLOAT32,
80             .dimensions = {2, 4},
81             .numberOfConsumers = 0,
82             .scale = 0.0f,
83             .zeroPoint = 0,
84             .lifetime = OperandLifeTime::MODEL_OUTPUT,
85             .location = {.poolIndex = 0, .offset = 0, .length = 0},
86         }
87     };
88 
89     const std::vector<Operation> operations = {
90         {
91             .type = OperationType::SVDF,
92             .inputs = {0, 1, 2, 3, 4, 5, 6},
93             .outputs = {7, 8},
94         }
95     };
96 
97     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4};
98     const std::vector<uint32_t> outputIndexes = {7, 8};
99     std::vector<uint8_t> operandValues = {
100       1, 0, 0, 0, 0, 0, 0, 0
101     };
102     const std::vector<hidl_memory> pools = {};
103 
104     return {
105         .operands = operands,
106         .operations = operations,
107         .inputIndexes = inputIndexes,
108         .outputIndexes = outputIndexes,
109         .operandValues = operandValues,
110         .pools = pools,
111     };
112 }
113 
is_ignored(int i)114 inline bool is_ignored(int i) {
115   static std::set<int> ignore = {0};
116   return ignore.find(i) != ignore.end();
117 }
118 
119 // Create the model
createTestModel_dynamic_output_shape()120 Model createTestModel_dynamic_output_shape() {
121     const std::vector<Operand> operands = {
122         {
123             .type = OperandType::TENSOR_FLOAT32,
124             .dimensions = {2, 3},
125             .numberOfConsumers = 1,
126             .scale = 0.0f,
127             .zeroPoint = 0,
128             .lifetime = OperandLifeTime::MODEL_INPUT,
129             .location = {.poolIndex = 0, .offset = 0, .length = 0},
130         },
131         {
132             .type = OperandType::TENSOR_FLOAT32,
133             .dimensions = {4, 3},
134             .numberOfConsumers = 1,
135             .scale = 0.0f,
136             .zeroPoint = 0,
137             .lifetime = OperandLifeTime::MODEL_INPUT,
138             .location = {.poolIndex = 0, .offset = 0, .length = 0},
139         },
140         {
141             .type = OperandType::TENSOR_FLOAT32,
142             .dimensions = {4, 10},
143             .numberOfConsumers = 1,
144             .scale = 0.0f,
145             .zeroPoint = 0,
146             .lifetime = OperandLifeTime::MODEL_INPUT,
147             .location = {.poolIndex = 0, .offset = 0, .length = 0},
148         },
149         {
150             .type = OperandType::TENSOR_FLOAT32,
151             .dimensions = {4},
152             .numberOfConsumers = 1,
153             .scale = 0.0f,
154             .zeroPoint = 0,
155             .lifetime = OperandLifeTime::MODEL_INPUT,
156             .location = {.poolIndex = 0, .offset = 0, .length = 0},
157         },
158         {
159             .type = OperandType::TENSOR_FLOAT32,
160             .dimensions = {2, 40},
161             .numberOfConsumers = 1,
162             .scale = 0.0f,
163             .zeroPoint = 0,
164             .lifetime = OperandLifeTime::MODEL_INPUT,
165             .location = {.poolIndex = 0, .offset = 0, .length = 0},
166         },
167         {
168             .type = OperandType::INT32,
169             .dimensions = {},
170             .numberOfConsumers = 1,
171             .scale = 0.0f,
172             .zeroPoint = 0,
173             .lifetime = OperandLifeTime::CONSTANT_COPY,
174             .location = {.poolIndex = 0, .offset = 0, .length = 4},
175         },
176         {
177             .type = OperandType::INT32,
178             .dimensions = {},
179             .numberOfConsumers = 1,
180             .scale = 0.0f,
181             .zeroPoint = 0,
182             .lifetime = OperandLifeTime::CONSTANT_COPY,
183             .location = {.poolIndex = 0, .offset = 4, .length = 4},
184         },
185         {
186             .type = OperandType::TENSOR_FLOAT32,
187             .dimensions = {0, 0},
188             .numberOfConsumers = 0,
189             .scale = 0.0f,
190             .zeroPoint = 0,
191             .lifetime = OperandLifeTime::MODEL_OUTPUT,
192             .location = {.poolIndex = 0, .offset = 0, .length = 0},
193         },
194         {
195             .type = OperandType::TENSOR_FLOAT32,
196             .dimensions = {0, 0},
197             .numberOfConsumers = 0,
198             .scale = 0.0f,
199             .zeroPoint = 0,
200             .lifetime = OperandLifeTime::MODEL_OUTPUT,
201             .location = {.poolIndex = 0, .offset = 0, .length = 0},
202         }
203     };
204 
205     const std::vector<Operation> operations = {
206         {
207             .type = OperationType::SVDF,
208             .inputs = {0, 1, 2, 3, 4, 5, 6},
209             .outputs = {7, 8},
210         }
211     };
212 
213     const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4};
214     const std::vector<uint32_t> outputIndexes = {7, 8};
215     std::vector<uint8_t> operandValues = {
216       1, 0, 0, 0, 0, 0, 0, 0
217     };
218     const std::vector<hidl_memory> pools = {};
219 
220     return {
221         .operands = operands,
222         .operations = operations,
223         .inputIndexes = inputIndexes,
224         .outputIndexes = outputIndexes,
225         .operandValues = operandValues,
226         .pools = pools,
227     };
228 }
229 
is_ignored_dynamic_output_shape(int i)230 inline bool is_ignored_dynamic_output_shape(int i) {
231   static std::set<int> ignore = {0};
232   return ignore.find(i) != ignore.end();
233 }
234 
235