| 439 | #endif |
| 440 | |
| 441 | Status TensorHandle::SetTensor(const tensorflow::Tensor& tensor) { |
| 442 | DCHECK(!is_remote_) << "SetTensor is not called on remote handles."; |
| 443 | DCHECK(!is_ready_notification_.HasBeenNotified()) |
| 444 | << "SetTensor is only called on non-ready handles."; |
| 445 | |
| 446 | VLOG(3) << "SetTensor on TensorHandle: " << this; |
| 447 | |
| 448 | if (tensor.dtype() == DT_RESOURCE) { |
| 449 | auto& resource_handle = tensor.flat<class ResourceHandle>()(0); |
| 450 | handle_dtypes_and_shapes_ = resource_handle.dtypes_and_shapes(); |
| 451 | } |
| 452 | tensor_handle_data_ = absl::make_unique<LocalTensorHandleData>(tensor); |
| 453 | is_poisoned_ = Status::OK(); |
| 454 | is_ready_notification_.Notify(); |
| 455 | return Status::OK(); |
| 456 | } |
| 457 | |
| 458 | void TensorHandle::Poison(Status status) { |
| 459 | DCHECK(!is_ready_notification_.HasBeenNotified()) |
no test coverage detected