Loading...
Use StepLR to decay the learning rate by a factor every N epochs.
StepLR(optimizer, step_size, gamma) multiplies LR by gamma every step_size epochs. It's the simplest scheduling strategy.
The starter code creates a model and SGD optimizer. Create a StepLR scheduler that halves the learning rate every 3 epochs.
The epoch loop that records LR history is pre-filled.
Returns a dictionary with "lr_history" (10 values), "initial_lr", and "final_lr".
None
{'lr_history': [0.1, 0.1, 0.1, 0.05, 0.05, 0.05, 0.025, 0.025, 0.025, 0.0125], 'initial_lr': 0.1, 'final_lr': 0.0125}StepLR scheduler with step_size=3 and gamma=0.5, meaning the learning rate will be multiplied by 0.5 every 3 epochs.