diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-09-17 12:58:22 +0100 |
---|---|---|
committer | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-09-17 17:28:20 +0100 |
commit | 44a0142b17492a5af4cfa28b08c6763e463e6ca3 (patch) | |
tree | a63341b0f42c7f221f1315dc936a600a3cc79f8d /src/armnn/layers/TransposeConvolution2dLayer.cpp | |
parent | 6db5f20ade72896ebf0f6513a4832b8f2e917aa0 (diff) | |
download | armnn-44a0142b17492a5af4cfa28b08c6763e463e6ca3.tar.gz |
IVGCVSW-3879 Fix output shape inference formula for TransposeConvolution2d
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: I766f4297b9daa26edacc2079fe62a083ba2fa68f
Diffstat (limited to 'src/armnn/layers/TransposeConvolution2dLayer.cpp')
-rw-r--r-- | src/armnn/layers/TransposeConvolution2dLayer.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/armnn/layers/TransposeConvolution2dLayer.cpp b/src/armnn/layers/TransposeConvolution2dLayer.cpp index 77a333d881..7bd2f3b9d8 100644 --- a/src/armnn/layers/TransposeConvolution2dLayer.cpp +++ b/src/armnn/layers/TransposeConvolution2dLayer.cpp @@ -66,7 +66,7 @@ std::vector<TensorShape> TransposeConvolution2dLayer::InferOutputShapes( DataLayoutIndexed dataLayoutIndex(m_Param.m_DataLayout); - const unsigned int batches = inputShape[0]; + const unsigned int batches = inputShape[0]; const unsigned int wInput = inputShape[dataLayoutIndex.GetWidthIndex()]; const unsigned int hInput = inputShape[dataLayoutIndex.GetHeightIndex()]; @@ -74,20 +74,18 @@ std::vector<TensorShape> TransposeConvolution2dLayer::InferOutputShapes( const unsigned int wKernel = kernelShape[dataLayoutIndex.GetWidthIndex()]; const unsigned int hKernel = kernelShape[dataLayoutIndex.GetHeightIndex()]; - const unsigned int wStridedInput = 1u + m_Param.m_StrideX * (wInput - 1); - const unsigned int hStridedInput = 1u + m_Param.m_StrideY * (hInput - 1); + unsigned int wPadding = m_Param.m_PadLeft + m_Param.m_PadRight; + unsigned int hPadding = m_Param.m_PadTop + m_Param.m_PadBottom; - const unsigned int wPaddedOutput = wStridedInput + wKernel - (wKernel % 2); - const unsigned int hPaddedOutput = hStridedInput + hKernel - (hKernel % 2); - - unsigned int wOutput = wPaddedOutput - (m_Param.m_PadLeft + m_Param.m_PadRight); - unsigned int hOutput = hPaddedOutput - (m_Param.m_PadTop + m_Param.m_PadBottom); + unsigned int wOutput = (wInput - 1) * m_Param.m_StrideX + wKernel - wPadding; + unsigned int hOutput = (hInput - 1) * m_Param.m_StrideY + hKernel - hPadding; unsigned int kernelElements = kernelShape[0] * kernelShape[dataLayoutIndex.GetChannelsIndex()]; - unsigned int inputElements = batches * inputShape[dataLayoutIndex.GetChannelsIndex()]; + unsigned int inputElements = batches * inputShape[dataLayoutIndex.GetChannelsIndex()]; BOOST_ASSERT_MSG(inputElements != 0, "Invalid number of input elements"); BOOST_ASSERT_MSG(kernelElements % inputElements == 0, "Invalid number of elements"); + unsigned int channels = kernelElements / inputElements; TensorShape tensorShape = m_Param.m_DataLayout == armnn::DataLayout::NHWC ? |