My model contains dropout layers. So I just want to double check, when I am looping through the number of epochs, I want to get both train and validation’s loss and accuracy. So I have model.train() … and then model.eval() in side the loop.
And then for my testing, I also have model.eval().
Is my implementation correct?
The answer can be found on PyTorch tutorial:
https://pytorch.org/tutorials/beginner/introyt/trainingyt.html#per-epoch-activity
Thank you for sharing the link. But I have not seen example of testing process in it? Just wondering if I still need model.eval() for that.
You need model.eval() upon testing. The reason is the same as one of validation.
1 Like