From 26654cb71db2b1e163527f52c3198d9434bb0e37 Mon Sep 17 00:00:00 2001 From: Narumol Prangnawarat Date: Wed, 3 May 2023 16:08:11 +0100 Subject: IVGCVSW-7423 Add ArmnnDelegatePlugin Signed-off-by: Narumol Prangnawarat Signed-off-by: Ryan OShea Change-Id: Ie02021ac56a512598760e4c6d05ef1a80f4aec8d --- delegate/opaque/include/armnn_delegate.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'delegate/opaque/include/armnn_delegate.hpp') diff --git a/delegate/opaque/include/armnn_delegate.hpp b/delegate/opaque/include/armnn_delegate.hpp index 653015a63c..bb6451f649 100644 --- a/delegate/opaque/include/armnn_delegate.hpp +++ b/delegate/opaque/include/armnn_delegate.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 5) #define ARMNN_POST_TFLITE_2_5 @@ -87,6 +88,35 @@ const TfLiteOpaqueDelegatePlugin* GetArmnnDelegatePluginApi(); extern const TfLiteStableDelegate TFL_TheStableDelegate; +using tflite::delegates::DelegatePluginInterface; +using TfLiteOpaqueDelegatePtr = tflite::delegates::TfLiteDelegatePtr; + +class ArmnnDelegatePlugin : public DelegatePluginInterface +{ +public: + static std::unique_ptr New(const tflite::TFLiteSettings& tflite_settings) + { + return std::make_unique(tflite_settings); + } + + tflite::delegates::TfLiteDelegatePtr Create() override + { + // Use default settings until options have been enabled. + return tflite::delegates::TfLiteDelegatePtr( + TfLiteArmnnOpaqueDelegateCreate(nullptr), TfLiteArmnnOpaqueDelegateDelete); + } + + int GetDelegateErrno(TfLiteOpaqueDelegate* from_delegate) override + { + return 0; + } + + explicit ArmnnDelegatePlugin(const tflite::TFLiteSettings& tfliteSettings) + { + // Use default settings until options have been enabled. + } +}; + /// ArmnnSubgraph class where parsing the nodes to ArmNN format and creating the ArmNN Graph class ArmnnSubgraph { -- cgit v1.2.1