Return false instead of crashing in Tensor::SharesBufferWith if neither tensor has...
authorA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 12 Feb 2018 22:01:51 +0000 (14:01 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 12 Feb 2018 22:05:39 +0000 (14:05 -0800)
commitb47dcaf853f56f2709db06eb5aec83c545a5c87e
tree72e12d637d9f23490592cd79dacb424786ebf324
parent0981949cb426c1cf8c6c8c027144d99823a73abd
Return false instead of crashing in Tensor::SharesBufferWith if neither tensor has a buffer assigned yet, since that is a valid state. Returning

  buf_ != nullptr && b.buf_ != nullptr &&  buf_->root_buffer() == b.buf_->root_buffer();

still satisfies the contract in the header, i.e. "True iff the two tensors use the same underlying refcounted storage."

PiperOrigin-RevId: 185431574
tensorflow/core/framework/tensor.cc
tensorflow/core/framework/tensor_test.cc