1. Learn
  2. /
  3. Courses
  4. /
  5. Scalable AI Models with PyTorch Lightning

Connected

Exercise

Implementing the training step

In this exercise, you'll implement the training_step() method in a PyTorch Lightning module designed for an image classification task. Your implementation should unpack a batch of images and labels, compute the model predictions via the forward pass, calculate the cross entropy loss, and log the training loss.

Instructions

100 XP
  • Ensure that you compute predictions using the forward pass.
  • Calculate the cross entropy loss.
  • Log the training loss.