Shuffle the order of images present in a batch

I have a tensor of shape (64, 3, 32, 32), where 64 refers to 64 images.
I would like to shuffle the order of images in any random way (the resulting image would still be (64, 3, 32, 32) tensor).

Numpy has np.random.shuffle method, is there anything similar in pytorch?

On using dataloader, use shuffle=True. That’s it.

loader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True)

You can look at the docs here:

Thanks.