aboutsummaryrefslogtreecommitdiff
path: root/delegate/common/src
diff options
context:
space:
mode:
authorTianle Cheng <tianle.cheng@arm.com>2023-10-03 12:01:11 +0100
committerTianle Cheng <tianle.cheng@arm.com>2023-10-03 14:31:21 +0100
commit2077348da176dd5f264bb04a0b500c5901969d09 (patch)
tree6a2e944d16b2693bbc6a666cd3c5432e59265498 /delegate/common/src
parentad323af0e9b47e53d366b85cdf74927f88748d40 (diff)
downloadarmnn-2077348da176dd5f264bb04a0b500c5901969d09.tar.gz
IVGCVSW-7749 DTS: Fix reshape floating point exception
* Updated Opaque Delegate, TfliteParser, OnnxParser, and Deserializer to handle the Zero In Shape edge case Signed-off-by: Tianle Cheng <tianle.cheng@arm.com> Change-Id: I4a0d1e72a66de1fa56de99af9b6730a84e0ff596
Diffstat (limited to 'delegate/common/src')
-rw-r--r--delegate/common/src/DelegateUtils.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/delegate/common/src/DelegateUtils.hpp b/delegate/common/src/DelegateUtils.hpp
index a74ed8b549..a2cdc83a64 100644
--- a/delegate/common/src/DelegateUtils.hpp
+++ b/delegate/common/src/DelegateUtils.hpp
@@ -186,7 +186,16 @@ TfLiteStatus CreateOutputTensorShape(const armnn::TensorInfo& inputTensorInfo,
std::accumulate(targetShape.begin(), targetShape.end(), -1, std::multiplies<int32_t>()));
auto stretchIndex = static_cast<size_t>(std::distance(targetShape.begin(), stretchDim));
- outputDims[stretchIndex] = inputTensorInfo.GetNumElements() / targetNumElements;
+
+ if (targetNumElements == 0)
+ {
+ // To handle the edge case that input and output both have zero elements
+ outputDims[stretchIndex] = 0;
+ }
+ else
+ {
+ outputDims[stretchIndex] = inputTensorInfo.GetNumElements() / targetNumElements;
+ }
}
armnn::TensorShape outputShape = armnn::TensorShape(static_cast<unsigned int>(outputDims.size()),