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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM