| 415 | } |
| 416 | |
| 417 | StatusOr<ShapedBuffer> PyLocalBuffer::AsShapedBuffer() const { |
| 418 | absl::MutexLock lock(&mu_); |
| 419 | if (!device_buffer_) { |
| 420 | return InvalidArgument( |
| 421 | "Attempted to fetch value of invalid/deleted buffer."); |
| 422 | } |
| 423 | return device_buffer_->AsShapedBuffer(on_host_shape_, on_device_shape_, |
| 424 | client_->client()->platform()); |
| 425 | } |
| 426 | |
| 427 | StatusOr<std::vector<std::unique_ptr<PyLocalBuffer>>> |
| 428 | PyLocalBuffer::DestructureTuple() { |