Hello,
If we want  to shuffle the order of image database (format: [batch_size, channels, height, width]), I think this is a good method:
t = torch.rand(4, 2, 3, 3)
idx = torch.randperm(t.shape[0])
t = t[idx].view(t.size())

 t[idx] will retain the structure of channels, height, and width, while shuffling the order of the image.