From 225fb41627cdfa7f81406e22527531af1aeddcda Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Fri, 20 Nov 2020 11:59:40 +0000 Subject: IVGCVSW-5550 Fix failing delegate Conv2d tests for CpuAcc/GpuAcc Signed-off-by: Jan Eilers Change-Id: Ibfd1968a622c2538bbfacf4802cd45096de59db5 --- delegate/src/test/Convolution2dTest.cpp | 60 ++++++----------------------- delegate/src/test/ConvolutionTestHelper.hpp | 2 +- 2 files changed, 13 insertions(+), 49 deletions(-) diff --git a/delegate/src/test/Convolution2dTest.cpp b/delegate/src/test/Convolution2dTest.cpp index f8ee7b1efd..6c50f8d3e4 100644 --- a/delegate/src/test/Convolution2dTest.cpp +++ b/delegate/src/test/Convolution2dTest.cpp @@ -73,7 +73,7 @@ void Conv2DWithBiasesFp32Test(std::vector& backends) biasValues); } -void Conv2DWithBiasesUint8Test(std::vector& backends) +void Conv2DWithBiasesInt8Test(std::vector& backends) { // Set input data std::vector inputShape { 1, 2, 2, 1 }; @@ -81,13 +81,13 @@ void Conv2DWithBiasesUint8Test(std::vector& backends) std::vector biasShape { 1 }; std::vector outputShape { 1, 2, 2, 1 }; - static std::vector inputValues = { 1, 2, 3, 4 }; + static std::vector inputValues = { 1, 2, 3, 4 }; - std::vector filterValues = { 2, 1, 0, 6 }; + std::vector filterValues = { 2, 1, 0, 6 }; std::vector biasValues = { 10 }; - std::vector expectedOutputValues = + std::vector expectedOutputValues = { (1 * 2 + 2 * 1 + 3 * 0 + 4 * 6 + 10) / 2, // 19 (2 * 2 + 0 * 1 + 4 * 0 + 0 * 6 + 10) / 2, // 7 @@ -97,8 +97,8 @@ void Conv2DWithBiasesUint8Test(std::vector& backends) tflite::Padding padding = tflite::Padding_SAME; - ConvolutionTest(tflite::BuiltinOperator_CONV_2D, - ::tflite::TensorType_UINT8, + ConvolutionTest(tflite::BuiltinOperator_CONV_2D, + ::tflite::TensorType_INT8, 1, // strideX 1, // strideY 1, // dilationX @@ -229,22 +229,10 @@ TEST_CASE ("Conv2DWithBiases_Fp32_CpuRef_Test") Conv2DWithBiasesFp32Test(backends); } -TEST_CASE ("Conv2DWithBiases_Uint8_CpuRef_Test") +TEST_CASE ("Conv2DWithBiases_Int8_CpuRef_Test") { std::vector backends = {armnn::Compute::CpuRef}; - Conv2DWithBiasesUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu_Uint8_CpuRef_Test") -{ - std::vector backends = {armnn::Compute::CpuRef}; - Conv2DWithBiasesReluUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu6_Uint8_CpuRef_Test") -{ - std::vector backends = {armnn::Compute::CpuRef}; - Conv2DWithBiasesRelu6Uint8Test(backends); + Conv2DWithBiasesInt8Test(backends); } } //End of TEST_SUITE("Convolution2dTest_CpuRef") @@ -258,22 +246,10 @@ std::vector backends = {armnn::Compute::CpuAcc}; Conv2DWithBiasesFp32Test(backends); } -TEST_CASE ("Conv2DWithBiases_Uint8_CpuAcc_Test") +TEST_CASE ("Conv2DWithBiases_Int8_CpuAcc_Test") { std::vector backends = {armnn::Compute::CpuAcc}; -Conv2DWithBiasesUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu_Uint8_CpuAcc_Test") -{ -std::vector backends = {armnn::Compute::CpuAcc}; -Conv2DWithBiasesReluUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu6Uint8_CpuAcc_Test") -{ -std::vector backends = {armnn::Compute::CpuAcc}; -Conv2DWithBiasesRelu6Uint8Test(backends); +Conv2DWithBiasesInt8Test(backends); } } //End of TEST_SUITE("Convolution2dTest_CpuAcc") @@ -287,22 +263,10 @@ std::vector backends = {armnn::Compute::GpuAcc}; Conv2DWithBiasesFp32Test(backends); } -TEST_CASE ("Conv2DWithBiases_Uint8_GpuAcc_Test") -{ -std::vector backends = {armnn::Compute::GpuAcc}; -Conv2DWithBiasesUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu_Uint8_GpuAcc_Test") -{ -std::vector backends = {armnn::Compute::GpuAcc}; -Conv2DWithBiasesReluUint8Test(backends); -} - -TEST_CASE ("Conv2DWithBiases_Relu_Uint8_GpuAcc_Test") +TEST_CASE ("Conv2DWithBiases_Int8_GpuAcc_Test") { std::vector backends = {armnn::Compute::GpuAcc}; -Conv2DWithBiasesRelu6Uint8Test(backends); +Conv2DWithBiasesInt8Test(backends); } } //End of TEST_SUITE("Convolution2dTest_GpuAcc") diff --git a/delegate/src/test/ConvolutionTestHelper.hpp b/delegate/src/test/ConvolutionTestHelper.hpp index b7705cc904..b3175174d2 100644 --- a/delegate/src/test/ConvolutionTestHelper.hpp +++ b/delegate/src/test/ConvolutionTestHelper.hpp @@ -91,7 +91,7 @@ std::vector CreateConv2dTfLiteModel(tflite::BuiltinOperator convolutionOpe filterQuantizationParameters); auto biasTensorType = ::tflite::TensorType_FLOAT32; - if (tensorType == ::tflite::TensorType_UINT8) + if (tensorType == ::tflite::TensorType_INT8 || tensorType == ::tflite::TensorType_UINT8) { biasTensorType = ::tflite::TensorType_INT32; } -- cgit v1.2.1