UserWarning:Implicit dimension choice for softmax has been deprecated. Change the call to include..

问题:

UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. input = module(input)

这个警告的原因是softmax()函数已经被弃用了,虽然程序还是可以运行成功,但是这个做法不被pytorch所赞成。

这个写法在早期的pytorch版本是没有警告的,现在因为其他考虑,要加上有指明dim参数。

nn.Softmax()

改成

nn.Softmax(dim=1)

dim=常为1,可以根据自己的需要更改。

posted @ 2020-04-25 00:32  龙雪  阅读(851)  评论(0编辑  收藏  举报