`TypeError: torch.mm received an invalid combination of arguments - got (torch.FloatTensor, Variable),


`TypeError: torch.mm received an invalid combination of arguments - got (torch.FloatTensor, Variable), but expected one of:

    • (torch.SparseFloatTensor mat1, torch.FloatTensor mat2)
    • (torch.FloatTensor source, torch.FloatTensor mat2)

 

They can, but a function takes either Tensors or Variables as input but not a mix of them.
You should wrap your tensor into a Variable before using it.

 

不管是張量還是變量都行,但是混合的就不行。

參考:https://github.com/pytorch/pytorch/issues/1252


免責聲明!

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



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