diff options
author | 2018-07-31 10:01:05 -0700 | |
---|---|---|
committer | 2018-07-31 10:05:40 -0700 | |
commit | 3fa30255c57b807c3f4b92c7f34c77e8128e911f (patch) | |
tree | a7762b2ba170d87de8868917070085c1c5de9842 /tensorflow/python/client | |
parent | 356a9f85c0c2fadd9c11c5f201ced9fe2c490ada (diff) |
Enable error interpolation in Python.
It is still guarded by an experimental config setting and can be enabled using e.g.
config = tf.ConfigProto()
config.experimental.client_handles_error_formatting = True
with tf.Session(config=config) as sess:
...
PiperOrigin-RevId: 206779413
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r-- | tensorflow/python/client/session.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/python/client/session.py b/tensorflow/python/client/session.py index f8e20e1b89..58a002c776 100644 --- a/tensorflow/python/client/session.py +++ b/tensorflow/python/client/session.py @@ -29,6 +29,7 @@ import numpy as np from tensorflow.core.protobuf import config_pb2 from tensorflow.python import pywrap_tensorflow as tf_session from tensorflow.python.framework import device +from tensorflow.python.framework import error_interpolation from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor @@ -1301,6 +1302,9 @@ class BaseSession(SessionInterface): node_def = op.node_def except KeyError: pass + if (self._config is not None and + self._config.experimental.client_handles_error_formatting): + message = error_interpolation.interpolate(message, self._graph) raise type(e)(node_def, op, message) def _extend_graph(self): |