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/include/armnn_delegate.hpp | |
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/include/armnn_delegate.hpp')
-rw-r--r-- | delegate/opaque/include/armnn_delegate.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
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 <tensorflow/core/public/version.h> #include <tensorflow/lite/c/c_api_opaque.h> #include <tensorflow/lite/core/experimental/acceleration/configuration/c/stable_delegate.h> +#include <tensorflow/lite/experimental/acceleration/configuration/delegate_registry.h> #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<ArmnnDelegatePlugin> New(const tflite::TFLiteSettings& tflite_settings) + { + return std::make_unique<ArmnnDelegatePlugin>(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 { |