tf.io.TFRecordWriter

View source on GitHub

A class to write records to a TFRecords file.

This class implements __enter__ and __exit__, and can be used in with blocks like a normal file.

Args
path The path to the TFRecords file.
options (optional) String specifying compression type, TFRecordCompressionType, or TFRecordOptions object.
Raises
IOError If path cannot be opened for writing.
ValueError If valid compression_type can't be determined from options.

Methods

close

View source

Close the file.

flush

View source

Flush the file.

write

View source

Write a string record to the file.

Args
record str

__enter__

View source

Enter a with block.

__exit__

View source

Exit a with block, closing the file.

© 2020 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/versions/r1.15/api_docs/python/tf/io/TFRecordWriter