torch.mm expect scalar type Float but found Double
pytorch 在矩阵相乘时expected scalar type Float but found Double问题今天在写MNIST数据集分类的时候进行矩阵相乘一直报错expected scalar type Float but found Double代码:x = torch.tensor([[1,3,4]]).float()w = torch.randn([3,10],dtype=float,requires_grad=True)x.mm(w)原因:torch.randn()中d