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

Method BuildEagerInputs

tensorflow/lite/delegates/flex/kernel.cc:275–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }
274
275 tensorflow::Status BuildEagerInputs(const BufferMap* buffer_map) {
276 for (int i = 0; i < inputs_.Size(); ++i) {
277 int input_index = inputs_.TfLiteIndex(i);
278 TensorSource s = inputs_.GetTensorSource(i);
279 if (!s.node) {
280 // This input is not produced by this Eager subgraph (it could be a TF
281 // Lite native buffer, or could be produced by a separater subgraph). We
282 // need to fetch it from the delegate's buffer_map.
283 if (!buffer_map->HasTensor(input_index)) {
284 return tensorflow::errors::Internal(
285 "Cannot read from invalid tensor index ", input_index);
286 }
287 tensorflow::TensorHandle* handle;
288 TF_RETURN_IF_ERROR(tensorflow::TensorHandle::CreateLocalHandle(
289 buffer_map->GetTensor(input_index), &handle));
290 op_->MutableInputs()->push_back(handle);
291 } else {
292 // If this is a forwardable tensor, we will remove it from the previous
293 // op's list, giving TF the opportunity to reuse its buffer.
294 bool unref_handle = inputs_.IsForwardable(i);
295 auto* handle =
296 s.node->outputs_.GetHandle(s.node_output_index, unref_handle);
297 op_->MutableInputs()->push_back(handle);
298 }
299 }
300 return tensorflow::Status::OK();
301 }
302
303 tensorflow::Status PersistEagerOutputs(BufferMap* buffer_map) {
304 auto* handles = outputs_.GetTensorHandles();

Callers 1

ExecuteFlexOpFunction · 0.80

Calls 10

InternalFunction · 0.85
GetTensorSourceMethod · 0.80
MutableInputsMethod · 0.80
IsForwardableMethod · 0.80
SizeMethod · 0.45
TfLiteIndexMethod · 0.45
HasTensorMethod · 0.45
GetTensorMethod · 0.45
push_backMethod · 0.45
GetHandleMethod · 0.45

Tested by

no test coverage detected