Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input
在训练模型时使用的gpu,而在预测时使用cup导致,所以需要将预测图片加上.cuda(),使用GPU进行预测。
·
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor
出现此类错误的原因主要是:
在训练模型时使用的gpu,而在预测时使用cup导致,所以需要将预测图片加上.cuda(),使用GPU进行预测
这样便可解决!

欢迎来到由智源人工智能研究院发起的Triton中文社区,这里是一个汇聚了AI开发者、数据科学家、机器学习爱好者以及业界专家的活力平台。我们致力于成为业内领先的Triton技术交流与应用分享的殿堂,为推动人工智能技术的普及与深化应用贡献力量。
更多推荐
所有评论(0)