From 778ec77be9943e00a9bc1081f80e7f2b9a2cd2ff Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 1 May 2022 19:54:02 +0800 Subject: [PATCH] remove useless lod copy (#42425) --- paddle/phi/core/dense_tensor_impl.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/paddle/phi/core/dense_tensor_impl.cc b/paddle/phi/core/dense_tensor_impl.cc index 5ee83089589..60b71ca97e1 100644 --- a/paddle/phi/core/dense_tensor_impl.cc +++ b/paddle/phi/core/dense_tensor_impl.cc @@ -356,10 +356,15 @@ std::vector DenseTensor::Chunk(int64_t chunks, DenseTensor& DenseTensor::ShareDataWith(const DenseTensor& src) { src.check_memory_size(); - // Preserve LoD - auto lod = meta_.lod; - *this = src; - meta_.lod = lod; + holder_ = src.holder_; + meta_.is_scalar = src.meta_.is_scalar; + meta_.dims = src.meta_.dims; + meta_.dtype = src.meta_.dtype; + meta_.layout = src.meta_.layout; + meta_.offset = src.meta_.offset; +#ifdef PADDLE_WITH_MKLDNN + format_ = src.format_; +#endif return *this; } -- GitLab