From d914e48cd192564edd00007044a06e7bf23c386c Mon Sep 17 00:00:00 2001 From: Davide Libenzi Date: Tue, 21 Apr 2020 12:29:40 -0700 Subject: [PATCH] Do not assert for null device memory pointer if size is zero. PiperOrigin-RevId: 307658410 Change-Id: I198173e9a3e4d967075f9b31da211f6c73c5572f --- tensorflow/compiler/xrt/xrt_state.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xrt/xrt_state.cc b/tensorflow/compiler/xrt/xrt_state.cc index a0daa5c6c23..c2f9a1c62c9 100644 --- a/tensorflow/compiler/xrt/xrt_state.cc +++ b/tensorflow/compiler/xrt/xrt_state.cc @@ -588,7 +588,8 @@ xla::StatusOr XRTTupleAllocation::ToShapedBuffer() { allocator_->platform(), device_ordinal_); for (const auto& index_buffer : buffers_) { if (index_buffer.second == nullptr || - index_buffer.second->allocation().is_null()) { + (index_buffer.second->allocation().is_null() && + index_buffer.second->allocation().size() > 0)) { return errors::InvalidArgument("Literal buffer at index ", index_buffer.first.ToString(), " has been released"); @@ -652,7 +653,8 @@ xla::StatusOr XRTTupleAllocation::ToExecutionInput( xla::ExecutionInput result(on_device_shape()); for (const auto& index_buffer : buffers_) { if (index_buffer.second == nullptr || - index_buffer.second->allocation().is_null()) { + (index_buffer.second->allocation().is_null() && + index_buffer.second->allocation().size() > 0)) { return errors::InvalidArgument("Literal buffer at index ", index_buffer.first.ToString(), " has been released");