RuntimeError: mat1 and mat2 must have the same dtype

这个坑卡了我一晚上

不如去stackoverflow上看一眼

np默认返回float64类型。F.linear对精度傻了。

一个快速的解决方法可能是换成dtype='float32’的浮点数

inputs = inputs.to(torch.float32)

你可能感兴趣的:(人工智能,深度学习,python)