From 88d44b893684be7a14776331c47e3408d29da109 Mon Sep 17 00:00:00 2001 From: Ruomei Yan Date: Thu, 23 May 2019 14:29:06 +0100 Subject: IVGCVSW-3074 Extend the DepthwiseConvolution2d workload to support QSymm16 Change-Id: I47bb0f782acfa5b2d2fee9132875f9a655ea635e Signed-off-by: Ruomei Yan --- src/backends/backendsCommon/WorkloadData.cpp | 18 ++++++++++++++++++ src/backends/backendsCommon/test/LayerTests.cpp | 20 ++++++++++++++++++++ src/backends/backendsCommon/test/LayerTests.hpp | 12 ++++++++++++ src/backends/reference/test/RefLayerTests.cpp | 3 +++ 4 files changed, 53 insertions(+) diff --git a/src/backends/backendsCommon/WorkloadData.cpp b/src/backends/backendsCommon/WorkloadData.cpp index a3470ad601..a1c74df17b 100644 --- a/src/backends/backendsCommon/WorkloadData.cpp +++ b/src/backends/backendsCommon/WorkloadData.cpp @@ -32,6 +32,8 @@ DataType GetBiasDataType(DataType inputDataType) return DataType::Float32; case DataType::QuantisedAsymm8: return DataType::Signed32; + case DataType::QuantisedSymm16: + return DataType::Signed32; default: BOOST_ASSERT_MSG(false, "Invalid input data type"); return DataType::Float32; @@ -693,6 +695,22 @@ void DepthwiseConvolution2dQueueDescriptor::Validate(const WorkloadInfo& workloa ValidateTensorQuantizationMultiplier(workloadInfo.m_InputTensorInfos[0], m_Weight->GetTensorInfo(), workloadInfo.m_OutputTensorInfos[0], "DepthwiseConvolution2dQueueDescriptor", "input", "weights", "output"); + + // Check the supported data types + std::vector supportedTypes = { + DataType::Float32, + DataType::QuantisedAsymm8, + DataType::QuantisedSymm16, + DataType::Float16 + }; + + ValidateDataTypes(workloadInfo.m_InputTensorInfos[0], + supportedTypes, + "DepthwiseConvolution2dQueueDescriptor"); + + ValidateDataTypes(workloadInfo.m_OutputTensorInfos[0], + {workloadInfo.m_InputTensorInfos[0].GetDataType()}, + "DepthwiseConvolution2dQueueDescriptor"); } void PermuteQueueDescriptor::Validate(const WorkloadInfo& workloadInfo) const diff --git a/src/backends/backendsCommon/test/LayerTests.cpp b/src/backends/backendsCommon/test/LayerTests.cpp index c94dc53291..cc6e8b3958 100644 --- a/src/backends/backendsCommon/test/LayerTests.cpp +++ b/src/backends/backendsCommon/test/LayerTests.cpp @@ -908,6 +908,26 @@ LayerTestResult SimpleDepthwiseConvolution2d3x3Dilation3x3NhwcTest( false); } +LayerTestResult DepthwiseConvolution2dInt16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + bool biasEnabled, + const armnn::DataLayout layout) +{ + return DepthwiseConvolution2dTestImpl( + workloadFactory, memoryManager, 0.5f, 50, biasEnabled, layout); +} + +LayerTestResult DepthwiseConvolution2dDepthMul1Int16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + bool biasEnabled, + const armnn::DataLayout layout) +{ + return DepthwiseConvolution2dDepthMul1TestImpl( + workloadFactory, memoryManager, 0.5f, 50, biasEnabled, layout); +} + LayerTestResult Convolution1dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, diff --git a/src/backends/backendsCommon/test/LayerTests.hpp b/src/backends/backendsCommon/test/LayerTests.hpp index efd8c3488e..26bab72807 100644 --- a/src/backends/backendsCommon/test/LayerTests.hpp +++ b/src/backends/backendsCommon/test/LayerTests.hpp @@ -956,6 +956,18 @@ LayerTestResult DepthwiseConvolution2dDepthMul1Uint8Test( bool biasEnabled, const armnn::DataLayout layout); +LayerTestResult DepthwiseConvolution2dInt16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + bool biasEnabled, + const armnn::DataLayout layout); + +LayerTestResult DepthwiseConvolution2dDepthMul1Int16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + bool biasEnabled, + const armnn::DataLayout layout); + LayerTestResult ConstantLinearActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index 62e05a9db3..b72c87b261 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -71,6 +71,7 @@ ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dUint8, DepthwiseConvolution2dUint8Test, false, armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dQSymm16, DepthwiseConvolution2dInt16Test, true, armnn::DataLayout::NCHW) // NHWC Depthwise Convolution ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dNhwc, DepthwiseConvolution2dTest, true, armnn::DataLayout::NHWC) @@ -89,6 +90,8 @@ ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1, DepthwiseConvolution2dDepthMul1Test, true, armnn::DataLayout::NCHW) ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1Uint8, DepthwiseConvolution2dDepthMul1Uint8Test, true, armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1Int16, + DepthwiseConvolution2dDepthMul1Int16Test, true, armnn::DataLayout::NCHW) ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1, DepthwiseConvolution2dDepthMul1Test, false, armnn::DataLayout::NCHW) -- cgit v1.2.1