`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