本文整理汇总了Python中horovod.tensorflow.broadcast_global_variables方法的典型用法代码示例。如果您正苦于以下问题:Python tensorflow.broadcast_global_variables方法的具体用法?Python tensorflow.broadcast_global_variables怎么用?Python tensorflow.broadcast_global_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horovod.tensorflow
的用法示例。
在下文中一共展示了tensorflow.broadcast_global_variables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: broadcast_global_variables
# 需要导入模块: from horovod import tensorflow [as 别名]
# 或者: from horovod.tensorflow import broadcast_global_variables [as 别名]
def broadcast_global_variables(cls, *args):
"""Get a TensorFlow operation to broadcast all the global variables."""
try:
return mgw.broadcast_global_variables(*args)
except NameError:
raise NameError('module <mgw> not imported')
示例2: broadcast_global_variables
# 需要导入模块: from horovod import tensorflow [as 别名]
# 或者: from horovod.tensorflow import broadcast_global_variables [as 别名]
def broadcast_global_variables(root_rank):
"""Broadcasts all global variables from root rank to all other processes.
Arguments:
root_rank: Rank of the process from which global variables will be broadcasted
to all other processes.
"""
bcast_op = hvd.broadcast_global_variables(root_rank)
return K.get_session().run(bcast_op)
示例3: on_train_begin
# 需要导入模块: from horovod import tensorflow [as 别名]
# 或者: from horovod.tensorflow import broadcast_global_variables [as 别名]
def on_train_begin(self, logs=None):
with tf.device(self.device):
bcast_op = hvd.broadcast_global_variables(self.root_rank)
K.get_session().run(bcast_op)