From e5489b8999672d6ad8b5ee6382312419a1b0003e Mon Sep 17 00:00:00 2001 From: zhaocaibei123 Date: Thu, 24 Mar 2022 04:22:37 +0000 Subject: [PATCH] test=document_fix --- python/paddle/fluid/communicator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/communicator.py b/python/paddle/fluid/communicator.py index 2a4f125eb3635..d12af8ee72389 100644 --- a/python/paddle/fluid/communicator.py +++ b/python/paddle/fluid/communicator.py @@ -97,7 +97,9 @@ def init_with_ctx(self, recv_ctx, proto_txt, unit64_hosts, - scope=global_scope()): + scope=None): + if scope == None: + scope = global_scope() self.communicator_ = core.DistCommunicator(self.mode, proto_txt, unit64_hosts, send_ctx, recv_ctx, scope, self.envs) @@ -191,7 +193,9 @@ def init_params(self, context): def pull_dense(self, context): self.communicator_.pull_dense(context) - def push_sparse_param(self, var_name, table_id=-1, scope=global_scope()): + def push_sparse_param(self, var_name, table_id=-1, scope=None): + if scope == None: + scope = global_scope() if not self.is_running(): raise ValueError( "Communicator should init first. Using fleet.init_worker() before push_sparse_param()"