diff options
author | Martin Wicke <wicke@google.com> | 2016-03-01 14:06:25 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-03-01 16:35:16 -0800 |
commit | bcf0d9ea050a1056c9c40a11dcb078c9a022e9dd (patch) | |
tree | 4101d3494db87bd6228e03bee85f612f22e86854 | |
parent | f16aabc6d9c1f11d1b2c393544999d1ac960a80b (diff) |
Make a better error message for restoring from an invalid file pattern.
Change: 116049226
-rw-r--r-- | tensorflow/python/training/saver.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/python/training/saver.py b/tensorflow/python/training/saver.py index c3833a2bf6..c5f235cff9 100644 --- a/tensorflow/python/training/saver.py +++ b/tensorflow/python/training/saver.py @@ -1032,7 +1032,12 @@ class Saver(object): Args: sess: A `Session` to use to restore the parameters. save_path: Path where parameters were previously saved. + + Raises: + ValueError: If the given `save_path` does not point to a file. """ + if not gfile.Glob(save_path): + raise ValueError("Restore called with invalid save path %s" % save_path) sess.run(self.saver_def.restore_op_name, {self.saver_def.filename_tensor_name: save_path}) |