| 709 | Tensor::~Tensor() { UnrefIfNonNull(buf_); } |
| 710 | |
| 711 | void Tensor::CopyFromInternal(const Tensor& other, const TensorShape& shape) { |
| 712 | CHECK_EQ(shape.num_elements(), other.NumElements()); |
| 713 | // Data type will be overwritten if this == &other, since dtype is part of |
| 714 | // shape. |
| 715 | DataType other_dtype = other.dtype(); |
| 716 | shape_ = shape; |
| 717 | set_dtype(other_dtype); |
| 718 | if (buf_ != other.buf_) { |
| 719 | UnrefIfNonNull(buf_); |
| 720 | buf_ = other.buf_; |
| 721 | RefIfNonNull(buf_); |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | Status Tensor::BitcastFrom(const Tensor& other, DataType dtype, |
| 726 | const TensorShape& shape) { |
nothing calls this directly
no test coverage detected