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);
59 TfLiteIntArray* IdentifyOperatorsToDelegate(TfLiteContext* context);
61 TfLiteDelegate* GetDelegate();
67 TfLiteDelegate m_Delegate = {
68 reinterpret_cast<void*
>(
this),
73 kTfLiteDelegateFlagsNone,
87 const TfLiteDelegateParams* parameters,
90 TfLiteStatus Prepare(TfLiteContext* tfLiteContext);
92 TfLiteStatus Invoke(TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode);
94 static TfLiteStatus VisitNode(
DelegateData& delegateData,
95 TfLiteContext* tfLiteContext,
96 TfLiteRegistration* tfLiteRegistration,
97 TfLiteNode* tfLiteNode,
103 std::vector<armnn::BindingPointInfo>& inputBindings,
104 std::vector<armnn::BindingPointInfo>& outputBindings)
105 : m_NetworkId(networkId), m_Runtime(runtime), m_InputBindings(inputBindings), m_OutputBindings(outputBindings)
108 static TfLiteStatus AddInputLayer(
DelegateData& delegateData,
109 TfLiteContext* tfLiteContext,
110 const TfLiteIntArray* inputs,
111 std::vector<armnn::BindingPointInfo>& inputBindings);
113 static TfLiteStatus AddOutputLayer(
DelegateData& delegateData,
114 TfLiteContext* tfLiteContext,
115 const TfLiteIntArray* outputs,
116 std::vector<armnn::BindingPointInfo>& outputBindings);
125 std::vector<armnn::BindingPointInfo> m_InputBindings;
126 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