8 #include <DelegateOptions.hpp>
11 #include <tensorflow/core/public/version.h>
12 #include <tensorflow/lite/c/c_api_opaque.h>
14 #include <tensorflow/lite/acceleration/configuration/delegate_registry.h>
15 #include <tensorflow/lite/core/acceleration/configuration/c/stable_delegate.h>
17 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 5)
18 #define ARMNN_POST_TFLITE_2_5
43 TfLiteStatus
DoPrepare(TfLiteOpaqueContext* context, TfLiteOpaqueDelegate* delegate,
void* data);
45 armnnDelegate::DelegateOptions
ParseArmNNSettings(
const tflite::TFLiteSettings* tflite_settings);
69 return instance.get();
72 TfLiteOpaqueDelegateBuilder m_Builder =
74 reinterpret_cast<void*
>(
this),
79 kTfLiteDelegateFlagsNone,
85 armnnDelegate::DelegateOptions m_Options;
88 static int TfLiteArmnnOpaqueDelegateErrno(TfLiteOpaqueDelegate* delegate) {
return 0; }
93 using tflite::delegates::DelegatePluginInterface;
99 static std::unique_ptr<ArmnnDelegatePlugin>
New(
const tflite::TFLiteSettings& tfliteSettings)
101 return std::make_unique<ArmnnDelegatePlugin>(tfliteSettings);
104 tflite::delegates::TfLiteDelegatePtr
Create()
override
120 armnnDelegate::DelegateOptions m_delegateOptions;
128 const TfLiteOpaqueDelegateParams* parameters,
131 TfLiteStatus
Prepare(TfLiteOpaqueContext* tfLiteContext);
133 TfLiteStatus
Invoke(TfLiteOpaqueContext* tfLiteContext, TfLiteOpaqueNode* tfLiteNode);
136 TfLiteOpaqueContext* tfLiteContext,
137 TfLiteRegistrationExternal* tfLiteRegistration,
138 TfLiteOpaqueNode* tfLiteNode,
143 std::vector<armnn::BindingPointInfo>& inputBindings,
144 std::vector<armnn::BindingPointInfo>& outputBindings)
145 : m_NetworkId(networkId)
147 , m_InputBindings(inputBindings)
148 , m_OutputBindings(outputBindings)
150 static TfLiteStatus AddInputLayer(
DelegateData& delegateData,
151 TfLiteOpaqueContext* tfLiteContext,
152 const TfLiteIntArray* inputs,
153 std::vector<armnn::BindingPointInfo>& inputBindings);
154 static TfLiteStatus AddOutputLayer(
DelegateData& delegateData,
155 TfLiteOpaqueContext* tfLiteContext,
156 const TfLiteIntArray* outputs,
157 std::vector<armnn::BindingPointInfo>& outputBindings);
163 std::vector<armnn::BindingPointInfo> m_InputBindings;
164 std::vector<armnn::BindingPointInfo> m_OutputBindings;