# tf.random.shuffle

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.7.4/tensorflow/python/ops/random_ops.py#L329-L359) |

Randomly 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.shuffle`](https://www.tensorflow.org/api_docs/python/tf/random/shuffle), [`tf.compat.v1.random_shuffle`](https://www.tensorflow.org/api_docs/python/tf/random/shuffle)

<br />

    tf.random.shuffle(
        value, seed=None, 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]]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | A Tensor to be shuffled. |
| `seed` | A Python integer. Used to create a random seed for the distribution. See [`tf.random.set_seed`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/random/set_seed) for behavior. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

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

<br />