From 727d017aa3559cb33c97a8d77b5a32fbb98b9e35 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 4 Oct 2023 10:16:24 +0100 Subject: IVGCVSW-7750 DTS: Fix ElementWise isnan assert * Removed the ASSERTS in TypesUtils.cpp in favour of InvalidArgumentExceptions instead * Added a try/catch block when calling EnqueueWorkload to catch Exceptions raised by bad inputs Signed-off-by: David Monahan Change-Id: Icade014ec75db13722eb5d8adc7bdb93c8862417 --- delegate/opaque/src/armnn_delegate.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'delegate') diff --git a/delegate/opaque/src/armnn_delegate.cpp b/delegate/opaque/src/armnn_delegate.cpp index 6abf7398cc..83e90a0026 100644 --- a/delegate/opaque/src/armnn_delegate.cpp +++ b/delegate/opaque/src/armnn_delegate.cpp @@ -600,14 +600,25 @@ TfLiteStatus ArmnnSubgraph::Invoke(TfLiteOpaqueContext* tfLiteContext, TfLiteOpa } // Run graph - auto status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors); - // The delegate holds its own Arm NN runtime so this is our last chance to print internal profiling data. - std::shared_ptr profiler = m_Runtime->GetProfiler(m_NetworkId); - if (profiler && profiler->IsProfilingEnabled()) + try { - profiler->Print(std::cout); + auto status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors); + // The delegate holds its own Arm NN runtime so this is our last chance to print internal profiling data. + std::shared_ptr profiler = m_Runtime->GetProfiler(m_NetworkId); + if (profiler && profiler->IsProfilingEnabled()) + { + profiler->Print(std::cout); + } + return (status == armnn::Status::Success) ? kTfLiteOk : kTfLiteError; } - return (status == armnn::Status::Success) ? kTfLiteOk : kTfLiteError; + catch (armnn::InvalidArgumentException& ex) + { + ARMNN_LOG(error) << "ArmNN Failed to EnqueueWorkload with error: " << ex.what(); + // This should really be kTfLiteDelegateError but the Delegate Test Suite expects kTfLiteError so we return + // that instead + return kTfLiteError; + } + } TfLiteStatus ArmnnSubgraph::VisitNode(DelegateData& delegateData, -- cgit v1.2.1