diff options
Diffstat (limited to 'src/armnn')
-rw-r--r-- | src/armnn/LayerSupport.cpp | 23 | ||||
-rw-r--r-- | src/armnn/layers/DepthwiseConvolution2dLayer.cpp | 7 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/armnn/LayerSupport.cpp b/src/armnn/LayerSupport.cpp index 320d9cef74..831a846092 100644 --- a/src/armnn/LayerSupport.cpp +++ b/src/armnn/LayerSupport.cpp @@ -186,7 +186,28 @@ bool IsDepthwiseConvolutionSupported(const BackendId& backend, char* reasonIfUnsupported, size_t reasonIfUnsupportedMaxLength) { - FORWARD_LAYER_SUPPORT_FUNC(backend, IsDepthwiseConvolutionSupported, input, output, descriptor, weights, biases); + if (descriptor.m_DilationX == 1 && descriptor.m_DilationY == 1) + { + // Pre 19.05 ArmNN did not have the dilation parameters. + // This version of IsDepthwiseConvolutionSupported is called for backwards-compatibility + FORWARD_LAYER_SUPPORT_FUNC(backend, + IsDepthwiseConvolutionSupported, + input, + output, + descriptor, + weights, + biases); + } + else + { + FORWARD_LAYER_SUPPORT_FUNC(backend, + IsDilatedDepthwiseConvolutionSupported, + input, + output, + descriptor, + weights, + biases); + } } bool IsDequantizeSupported(const BackendId& backend, 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; |