[报错]-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:对应

 np.array(x, dtype = 'float32')

torch.cuda.FloatTensor:对应

 np.array(x, dtype = 'float16')

参考链接:
https://stackoverflow.com/questions/65029217/runtimeerror-input-type-torch-cuda-floattensor-and-weight-type-torch-cuda-ha


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM