in-process TensorFlow 服务器,用于分布式训练。
用法
tf.distribute.Server(
server_or_cluster_def, job_name=None, task_index=None, protocol=None,
config=None, start=True
)参数
-
server_or_cluster_deftf.train.ServerDef或tf.train.ClusterDef协议缓冲区或tf.train.ClusterSpec对象,说明要创建的服务器和/或它所属的集群。 -
job_name(可选。)指定服务器所属的作业的名称。如果指定,默认为server_or_cluster_def中的值。 -
task_index(可选。)指定服务器在其作业中的任务索引。如果指定,默认为server_or_cluster_def中的值。否则,如果服务器的作业只有一项任务,则默认为 0。 -
protocol(可选。)指定服务器要使用的协议。可接受的值包括"grpc", "grpc+verbs"。如果指定,默认为server_or_cluster_def中的值。否则默认为"grpc"。 -
config(选项。)tf.compat.v1.ConfigProto,指定在此服务器上运行的所有会话的默认配置选项。 -
start(可选。)布尔值,表示创建后是否启动服务器。默认为True。
抛出
-
tf.errors.OpError如果在创建 TensorFlow 服务器时发生错误,则为其子类之一。
属性
-
server_def返回此服务器的tf.train.ServerDef。 -
target返回一个目标tf.compat.v1.Session连接到此服务器。要创建连接到此服务器的
tf.compat.v1.Session,请使用以下代码段:server = tf.distribute.Server(...) with tf.compat.v1.Session(server.target): # ...
一个tf.distribute.Server 实例封装了一组设备和一个可以参与分布式训练的tf.compat.v1.Session 目标。服务器属于一个集群(由 tf.train.ClusterSpec 指定),并且对应于命名作业中的特定任务。该服务器可以与同一集群中的任何其他服务器进行通信。
相关用法
- Python tf.distribute.Strategy.scope用法及代码示例
- Python tf.distribute.Strategy.experimental_distribute_values_from_function用法及代码示例
- Python tf.distribute.StrategyExtended.reduce_to用法及代码示例
- Python tf.distribute.StrategyExtended.variable_created_in_scope用法及代码示例
- Python tf.distribute.Strategy用法及代码示例
- Python tf.distribute.StrategyExtended.batch_reduce_to用法及代码示例
- Python tf.distribute.Strategy.reduce用法及代码示例
- Python tf.distribute.StrategyExtended.update用法及代码示例
- Python tf.distribute.Strategy.experimental_distribute_dataset用法及代码示例
- Python tf.distribute.StrategyExtended.colocate_vars_with用法及代码示例
- Python tf.distribute.Strategy.run用法及代码示例
- Python tf.distribute.Strategy.gather用法及代码示例
- Python tf.distribute.OneDeviceStrategy.experimental_distribute_values_from_function用法及代码示例
- Python tf.distribute.TPUStrategy用法及代码示例
- Python tf.distribute.experimental_set_strategy用法及代码示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy.gather用法及代码示例
- Python tf.distribute.cluster_resolver.TFConfigClusterResolver用法及代码示例
- Python tf.distribute.experimental.MultiWorkerMirroredStrategy用法及代码示例
- Python tf.distribute.TPUStrategy.experimental_assign_to_logical_device用法及代码示例
- Python tf.distribute.NcclAllReduce用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.distribute.Server。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
