aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan OShea <ryan.oshea3@arm.com>2023-01-11 15:27:50 +0000
committerJim Flynn <jim.flynn@arm.com>2023-01-12 00:38:46 +0000
commit05b6a3e5946a3f58b6f5b0caface9153a1c2b364 (patch)
treeea786e551bb6f3e49e1ed972c49d86393c18436f
parentd9e55f05847792edbbf6a8c2c4d3901d37f63d1f (diff)
downloadarmnn-05b6a3e5946a3f58b6f5b0caface9153a1c2b364.tar.gz
Fix delegate fallback during VisitNode
During VisitNode throwing an ArmNN exception incorrectly terminates the process instead of handing over to tflite * Catches ArmNN exceptions during VisitNode Signed-off-by: Ryan OShea <ryan.oshea3@arm.com> Change-Id: I6c71be11e9b73694747b27fe9febab8d9669b4d4
-rw-r--r--delegate/src/armnn_delegate.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/delegate/src/armnn_delegate.cpp b/delegate/src/armnn_delegate.cpp
index 06affca752..aa6c1be37d 100644
--- a/delegate/src/armnn_delegate.cpp
+++ b/delegate/src/armnn_delegate.cpp
@@ -205,8 +205,20 @@ TfLiteIntArray* Delegate::IdentifyOperatorsToDelegate(TfLiteContext* tfLiteConte
continue;
}
- if (ArmnnSubgraph::VisitNode(
- delegateData, tfLiteContext, tfLiteRegistration, tfLiteNode, nodeIndex) != kTfLiteOk)
+ TfLiteStatus visitStatus;
+
+ try
+ {
+ visitStatus = ArmnnSubgraph::VisitNode(
+ delegateData, tfLiteContext, tfLiteRegistration, tfLiteNode, nodeIndex);
+ }
+ catch(std::exception& ex)
+ {
+ ARMNN_LOG(error) << "ArmNN Failed to visit node with error: " << ex.what();
+ visitStatus = kTfLiteError;
+ }
+
+ if ( visitStatus != kTfLiteOk)
{
// node is not supported by ArmNN
unsupportedOperators.insert(tfLiteRegistration->builtin_code);
@@ -376,7 +388,7 @@ ArmnnSubgraph* ArmnnSubgraph::Create(TfLiteContext* tfLiteContext,
ARMNN_LOG(info) << "Optimize ArmnnSubgraph time: " << std::setprecision(2)
<< std::fixed << armnn::GetTimeDuration(optimizeStartTime).count() << " ms";
}
- catch (std::exception &ex)
+ catch (std::exception& ex)
{
std::stringstream exMessage;
exMessage << "TfLiteArmnnDelegate: Exception (" << ex.what() << ") caught from optimize.";