Shuffling the input before feeding it into the model and shuffling the output the model output produces different outputs.
I think it has something to do with GPU and batch norm since the problem only happens in train mode only on CUDA not CPU.
Does anyone know why this is happening?
import torch
import torchvision.models as models
model = models.resnet50()
model = model.cuda()
idx = torch.randperm(128).cuda()
x = torch.randn(128, 3, 224, 224).cuda()
print("input indexing", model(x[idx]))
print("output indexing", model(x)[idx])