unami:

Which as far as I understand means that weights of the model were updated.


No, that won’t be the case, since you are never updating the model (and the gradient calculation is also disabled via torch.no_grad()).
The difference in the losses might come from additional calls into the random number generator during the validation loop while the model is still in training mode.
As you’ve already described the dropout layers will be used, which will sample random numbers and would thus change the next call into the random number generator.
Besides that the running stats in all batchnorm layers will be updated with the validation batch statistics, which would be a data leak.