[Pytorch] Tensor shuffle, 텐서 랜덤 섞기
randperm(int) 입력된 숫자를 임의로 섞어주는 함수 torch.randperm(10) tensor([9, 8, 2, 1, 3, 4, 5, 6, 7, 0]) Tensor 행 섞기 tensor의 행이 랜덤으로 섞이는 코드 a = torch.rand(3,3) a = a[torch.randperm(a.size()[0])] tensor([[0.5326, 0.3624, 0.3423], [0.9065, 0.8168, 0.5219], [0.9516, 0.3635, 0.8481]]) tensor([[0.9065, 0.8168, 0.5219], [0.9516, 0.3635, 0.8481], [0.5326, 0.3624, 0.3423]]) Tensor 열 섞기 a = torch.rand(3,3) a = a[:,to..