ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf.compat.v1.ReaderBase

Base class for different Reader types, that produce a record every step.

Conceptually, Readers convert string 'work units' into records (key, value pairs). Typically the 'work units' are filenames and the records are extracted from the contents of those files. We want a single record produced per step, but a work unit can correspond to many records.

Therefore we introduce some decoupling using a queue. The queue contains the work units and the Reader dequeues from the queue when it is asked to produce a record (via Read()) but it has finished the last work unit.

reader_ref The operation that implements the reader.
supports_serialize True if the reader implementation can serialize its state.

RuntimeError If eager execution is enabled.

reader_ref Op that implements the reader.
supports_serialize Whether the Reader implementation can serialize its state.

Methods

num_records_produced

View source

Returns the number of records this reader has produced.

This is the same as the number of Read executions that have succeeded.

Args
name A name for the operation (optional).

Returns
An int64 Tensor.

num_work_units_completed

View source

Returns the number of work units this reader has finished processing.

Args
name A name for the operation (optional).

Returns
An int64 Tensor.

read

View source

Returns the next record (key, value) pair produced by a reader.

Will dequeue a work unit from queue if necessary (e.g. when the Reader needs to start reading from a new file since it has finished with the previous file).

Args
queue A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
name A name for the operation (optional).

Returns
A tuple of Tensors (key, value).
key A string scalar Tensor.
value A string scalar Tensor.

read_up_to

View source