mindspore.ops.shuffle
- mindspore.ops.shuffle(x, seed=None)[source]
Randomly shuffles a Tensor along its first dimension.
- Parameters
- Returns
Tensor. The shape and type are the same as the input x.
- Raises
TypeError – If data type of seed is not None or non-negative int.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([1, 2, 3, 4]), mstype.float32) >>> output = ops.shuffle(x, seed=1) >>> print(output) (3. 4. 2. 1.)