From 17f9be55ad525270e2ae157392955d3269f24f9e Mon Sep 17 00:00:00 2001 From: typhoonzero Date: Fri, 15 Dec 2017 19:54:42 +0800 Subject: [PATCH] update for multi trainer --- paddle/operators/recv_op.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/paddle/operators/recv_op.cc b/paddle/operators/recv_op.cc index 07e66492e..731e5e475 100644 --- a/paddle/operators/recv_op.cc +++ b/paddle/operators/recv_op.cc @@ -95,6 +95,12 @@ class RecvOp : public framework::OperatorBase { } VLOG(10) << "recved grad: " << grad_var_name << " updating param: " << param_var_name; + auto *merged_grad = recv_scope.FindVar(grad_var_name); + if (merged_grad == nullptr) { + // create output of merged var. + recv_scope.Var(grad_var_name); + } + if (trainer_count > 1) { grad_var_name = this->GetGradVarNameForTrainer(grad_var_name); } -- GitLab