1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with PyTorch

Connected

Exercise

Writing the evaluation loop

In this exercise, you will write an evaluation loop to compute validation loss. The evaluation loop follows a similar structure to the training loop but without gradient calculations or weight updates.

model, validationloader, and loss function criterion have already been defined to handle predictions, data loading, and loss calculation.

Instructions 1/2

undefined XP
    1
    2
  • Set the model to evaluation mode.
  • Sum the current batch loss to the validation_loss variable.