W3cubDocs

/TensorFlow Python

tf.gfile.FastGFile

class tf.gfile.FastGFile

File I/O wrappers without thread locking.

Properties

mode

Returns the mode in which the file was opened.

name

Returns the file name.

Methods

__init__(name, mode='r')

close()

Closes FileIO. Should be called for the WritableFile to be flushed.

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

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) requested as a string.

readline()

Reads the next line from the file. Leaves the '\n' at the end.

readlines()

Returns all lines from the file in a list.

seek(position)

Seeks to the position in the file.

size()

Returns the size of the file.

tell()

Returns the current position in the file.

write(file_content)

Writes file_content to the file. Appends to the end of the file.

Defined in tensorflow/python/platform/gfile.py.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/gfile/FastGFile