Make TpuContext thread-local.

tf.contrib.AsyncCheckpointSaverHook creates a thread to asynchronously run the export, which currently breaks when exporting a TPU graph.

PiperOrigin-RevId: 258184145
This commit is contained in:
A. Unique TensorFlower 2019-07-15 09:59:36 -07:00 committed by TensorFlower Gardener
parent d6b43ac543
commit 01f6e6b5d1

View File

@ -20,9 +20,10 @@ from __future__ import division
from __future__ import print_function
import contextlib
import threading
class TpuContext(object):
class TpuContext(threading.local):
"""A context object holding state about the TPU computation being built."""
def __init__(self):