MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Interpreter

Class Interpreter

tensorflow/lite/interpreter.h:113–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111///
112
113class Interpreter {
114 public:
115 /// Instantiate an interpreter. All errors associated with reading and
116 /// processing this model will be forwarded to the error_reporter object.
117 //
118 /// Note, if error_reporter is nullptr, then a default StderrReporter is
119 /// used. Ownership of 'error_reporter' remains with the caller.
120 explicit Interpreter(ErrorReporter* error_reporter = DefaultErrorReporter());
121
122 ~Interpreter();
123
124 // Interpreters are not copyable as they have non-trivial memory semantics.
125 Interpreter(const Interpreter&) = delete;
126 Interpreter& operator=(const Interpreter&) = delete;
127
128 // Functions to build interpreter
129#ifndef DOXYGEN_SKIP
130 /// Provide a list of tensor indexes that are inputs to the model.
131 /// Each index is bound check and this modifies the consistent_ flag of the
132 /// interpreter.
133 TfLiteStatus SetInputs(std::vector<int> inputs);
134
135 /// Provide a list of tensor indexes that are outputs to the model
136 /// Each index is bound check and this modifies the consistent_ flag of the
137 /// interpreter.
138 TfLiteStatus SetOutputs(std::vector<int> outputs);
139
140 /// Provide a list of tensor indexes that are variable tensors.
141 /// Each index is bound check and this modifies the consistent_ flag of the
142 /// interpreter.
143 TfLiteStatus SetVariables(std::vector<int> variables);
144
145 /// Ensure the internal node storage memory allocates at least `count`
146 /// spots for node. NOTE, this doesn't actually add operators. This is an
147 /// efficiency optimization that is subject to change.
148 void ReserveNodes(int count);
149
150 /// Adds a node with the given parameters and returns the index of the new
151 /// node in `node_index` (optionally). Interpreter will take ownership of
152 /// `builtin_data` and destroy it with `free`. Ownership of 'init_data'
153 /// remains with the caller.
154 TfLiteStatus AddNodeWithParameters(const std::vector<int>& inputs,
155 const std::vector<int>& outputs,
156 const char* init_data,
157 size_t init_data_size, void* builtin_data,
158 const TfLiteRegistration* registration,
159 int* node_index = nullptr);
160
161 /// Adds `tensors_to_add` tensors, preserving pre-existing Tensor entries.
162 /// The value pointed to by `first_new_tensor_index` will be set to the
163 /// index of the first new tensor if `first_new_tensor_index` is non-null.
164 TfLiteStatus AddTensors(int tensors_to_add,
165 int* first_new_tensor_index = nullptr);
166
167 /// Set description of inputs/outputs/data/fptrs for node `node_index`.
168 /// This variant assumes an external buffer has been allocated of size
169 /// bytes. The lifetime of buffer must be ensured to be greater or equal
170 /// to Interpreter.

Callers

nothing calls this directly

Calls 5

DefaultErrorReporterFunction · 0.85
inputsMethod · 0.45
outputsMethod · 0.45
variablesMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected