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]
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。