RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should b

Posted e^iπ+1=0

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should b相关的知识,希望对你有一定的参考价值。

链接: http://t.csdn.cn/z3gkm

torch.tensor对应的是torch.DoubleTensor
torch.Tensor对应的是torch.FloatTensor

观察下 t的大小写
input = torch.Tensor(np.random.randn(4,3,256,256)).to(device)

以上是关于RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should b的主要内容,如果未能解决你的问题,请参考以下文章

Pytorch 抛出错误 RuntimeError: result type Float can't be cast to the desired output type Long

“RuntimeError: Expected 4-dimensional input for 4-dimensional weight 32 3 3, but got 3-dimensional i

RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for ar

RuntimeError: Bool type is not supported by dlpack

RuntimeError: Bool type is not supported by dlpack

一步真实解决RuntimeError: result type Float can‘t be cast to the desired output type long int