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,可以根據自己的需要更改。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章