Issue:#46004
Context:
Initial changes resulted in merge conflicts. As a result,I had to
come up with a different approach since _SHARDED_SUFFIX is a tensor now.
Solution:
Add os.path.normpath function to _temp/part instead
Additional:
Adding comments
diff --git a/tensorflow/python/training/saver.py b/tensorflow/python/training/saver.py
index a1c88a5..3ac09e2 100644
--- a/tensorflow/python/training/saver.py
+++ b/tensorflow/python/training/saver.py
@@ -228,7 +228,8 @@
# Transformations:
# * Users pass in "save_path" in save() and restore(). Say "myckpt".
# * checkpoint_prefix gets fed <save_path><_SHARDED_SUFFIX>.
- #
+ # * If checkpoint_prefix is a S3 bucket path ".part" is appended to it
+ # * Otherwise _temp/part is appended which is normalized relative to the OS
# Example:
# During runtime, a temporary directory is first created, which contains
# files
@@ -254,7 +255,7 @@
_SHARDED_SUFFIX = array_ops.where(
string_ops.regex_full_match(checkpoint_prefix, "^s3://.*"),
constant_op.constant(".part"),
- constant_op.constant("_temp/part"))
+ constant_op.constant(os.path.normpath("_temp/part")))
tmp_checkpoint_prefix = string_ops.string_join(
[checkpoint_prefix, _SHARDED_SUFFIX])