# tf.random.experimental.stateless_shuffle

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/ops/stateless_random_ops.py#L226-L271) |

Randomly and deterministically shuffles a tensor along its first dimension.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.random.experimental.stateless_shuffle`](https://www.tensorflow.org/api_docs/python/tf/random/experimental/stateless_shuffle)

<br />

    tf.random.experimental.stateless_shuffle(
        value, seed, alg='auto_select', name=None
    )

The tensor is shuffled along dimension 0, such that each `value[j]` is mapped
to one and only one `output[i]`. For example, a mapping that might occur for a
3x2 tensor is:

    [[1, 2],       [[5, 6],
     [3, 4],  ==>   [1, 2],
     [5, 6]]        [3, 4]]

    v = tf.constant([[1, 2], [3, 4], [5, 6]])
    shuffled = tf.random.experimental.stateless_shuffle(v, seed=[8, 9])
    print(shuffled)
    tf.Tensor(
    [[5 6]
      [1 2]
      [3 4]], shape=(3, 2), dtype=int32)

This is a stateless version of [`tf.random.shuffle`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/random/shuffle): if run twice with the
same `value` and `seed`, it will produce the same result. The
output is consistent across multiple runs on the same hardware (and between
CPU and GPU), but may change between versions of TensorFlow or on non-CPU/GPU
hardware.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | A Tensor to be shuffled. |
| `seed` | A shape \[2\] Tensor. The seed to the random number generator. Must have dtype `int32` or `int64`. |
| `alg` | The RNG algorithm used to generate the random numbers. See [`tf.random.stateless_uniform`](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/random/stateless_uniform) for a detailed explanation. |
| `name` | A name for the operation. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor of same shape and type as `value`, shuffled along its first dimension. ||

<br />