本文整理匯總了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)