RuntimeError: expected scalar type Double but found Float原因: tensor的数据类型dtype不正确 解决: 将数据类型转为float32
tensor = tensor.to(torch.float32)

RuntimeError: expected scalar type Double but found Float原因: tensor的数据类型dtype不正确 解决: 将数据类型转为float32
tensor = tensor.to(torch.float32)