PyTorch torch.randperm Function
PyTorch torch Reference Manual
torch.randpermis a function in PyTorch used to create a random permutation of integers from 0 to n-1.
Function Definition
torch.randperm(n, dtype, device, requires_grad)
Usage Example
Example
import torch
# Create a random permutation from 0 to 9
x = torch.randperm(10)
print(x)
# Create a random permutation from 0 to 9
x = torch.randperm(10)
print(x)
Other Extensions