Skip to content

Commit

Permalink
Added code to raise ValueError ifparent directory of path Saver.save(…
Browse files Browse the repository at this point in the history
…) should use doesn't exist. This give user a much more readable error message than previous NotFoundError

Added code to raise ValueError ifparent directory of  path Saver.save() should use doesn't exist. This give user a much more readable error message than previous NotFoundError

Added some comments

Removed cached file
  • Loading branch information
PuchatekwSzortach authored and kuba-lexues committed Aug 9, 2016
1 parent 32bd3d0 commit e28e3ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/python/training/saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,10 @@ def save(self, sess, save_path, global_step=None, latest_filename=None,
if not isinstance(sess, session.SessionInterface):
raise TypeError("'sess' must be a Session; %s" % sess)

# Note a few lines above save_path was set to os.path.dirname(save_path)
if not os.path.exists(save_path):
raise ValueError("Parent directory {} doesn't exist, can't save.".format(save_path))

model_checkpoint_path = sess.run(
self.saver_def.save_tensor_name,
{self.saver_def.filename_tensor_name: checkpoint_file})
Expand Down

0 comments on commit e28e3ba

Please sign in to comment.