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 > 5) 21 #define ARMNN_POST_TFLITE_2_5 46 TfLiteStatus
DoPrepare(TfLiteContext* context, TfLiteDelegate* delegate);
55 TfLiteIntArray* IdentifyOperatorsToDelegate(TfLiteContext* context);
57 TfLiteDelegate* GetDelegate();
63 TfLiteDelegate m_Delegate = {
64 reinterpret_cast<void*
>(
this),
69 kTfLiteDelegateFlagsNone,
83 const TfLiteDelegateParams* parameters,
86 TfLiteStatus Prepare(TfLiteContext* tfLiteContext);
88 TfLiteStatus Invoke(TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode);
90 static TfLiteStatus VisitNode(
DelegateData& delegateData,
91 TfLiteContext* tfLiteContext,
92 TfLiteRegistration* tfLiteRegistration,
93 TfLiteNode* tfLiteNode,
99 std::vector<armnn::BindingPointInfo>& inputBindings,
100 std::vector<armnn::BindingPointInfo>& outputBindings)
101 : m_NetworkId(networkId), m_Runtime(runtime), m_InputBindings(inputBindings), m_OutputBindings(outputBindings)
104 static TfLiteStatus AddInputLayer(
DelegateData& delegateData,
105 TfLiteContext* tfLiteContext,
106 const TfLiteIntArray* inputs,
107 std::vector<armnn::BindingPointInfo>& inputBindings);
109 static TfLiteStatus AddOutputLayer(
DelegateData& delegateData,
110 TfLiteContext* tfLiteContext,
111 const TfLiteIntArray* outputs,
112 std::vector<armnn::BindingPointInfo>& outputBindings);
121 std::vector<armnn::BindingPointInfo> m_InputBindings;
122 std::vector<armnn::BindingPointInfo> m_OutputBindings;
TfLiteStatus DoPrepare(TfLiteContext *context, TfLiteDelegate *delegate)
DelegateData(const std::vector< armnn::BackendId > &backends)
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
std::vector< armnn::IOutputSlot * > m_OutputSlotForNode
const std::string GetVersion()
armnn::INetworkPtr m_Network
const std::vector< armnn::BackendId > m_Backends
TfLiteDelegate * TfLiteArmnnDelegateCreate(armnnDelegate::DelegateOptions options)
void TfLiteArmnnDelegateDelete(TfLiteDelegate *tfLiteDelegate)
DelegateOptions TfLiteArmnnDelegateOptionsDefault()
ArmnnSubgraph class where parsing the nodes to ArmNN format and creating the ArmNN Graph...
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr