1 /* 2 * Copyright (C) 2019 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 #ifndef VTS_HAL_NEURALNETWORKS_GENERATED_TEST_HARNESS_H 18 #define VTS_HAL_NEURALNETWORKS_GENERATED_TEST_HARNESS_H 19 20 #include "TestHarness.h" 21 22 #include <android/hardware/neuralnetworks/1.0/IDevice.h> 23 #include <android/hardware/neuralnetworks/1.1/IDevice.h> 24 #include <android/hardware/neuralnetworks/1.2/IDevice.h> 25 26 namespace android { 27 namespace hardware { 28 namespace neuralnetworks { 29 30 namespace generated_tests { 31 using ::test_helper::MixedTypedExample; 32 33 void PrepareModel(const sp<V1_2::IDevice>& device, const V1_2::Model& model, 34 sp<V1_2::IPreparedModel>* preparedModel); 35 36 void EvaluatePreparedModel(sp<V1_2::IPreparedModel>& preparedModel, 37 std::function<bool(int)> is_ignored, 38 const std::vector<MixedTypedExample>& examples, 39 bool hasRelaxedFloat32Model, bool testDynamicOutputShape); 40 41 void Execute(const sp<V1_0::IDevice>& device, std::function<V1_0::Model(void)> create_model, 42 std::function<bool(int)> is_ignored, const std::vector<MixedTypedExample>& examples); 43 44 void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> create_model, 45 std::function<bool(int)> is_ignored, const std::vector<MixedTypedExample>& examples); 46 47 void Execute(const sp<V1_2::IDevice>& device, std::function<V1_2::Model(void)> create_model, 48 std::function<bool(int)> is_ignored, const std::vector<MixedTypedExample>& examples, 49 bool testDynamicOutputShape = false); 50 51 } // namespace generated_tests 52 53 } // namespace neuralnetworks 54 } // namespace hardware 55 } // namespace android 56 57 #endif // VTS_HAL_NEURALNETWORKS_GENERATED_TEST_HARNESS_H 58