`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

猜你喜欢

转载自www.cnblogs.com/huhuai/p/9490528.html