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]

 


 

相关文章:

  • 2021-11-05
  • 2021-11-26
  • 2021-12-20
  • 2022-12-23
  • 2021-04-05
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2022-02-10
  • 2021-06-17
  • 2021-12-13
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案