tf.data.experimental.shuffle_and_repeat

Shuffles and repeats a Dataset, reshuffling with each repetition. (deprecated)

d = tf.data.Dataset.from_tensor_slices([1, 2, 3])
d = d.apply(tf.data.experimental.shuffle_and_repeat(2, count=2))
[elem.numpy() for elem in d] # doctest: +SKIP
[2, 3, 1, 1, 3, 2]
dataset.apply(
  tf.data.experimental.shuffle_and_repeat(buffer_size, count, seed))

produces the same output as

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

In each repetition, this dataset fills a buffer with buffer_size elements, then randomly samples elements from this buffer, replacing the selected elements with new elemen