You would usually use model.eval() to calculate the epoch loss using the validation set, as this would also be the workflow for the model deployment. Using the model in training mode during validation and test would leak the data information e.g. into the batchnorm statistics, and could create a biased loss estimation for “real unseen” data. Also, it’s usually not desired to apply dropout during validation/testing/deployment.