FaultyBagnose:

I assume I’m missing something, but I wouldn’t expect the statements
resnet.train()
dummy = resnet(batch_t)
to make any changes to the model?


The forward pass will update the running statistics of all batch norm layers and thus the next output in model.eval() will be changed.
Note that model.train() and model.eval() are exactly used to switch this behavior. I.e. during training the batch statistics will be used to normalize the data and the running stats will be updated, while during evaluation the running stats will be applied to normalize the input data. (Unrelated to this issue, but also dropout will be disabled during model.eval().)