From be5d356c1663009c69c934fd860db1f91863e3d1 Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Tue, 16 Jul 2019 11:32:29 +0100 Subject: IVGCVSW-3522 Support dynamic output shape in hal_1_2::HalPolicy::ConvertResize Signed-off-by: Aron Virginas-Tar Change-Id: I962f9759679f539566f7bc3aa75ed3e0bffe7c9f --- OutputShapeUtils.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'OutputShapeUtils.cpp') diff --git a/OutputShapeUtils.cpp b/OutputShapeUtils.cpp index 285e25f4..6c936ee7 100644 --- a/OutputShapeUtils.cpp +++ b/OutputShapeUtils.cpp @@ -144,6 +144,28 @@ TensorShape InferPreluOutputShape(const TensorShape& inputShape, const TensorSha return CalculateMaxShape(inputShape, alphaShape); } +TensorShape InferResizeOutputShape(const TensorShape& inputShape, const ResizeDescriptor& descriptor) +{ + if (inputShape.GetNumDimensions() != 4) + { + throw InvalidArgumentException("Input shape for Resize must be 4D"); + } + + armnnUtils::DataLayoutIndexed dataLayoutIndexed(descriptor.m_DataLayout); + + const unsigned int cIndex = dataLayoutIndexed.GetChannelsIndex(); + const unsigned int wIndex = dataLayoutIndexed.GetWidthIndex(); + const unsigned int hIndex = dataLayoutIndexed.GetHeightIndex(); + + TensorShape outputShape(4); + outputShape[0] = inputShape[0]; + outputShape[cIndex] = inputShape[cIndex]; + outputShape[wIndex] = descriptor.m_TargetWidth; + outputShape[hIndex] = descriptor.m_TargetHeight; + + return outputShape; +} + TensorShape InferSubOutputShape(const TensorShape& input0Shape, const TensorShape& input1Shape) { return CalculateMaxShape(input0Shape, input1Shape); -- cgit v1.2.1