diff options
Diffstat (limited to 'tensorflow/core/common_runtime/sycl/sycl_allocator.cc')
-rw-r--r-- | tensorflow/core/common_runtime/sycl/sycl_allocator.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tensorflow/core/common_runtime/sycl/sycl_allocator.cc b/tensorflow/core/common_runtime/sycl/sycl_allocator.cc index 699b54f345..0d238276f4 100644 --- a/tensorflow/core/common_runtime/sycl/sycl_allocator.cc +++ b/tensorflow/core/common_runtime/sycl/sycl_allocator.cc @@ -36,8 +36,10 @@ void SYCLAllocator::DeallocateRaw(void *ptr) { } void SYCLAllocator::EnterLameDuckMode() { - device_->deallocate_all(); - device_ = nullptr; + if (device_) { + device_->deallocate_all(); + device_ = nullptr; + } } } // namespace tensorflow |