|  TensorFlow 2 version |  View source on GitHub | 
A class to write records to a TFRecords file.
tf.io.TFRecordWriter(
    path, options=None
)
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, orTFRecordOptionsobject. | 
| Raises | |
|---|---|
| IOError | If pathcannot be opened for writing. | 
| ValueError | If valid compression_type can't be determined from options. | 
Methods
close
close()
Close the file.
flush
flush()
Flush the file.
write
write(
    record
)
Write a string record to the file.
| Args | |
|---|---|
| record | str | 
__enter__
__enter__()
Enter a with block.
__exit__
__exit__(
    unused_type, unused_value, unused_traceback
)
Exit a with block, closing the file.