aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeresa Charlin <teresa.charlinreyes@arm.com>2023-10-26 13:31:38 +0100
committerTeresaARM <teresa.charlinreyes@arm.com>2023-10-26 12:33:00 +0000
commit16ea11e4a5775fe4098fa262aaf9dcf533b8b564 (patch)
tree0d35e6777bf6bac27b4fdf9d72f117cc931c2342
parentabd3c214fa6f32075b243eb9d2f58ee75b8979e0 (diff)
downloadarmnn-16ea11e4a5775fe4098fa262aaf9dcf533b8b564.tar.gz
IVGCVSW-7722 Add ArmNNSettings to Opaque Delegate for ExecuteNetwork
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Change-Id: I0a111fa8ef62632c3c975537a727d75531a44b7a
-rw-r--r--tests/ExecuteNetwork/TfliteExecutor.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/tests/ExecuteNetwork/TfliteExecutor.cpp b/tests/ExecuteNetwork/TfliteExecutor.cpp
index 04e510f938..4d64552028 100644
--- a/tests/ExecuteNetwork/TfliteExecutor.cpp
+++ b/tests/ExecuteNetwork/TfliteExecutor.cpp
@@ -71,27 +71,24 @@ TfLiteExecutor::TfLiteExecutor(const ExecuteNetworkParams& params, armnn::IRunti
if (m_Params.m_TfLiteExecutor == ExecuteNetworkParams::TfLiteExecutor::ArmNNTfLiteOpaqueDelegate)
{
#if defined(ARMNN_TFLITE_OPAQUE_DELEGATE)
- // Use default settings until options have been enabled
- flatbuffers::FlatBufferBuilder flatBufferBuilder;
- TFLiteSettingsBuilder tfliteSettingsBuilder(flatBufferBuilder);
- flatbuffers::Offset<TFLiteSettings> tfliteSettings = tfliteSettingsBuilder.Finish();
- flatBufferBuilder.Finish(tfliteSettings);
- const TFLiteSettings* settings =
- flatbuffers::GetRoot<TFLiteSettings>(flatBufferBuilder.GetBufferPointer());
-
- std::unique_ptr<delegates::DelegatePluginInterface> delegatePlugIn =
- delegates::DelegatePluginRegistry::CreateByName("armnn_delegate", *settings);
-
- // Create Armnn Opaque Delegate from Armnn Delegate Plugin
- delegates::TfLiteDelegatePtr armnnDelegate = delegatePlugIn->Create();
-
- // Add Delegate to the builder
- builder.AddDelegate(armnnDelegate.get());
if (builder(&m_TfLiteInterpreter) != kTfLiteOk)
{
LogAndThrow("Error loading the model into the TfLiteInterpreter.");
}
+ // Populate a DelegateOptions from the ExecuteNetworkParams.
+ armnnDelegate::DelegateOptions delegateOptions = m_Params.ToDelegateOptions();
+ delegateOptions.SetRuntimeOptions(runtimeOptions);
+ std::unique_ptr<TfLiteDelegate, decltype(&armnnOpaqueDelegate::TfLiteArmnnOpaqueDelegateDelete)>
+ theArmnnDelegate(armnnOpaqueDelegate::TfLiteArmnnOpaqueDelegateCreate(delegateOptions),
+ armnnOpaqueDelegate::TfLiteArmnnOpaqueDelegateDelete);
+ // Register armnn_delegate to TfLiteInterpreter
+ auto result = m_TfLiteInterpreter->ModifyGraphWithDelegate(std::move(theArmnnDelegate));
+ if (result != kTfLiteOk)
+ {
+ LogAndThrow("Could not register ArmNN TfLite Opaque Delegate to TfLiteInterpreter: " +
+ TfLiteStatusToString(result) + ".");
+ }
#else
LogAndThrow("Not built with Arm NN Tensorflow-Lite opaque delegate support.");
#endif