8 #include <DelegateOptions.hpp>
10 #include <tensorflow/lite/builtin_ops.h>
11 #include <tensorflow/lite/c/builtin_op_data.h>
12 #include <tensorflow/lite/c/common.h>
13 #include <tensorflow/lite/minimal_logging.h>
14 #include <tensorflow/lite/version.h>
16 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 3)
17 #define ARMNN_POST_TFLITE_2_3
20 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 4)
21 #define ARMNN_POST_TFLITE_2_4
24 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 5)
25 #define ARMNN_POST_TFLITE_2_5
50 TfLiteStatus
DoPrepare(TfLiteContext* context, TfLiteDelegate* delegate);
57 explicit Delegate(armnnDelegate::DelegateOptions options);
74 return instance.get();
77 TfLiteDelegate m_Delegate = {
78 reinterpret_cast<void*
>(
this),
83 kTfLiteDelegateFlagsNone,
90 armnnDelegate::DelegateOptions m_Options;
98 const TfLiteDelegateParams* parameters,
103 TfLiteStatus
Prepare(TfLiteContext* tfLiteContext);
105 TfLiteStatus
Invoke(TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode);
108 TfLiteContext* tfLiteContext,
109 TfLiteRegistration* tfLiteRegistration,
110 TfLiteNode* tfLiteNode,
116 std::vector<armnn::BindingPointInfo>& inputBindings,
117 std::vector<armnn::BindingPointInfo>& outputBindings)
118 : m_NetworkId(networkId), m_Runtime(runtime), m_InputBindings(inputBindings), m_OutputBindings(outputBindings)
121 static TfLiteStatus AddInputLayer(
DelegateData& delegateData,
122 TfLiteContext* tfLiteContext,
123 const TfLiteIntArray* inputs,
124 std::vector<armnn::BindingPointInfo>& inputBindings);
126 static TfLiteStatus AddOutputLayer(
DelegateData& delegateData,
127 TfLiteContext* tfLiteContext,
128 const TfLiteIntArray* outputs,
129 std::vector<armnn::BindingPointInfo>& outputBindings);
138 std::vector<armnn::BindingPointInfo> m_InputBindings;
139 std::vector<armnn::BindingPointInfo> m_OutputBindings;
static IRuntimePtr Create(const CreationOptions &options)
ArmnnSubgraph class where parsing the nodes to ArmNN format and creating the ArmNN Graph.
static TfLiteStatus VisitNode(DelegateData &delegateData, TfLiteContext *tfLiteContext, TfLiteRegistration *tfLiteRegistration, TfLiteNode *tfLiteNode, int nodeIndex)
static ArmnnSubgraph * Create(TfLiteContext *tfLiteContext, const TfLiteDelegateParams *parameters, const Delegate *delegate)
TfLiteStatus Invoke(TfLiteContext *tfLiteContext, TfLiteNode *tfLiteNode)
TfLiteStatus Prepare(TfLiteContext *tfLiteContext)
Delegate(armnnDelegate::DelegateOptions options)
static const std::string GetVersion()
Retrieve version in X.Y.Z form.
TfLiteDelegate * GetDelegate()
TfLiteIntArray * IdentifyOperatorsToDelegate(TfLiteContext *context)
void TfLiteArmnnDelegateDelete(TfLiteDelegate *tfLiteDelegate)
TfLiteStatus DoPrepare(TfLiteContext *context, TfLiteDelegate *delegate)
DelegateOptions TfLiteArmnnDelegateOptionsDefault()
TfLiteDelegate * TfLiteArmnnDelegateCreate(armnnDelegate::DelegateOptions options)
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
DelegateData(const std::vector< armnn::BackendId > &backends)
armnn::INetworkPtr m_Network
std::vector< armnn::IOutputSlot * > m_OutputSlotForNode
const std::vector< armnn::BackendId > m_Backends