tf.train.ClusterSpec: 将集群表示为一组"tasks",组织成"jobs"。
用法
tf.train.ClusterSpec(
cluster
)
参数
- cluster 将一个或多个作业名称映射到 (i) 网络地址列表,或 (ii) 将整数任务索引映射到网络地址的字典;或 tf.train.ClusterDef 协议缓冲区。
抛出
- TypeError 如果 cluster 不是将字符串映射到字符串列表的字典,也不是 tf.train.ClusterDef protobuf。
属性
- jobs 返回此集群中的作业名称列表。
tf.train.ClusterSpec 表示参与分布式 TensorFlow 计算的进程集。每个tf.distribute.Server 都在一个特定的集群中构建。
要创建具有两个作业和五个任务的集群,您需要指定从作业名称到网络地址列表(通常为 hostname-port 对)的映射。
cluster = tf.train.ClusterSpec({"worker":["worker0.example.com:2222",
"worker1.example.com:2222",
"worker2.example.com:2222"],
"ps":["ps0.example.com:2222",
"ps1.example.com:2222"]})
每个作业也可以指定为从任务索引到网络地址的稀疏映射。这使得无需知道(例如)所有其他工作任务的身份即可配置服务器:
cluster = tf.train.ClusterSpec({"worker":{1:"worker1.example.com:2222"},
"ps":["ps0.example.com:2222",
"ps1.example.com:2222"]})
搬运 http://www.manongjc.com/detail/31-exnksmnihnyspkh.html
参考学习https://blog.csdn.net/bojikeqian/article/details/120666710