问题:Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

出现这个问题说明模型,输入之间的变量模式不匹配,有的是GPU形态有的是CPU形态
1 在input的时候别忘了input = input.to(device)
2 在网络定义完之后net = net.to(device)

你可能感兴趣的:(总结)