| 51 | } |
| 52 | |
| 53 | Status TensorResponse::InitFrom(RecvTensorResponse* response) { |
| 54 | Status s; |
| 55 | meta_.Swap(response); |
| 56 | if (on_host_) { |
| 57 | if (!tensor_.FromProto(allocator_, meta_.tensor())) { |
| 58 | s = errors::InvalidArgument("Cannot parse tensor from response"); |
| 59 | } |
| 60 | } else { |
| 61 | s = device_->MakeTensorFromProto(meta_.tensor(), alloc_attrs_, &tensor_); |
| 62 | } |
| 63 | { |
| 64 | TensorProto empty; |
| 65 | meta_.mutable_tensor()->Swap(&empty); |
| 66 | } |
| 67 | meta_.clear_tensor(); |
| 68 | return s; |
| 69 | } |
| 70 | |
| 71 | void TensorResponse::InitPartial(const RecvTensorResponse& response, |
| 72 | const AllocationAttributes& allocation_attr) { |
nothing calls this directly
no test coverage detected