aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-04-26 17:58:13 +0100
committerPablo Tello <pablo.tello@arm.com>2019-05-13 16:51:35 +0100
commitf0bd68386cc8598f702b1df2d1ba60094e6a9d97 (patch)
tree4e5a0d2f58bbd7fb095f24bee8932970d14e52a8 /src/armnn/layers/DepthwiseConvolution2dLayer.cpp
parent3f9119a115bfaaf0ad89a46d00e7b9da844aca22 (diff)
downloadarmnn-f0bd68386cc8598f702b1df2d1ba60094e6a9d97.tar.gz
MLCE-101: Adding dilation support in conv and dconv
Added support for dilation in DepthwiseConvolution2d in the Neon and CL backends. Change-Id: Ie1522b498c07f80d6efcf9dc79e926c8cfa06ca5 Signed-off-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/armnn/layers/DepthwiseConvolution2dLayer.cpp')
-rw-r--r--src/armnn/layers/DepthwiseConvolution2dLayer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
index a1ffe91792..e49c179eb1 100644
--- a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
+++ b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp
@@ -74,15 +74,16 @@ DepthwiseConvolution2dLayer::InferOutputShapes(const std::vector<TensorShape>& i
// Expected filter shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
// Namely: [ depth multiplier, input channels, filter height, filter width ]
// Output channels = input channels * depthMultiplier
-
unsigned int depthMultiplier = filterShape[0];
unsigned int filterHeight = filterShape[2];
- unsigned int readHeight = (inputHeight + m_Param.m_PadTop + m_Param.m_PadBottom) - filterHeight;
+ unsigned int dilatedFilterHeight = filterHeight + (m_Param.m_DilationY - 1) * (filterHeight - 1);
+ unsigned int readHeight = (inputHeight + m_Param.m_PadTop + m_Param.m_PadBottom) - dilatedFilterHeight;
unsigned int outputHeight = 1 + (readHeight / m_Param.m_StrideY);
unsigned int filterWidth = filterShape[3];
- unsigned int readWidth = (inputWidth + m_Param.m_PadLeft + m_Param.m_PadRight) - filterWidth;
+ unsigned int dilatedFilterWidth = filterWidth + (m_Param.m_DilationX - 1) * (filterWidth - 1);
+ unsigned int readWidth = (inputWidth + m_Param.m_PadLeft + m_Param.m_PadRight) - dilatedFilterWidth;
unsigned int outputWidth = 1 + (readWidth / m_Param.m_StrideX);
unsigned int outputChannels = inputChannels * depthMultiplier;