Fix the cluster spec propagation

PiperOrigin-RevId: 254858853
This commit is contained in:
Sourabh Bajaj 2019-06-24 16:18:17 -07:00 committed by TensorFlower Gardener
parent 4f30dfe6bb
commit fb6f20cfbd

View File

@ -155,8 +155,9 @@ def main(argv):
test_accuracy.variables)
config = tf.ConfigProto()
config.cluster_def.CopyFrom(
cluster_resolver.cluster_spec().as_cluster_def())
cluster_spec = cluster_resolver.cluster_spec()
if cluster_spec:
config.cluster_def.CopyFrom(cluster_spec.as_cluster_def())
with tf.Session(cluster_resolver.master(), config=config) as session:
session.run([v.initializer for v in all_variables])