diff options
author | 2017-11-06 09:18:53 -0800 | |
---|---|---|
committer | 2017-11-06 09:24:09 -0800 | |
commit | 3d590ada31123cbf670d2ad9afdf027eb6ec0d64 (patch) | |
tree | 849a5ff17f9110090cc8ac8e5ee51a6d666f33aa | |
parent | fcd7019cb9ac15cd5ac9692f5cdc775171fd038f (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.py | 6 |
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 |