From 9b3983299f882c8d84c5abd0d40ca75a801ea7f2 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Wed, 22 May 2019 17:21:49 +0100 Subject: IVGCVSW-3025: Refactor reference Convolution2d workload * Refactored RefConvolution2dWorkload to support all DataTypes through Encoders and Decoders. * Added Convolute function to ConvImpl that uses Encoders and Decoders to support all DataTypes. * Deleted RefConvolution2dFloat32Workload and RefConvolution2dUint8Workload. Signed-off-by: Mike Kelly Signed-off-by: Teresa Charlin Change-Id: Ic5ef0f499d08b948fa65fdee54b5f681fd0b1c05 --- src/backends/backendsCommon/test/Conv2dTestImpl.hpp | 1 + src/backends/backendsCommon/test/LayerTests.cpp | 18 +++++++++--------- src/backends/backendsCommon/test/WorkloadTestUtils.hpp | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src/backends/backendsCommon') diff --git a/src/backends/backendsCommon/test/Conv2dTestImpl.hpp b/src/backends/backendsCommon/test/Conv2dTestImpl.hpp index bb5656bd01..0533c77d53 100644 --- a/src/backends/backendsCommon/test/Conv2dTestImpl.hpp +++ b/src/backends/backendsCommon/test/Conv2dTestImpl.hpp @@ -1125,6 +1125,7 @@ LayerTestResult CompareConvolution2dTestImpl( ExecuteWorkload(*workload, memoryManager); + workloadRef->PostAllocationConfigure(); workloadRef->Execute(); CopyDataFromITensorHandle(&ret.output[0][0][0][0], outputHandle.get()); diff --git a/src/backends/backendsCommon/test/LayerTests.cpp b/src/backends/backendsCommon/test/LayerTests.cpp index 5d059598a5..c94dc53291 100644 --- a/src/backends/backendsCommon/test/LayerTests.cpp +++ b/src/backends/backendsCommon/test/LayerTests.cpp @@ -79,12 +79,12 @@ static std::vector Bias2({0, 2}); // Helper function that returns either Bias2 or an empty vector depending on whether bias is enabled. template> -boost::multi_array GetBias2(bool biasEnabled, float qScale, int32_t qOffset) +boost::multi_array GetBias2(bool biasEnabled, float qScale) { if(biasEnabled) { armnn::TensorInfo biasDesc({static_cast(Bias2.size())}, ArmnnType); - boost::multi_array bias = MakeTensor(biasDesc, QuantizedVector(qScale, qOffset, Bias2)); + boost::multi_array bias = MakeTensor(biasDesc, QuantizedVector(qScale, 0.0f, Bias2)); return bias; } else @@ -170,7 +170,7 @@ LayerTestResult SimpleConvolution2d3x5TestCommon( memoryManager, input, kernel, - GetBias2(biasEnabled, qScale, qOffset), + GetBias2(biasEnabled, qScale * qScale), expectedOutput, qScale, qOffset, @@ -247,7 +247,7 @@ LayerTestResult SimpleConvolution2d3x3TestCommon( memoryManager, input, kernel, - GetBias2(biasEnabled, qScale, qOffset), + GetBias2(biasEnabled, qScale * qScale), expectedOutput, qScale, qOffset, @@ -494,7 +494,7 @@ LayerTestResult Convolution2dAsymmetricPaddingLargerThanHalfKernelSizeTest memoryManager, input, kernel, - GetBias2(false, qScale, qOffset), + GetBias2(false, qScale * qScale), expectedOutput, qScale, qOffset, @@ -552,7 +552,7 @@ LayerTestResult SimpleConvolution2dAsymmetricPaddingTestCommon( memoryManager, input, kernel, - GetBias2(false, qScale, qOffset), + GetBias2(false, qScale * qScale), expectedOutput, qScale, qOffset, @@ -627,7 +627,7 @@ LayerTestResult DepthwiseConvolution2dAsymmetricTestCommon( memoryManager, input, kernel, - GetBias2(biasEnabled, qScale, qOffset), + GetBias2(biasEnabled, qScale * qScale), expectedOutput, qScale, qOffset, @@ -736,7 +736,7 @@ LayerTestResult DepthwiseConvolution2dNhwcTestCommon( memoryManager, input, kernel, - GetBias2(biasEnabled, qScale, qOffset), + GetBias2(biasEnabled, qScale * qScale), expectedOutput, qScale, qOffset, @@ -802,7 +802,7 @@ LayerTestResult SimpleDepthwiseConvolution2d3x3Dilation3x3NhwcTestCommon( memoryManager, input, kernel, - GetBias2(biasEnabled, qScale, qOffset), + GetBias2(biasEnabled, qScale * qScale), expectedOutput, qScale, qOffset, diff --git a/src/backends/backendsCommon/test/WorkloadTestUtils.hpp b/src/backends/backendsCommon/test/WorkloadTestUtils.hpp index d03c5a9210..212fea34a6 100644 --- a/src/backends/backendsCommon/test/WorkloadTestUtils.hpp +++ b/src/backends/backendsCommon/test/WorkloadTestUtils.hpp @@ -73,6 +73,9 @@ inline void ExecuteWorkload(armnn::IWorkload& workload, memoryManager->Acquire(); } + // Perform PostAllocationConfiguration + workload.PostAllocationConfigure(); + // Execute the workload workload.Execute(); -- cgit v1.2.1