tf.io.gfile.GFile     View source on GitHub    File I/O wrappers without thread locking.  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.gfile.GFile, tf.compat.v1.gfile.Open, tf.compat.v1.io.gfile.GFile  
tf.io.gfile.GFile(
    name, mode='r'
)
 The main roles of the tf.io.gfile module are:  To provide an API that is close to Python's file I/O objects, and To provide an implementation based on TensorFlow's C++ FileSystem API.  The C++ FileSystem API supports multiple file system implementations, including local files, Google Cloud Storage (using a gs:// prefix, and HDFS (using an hdfs:// prefix). TensorFlow exports these as tf.io.gfile, so that you can use these implementations for saving and loading checkpoints, writing to TensorBoard logs, and accessing training data (among other uses). However, if all your files are local, you can use the regular Python file API without any problem. 
Note: though similar to Python's I/O implementation, there are semantic differences to make tf.io.gfile more efficient for backing filesystems. For example, a write mode file will not be opened until the first write call, to minimize RPC invocations in network filesystems.

 


 Attributes
  mode   Returns the mode in which the file was opened.  
  name   Returns the file name.    Methods close View source 
close()
 Closes FileIO. Should be called for the WritableFile to be flushed. flush View source 
flush()
 Flushes the Writable file. This only ensures that the data has made its way out of the process without any guarantees on whether it's written to disk. This means that the data would survive an application crash but not necessarily an OS crash. next View source 
next()
 read View source 
read(
    n=-1
)
 Returns the contents of a file as a string. Starts reading from current position in file.
 


 Args
  n   Read n bytes if n != -1. If n = -1, reads to end of file.   
 


 Returns   n bytes of the file (or whole file) in bytes mode or n bytes of the string if in string (regular) mode.  
 readline View source 
readline()
 Reads the next line, keeping \n. At EOF, returns ''. readlines View source 
readlines()
 Returns all lines from the file in a list. seek View source 
seek(
    offset=None, whence=0, position=None
)
 Seeks to the offset in the file. (deprecated arguments) Warning: SOME ARGUMENTS ARE DEPRECATED: (position). They will be removed in a future version. Instructions for updating: position is deprecated in favor of the offset argument.
 


 Args
  offset   The byte count relative to the whence argument.  
  whence   Valid values for whence are: 0: start of the file (default) 1: relative to the current position of the file 2: relative to the end of file. offset is usually negative.    seekable View source 
seekable()
 Returns True as FileIO supports random access ops of seek()/tell() size View source 
size()
 Returns the size of the file. tell View source 
tell()
 Returns the current position in the file. write View source 
write(
    file_content
)
 Writes file_content to the file. Appends to the end of the file. __enter__ View source 
__enter__()
 Make usable with "with" statement. __exit__ View source 
__exit__(
    unused_type, unused_value, unused_traceback
)
 Make usable with "with" statement. __iter__ View source 
__iter__()