Notice that buf_ either points to a regular TensorBuffer or a SubBuffer. For the latter case, we have to make sure that the refcount is one both for the SubBuffer _and_ the underlying TensorBuffer.
Source from the content-addressed store, hash-verified