udacity / deep-learning-v2-pytorch

Projects and exercises for the latest Deep Learning ND program https://www.udacity.com/course/deep-learning-nanodegree--nd101
MIT License
5.26k stars 5.32k forks source link

Include model.eval() #397

Closed salehsargolzaee closed 2 years ago

salehsargolzaee commented 2 years ago

Setting all the layers in the model to evaluation mode before evaluation to turn off dropout layer.

salehsargolzaee commented 2 years ago

Thanks for the PR request. The model.train() needs to be added back if we're going to use model.eval()

I don't think model.train() is necessary since we always evaluate the model after all the epochs are done in this code, so the default mode is train mode before the evaluation steps. However, it's safe to add it.