diff options
author | Sanjoy Das <sanjoy@google.com> | 2018-07-19 15:39:25 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-07-19 15:43:02 -0700 |
commit | b7b86af2425f166c586fef80e6ae46991cdedde9 (patch) | |
tree | a8fa81f855d67dd1fbf0b38c18ec101cde0d7cbc | |
parent | 97f89dcd6ec02d40f6aae1d5ce5ffa377a40c110 (diff) |
Teach XlaTensorBuffer to not deallocate null pointers
Zero sized XlaTensorBuffer can have null as the backing storage. De-allocating
a null pointer produces an annoying warning from the BFCAllocator.
PiperOrigin-RevId: 205314271
-rw-r--r-- | tensorflow/compiler/jit/xla_launch_util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tensorflow/compiler/jit/xla_launch_util.h b/tensorflow/compiler/jit/xla_launch_util.h index 90531174ff..1ea3fa4cf2 100644 --- a/tensorflow/compiler/jit/xla_launch_util.h +++ b/tensorflow/compiler/jit/xla_launch_util.h @@ -122,7 +122,11 @@ class XlaTensorBuffer : public TensorBuffer { data_ = const_cast<void*>(ptr); } - ~XlaTensorBuffer() override { allocator_->DeallocateRaw(data_); } + ~XlaTensorBuffer() override { + if (data_) { + allocator_->DeallocateRaw(data_); + } + } void* data() const override { return data_; } size_t size() const override { return expected_size_; } |