randperm功能是随机打乱一个数字序列。
语法格式:
y = torch.randperm(n)
y是把1到n这些数随机打乱得到的一个数字序列。
th> torch.randperm(5) 3 1 5 4 2 [torch.DoubleTensor of size 5] [0.0003s] th> torch.randperm(7) 7 3 2 5 6 4 1 [torch.DoubleTensor of size 7]
randperm功能是随机打乱一个数字序列。
语法格式:
y = torch.randperm(n)
y是把1到n这些数随机打乱得到的一个数字序列。
th> torch.randperm(5) 3 1 5 4 2 [torch.DoubleTensor of size 5] [0.0003s] th> torch.randperm(7) 7 3 2 5 6 4 1 [torch.DoubleTensor of size 7]