diff options
author | Tianle Cheng <tianle.cheng@arm.com> | 2023-10-03 12:01:11 +0100 |
---|---|---|
committer | Tianle Cheng <tianle.cheng@arm.com> | 2023-10-03 14:31:21 +0100 |
commit | 2077348da176dd5f264bb04a0b500c5901969d09 (patch) | |
tree | 6a2e944d16b2693bbc6a666cd3c5432e59265498 /delegate/opaque/src/Redefine.hpp | |
parent | ad323af0e9b47e53d366b85cdf74927f88748d40 (diff) | |
download | armnn-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/opaque/src/Redefine.hpp')
-rw-r--r-- | delegate/opaque/src/Redefine.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/delegate/opaque/src/Redefine.hpp b/delegate/opaque/src/Redefine.hpp index 5ce7a3dcc1..6319ca7841 100644 --- a/delegate/opaque/src/Redefine.hpp +++ b/delegate/opaque/src/Redefine.hpp @@ -201,6 +201,19 @@ TfLiteStatus VisitReshapeOperator(DelegateData& delegateData, return kTfLiteError; } + // Check the target shape to check if there is zero in the shape. + if (std::find(targetShape.begin(), targetShape.end(), 0) != targetShape.end() && + inputTensorInfo0.GetNumElements() != 0) + { + TF_LITE_OPAQUE_MAYBE_KERNEL_LOG( + tfLiteContext, + "TfLiteArmnnOpaqueDelegate: Input to reshape is a tensor with elements, " + "but the requested shape has 0. " + "operator #%d node #%d: ", + operatorCode, nodeIndex); + return kTfLiteError; + } + // Use the data to create the required tensor shape. if (CreateOutputTensorShape(inputTensorInfo0, targetShape, reshapeDesc) != kTfLiteOk) { |