PyTorch torch.randperm function
PyTorch torch reference manual
torch.randperm is a function in PyTorch used to create a random permutation of the integers from 0 to n-1.
Function definition
torch.randperm(n, dtype, device, requires_grad)
Usage examples
Example
import
torch
Create a random permutation of 0 to 9
x
=
torch.
randperm
(
10
)
(
x
)