报错如下:
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
Input type (torch.cuda.FloatTensor) :代表输入在 GPU 上
weight type (torch.FloatTensor):代表模型在 CPU 上
需要将模型转到 GPU 上,即:model.cuda()
报错如下:
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
Input type (torch.cuda.FloatTensor) :代表输入在 GPU 上
weight type (torch.FloatTensor):代表模型在 CPU 上
需要将模型转到 GPU 上,即:model.cuda()