Input and parameter tensors are not at the same device
出现这个问题的原因是没有把模型和数据都放到cuda里面
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
model.to(device=device)
# 一个batch的数据转换为RNN的输入维度
images = images.to(device)
labels = labels.to(device)
版权声明:本文为CSDN博主「爱猫的吴小圆」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_48345413/article/details/121645015
暂无评论