From fb6f20cfbda45a5cce120a77f1dd1c826ed135e9 Mon Sep 17 00:00:00 2001 From: Sourabh Bajaj Date: Mon, 24 Jun 2019 16:18:17 -0700 Subject: [PATCH] Fix the cluster spec propagation PiperOrigin-RevId: 254858853 --- .../contrib/distribute/python/examples/mnist_tf1_tpu.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow/contrib/distribute/python/examples/mnist_tf1_tpu.py b/tensorflow/contrib/distribute/python/examples/mnist_tf1_tpu.py index feb9d753ea3..df0e5479d98 100644 --- a/tensorflow/contrib/distribute/python/examples/mnist_tf1_tpu.py +++ b/tensorflow/contrib/distribute/python/examples/mnist_tf1_tpu.py @@ -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])