>> x = torch.randperm(20).reshape(2, -1)
tensor([[17, 5, 19, 6, 10, 12, 7, 18, 3, 2],
[...values=tensor([[19, 18, 17], [15, 16, 14]]),
indices=tensor([[2, 7, 0], [8, 4, 3]]))
5、获取随机整数排列:
torch.randperm...>> torch.randperm(10)
tensor([8, 0, 4, 2, 5, 9, 1, 6, 7, 3])
6、张量的切片方式*:
假设,现在有一个形状为(6, 4, 5, 7, 10)的张量