# tf.compat.v1.TextLineReader

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L461-L488) |

A Reader that outputs the lines of a file delimited by newlines.

Inherits From: [`ReaderBase`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/compat/v1/ReaderBase)

    tf.compat.v1.TextLineReader(
        skip_header_lines=None, name=None
    )

Newlines are stripped from the output.
See ReaderBase for supported methods.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `skip_header_lines` | An optional int. Defaults to 0. Number of lines to skip from the beginning of every file. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `reader_ref` | Op that implements the reader. |
| `supports_serialize` | Whether the Reader implementation can serialize its state. |

<br />

## Methods

### `num_records_produced`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L328-L346)

    num_records_produced(
        name=None
    )

Returns the number of records this reader has produced.

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

<br />

<br />

<br />

| Args ||
|---|---|
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| An int64 Tensor. ||

<br />

### `num_work_units_completed`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L348-L362)

    num_work_units_completed(
        name=None
    )

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

<br />

<br />

<br />

| Args ||
|---|---|
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| An int64 Tensor. ||

<br />

### `read`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L261-L288)

    read(
        queue, name=None
    )

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).

<br />

<br />

<br />

| 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). |

<br />

<br />

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

<br />

### `read_up_to`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L290-L326)

    read_up_to(
        queue, num_records, name=None
    )

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.

<br />

<br />

<br />

| Args ||
|---|---|
| `queue` | A Queue or a mutable string Tensor representing a handle to a Queue, with string work items. |
| `num_records` | Number of records to read. |
| `name` | A name for the operation (optional). |

<br />

<br />

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

<br />

### `reset`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L406-L418)

    reset(
        name=None
    )

Restore a reader to its initial clean state.

<br />

<br />

<br />

| Args ||
|---|---|
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The created Operation. ||

<br />

### `restore_state`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L381-L399)

    restore_state(
        state, name=None
    )

Restore a reader to a previously saved state.

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

<br />

<br />

<br />

| Args ||
|---|---|
| `state` | A string Tensor. Result of a SerializeState of a Reader with matching type. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The created Operation. ||

<br />

### `serialize_state`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/io_ops.py#L364-L379)

    serialize_state(
        name=None
    )

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

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

<br />

<br />

<br />

| Args ||
|---|---|
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A string Tensor. ||

<br />

<br />

## eager compatibility

<br />

Readers are not compatible with eager execution. Instead, please
use [`tf.data`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data) to get data into your model.

<br />

<br />