# tf.keras.utils.SequenceEnqueuer

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/utils/data_utils.py#L651-L776) |

Base class to enqueue inputs.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

\`tf.compat.v1.keras.utils.SequenceEnqueuer\`

<br />

    tf.keras.utils.SequenceEnqueuer(
        sequence, use_multiprocessing=False
    )

The task of an Enqueuer is to use parallelism to speed up preprocessing.
This is done with processes or threads.

#### Example:

        enqueuer = SequenceEnqueuer(...)
        enqueuer.start()
        datas = enqueuer.get()
        for data in datas:
            # Use the inputs; training, evaluating, predicting.
            # ... stop sometime.
        enqueuer.stop()

The `enqueuer.get()` should be an infinite stream of data.

## Methods

### `get`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/utils/data_utils.py#L767-L776)

    get()

Creates a generator to extract data from the queue.

Skip the data if it is `None`.
Returns:
Generator yielding tuples `(inputs, targets)`
or `(inputs, targets, sample_weights)`.

### `is_running`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/utils/data_utils.py#L702-L703)

    is_running()

### `start`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/utils/data_utils.py#L705-L723)

    start(
        workers=1, max_queue_size=10
    )

Starts the handler's workers.

<br />

<br />

<br />

| Args ||
|---|---|
| `workers` | Number of workers. |
| `max_queue_size` | queue size (when full, workers could block on `put()`) |

<br />

### `stop`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/utils/data_utils.py#L730-L744)

    stop(
        timeout=None
    )

Stops running threads and wait for them to exit, if necessary.

Should be called by the same thread which called `start()`.

<br />

<br />

<br />

| Args ||
|---|---|
| `timeout` | maximum time to wait on `thread.join()` |

<br />