RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the
训练pytorch的时候碰到一个问题,程序总是报这个错:Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same查了好久,才找到根本原因。输入的图像已经在GPU了,而模型还在CPU。增加以下代码即可:model = model.cuda( )...
·
训练pytorch的时候碰到一个问题,程序总是报这个错:
Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
查了好久,才找到根本原因。
输入的图像已经在GPU了,而模型还在CPU。
增加以下代码即可:
model = model.cuda( )
欢迎来到FlagOS开发社区,这里是一个汇聚了AI开发者、数据科学家、机器学习爱好者以及业界专家的活力平台。我们致力于成为业内领先的Triton技术交流与应用分享的殿堂,为推动人工智能技术的普及与深化应用贡献力量。
更多推荐
所有评论(0)