From 805e659f8ef383568e68f9b49adf78951582743d Mon Sep 17 00:00:00 2001 From: Frank Chen Date: Mon, 25 Nov 2019 13:32:38 -0800 Subject: [PATCH] Move check for `local` to before check for `force` in TPU driver PiperOrigin-RevId: 282422376 Change-Id: Ib0197d5d5edc60c2f0b615690b744872a064693d --- .../compiler/xla/python/tpu_driver/client/tpu_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xla/python/tpu_driver/client/tpu_client.py b/tensorflow/compiler/xla/python/tpu_driver/client/tpu_client.py index f86a7869ec4..43c0d1a40c3 100644 --- a/tensorflow/compiler/xla/python/tpu_driver/client/tpu_client.py +++ b/tensorflow/compiler/xla/python/tpu_driver/client/tpu_client.py @@ -53,10 +53,10 @@ class TpuBackend(xla_client.Backend): if worker == 'local' or 'local://' in worker: # We usually want to cache for local backends to prevent double # initialization, except where `force` == True. - if force: - return TpuBackend(_tpu_client.TpuClient.Get(worker)) if worker == 'local': worker = 'local://' + if force: + return TpuBackend(_tpu_client.TpuClient.Get(worker)) if TpuBackend._local_backend is None: logging.info('Starting the local TPU driver.') TpuBackend._local_backend = TpuBackend(