tf.compat.v1.gfile.FastGFile

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).

mode Returns the mode in which the file was opened.
name Returns the file name.

Methods

close

View source

Closes the file.

Should be called for the WritableFile to be flushed.

In general, if you use the context manager pattern, you don't need to call this directly.

with tf.io.gfile.GFile("/tmp/x", "w") as f:
  f.write("asdf\n")
  f.write("qwer\n")
# implicit f.close() at the end of the block

For cloud filesystems, forgetting to ca