From 4b961d36bc80e2f302362011af92649635cbfbc5 Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 11 Jul 2019 09:19:35 +0100 Subject: [PATCH] IVGCVSW-3298 Add CL backend support for dilated Convolution2d * Update ClConvolution2dWorkload * Enable unit tests Change-Id: Id07bae220a35a0cadcacebe615f156622ae5f196 Signed-off-by: Jan Eilers --- src/backends/cl/test/ClLayerTests.cpp | 55 ++++++++++++++++++++++ .../cl/workloads/ClConvolution2dWorkload.cpp | 14 +++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/backends/cl/test/ClLayerTests.cpp b/src/backends/cl/test/ClLayerTests.cpp index 7d72e17..c786244 100644 --- a/src/backends/cl/test/ClLayerTests.cpp +++ b/src/backends/cl/test/ClLayerTests.cpp @@ -90,6 +90,61 @@ ARMNN_AUTO_TEST_CASE(SimpleConvolution2dAsymmetricPaddingNhwc, ARMNN_AUTO_TEST_CASE(SimpleConvolution2dSquareNhwc, SimpleConvolution2d3x3NhwcTest, false) +ARMNN_AUTO_TEST_CASE(Convolution2d3x3Dilation3x3, + Convolution2d3x3Dilation3x3Test, + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d3x3Dilation3x3Nhwc, + Convolution2d3x3Dilation3x3Test, + false, + armnn::DataLayout::NHWC) +ARMNN_AUTO_TEST_CASE(Convolution2d3x3Dilation3x3Uint8, + Convolution2d3x3Dilation3x3Test, + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d3x3Dilation3x3NhwcUint8, + Convolution2d3x3Dilation3x3Test, + false, + armnn::DataLayout::NHWC) + +ARMNN_AUTO_TEST_CASE(Convolution2d2x3x3Dilation3x3, + Convolution2d2x3x3Dilation3x3Test, + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d2x3x3Dilation3x3Nhwc, + Convolution2d2x3x3Dilation3x3Test, + false, + armnn::DataLayout::NHWC) +ARMNN_AUTO_TEST_CASE(Convolution2d2x3x3Dilation3x3Uint8, + Convolution2d2x3x3Dilation3x3Test, + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d2x3x3Dilation3x3NhwcUint8, + Convolution2d2x3x3Dilation3x3Test, + false, + armnn::DataLayout::NHWC) + +ARMNN_AUTO_TEST_CASE(Convolution2d2x2Dilation2x2Padding1x1, + Convolution2d2x2Dilation2x2Padding2x2Stride3x3Test + , + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d2x2Dilation2x2Padding1x1TestNhwc, + Convolution2d2x2Dilation2x2Padding2x2Stride3x3Test + , + false, + armnn::DataLayout::NHWC) +ARMNN_AUTO_TEST_CASE(Convolution2d2x2Dilation2x2Padding1x1TestUint8, + Convolution2d2x2Dilation2x2Padding2x2Stride3x3Test + , + false, + armnn::DataLayout::NCHW) +ARMNN_AUTO_TEST_CASE(Convolution2d2x2Dilation2x2Padding1x1TestNhwcUint8, + Convolution2d2x2Dilation2x2Padding2x2Stride3x3Test + , + false, + armnn::DataLayout::NHWC) + // Depthwise Convolution ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1, DepthwiseConvolution2dDepthMul1Test, true, armnn::DataLayout::NCHW) diff --git a/src/backends/cl/workloads/ClConvolution2dWorkload.cpp b/src/backends/cl/workloads/ClConvolution2dWorkload.cpp index f3810cf..3b6aa6c 100644 --- a/src/backends/cl/workloads/ClConvolution2dWorkload.cpp +++ b/src/backends/cl/workloads/ClConvolution2dWorkload.cpp @@ -30,6 +30,9 @@ arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo& input, const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output, descriptor.m_DataLayout); const arm_compute::TensorInfo aclWeightsInfo = BuildArmComputeTensorInfo(weights, descriptor.m_DataLayout); + const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(descriptor.m_DilationX, + descriptor.m_DilationY); + arm_compute::TensorInfo aclBiasesInfo; arm_compute::TensorInfo *optionalAclBiasesInfo = nullptr; @@ -47,7 +50,9 @@ arm_compute::Status ClConvolution2dWorkloadValidate(const TensorInfo& input, &aclWeightsInfo, optionalAclBiasesInfo, &aclOutputInfo, - layerInfo); + layerInfo, + arm_compute::WeightsInfo(), + aclDilationInfo); } ClConvolution2dWorkload::ClConvolution2dWorkload(const Convolution2dQueueDescriptor& descriptor, @@ -69,6 +74,9 @@ ClConvolution2dWorkload::ClConvolution2dWorkload(const Convolution2dQueueDescrip m_Data.m_Parameters.m_PadBottom, arm_compute::DimensionRoundingType::FLOOR); + const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(m_Data.m_Parameters.m_DilationX, + m_Data.m_Parameters.m_DilationY); + if (m_Data.m_Parameters.m_BiasEnabled) { m_BiasTensor = std::make_unique(); @@ -88,7 +96,9 @@ ClConvolution2dWorkload::ClConvolution2dWorkload(const Convolution2dQueueDescrip m_KernelTensor.get(), m_BiasTensor.get(), &output, - padStrideInfo); + padStrideInfo, + arm_compute::WeightsInfo(), + aclDilationInfo); InitializeArmComputeClTensorData(*m_KernelTensor, m_Data.m_Weight); -- 2.7.4