W3cubDocs

/TensorFlow Python

tf.python_io.TFRecordWriter

Class TFRecordWriter

Defined in tensorflow/python/lib/io/tf_record.py.

See the guides: Data IO (Python functions), Reading data > QueueRunner

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.

Methods

__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) A TFRecordOptions object.

Raises:

  • IOError: If path cannot be opened for writing.

__enter__

__enter__()

Enter a with block.

__exit__

__exit__(
    unused_type,
    unused_value,
    unused_traceback
)

Exit a with block, closing the file.

close

close()

Close the file.

flush

flush()

Flush the file.

write

write(record)

Write a string record to the file.

Args:

  • record: str

© 2018 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/python_io/TFRecordWriter