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

Connected

Exercise

Experimenting with dropout

Dropout helps prevent overfitting by randomly setting some output values to zero during training. In this exercise, you'll build a simple neural network with dropout and observe how it behaves in training and evaluation modes.

torch.nn package is preloaded as nn, and features is already defined for you.

Instructions 1/2

undefined XP
    1
    2
  • Add a dropout layer to the model with a 50% probability of zeroing out elements.
  • Set the model to training mode and generate predictions using features, storing the output as output_train.