diff options
author | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2023-05-03 16:08:11 +0100 |
---|---|---|
committer | Francis Murtagh <francis.murtagh@arm.com> | 2023-05-05 15:45:35 +0000 |
commit | 26654cb71db2b1e163527f52c3198d9434bb0e37 (patch) | |
tree | c7406ad3edde1e914c9474bbedd4a21c62d612b4 /delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp | |
parent | 74be13e0d663b9127f630360fffa55993ccce9d6 (diff) | |
download | armnn-26654cb71db2b1e163527f52c3198d9434bb0e37.tar.gz |
IVGCVSW-7423 Add ArmnnDelegatePlugin
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: Ie02021ac56a512598760e4c6d05ef1a80f4aec8d
Diffstat (limited to 'delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp')
-rw-r--r-- | delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp b/delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp index 1635b65809..79f98a9e5e 100644 --- a/delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp +++ b/delegate/opaque/src/test/ArmnnOpaqueDelegateTest.cpp @@ -9,6 +9,9 @@ #include <opaque/include/armnn_delegate.hpp> #include <opaque/include/Version.hpp> +#include <flatbuffers/flatbuffers.h> +#include <tensorflow/lite/experimental/acceleration/configuration/delegate_registry.h> + namespace armnnOpaqueDelegate { @@ -37,6 +40,28 @@ TEST_CASE ("DelegateOptions_OpaqueDelegateDefault") armnnOpaqueDelegate::TfLiteArmnnOpaqueDelegateDelete(opaqueDelegate); } +TEST_CASE ("DelegatePluginTest") +{ + // Use default settings until options have been enabled. + flatbuffers::FlatBufferBuilder flatBufferBuilder; + tflite::TFLiteSettingsBuilder tfliteSettingBuilder(flatBufferBuilder); + flatbuffers::Offset<tflite::TFLiteSettings> tfliteSettings = tfliteSettingBuilder.Finish(); + flatBufferBuilder.Finish(tfliteSettings); + const tflite::TFLiteSettings* settings = flatbuffers::GetRoot<tflite::TFLiteSettings>( + flatBufferBuilder.GetBufferPointer()); + + std::unique_ptr<tflite::delegates::DelegatePluginInterface> delegatePlugin = + tflite::delegates::DelegatePluginRegistry::CreateByName("armnn_delegate", *settings); + + // Plugin is created correctly using armnn_delegate name. + CHECK((delegatePlugin != nullptr)); + + tflite::delegates::TfLiteDelegatePtr armnnDelegate = delegatePlugin->Create(); + + // Armnn Opaque Delegate is created correctly. + CHECK((armnnDelegate != nullptr)); + CHECK((armnnDelegate->opaque_delegate_builder != nullptr)); } +} } // namespace armnnDelegate |