PyTorch torch.randperm 関数


Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

torch.randpermPyTorch で 0 から n-1 までのランダムな順列を作成するために使用される関数です。

関数定義

torch.randperm(n, dtype, device, requires_grad)

使用例

例

import torch

# 0 から 9 までのランダムな順列を作成
x = torch.randperm(10)

print(x)

Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

その他の拡張