PyTorch torch.randperm 関数
torch.randpermPyTorch で 0 から n-1 までのランダムな順列を作成するために使用される関数です。
関数定義
torch.randperm(n, dtype, device, requires_grad)
使用例
例
import torch
# 0 から 9 までのランダムな順列を作成
x = torch.randperm(10)
print(x)
# 0 から 9 までのランダムな順列を作成
x = torch.randperm(10)
print(x)
その他の拡張
Pytorch torch リファレンスマニュアル