tf.compat.v1.WholeFileReader

A Reader that outputs the entire contents of a file as a value.

Inherits From: ReaderBase

To use, enqueue filenames in a Queue. The output of Read will be a filename (key) and the contents of that file (value).

See ReaderBase for supported methods.

nameA name for the operation (optional).

reader_refOp that implements the reader.
supports_serializeWhether 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
nameA 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
nameA 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
queueA Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
nameA name for the operation (optional).

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

read_up_to

View source

Returns up to num_records (key, value) pairs 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). It may return less than num_records even before the last batch.

Args
queueA Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
num_recordsNumber of records to read.
nameA name for the operation (optional).

Returns
A tuple of Tensors (keys, values).
keysA 1-D string Tensor.
valuesA 1-D string Tensor.

reset

View source

Restore a reader to its initial clean state.

Args
nameA name for the operation (optional).

Returns
The created Operation.

restore_state

View source

Restore a reader to a previously saved state.

Not all Readers support being restored, so this can produce an Unimplemented error.

Args
stateA string Tensor. Result of a SerializeState of a Reader with matching type.
nameA name for the operation (optional).

Returns
The created Operation.

serialize_state

View source

Produce a string tensor that encodes the state of a reader.

Not all Readers support being serialized, so this can produce an Unimplemented error.

Args
nameA name for the operation (optional).

Returns
A string Tensor.

eager compatibility

Readers are not compatible with eager execution. Instead, please use tf.data to get data into your model.