From f95f3a656fcb78cccf11c8ee97aeaded6a4a7f20 Mon Sep 17 00:00:00 2001 From: zhaocaibei123 <48509226+zhaocaibei123@users.noreply.github.com> Date: Thu, 24 Mar 2022 14:30:37 +0800 Subject: [PATCH] modify communicator api (#40881) --- 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 2a4f125eb3..d12af8ee72 100644 --- a/python/paddle/fluid/communicator.py +++ b/python/paddle/fluid/communicator.py @@ -97,7 +97,9 @@ class Communicator(object): 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 @@ class Communicator(object): 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()" -- GitLab