Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe that the semantics of gfile are different. #20847

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions tensorflow/python/platform/gfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,29 @@

@tf_export('gfile.GFile', 'gfile.Open')
class GFile(_FileIO):
"""File I/O wrappers without thread locking."""
"""File I/O wrappers without thread locking.

Note, that this is somewhat like builtin Python file I/O, but
there are semantic differences to make it more efficient for
some backing filesystems. For example, a write mode file will
not be opened until the first write call (to minimize RPC
invocations in network filesystems).
"""

def __init__(self, name, mode='r'):
super(GFile, self).__init__(name=name, mode=mode)


@tf_export('gfile.FastGFile')
class FastGFile(_FileIO):
"""File I/O wrappers without thread locking."""
"""File I/O wrappers without thread locking.

Note, that this is somewhat like builtin Python file I/O, but
there are semantic differences to make it more efficient for
some backing filesystems. For example, a write mode file will
not be opened until the first write call (to minimize RPC
invocations in network filesystems).
"""

def __init__(self, name, mode='r'):
super(FastGFile, self).__init__(name=name, mode=mode)
Expand Down