Loading neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace aidl::android::hardware::neuralnetworks::utils { constexpr auto kDefaultPriority = Priority::MEDIUM; constexpr auto kVersion = nn::Version::ANDROID_S; constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6; template <typename Type> nn::Result<void> validate(const Type& halObject) { Loading neuralnetworks/aidl/vts/functional/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ cc_test { "neuralnetworks_utils_hal_aidl", ], whole_static_libs: [ "neuralnetworks_generated_AIDL_V2_example", "neuralnetworks_generated_V1_0_example", "neuralnetworks_generated_V1_1_example", "neuralnetworks_generated_V1_2_example", Loading neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,20 @@ void GeneratedTestBase::SetUp() { const bool deviceIsResponsive = ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk(); ASSERT_TRUE(deviceIsResponsive); // TODO(b/201260787): We should require old drivers to report the model as // unsupported instead of simply skipping the test. SkipIfDriverOlderThanTestModel(); } void GeneratedTestBase::SkipIfDriverOlderThanTestModel() { int32_t deviceVersion; ASSERT_TRUE(kDevice->getInterfaceVersion(&deviceVersion).isOk()); const int32_t modelVersion = kTestModel.getAidlVersionInt(); if (deviceVersion < modelVersion) { GTEST_SKIP() << "Device interface version " << deviceVersion << " is older than test model's minimum supported HAL version " << modelVersion << ". Skipping test."; } } std::vector<NamedModel> getNamedModels(const FilterFn& filter) { Loading neuralnetworks/aidl/vts/functional/GeneratedTestHarness.h +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ class GeneratedTestBase : public testing::TestWithParam<GeneratedTestParam> { void SetUp() override; const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam())); const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam())); private: void SkipIfDriverOlderThanTestModel(); }; using FilterFn = std::function<bool(const test_helper::TestModel&)>; Loading neuralnetworks/aidl/vts/functional/ValidateModel.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) { // align_corners and half_pixel_centers parameters. // - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis // parameter. // - PACK has at least 2 inputs, with the first element being INT32. switch (op.type) { case OperationType::CONCATENATION: { if (op.inputs.size() > 2 && input != op.inputs.size() - 1) { Loading Loading @@ -1178,6 +1179,11 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) { return true; } } break; case OperationType::PACK: { if (op.inputs.size() > 2 && input != 0) { return true; } } break; default: break; } Loading Loading
neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace aidl::android::hardware::neuralnetworks::utils { constexpr auto kDefaultPriority = Priority::MEDIUM; constexpr auto kVersion = nn::Version::ANDROID_S; constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6; template <typename Type> nn::Result<void> validate(const Type& halObject) { Loading
neuralnetworks/aidl/vts/functional/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ cc_test { "neuralnetworks_utils_hal_aidl", ], whole_static_libs: [ "neuralnetworks_generated_AIDL_V2_example", "neuralnetworks_generated_V1_0_example", "neuralnetworks_generated_V1_1_example", "neuralnetworks_generated_V1_2_example", Loading
neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,20 @@ void GeneratedTestBase::SetUp() { const bool deviceIsResponsive = ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk(); ASSERT_TRUE(deviceIsResponsive); // TODO(b/201260787): We should require old drivers to report the model as // unsupported instead of simply skipping the test. SkipIfDriverOlderThanTestModel(); } void GeneratedTestBase::SkipIfDriverOlderThanTestModel() { int32_t deviceVersion; ASSERT_TRUE(kDevice->getInterfaceVersion(&deviceVersion).isOk()); const int32_t modelVersion = kTestModel.getAidlVersionInt(); if (deviceVersion < modelVersion) { GTEST_SKIP() << "Device interface version " << deviceVersion << " is older than test model's minimum supported HAL version " << modelVersion << ". Skipping test."; } } std::vector<NamedModel> getNamedModels(const FilterFn& filter) { Loading
neuralnetworks/aidl/vts/functional/GeneratedTestHarness.h +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ class GeneratedTestBase : public testing::TestWithParam<GeneratedTestParam> { void SetUp() override; const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam())); const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam())); private: void SkipIfDriverOlderThanTestModel(); }; using FilterFn = std::function<bool(const test_helper::TestModel&)>; Loading
neuralnetworks/aidl/vts/functional/ValidateModel.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) { // align_corners and half_pixel_centers parameters. // - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis // parameter. // - PACK has at least 2 inputs, with the first element being INT32. switch (op.type) { case OperationType::CONCATENATION: { if (op.inputs.size() > 2 && input != op.inputs.size() - 1) { Loading Loading @@ -1178,6 +1179,11 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) { return true; } } break; case OperationType::PACK: { if (op.inputs.size() > 2 && input != 0) { return true; } } break; default: break; } Loading