mindspore.ops.RandpermV2

class mindspore.ops.RandpermV2(dtype=mstype.int64)[source]

Generates random permutation of integers from 0 to n-1 without repeating.

Refer to mindspore.ops.randperm() for more details.

Warning

This is an experimental API that is subject to change or deletion.

Supported Platforms:

Ascend CPU

Examples

>>> n = Tensor([4], mstype.int64)
>>> seed = 0
>>> offset = 0
>>> randperm = ops.RandpermV2(dtype=mstype.int64)
>>> output = randperm(n, seed, offset)
>>> print(output)
[1 0 2 3]