aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2020-01-15 10:02:33 +0000
committerTeresaARM <teresa.charlinreyes@arm.com>2020-01-28 17:03:27 +0000
commit26123db75b77b4bba9878ef0eb1c9d7d2651ccee (patch)
tree9f6168de146b99f22d8f7e86be6f36ce61f25211
parent370b9b73f59adae331cccfc117caef04a028333a (diff)
downloadandroid-nn-driver-26123db75b77b4bba9878ef0eb1c9d7d2651ccee.tar.gz
MLCE-153 Padding calculation for TransposeConv ignores stride
* Changed ConvertTransposeConv2d to use the unsigned values for strideX and strideY not the signed values from the descriptor. !ComputeLibrary:2599 !armnn:2612 Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: Iee300041f3ed585820b7c7e2edd8ab541f339d59
-rw-r--r--1.2/HalPolicy.cpp8
-rw-r--r--ConversionUtils.hpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp
index c9b4dad..8e4ef8a 100644
--- a/1.2/HalPolicy.cpp
+++ b/1.2/HalPolicy.cpp
@@ -2697,11 +2697,11 @@ bool HalPolicy::ConvertTransposeConv2d(const Operation& operation, const Model&
const uint32_t kernelX = weights.GetShape()[widthIndex];
const uint32_t kernelY = weights.GetShape()[heightIndex];
- const uint32_t outputX = outputInfo.GetShape()[widthIndex];
- const uint32_t outputY = outputInfo.GetShape()[heightIndex];
+ const uint32_t outputX = outputInfo.GetShape()[widthIndex];
+ const uint32_t outputY = outputInfo.GetShape()[heightIndex];
- CalcPaddingTransposeConv(outputX, kernelX, desc.m_StrideX, padLeft, padRight, paddingScheme);
- CalcPaddingTransposeConv(outputY, kernelY, desc.m_StrideY, padTop, padBottom, paddingScheme);
+ CalcPaddingTransposeConv(outputX, kernelX, strideX, padLeft, padRight, paddingScheme);
+ CalcPaddingTransposeConv(outputY, kernelY, strideY, padTop, padBottom, paddingScheme);
// NOTE: The Android NN API allows for negative padding values in TransposeConv2d,
// but Arm NN only supports values >= 0
diff --git a/ConversionUtils.hpp b/ConversionUtils.hpp
index 4881ec9..550c320 100644
--- a/ConversionUtils.hpp
+++ b/ConversionUtils.hpp
@@ -358,7 +358,7 @@ void CalcPadding(uint32_t input, uint32_t kernel, uint32_t stride, uint32_t dila
outPadTail = boost::numeric_cast<uint32_t>(padTail);
}
-void CalcPaddingTransposeConv(uint32_t output, uint32_t kernel, uint32_t stride, int32_t& outPadHead,
+void CalcPaddingTransposeConv(uint32_t output, uint32_t kernel, int32_t stride, int32_t& outPadHead,
int32_t& outPadTail, android::nn::PaddingScheme scheme)
{
calculateExplicitPaddingTransposeConv(output, stride, kernel, scheme, &outPadHead, &outPadTail);