From 8d2ca734165a068478df7cffa46185680b05cd20 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 24 Feb 2023 10:28:19 +0000 Subject: Update Doxygen docu for 23.02 Signed-off-by: Nikhil Raj Change-Id: Ie6c19a27d50fefab2796b2b5875374e81f5bf971 --- 23.02/armnn__delegate_8hpp_source.xhtml | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 23.02/armnn__delegate_8hpp_source.xhtml (limited to '23.02/armnn__delegate_8hpp_source.xhtml') diff --git a/23.02/armnn__delegate_8hpp_source.xhtml b/23.02/armnn__delegate_8hpp_source.xhtml new file mode 100644 index 0000000000..cc148bb6b2 --- /dev/null +++ b/23.02/armnn__delegate_8hpp_source.xhtml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + +ArmNN: delegate/include/armnn_delegate.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
armnn_delegate.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "DelegateOptions.hpp"
9 
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>
15 
16 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 3)
17 #define ARMNN_POST_TFLITE_2_3
18 #endif
19 
20 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 4)
21 #define ARMNN_POST_TFLITE_2_4
22 #endif
23 
24 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 5)
25 #define ARMNN_POST_TFLITE_2_5
26 #endif
27 
28 namespace armnnDelegate
29 {
30 
32 {
33  DelegateData(const std::vector<armnn::BackendId>& backends)
34  : m_Backends(backends)
35  , m_Network(nullptr, nullptr)
36  {}
37 
38  const std::vector<armnn::BackendId> m_Backends;
40  std::vector<armnn::IOutputSlot*> m_OutputSlotForNode;
41 };
42 
43 // Forward decleration for functions initializing the ArmNN Delegate
45 
47 
48 void TfLiteArmnnDelegateDelete(TfLiteDelegate* tfLiteDelegate);
49 
50 TfLiteStatus DoPrepare(TfLiteContext* context, TfLiteDelegate* delegate);
51 
52 /// ArmNN Delegate
53 class Delegate
54 {
55  friend class ArmnnSubgraph;
56 public:
57  explicit Delegate(armnnDelegate::DelegateOptions options);
58 
59  TfLiteIntArray* IdentifyOperatorsToDelegate(TfLiteContext* context);
60 
61  TfLiteDelegate* GetDelegate();
62 
63  /// Retrieve version in X.Y.Z form
64  static const std::string GetVersion();
65 
66 private:
67  /**
68  * Returns a pointer to the armnn::IRuntime* this will be shared by all armnn_delegates.
69  */
70  armnn::IRuntime* GetRuntime(const armnn::IRuntime::CreationOptions& options)
71  {
72  static armnn::IRuntimePtr instance = armnn::IRuntime::Create(options);
73  // Instantiated on first use.
74  return instance.get();
75  }
76 
77  TfLiteDelegate m_Delegate = {
78  reinterpret_cast<void*>(this), // .data_
79  DoPrepare, // .Prepare
80  nullptr, // .CopyFromBufferHandle
81  nullptr, // .CopyToBufferHandle
82  nullptr, // .FreeBufferHandle
83  kTfLiteDelegateFlagsNone, // .flags
84  };
85 
86  /// ArmNN Runtime pointer
87  armnn::IRuntime* m_Runtime;
88  /// ArmNN Delegate Options
90 };
91 
92 /// ArmnnSubgraph class where parsing the nodes to ArmNN format and creating the ArmNN Graph
94 {
95 public:
96  static ArmnnSubgraph* Create(TfLiteContext* tfLiteContext,
97  const TfLiteDelegateParams* parameters,
98  const Delegate* delegate);
99 
100  TfLiteStatus Prepare(TfLiteContext* tfLiteContext);
101 
102  TfLiteStatus Invoke(TfLiteContext* tfLiteContext, TfLiteNode* tfLiteNode);
103 
104  static TfLiteStatus VisitNode(DelegateData& delegateData,
105  TfLiteContext* tfLiteContext,
106  TfLiteRegistration* tfLiteRegistration,
107  TfLiteNode* tfLiteNode,
108  int nodeIndex);
109 
110 private:
112  armnn::IRuntime* runtime,
113  std::vector<armnn::BindingPointInfo>& inputBindings,
114  std::vector<armnn::BindingPointInfo>& outputBindings)
115  : m_NetworkId(networkId), m_Runtime(runtime), m_InputBindings(inputBindings), m_OutputBindings(outputBindings)
116  {}
117 
118  static TfLiteStatus AddInputLayer(DelegateData& delegateData,
119  TfLiteContext* tfLiteContext,
120  const TfLiteIntArray* inputs,
121  std::vector<armnn::BindingPointInfo>& inputBindings);
122 
123  static TfLiteStatus AddOutputLayer(DelegateData& delegateData,
124  TfLiteContext* tfLiteContext,
125  const TfLiteIntArray* outputs,
126  std::vector<armnn::BindingPointInfo>& outputBindings);
127 
128 
129  /// The Network Id
130  armnn::NetworkId m_NetworkId;
131  /// ArmNN Rumtime
132  armnn::IRuntime* m_Runtime;
133 
134  // Binding information for inputs and outputs
135  std::vector<armnn::BindingPointInfo> m_InputBindings;
136  std::vector<armnn::BindingPointInfo> m_OutputBindings;
137 
138 };
139 
140 } // armnnDelegate namespace
141 
142 
TfLiteStatus DoPrepare(TfLiteContext *context, TfLiteDelegate *delegate)
+
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:52
+ +
DelegateData(const std::vector< armnn::BackendId > &backends)
+ +
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:41
+
std::vector< armnn::IOutputSlot * > m_OutputSlotForNode
+ +
const std::string GetVersion()
Definition: Utils.cpp:77
+
armnn::INetworkPtr m_Network
+
const std::vector< armnn::BackendId > m_Backends
+
int NetworkId
Definition: IRuntime.hpp:35
+ + +
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
Definition: INetwork.hpp:252
+
+
+ + + + -- cgit v1.2.1