[d2l] section3.7

发布于 2023-07-16  388 次阅读


Problem

在运行以下代码时,会报以下错误:

num_epochs = 10
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, trainer)
module 'd2l.torch' has no attribute 'train_ch3'

原因:可能为新版d2l包中,删掉了train_ch3函数

解决办法(根源):找到d2l的torch.py,在里面加入train_ch3函数。