【CrossEntropyLoss】TypeError: __init__() got an unexpected keyword argument ‘label_smoothing‘

在使用torch.nn.CrossEntropyLoss(label_smoothing=0.1)时报错:
TypeError: __init__() got an unexpected keyword argument 'label_smoothing'

报错原因: torch版本问题,用的是torch1.9.1。
解决方案: 升级torch版本,升级为torch1.10.1即可。

猜你喜欢

转载自blog.csdn.net/weixin_45377629/article/details/128365921