Learn Before
Example
Concise SGD Training Example on Airfoil Dataset
To validate the concise training harness, train_concise_ch11 is invoked with torch.optim.SGD as the optimizer, a learning rate of , and a minibatch size of on the Airfoil Self-Noise dataset. The training reproduces the same convergence behavior observed with the from-scratch implementation, reaching a final loss of approximately in about seconds per epoch. This confirms that the high-level-API version and the manually coded version yield identical optimization trajectories.
python data_iter, _ = get_data_ch11(10) trainer = torch.optim.SGD train_concise_ch11(trainer, {'lr': 0.01}, data_iter)
Output:
loss: 0.243, 0.096 sec/epoch
0
1
Updated 2026-05-15
Tags
D2L
Dive into Deep Learning @ D2L