# tf.keras.utils.OrderedEnqueuer

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/utils/OrderedEnqueuer) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/utils/data_utils.py#L796-L881) |

Builds a Enqueuer from a Sequence.

Inherits From: [`SequenceEnqueuer`](https://www.tensorflow.org/versions/r2.1/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`](https://www.tensorflow.org/api_docs/python/tf/keras/utils/OrderedEnqueuer)

<br />

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

Used in `fit_generator`, `evaluate_generator`, `predict_generator`.

<br />

<br />

<br />

| ## Arguments ||
|---|---|
| `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/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/utils/data_utils.py#L863-L881)

    get()

Creates a generator to extract data from the queue.

Skip the data if it is `None`.

#### Yields:

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

### `is_running`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/utils/data_utils.py#L718-L719)

    is_running()

### `start`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/utils/data_utils.py#L721-L739)

    start(
        workers=1, max_queue_size=10
    )

Starts the handler's workers.

<br />

<br />

<br />

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

<br />

### `stop`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/utils/data_utils.py#L746-L760)

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

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

<br />