삶은 감자
a = torch.tensor([1,2,3,4]) idx = 4 # 섞을 torch 길이 rand_idx = torch.randperm(idx)
torch.randperm(n) : 0 ~ (n-1) 사이의 값이 랜덤하게 들어있는 tensor를 출력한다.
torch.randperm(n)
shuffle_tensor = a[rand_idx]
결과