Skip to content

Commit 778ec77

Browse files
authored
remove useless lod copy (#42425)
1 parent 16ef2b2 commit 778ec77

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

paddle/phi/core/dense_tensor_impl.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,15 @@ std::vector<DenseTensor> DenseTensor::Chunk(int64_t chunks,
356356

357357
DenseTensor& DenseTensor::ShareDataWith(const DenseTensor& src) {
358358
src.check_memory_size();
359-
// Preserve LoD
360-
auto lod = meta_.lod;
361-
*this = src;
362-
meta_.lod = lod;
359+
holder_ = src.holder_;
360+
meta_.is_scalar = src.meta_.is_scalar;
361+
meta_.dims = src.meta_.dims;
362+
meta_.dtype = src.meta_.dtype;
363+
meta_.layout = src.meta_.layout;
364+
meta_.offset = src.meta_.offset;
365+
#ifdef PADDLE_WITH_MKLDNN
366+
format_ = src.format_;
367+
#endif
363368
return *this;
364369
}
365370

0 commit comments

Comments
 (0)