aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar RJ Ryan <rjryan@google.com>2017-11-06 09:18:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-06 09:24:09 -0800
commit3d590ada31123cbf670d2ad9afdf027eb6ec0d64 (patch)
tree849a5ff17f9110090cc8ac8e5ee51a6d666f33aa
parentfcd7019cb9ac15cd5ac9692f5cdc775171fd038f (diff)
Improve error message when a function is already defined with the same name and different hash string.
PiperOrigin-RevId: 174715563
-rw-r--r--tensorflow/python/framework/ops.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tensorflow/python/framework/ops.py b/tensorflow/python/framework/ops.py
index 95274374ad..6469aca3ec 100644
--- a/tensorflow/python/framework/ops.py
+++ b/tensorflow/python/framework/ops.py
@@ -2952,7 +2952,11 @@ class Graph(object):
if previous._hash_str == function._hash_str:
return
else:
- raise ValueError("Another function is already defined with that name")
+ raise ValueError("Cannot add function (%s, hash %s) to graph (%s). "
+ "Another function (%s, hash %s) is already defined "
+ "with that name (%s)" % (
+ function, function._hash_str, self,
+ previous, previous._hash_str, name))
# pylint: enable=protected-access
self._functions[name] = function