# tf.contrib.data.shuffle_and_repeat

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/data/python/ops/shuffle_ops.py#L24-L54) |

Shuffles and repeats a Dataset returning a new permutation for each epoch. (deprecated)

    tf.contrib.data.shuffle_and_repeat(
        buffer_size, count=None, seed=None
    )

> [!WARNING]
> **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.experimental.shuffle_and_repeat(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/shuffle_and_repeat).

`dataset.apply(tf.data.experimental.shuffle_and_repeat(buffer_size, count))`

is equivalent to

`dataset.shuffle(buffer_size, reshuffle_each_iteration=True).repeat(count)`

The difference is that the latter dataset is not serializable. So,
if you need to checkpoint an input pipeline with reshuffling you must use
this implementation.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `buffer_size` | A [`tf.int64`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf#int64) scalar [`tf.Tensor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Tensor), representing the maximum number elements that will be buffered when prefetching. |
| `count` | (Optional.) A [`tf.int64`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf#int64) scalar [`tf.Tensor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Tensor), representing the number of times the dataset should be repeated. The default behavior (if `count` is `None` or `-1`) is for the dataset be repeated indefinitely. |
| `seed` | (Optional.) A [`tf.int64`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf#int64) scalar [`tf.Tensor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Tensor), representing the random seed that will be used to create the distribution. See [`tf.compat.v1.set_random_seed`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/random/set_random_seed) for behavior. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/Dataset#apply). ||

<br />