From ec1e5b8d0a0eeba7eae0f1fdb5e32c72f8a8093c Mon Sep 17 00:00:00 2001 From: Kevin May Date: Wed, 26 Feb 2020 17:00:39 +0000 Subject: IVGCVSW-4473 Android R pre Hal 1_3 build changes * Update ErrorStatus to V1_0::ErrorStatus * Update Request to V1_0::Request * Update OperandType to V1_2::OperandType * Add namespace android::nn::hal in ArmnnDriverImpl for R only * Add missing g_RelaxedFloat32toFloat16PerformancePowerUsageName * Add namespace V1_0 or V1_1 where necessary * Update Android.mk with R macro and android.hardware.neuralnetworks@1.3 * Remove androidnn.go * include IAllocator in DriverTestHelpers * Remove unused LOCAL_CFLAGS Signed-off-by: Kevin May Change-Id: I1787f1ed6784b3bbec017536d87d49197405e853 Signed-off-by: Kevin May --- test/GenericLayerTests.cpp | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'test/GenericLayerTests.cpp') diff --git a/test/GenericLayerTests.cpp b/test/GenericLayerTests.cpp index 3788e66a..961ab166 100644 --- a/test/GenericLayerTests.cpp +++ b/test/GenericLayerTests.cpp @@ -22,10 +22,10 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) { auto driver = std::make_unique(DriverOptions(armnn::Compute::CpuRef)); - ErrorStatus errorStatus; + V1_0::ErrorStatus errorStatus; std::vector supported; - auto cb = [&](ErrorStatus _errorStatus, const std::vector& _supported) + auto cb = [&](V1_0::ErrorStatus _errorStatus, const std::vector& _supported) { errorStatus = _errorStatus; supported = _supported; @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model0.operations[0].outputs = hidl_vec{4}; driver->getSupportedOperations(model0, cb); - BOOST_TEST((int)errorStatus == (int)ErrorStatus::NONE); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::NONE); BOOST_TEST(supported.size() == (size_t)1); BOOST_TEST(supported[0] == true); @@ -81,19 +81,8 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) driver->getSupportedOperations(model1, cb); -#if defined(ARMNN_ANDROID_P) || defined(ARMNN_ANDROID_Q) - // In Android P, android::nn::validateModel returns INVALID_ARGUMENT, because of the wrong number of inputs for the - // fully connected layer (1 instead of 4) - BOOST_TEST((int)errorStatus == (int)ErrorStatus::INVALID_ARGUMENT); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::INVALID_ARGUMENT); BOOST_TEST(supported.empty()); -#else - // In Android O, android::nn::validateModel indicates that the second (wrong) fully connected layer in unsupported - // in the vector of flags returned by the callback - BOOST_TEST((int)errorStatus == (int)ErrorStatus::NONE); - BOOST_TEST(supported.size() == (size_t)2); - BOOST_TEST(supported[0] == true); - BOOST_TEST(supported[1] == false); -#endif // Test Broadcast on add/mul operators HalPolicy::Model model2 = {}; @@ -115,7 +104,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model2.operations[1].outputs = hidl_vec{4}; driver->getSupportedOperations(model2, cb); - BOOST_TEST((int)errorStatus == (int)ErrorStatus::NONE); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::NONE); BOOST_TEST(supported.size() == (size_t)2); BOOST_TEST(supported[0] == true); BOOST_TEST(supported[1] == true); @@ -144,7 +133,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model3.operations[0].outputs = hidl_vec{3, 4}; driver->getSupportedOperations(model3, cb); - BOOST_TEST((int)errorStatus == (int)ErrorStatus::NONE); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::NONE); BOOST_TEST(supported.size() == (size_t)1); BOOST_TEST(supported[0] == false); @@ -159,7 +148,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model4.operations[0].outputs = hidl_vec{0}; driver->getSupportedOperations(model4, cb); - BOOST_TEST((int)errorStatus == (int)ErrorStatus::INVALID_ARGUMENT); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::INVALID_ARGUMENT); BOOST_TEST(supported.empty()); } @@ -170,10 +159,10 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure) { auto driver = std::make_unique(DriverOptions(armnn::Compute::CpuRef)); - ErrorStatus errorStatus; + V1_0::ErrorStatus errorStatus; std::vector supported; - auto cb = [&](ErrorStatus _errorStatus, const std::vector& _supported) + auto cb = [&](V1_0::ErrorStatus _errorStatus, const std::vector& _supported) { errorStatus = _errorStatus; supported = _supported; @@ -233,7 +222,7 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure) // We are testing that the unsupported layers return false and the test continues rather than failing and stopping driver->getSupportedOperations(model, cb); - BOOST_TEST((int)errorStatus == (int)ErrorStatus::NONE); + BOOST_TEST((int)errorStatus == (int)V1_0::ErrorStatus::NONE); BOOST_TEST(supported.size() == (size_t)3); BOOST_TEST(supported[0] == false); BOOST_TEST(supported[1] == true); @@ -246,10 +235,10 @@ BOOST_AUTO_TEST_CASE(ModelToINetworkConverterMemPoolFail) { auto driver = std::make_unique(DriverOptions(armnn::Compute::CpuRef)); - ErrorStatus errorStatus; + V1_0::ErrorStatus errorStatus; std::vector supported; - auto cb = [&](ErrorStatus _errorStatus, const std::vector& _supported) + auto cb = [&](V1_0::ErrorStatus _errorStatus, const std::vector& _supported) { errorStatus = _errorStatus; supported = _supported; @@ -261,7 +250,7 @@ BOOST_AUTO_TEST_CASE(ModelToINetworkConverterMemPoolFail) // Memory pool mapping should fail, we should report an error driver->getSupportedOperations(model, cb); - BOOST_TEST((int)errorStatus != (int)ErrorStatus::NONE); + BOOST_TEST((int)errorStatus != (int)V1_0::ErrorStatus::NONE); BOOST_TEST(supported.empty()); } -- cgit v1.2.1