• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define LOG_TAG "neuralnetworks_hidl_hal_test"
18 
19 #include "VtsHalNeuralnetworks.h"
20 
21 #include "Callbacks.h"
22 
23 namespace android {
24 namespace hardware {
25 namespace neuralnetworks {
26 namespace V1_1 {
27 
28 using V1_0::IPreparedModel;
29 using V1_0::Operand;
30 using V1_0::OperandLifeTime;
31 using V1_0::OperandType;
32 
33 namespace vts {
34 namespace functional {
35 
36 using ::android::hardware::neuralnetworks::V1_2::implementation::ExecutionCallback;
37 using ::android::hardware::neuralnetworks::V1_2::implementation::PreparedModelCallback;
38 
39 ///////////////////////// UTILITY FUNCTIONS /////////////////////////
40 
validateGetSupportedOperations(const sp<IDevice> & device,const std::string & message,const V1_1::Model & model)41 static void validateGetSupportedOperations(const sp<IDevice>& device, const std::string& message,
42                                            const V1_1::Model& model) {
43     SCOPED_TRACE(message + " [getSupportedOperations_1_1]");
44 
45     Return<void> ret =
46         device->getSupportedOperations_1_1(model, [&](ErrorStatus status, const hidl_vec<bool>&) {
47             EXPECT_EQ(ErrorStatus::INVALID_ARGUMENT, status);
48         });
49     EXPECT_TRUE(ret.isOk());
50 }
51 
validatePrepareModel(const sp<IDevice> & device,const std::string & message,const V1_1::Model & model,ExecutionPreference preference)52 static void validatePrepareModel(const sp<IDevice>& device, const std::string& message,
53                                  const V1_1::Model& model, ExecutionPreference preference) {
54     SCOPED_TRACE(message + " [prepareModel_1_1]");
55 
56     sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
57     ASSERT_NE(nullptr, preparedModelCallback.get());
58     Return<ErrorStatus> prepareLaunchStatus =
59         device->prepareModel_1_1(model, preference, preparedModelCallback);
60     ASSERT_TRUE(prepareLaunchStatus.isOk());
61     ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(prepareLaunchStatus));
62 
63     preparedModelCallback->wait();
64     ErrorStatus prepareReturnStatus = preparedModelCallback->getStatus();
65     ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, prepareReturnStatus);
66     sp<IPreparedModel> preparedModel = preparedModelCallback->getPreparedModel();
67     ASSERT_EQ(nullptr, preparedModel.get());
68 }
69 
validExecutionPreference(ExecutionPreference preference)70 static bool validExecutionPreference(ExecutionPreference preference) {
71     return preference == ExecutionPreference::LOW_POWER ||
72            preference == ExecutionPreference::FAST_SINGLE_ANSWER ||
73            preference == ExecutionPreference::SUSTAINED_SPEED;
74 }
75 
76 // Primary validation function. This function will take a valid model, apply a
77 // mutation to it to invalidate the model, then pass it to interface calls that
78 // use the model. Note that the model here is passed by value, and any mutation
79 // to the model does not leave this function.
validate(const sp<IDevice> & device,const std::string & message,V1_1::Model model,const std::function<void (Model *)> & mutation,ExecutionPreference preference=ExecutionPreference::FAST_SINGLE_ANSWER)80 static void validate(const sp<IDevice>& device, const std::string& message, V1_1::Model model,
81                      const std::function<void(Model*)>& mutation,
82                      ExecutionPreference preference = ExecutionPreference::FAST_SINGLE_ANSWER) {
83     mutation(&model);
84     if (validExecutionPreference(preference)) {
85         validateGetSupportedOperations(device, message, model);
86     }
87     validatePrepareModel(device, message, model, preference);
88 }
89 
90 // Delete element from hidl_vec. hidl_vec doesn't support a "remove" operation,
91 // so this is efficiently accomplished by moving the element to the end and
92 // resizing the hidl_vec to one less.
93 template <typename Type>
hidl_vec_removeAt(hidl_vec<Type> * vec,uint32_t index)94 static void hidl_vec_removeAt(hidl_vec<Type>* vec, uint32_t index) {
95     if (vec) {
96         std::rotate(vec->begin() + index, vec->begin() + index + 1, vec->end());
97         vec->resize(vec->size() - 1);
98     }
99 }
100 
101 template <typename Type>
hidl_vec_push_back(hidl_vec<Type> * vec,const Type & value)102 static uint32_t hidl_vec_push_back(hidl_vec<Type>* vec, const Type& value) {
103     // assume vec is valid
104     const uint32_t index = vec->size();
105     vec->resize(index + 1);
106     (*vec)[index] = value;
107     return index;
108 }
109 
addOperand(Model * model)110 static uint32_t addOperand(Model* model) {
111     return hidl_vec_push_back(&model->operands,
112                               {
113                                   .type = OperandType::INT32,
114                                   .dimensions = {},
115                                   .numberOfConsumers = 0,
116                                   .scale = 0.0f,
117                                   .zeroPoint = 0,
118                                   .lifetime = OperandLifeTime::MODEL_INPUT,
119                                   .location = {.poolIndex = 0, .offset = 0, .length = 0},
120                               });
121 }
122 
addOperand(Model * model,OperandLifeTime lifetime)123 static uint32_t addOperand(Model* model, OperandLifeTime lifetime) {
124     uint32_t index = addOperand(model);
125     model->operands[index].numberOfConsumers = 1;
126     model->operands[index].lifetime = lifetime;
127     return index;
128 }
129 
130 ///////////////////////// VALIDATE MODEL OPERAND TYPE /////////////////////////
131 
132 static const int32_t invalidOperandTypes[] = {
133     static_cast<int32_t>(OperandType::FLOAT32) - 1,              // lower bound fundamental
134     static_cast<int32_t>(OperandType::TENSOR_QUANT8_ASYMM) + 1,  // upper bound fundamental
135     static_cast<int32_t>(OperandType::OEM) - 1,                  // lower bound OEM
136     static_cast<int32_t>(OperandType::TENSOR_OEM_BYTE) + 1,      // upper bound OEM
137 };
138 
mutateOperandTypeTest(const sp<IDevice> & device,const V1_1::Model & model)139 static void mutateOperandTypeTest(const sp<IDevice>& device, const V1_1::Model& model) {
140     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
141         for (int32_t invalidOperandType : invalidOperandTypes) {
142             const std::string message = "mutateOperandTypeTest: operand " +
143                                         std::to_string(operand) + " set to value " +
144                                         std::to_string(invalidOperandType);
145             validate(device, message, model, [operand, invalidOperandType](Model* model) {
146                 model->operands[operand].type = static_cast<OperandType>(invalidOperandType);
147             });
148         }
149     }
150 }
151 
152 ///////////////////////// VALIDATE OPERAND RANK /////////////////////////
153 
getInvalidRank(OperandType type)154 static uint32_t getInvalidRank(OperandType type) {
155     switch (type) {
156         case OperandType::FLOAT32:
157         case OperandType::INT32:
158         case OperandType::UINT32:
159             return 1;
160         case OperandType::TENSOR_FLOAT32:
161         case OperandType::TENSOR_INT32:
162         case OperandType::TENSOR_QUANT8_ASYMM:
163             return 0;
164         default:
165             return 0;
166     }
167 }
168 
mutateOperandRankTest(const sp<IDevice> & device,const V1_1::Model & model)169 static void mutateOperandRankTest(const sp<IDevice>& device, const V1_1::Model& model) {
170     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
171         const uint32_t invalidRank = getInvalidRank(model.operands[operand].type);
172         const std::string message = "mutateOperandRankTest: operand " + std::to_string(operand) +
173                                     " has rank of " + std::to_string(invalidRank);
174         validate(device, message, model, [operand, invalidRank](Model* model) {
175             model->operands[operand].dimensions = std::vector<uint32_t>(invalidRank, 0);
176         });
177     }
178 }
179 
180 ///////////////////////// VALIDATE OPERAND SCALE /////////////////////////
181 
getInvalidScale(OperandType type)182 static float getInvalidScale(OperandType type) {
183     switch (type) {
184         case OperandType::FLOAT32:
185         case OperandType::INT32:
186         case OperandType::UINT32:
187         case OperandType::TENSOR_FLOAT32:
188             return 1.0f;
189         case OperandType::TENSOR_INT32:
190             return -1.0f;
191         case OperandType::TENSOR_QUANT8_ASYMM:
192             return 0.0f;
193         default:
194             return 0.0f;
195     }
196 }
197 
mutateOperandScaleTest(const sp<IDevice> & device,const V1_1::Model & model)198 static void mutateOperandScaleTest(const sp<IDevice>& device, const V1_1::Model& model) {
199     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
200         const float invalidScale = getInvalidScale(model.operands[operand].type);
201         const std::string message = "mutateOperandScaleTest: operand " + std::to_string(operand) +
202                                     " has scale of " + std::to_string(invalidScale);
203         validate(device, message, model, [operand, invalidScale](Model* model) {
204             model->operands[operand].scale = invalidScale;
205         });
206     }
207 }
208 
209 ///////////////////////// VALIDATE OPERAND ZERO POINT /////////////////////////
210 
getInvalidZeroPoints(OperandType type)211 static std::vector<int32_t> getInvalidZeroPoints(OperandType type) {
212     switch (type) {
213         case OperandType::FLOAT32:
214         case OperandType::INT32:
215         case OperandType::UINT32:
216         case OperandType::TENSOR_FLOAT32:
217         case OperandType::TENSOR_INT32:
218             return {1};
219         case OperandType::TENSOR_QUANT8_ASYMM:
220             return {-1, 256};
221         default:
222             return {};
223     }
224 }
225 
mutateOperandZeroPointTest(const sp<IDevice> & device,const V1_1::Model & model)226 static void mutateOperandZeroPointTest(const sp<IDevice>& device, const V1_1::Model& model) {
227     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
228         const std::vector<int32_t> invalidZeroPoints =
229             getInvalidZeroPoints(model.operands[operand].type);
230         for (int32_t invalidZeroPoint : invalidZeroPoints) {
231             const std::string message = "mutateOperandZeroPointTest: operand " +
232                                         std::to_string(operand) + " has zero point of " +
233                                         std::to_string(invalidZeroPoint);
234             validate(device, message, model, [operand, invalidZeroPoint](Model* model) {
235                 model->operands[operand].zeroPoint = invalidZeroPoint;
236             });
237         }
238     }
239 }
240 
241 ///////////////////////// VALIDATE EXTRA ??? /////////////////////////
242 
243 // TODO: Operand::lifetime
244 // TODO: Operand::location
245 
246 ///////////////////////// VALIDATE OPERATION OPERAND TYPE /////////////////////////
247 
mutateOperand(Operand * operand,OperandType type)248 static void mutateOperand(Operand* operand, OperandType type) {
249     Operand newOperand = *operand;
250     newOperand.type = type;
251     switch (type) {
252         case OperandType::FLOAT32:
253         case OperandType::INT32:
254         case OperandType::UINT32:
255             newOperand.dimensions = hidl_vec<uint32_t>();
256             newOperand.scale = 0.0f;
257             newOperand.zeroPoint = 0;
258             break;
259         case OperandType::TENSOR_FLOAT32:
260             newOperand.dimensions =
261                 operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
262             newOperand.scale = 0.0f;
263             newOperand.zeroPoint = 0;
264             break;
265         case OperandType::TENSOR_INT32:
266             newOperand.dimensions =
267                 operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
268             newOperand.zeroPoint = 0;
269             break;
270         case OperandType::TENSOR_QUANT8_ASYMM:
271             newOperand.dimensions =
272                 operand->dimensions.size() > 0 ? operand->dimensions : hidl_vec<uint32_t>({1});
273             newOperand.scale = operand->scale != 0.0f ? operand->scale : 1.0f;
274             break;
275         case OperandType::OEM:
276         case OperandType::TENSOR_OEM_BYTE:
277         default:
278             break;
279     }
280     *operand = newOperand;
281 }
282 
mutateOperationOperandTypeSkip(size_t operand,const V1_1::Model & model)283 static bool mutateOperationOperandTypeSkip(size_t operand, const V1_1::Model& model) {
284     // LSH_PROJECTION's second argument is allowed to have any type. This is the
285     // only operation that currently has a type that can be anything independent
286     // from any other type. Changing the operand type to any other type will
287     // result in a valid model for LSH_PROJECTION. If this is the case, skip the
288     // test.
289     for (const Operation& operation : model.operations) {
290         if (operation.type == OperationType::LSH_PROJECTION && operand == operation.inputs[1]) {
291             return true;
292         }
293     }
294     return false;
295 }
296 
mutateOperationOperandTypeTest(const sp<IDevice> & device,const V1_1::Model & model)297 static void mutateOperationOperandTypeTest(const sp<IDevice>& device, const V1_1::Model& model) {
298     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
299         if (mutateOperationOperandTypeSkip(operand, model)) {
300             continue;
301         }
302         for (OperandType invalidOperandType : hidl_enum_range<OperandType>{}) {
303             // Do not test OEM types
304             if (invalidOperandType == model.operands[operand].type ||
305                 invalidOperandType == OperandType::OEM ||
306                 invalidOperandType == OperandType::TENSOR_OEM_BYTE) {
307                 continue;
308             }
309             const std::string message = "mutateOperationOperandTypeTest: operand " +
310                                         std::to_string(operand) + " set to type " +
311                                         toString(invalidOperandType);
312             validate(device, message, model, [operand, invalidOperandType](Model* model) {
313                 mutateOperand(&model->operands[operand], invalidOperandType);
314             });
315         }
316     }
317 }
318 
319 ///////////////////////// VALIDATE MODEL OPERATION TYPE /////////////////////////
320 
321 static const int32_t invalidOperationTypes[] = {
322     static_cast<int32_t>(OperationType::ADD) - 1,            // lower bound fundamental
323     static_cast<int32_t>(OperationType::TRANSPOSE) + 1,      // upper bound fundamental
324     static_cast<int32_t>(OperationType::OEM_OPERATION) - 1,  // lower bound OEM
325     static_cast<int32_t>(OperationType::OEM_OPERATION) + 1,  // upper bound OEM
326 };
327 
mutateOperationTypeTest(const sp<IDevice> & device,const V1_1::Model & model)328 static void mutateOperationTypeTest(const sp<IDevice>& device, const V1_1::Model& model) {
329     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
330         for (int32_t invalidOperationType : invalidOperationTypes) {
331             const std::string message = "mutateOperationTypeTest: operation " +
332                                         std::to_string(operation) + " set to value " +
333                                         std::to_string(invalidOperationType);
334             validate(device, message, model, [operation, invalidOperationType](Model* model) {
335                 model->operations[operation].type =
336                     static_cast<OperationType>(invalidOperationType);
337             });
338         }
339     }
340 }
341 
342 ///////////////////////// VALIDATE MODEL OPERATION INPUT OPERAND INDEX /////////////////////////
343 
mutateOperationInputOperandIndexTest(const sp<IDevice> & device,const V1_1::Model & model)344 static void mutateOperationInputOperandIndexTest(const sp<IDevice>& device,
345                                                  const V1_1::Model& model) {
346     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
347         const uint32_t invalidOperand = model.operands.size();
348         for (size_t input = 0; input < model.operations[operation].inputs.size(); ++input) {
349             const std::string message = "mutateOperationInputOperandIndexTest: operation " +
350                                         std::to_string(operation) + " input " +
351                                         std::to_string(input);
352             validate(device, message, model, [operation, input, invalidOperand](Model* model) {
353                 model->operations[operation].inputs[input] = invalidOperand;
354             });
355         }
356     }
357 }
358 
359 ///////////////////////// VALIDATE MODEL OPERATION OUTPUT OPERAND INDEX /////////////////////////
360 
mutateOperationOutputOperandIndexTest(const sp<IDevice> & device,const V1_1::Model & model)361 static void mutateOperationOutputOperandIndexTest(const sp<IDevice>& device,
362                                                   const V1_1::Model& model) {
363     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
364         const uint32_t invalidOperand = model.operands.size();
365         for (size_t output = 0; output < model.operations[operation].outputs.size(); ++output) {
366             const std::string message = "mutateOperationOutputOperandIndexTest: operation " +
367                                         std::to_string(operation) + " output " +
368                                         std::to_string(output);
369             validate(device, message, model, [operation, output, invalidOperand](Model* model) {
370                 model->operations[operation].outputs[output] = invalidOperand;
371             });
372         }
373     }
374 }
375 
376 ///////////////////////// REMOVE OPERAND FROM EVERYTHING /////////////////////////
377 
removeValueAndDecrementGreaterValues(hidl_vec<uint32_t> * vec,uint32_t value)378 static void removeValueAndDecrementGreaterValues(hidl_vec<uint32_t>* vec, uint32_t value) {
379     if (vec) {
380         // remove elements matching "value"
381         auto last = std::remove(vec->begin(), vec->end(), value);
382         vec->resize(std::distance(vec->begin(), last));
383 
384         // decrement elements exceeding "value"
385         std::transform(vec->begin(), vec->end(), vec->begin(),
386                        [value](uint32_t v) { return v > value ? v-- : v; });
387     }
388 }
389 
removeOperand(Model * model,uint32_t index)390 static void removeOperand(Model* model, uint32_t index) {
391     hidl_vec_removeAt(&model->operands, index);
392     for (Operation& operation : model->operations) {
393         removeValueAndDecrementGreaterValues(&operation.inputs, index);
394         removeValueAndDecrementGreaterValues(&operation.outputs, index);
395     }
396     removeValueAndDecrementGreaterValues(&model->inputIndexes, index);
397     removeValueAndDecrementGreaterValues(&model->outputIndexes, index);
398 }
399 
removeOperandTest(const sp<IDevice> & device,const V1_1::Model & model)400 static void removeOperandTest(const sp<IDevice>& device, const V1_1::Model& model) {
401     for (size_t operand = 0; operand < model.operands.size(); ++operand) {
402         const std::string message = "removeOperandTest: operand " + std::to_string(operand);
403         validate(device, message, model,
404                  [operand](Model* model) { removeOperand(model, operand); });
405     }
406 }
407 
408 ///////////////////////// REMOVE OPERATION /////////////////////////
409 
removeOperation(Model * model,uint32_t index)410 static void removeOperation(Model* model, uint32_t index) {
411     for (uint32_t operand : model->operations[index].inputs) {
412         model->operands[operand].numberOfConsumers--;
413     }
414     hidl_vec_removeAt(&model->operations, index);
415 }
416 
removeOperationTest(const sp<IDevice> & device,const V1_1::Model & model)417 static void removeOperationTest(const sp<IDevice>& device, const V1_1::Model& model) {
418     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
419         const std::string message = "removeOperationTest: operation " + std::to_string(operation);
420         validate(device, message, model,
421                  [operation](Model* model) { removeOperation(model, operation); });
422     }
423 }
424 
425 ///////////////////////// REMOVE OPERATION INPUT /////////////////////////
426 
removeOperationInputTest(const sp<IDevice> & device,const V1_1::Model & model)427 static void removeOperationInputTest(const sp<IDevice>& device, const V1_1::Model& model) {
428     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
429         for (size_t input = 0; input < model.operations[operation].inputs.size(); ++input) {
430             const V1_1::Operation& op = model.operations[operation];
431             // CONCATENATION has at least 2 inputs, with the last element being
432             // INT32. Skip this test if removing one of CONCATENATION's
433             // inputs still produces a valid model.
434             if (op.type == V1_1::OperationType::CONCATENATION && op.inputs.size() > 2 &&
435                 input != op.inputs.size() - 1) {
436                 continue;
437             }
438             const std::string message = "removeOperationInputTest: operation " +
439                                         std::to_string(operation) + ", input " +
440                                         std::to_string(input);
441             validate(device, message, model, [operation, input](Model* model) {
442                 uint32_t operand = model->operations[operation].inputs[input];
443                 model->operands[operand].numberOfConsumers--;
444                 hidl_vec_removeAt(&model->operations[operation].inputs, input);
445             });
446         }
447     }
448 }
449 
450 ///////////////////////// REMOVE OPERATION OUTPUT /////////////////////////
451 
removeOperationOutputTest(const sp<IDevice> & device,const V1_1::Model & model)452 static void removeOperationOutputTest(const sp<IDevice>& device, const V1_1::Model& model) {
453     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
454         for (size_t output = 0; output < model.operations[operation].outputs.size(); ++output) {
455             const std::string message = "removeOperationOutputTest: operation " +
456                                         std::to_string(operation) + ", output " +
457                                         std::to_string(output);
458             validate(device, message, model, [operation, output](Model* model) {
459                 hidl_vec_removeAt(&model->operations[operation].outputs, output);
460             });
461         }
462     }
463 }
464 
465 ///////////////////////// MODEL VALIDATION /////////////////////////
466 
467 // TODO: remove model input
468 // TODO: remove model output
469 // TODO: add unused operation
470 
471 ///////////////////////// ADD OPERATION INPUT /////////////////////////
472 
addOperationInputTest(const sp<IDevice> & device,const V1_1::Model & model)473 static void addOperationInputTest(const sp<IDevice>& device, const V1_1::Model& model) {
474     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
475         const std::string message = "addOperationInputTest: operation " + std::to_string(operation);
476         validate(device, message, model, [operation](Model* model) {
477             uint32_t index = addOperand(model, OperandLifeTime::MODEL_INPUT);
478             hidl_vec_push_back(&model->operations[operation].inputs, index);
479             hidl_vec_push_back(&model->inputIndexes, index);
480         });
481     }
482 }
483 
484 ///////////////////////// ADD OPERATION OUTPUT /////////////////////////
485 
addOperationOutputTest(const sp<IDevice> & device,const V1_1::Model & model)486 static void addOperationOutputTest(const sp<IDevice>& device, const V1_1::Model& model) {
487     for (size_t operation = 0; operation < model.operations.size(); ++operation) {
488         const std::string message =
489             "addOperationOutputTest: operation " + std::to_string(operation);
490         validate(device, message, model, [operation](Model* model) {
491             uint32_t index = addOperand(model, OperandLifeTime::MODEL_OUTPUT);
492             hidl_vec_push_back(&model->operations[operation].outputs, index);
493             hidl_vec_push_back(&model->outputIndexes, index);
494         });
495     }
496 }
497 
498 ///////////////////////// VALIDATE EXECUTION PREFERENCE /////////////////////////
499 
500 static const int32_t invalidExecutionPreferences[] = {
501     static_cast<int32_t>(ExecutionPreference::LOW_POWER) - 1,        // lower bound
502     static_cast<int32_t>(ExecutionPreference::SUSTAINED_SPEED) + 1,  // upper bound
503 };
504 
mutateExecutionPreferenceTest(const sp<IDevice> & device,const V1_1::Model & model)505 static void mutateExecutionPreferenceTest(const sp<IDevice>& device, const V1_1::Model& model) {
506     for (int32_t preference : invalidExecutionPreferences) {
507         const std::string message =
508             "mutateExecutionPreferenceTest: preference " + std::to_string(preference);
509         validate(device, message, model, [](Model*) {},
510                  static_cast<ExecutionPreference>(preference));
511     }
512 }
513 
514 ////////////////////////// ENTRY POINT //////////////////////////////
515 
validateModel(const V1_1::Model & model)516 void ValidationTest::validateModel(const V1_1::Model& model) {
517     mutateOperandTypeTest(device, model);
518     mutateOperandRankTest(device, model);
519     mutateOperandScaleTest(device, model);
520     mutateOperandZeroPointTest(device, model);
521     mutateOperationOperandTypeTest(device, model);
522     mutateOperationTypeTest(device, model);
523     mutateOperationInputOperandIndexTest(device, model);
524     mutateOperationOutputOperandIndexTest(device, model);
525     removeOperandTest(device, model);
526     removeOperationTest(device, model);
527     removeOperationInputTest(device, model);
528     removeOperationOutputTest(device, model);
529     addOperationInputTest(device, model);
530     addOperationOutputTest(device, model);
531     mutateExecutionPreferenceTest(device, model);
532 }
533 
534 }  // namespace functional
535 }  // namespace vts
536 }  // namespace V1_1
537 }  // namespace neuralnetworks
538 }  // namespace hardware
539 }  // namespace android
540