未验证 提交 f95f3a65 编写于 作者: Z zhaocaibei123 提交者: GitHub

modify communicator api (#40881)

上级 2e736531
...@@ -97,7 +97,9 @@ class Communicator(object): ...@@ -97,7 +97,9 @@ class Communicator(object):
recv_ctx, recv_ctx,
proto_txt, proto_txt,
unit64_hosts, unit64_hosts,
scope=global_scope()): scope=None):
if scope == None:
scope = global_scope()
self.communicator_ = core.DistCommunicator(self.mode, proto_txt, self.communicator_ = core.DistCommunicator(self.mode, proto_txt,
unit64_hosts, send_ctx, unit64_hosts, send_ctx,
recv_ctx, scope, self.envs) recv_ctx, scope, self.envs)
...@@ -191,7 +193,9 @@ class Communicator(object): ...@@ -191,7 +193,9 @@ class Communicator(object):
def pull_dense(self, context): def pull_dense(self, context):
self.communicator_.pull_dense(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(): if not self.is_running():
raise ValueError( raise ValueError(
"Communicator should init first. Using fleet.init_worker() before push_sparse_param()" "Communicator should init first. Using fleet.init_worker() before push_sparse_param()"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册