From 49cb7d0568b7d4c81889a1791a4ca4e6bd5c8f32 Mon Sep 17 00:00:00 2001 From: Matthew Bentham Date: Fri, 10 May 2019 16:55:23 +0100 Subject: MLCE-101 Add dilation support to reference backend Change-Id: I6d1ea80c9fabd8c50ee030272c51cb66e85e431d Signed-off-by: Matthew Bentham --- src/backends/reference/test/RefLayerTests.cpp | 2 ++ src/backends/reference/workloads/ConvImpl.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index b2600029b1..01afff8b02 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -81,6 +81,8 @@ ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dUint8Nhwc, DepthwiseConvolution2dUint8Test, false, armnn::DataLayout::NHWC) +ARMNN_AUTO_TEST_CASE(SimpleDepthwiseConvolution2d3x3Dilation3x3Nhwc, + SimpleDepthwiseConvolution2d3x3Dilation3x3NhwcTest) ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1, diff --git a/src/backends/reference/workloads/ConvImpl.hpp b/src/backends/reference/workloads/ConvImpl.hpp index 5c07f57ec0..23b402aa77 100644 --- a/src/backends/reference/workloads/ConvImpl.hpp +++ b/src/backends/reference/workloads/ConvImpl.hpp @@ -97,6 +97,8 @@ static void ConvImpl(ConvData data, unsigned int paddingLeft = data.m_Parameters.m_PadLeft; unsigned int xStride = data.m_Parameters.m_StrideX; unsigned int yStride = data.m_Parameters.m_StrideY; + unsigned int xDilation = data.m_Parameters.m_DilationX; + unsigned int yDilation = data.m_Parameters.m_DilationY; // The world's least efficient convolution. for (unsigned int batchIdx = 0; batchIdx < batchSize; batchIdx++) @@ -158,8 +160,8 @@ static void ConvImpl(ConvData data, AccumulatorType filterValue = filterData[filterIndex] - boost::numeric_cast(filterOffset); - unsigned int yInput = yOutput * yStride + yFilter; - unsigned int xInput = xOutput * xStride + xFilter; + unsigned int yInput = yOutput * yStride + yFilter * yDilation; + unsigned int xInput = xOutput * xStride + xFilter * xDilation; AccumulatorType inputValue; -- cgit v1.2.1