# tf.keras.utils.OrderedEnqueuer

<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#L779-L871) |

Builds a Enqueuer from a Sequence.

Inherits From: [`SequenceEnqueuer`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/keras/utils/SequenceEnqueuer)

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.keras.utils.OrderedEnqueuer(
        sequence, use_multiprocessing=False, shuffle=False
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `sequence` | A `tf.keras.utils.data_utils.Sequence` object. |
| `use_multiprocessing` | use multiprocessing if True, otherwise threading |
| `shuffle` | whether to shuffle the data at the beginning of each epoch |

<br />

## Methods

### `get`

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

    get()

Creates a generator to extract data from the queue.

Skip the data if it is `None`.

<br />

<br />

<br />

| Yields ||
|---|---|
| The next element in the queue, i.e. a tuple `(inputs, targets)` or `(inputs, targets, sample_weights)`. ||

<br />

### `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 />