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:
parent
d6b43ac543
commit
01f6e6b5d1
@ -20,9 +20,10 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import threading
|
||||||
|
|
||||||
|
|
||||||
class TpuContext(object):
|
class TpuContext(threading.local):
|
||||||
"""A context object holding state about the TPU computation being built."""
|
"""A context object holding state about the TPU computation being built."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user