Move check for local to before check for force in TPU driver

PiperOrigin-RevId: 282422376
Change-Id: Ib0197d5d5edc60c2f0b615690b744872a064693d
This commit is contained in:
Frank Chen 2019-11-25 13:32:38 -08:00 committed by TensorFlower Gardener
parent f39dec8996
commit 805e659f8e

View File

@ -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(