diff --git a/paddle/phi/core/dense_tensor.h b/paddle/phi/core/dense_tensor.h index 1a40df1f2b355331f16622a1bfc87e5c94e76e79..50bc9547f9cd65984ffd8c8502678817ef193790 100644 --- a/paddle/phi/core/dense_tensor.h +++ b/paddle/phi/core/dense_tensor.h @@ -190,6 +190,11 @@ class DenseTensor : public TensorBase, void set_storage_properties( std::unique_ptr&& storage_properties); + void clear() { + holder_.reset(); + meta_.offset = 0; + } + private: friend class DenseTensorUtils; friend class phi::distributed::DistTensor; diff --git a/paddle/phi/core/dense_tensor.inl b/paddle/phi/core/dense_tensor.inl index 025b3b0efba168ca8c207310fac52e2b8be70474..2a3e3ab1d78c489ef767a5b3e07d56908c741320 100644 --- a/paddle/phi/core/dense_tensor.inl +++ b/paddle/phi/core/dense_tensor.inl @@ -57,11 +57,6 @@ void check_memory_size() const; void set_layout(const DataLayout layout); -void clear() { - holder_.reset(); - meta_.offset = 0; -} - void ShareBufferWith(const DenseTensor& tensor, bool only_buffer=false); void ShareDataTypeWith(const DenseTensor& tensor) {