From ae8b5f11a39f4ff4d65445752b5caa79f8a8cd3a Mon Sep 17 00:00:00 2001 From: guofei <52460041+gfwm2013@users.noreply.github.com> Date: Wed, 26 Feb 2020 19:58:00 +0800 Subject: [PATCH] Change ShareDataWith() to TensorCopy() in ref_by_trainer_id (#22717) As the title --- paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h index 34192278d84..49dde44d6b6 100644 --- a/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h +++ b/paddle/fluid/operators/distributed_ops/ref_by_trainer_id_op.h @@ -40,7 +40,8 @@ class RefByTrainerIdKernel : public framework::OpKernel { } PADDLE_ENFORCE_LT((size_t)trainer_id, in_list.size()); out->mutable_data(context.GetPlace()); - out->ShareDataWith(*(in_list[trainer_id])); + framework::TensorCopy(*(in_list[trainer_id]), in_list[trainer_id]->place(), + out); } }; -- GitLab