| 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(); |
no test coverage detected