Debugging a Colab Denoising Network on MNIST
Goal: Make a Colab notebook that trains a denoising neural network on MNIST such that:
-
(a) the training loss steadily decreases, and
-
(b) the evaluation loss is close to the training loss.
You should identify and fix issues in three areas and describe how you validate each fix:
1) Data
-
Detect and correct a train/test distribution mismatch so the test set covers all digits 0–9.
-
Ensure the same normalization statistics (mean and std) computed from the training set are applied to both training and test data.
2) Model
-
Remove or replace an inappropriate final ReLU so the output range supports negative values typical of the denoised signal.
3) Optimization
-
Add the missing optimizer.zero_grad() and put backward() and optimizer.step() in the correct order.
For each of the three sections, describe:
-
Sanity checks and assertions you would add.
-
Minimal code changes and key code snippets.
-
Metrics you would track to validate the fix.