Class TFRecordWriter
Aliases:
- Class
tf.io.TFRecordWriter
- Class
tf.python_io.TFRecordWriter
Defined in tensorflow/python/lib/io/tf_record.py
.
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.
__init__
__init__(
path,
options=None
)
Opens file path
and creates a TFRecordWriter
writing to it.
Args:
path
: The path to the TFRecords file.options
: (optional) String specifying compression type,TFRecordCompressionType
, orTFRecordOptions
object.
Raises:
IOError
: Ifpath
cannot be opened for writing.ValueError
: If valid compression_type can't be determined fromoptions
.
Methods
tf.io.TFRecordWriter.__enter__
__enter__()
Enter a with
block.
tf.io.TFRecordWriter.__exit__
__exit__(
unused_type,
unused_value,
unused_traceback
)
Exit a with
block, closing the file.
tf.io.TFRecordWriter.close
close()
Close the file.
tf.io.TFRecordWriter.flush
flush()
Flush the file.
tf.io.TFRecordWriter.write
write(record)
Write a string record to the file.
Args:
record
: str