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 34192278d84758d720e021215c14a54349ba0c62..49dde44d6b65eecb1859dd4697c4a6440ceaeadb 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); } };