SectionΒ 3. ChapterΒ 5
single
Challenge: Integrate Dropout and BatchNorm
Swipe to show menu
Task
Swipe to start coding
You will extend a simple neural network by integrating Dropout and Batch Normalization. Your goal is to correctly insert these layers into the architecture and perform a forward pass.
You are given:
- Input batch
x - A partially defined network class
- A forward method missing some components
Complete the following steps:
-
Add a Dropout layer after the first fully connected layer.
-
Add a BatchNorm layer immediately after Dropout.
-
Complete the forward pass so that the data flows through:
- Linear β ReLU β Dropout β BatchNorm β Linear
-
Ensure Dropout is used only during training (PyTorch handles this automatically).
After execution, the script prints the network output.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 5
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat