From e443d034d676d309b43ed470ba37b2bc9ea43ec0 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Tue, 23 Jan 2018 02:23:54 +0000 Subject: [PATCH] bring back share data --- paddle/operators/parallel_do_op.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paddle/operators/parallel_do_op.cc b/paddle/operators/parallel_do_op.cc index 77936cf58e3..dd8a9e05f93 100644 --- a/paddle/operators/parallel_do_op.cc +++ b/paddle/operators/parallel_do_op.cc @@ -79,11 +79,11 @@ inline void CopyOrShare(const framework::Variable& src, auto *dst_sr = dst->GetMutable(); dst_sr->set_rows(src_sr.rows()); dst_sr->set_height(src_sr.height()); - Copy(src_sr.value(), dst_place, dst_sr->mutable_value()); -// if (src_sr.value().place() == dst_place) { -// dst_sr->mutable_value()->ShareDataWith(src_sr.value()); -// } else { -// } + if (src_sr.value().place() == dst_place) { + dst_sr->mutable_value()->ShareDataWith(src_sr.value()); + } else { + Copy(src_sr.value(), dst_place, dst_sr->mutable_value()); + } } else { PADDLE_THROW("Expect LoDTensor/SelectedRows, get %s", src.Type().name()); } -- GitLab