原文:[报错]-RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same

RuntimeError: Input type torch.cuda.HalfTensor and weight type torch.cuda.FloatTensor should be the same 模型输入的数据类型要与模型参数的数据类型一致。 torch.cuda.HalfTensor:对应 torch.cuda.FloatTensor:对应 参考链接: https: stackov ...

2022-03-07 15:28 0 2021 推荐指数:

查看详情

torch.cuda.FloatTensor

Pytorch中的tensor又包括CPU上的数据类型和GPU上的数据类型,一般GPU上的Tensor是CPU上的Tensor加cuda()函数得到。 一般系统默认是torch.FloatTensor类型。例如data = torch.Tensor(2,3)是一个2*3的张量,类型 ...

Mon Feb 24 23:54:00 CST 2020 0 5381
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM