aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/client
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-07-27 14:03:25 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-27 14:07:05 -0700
commit81d927bfc7e1e4c7b28aabdb0c64a12cec2833fe (patch)
treedb8ce58fcb792df76624a5e3f94d502a16aba1bf /tensorflow/python/client
parent388d0d860110a19a9d133fe4de85f8f6fa060cde (diff)
Adding NodeDef names to error messages for better debuggability.
The format used is as follows: {{node <node_name>}} PiperOrigin-RevId: 206370355
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r--tensorflow/python/client/session.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tensorflow/python/client/session.py b/tensorflow/python/client/session.py
index 861230e5a0..f8e20e1b89 100644
--- a/tensorflow/python/client/session.py
+++ b/tensorflow/python/client/session.py
@@ -1235,8 +1235,12 @@ class BaseSession(SessionInterface):
return _fetch_handler_run
- # Captures the name of a node in an error status.
- _NODEDEF_NAME_RE = re.compile(r'\[\[Node: ([^ ]*?) =')
+ # Captures the name of a node in an error status. The regex below matches
+ # both the old and the new formats:
+ # Old format: [[Node: <node_name> = ...]]
+ # New format: [[{{node <node_name>}} = ...]]
+ _NODEDEF_NAME_RE = re.compile(
+ r'\[\[(Node: )?(\{\{node )?([^\} ]*)(\}\})?\s*=')
def _do_run(self, handle, target_list, fetch_list, feed_dict, options,
run_metadata):
@@ -1291,7 +1295,7 @@ class BaseSession(SessionInterface):
node_def = None
op = None
if m is not None:
- node_name = m.group(1)
+ node_name = m.group(3)
try:
op = self._graph.get_operation_by_name(node_name)
node_def = op.node_def