aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColm Donelan <colm.donelan@arm.com>2020-07-06 15:41:43 +0100
committerColm Donelan <colm.donelan@arm.com>2020-07-09 10:26:53 +0000
commit8f3d33ef6f86a4512f268931e09de0b0487e0ecd (patch)
treedd0b620491233faef137c882d34bbb5d9f8aa7c0
parentfc884b4141a28fbd3c62f665341ec88158fcd332 (diff)
downloadandroid-nn-driver-8f3d33ef6f86a4512f268931e09de0b0487e0ecd.tar.gz
IVGCVSW-4988 Add handling output shape parameter to TransposeConvolution2d
* Updating ConvertTransposeConv2d to populate m_OutputShape if found in the model. Signed-off-by: Colm Donelan <Colm.Donelan@arm.com> Change-Id: I8c0c8184fdf29d81639dac8af36a9f1f048296b2
-rw-r--r--ConversionUtils_1_2.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/ConversionUtils_1_2.hpp b/ConversionUtils_1_2.hpp
index 0a153996..817aebd1 100644
--- a/ConversionUtils_1_2.hpp
+++ b/ConversionUtils_1_2.hpp
@@ -2613,6 +2613,19 @@ bool ConvertTransposeConv2d(const HalOperation& operation, const HalModel& model
return Fail("%s: Negative padding values are not supported", __func__);
}
+ // If output shape has been specified as a parameter then extract it and make it available.
+ const HalOperand* outputShapeOperand = GetInputOperand<HalPolicy>(operation, 3, model, false);
+ std::vector<int32_t> outputShape;
+ if ((outputShapeOperand) && (GetTensorInt32Values<HalPolicy>(*outputShapeOperand, outputShape, model, data)))
+ {
+ // Change from signed to unsigned int to store in TransposeConvolution2dDescriptor.
+ for (int dimension : outputShape)
+ {
+ desc.m_OutputShape.push_back(static_cast<unsigned int>(dimension));
+ }
+ desc.m_OutputShapeEnabled = true;
+ }
+
desc.m_StrideX = boost::numeric_cast<uint32_t>(strideX);
desc.m_StrideY = boost::numeric_cast<uint32_t>(strideY);
desc.m_PadLeft = boost::numeric_cast<uint32_t>(padLeft);