推理过程遇到的错误。
如果在GPU上训练的模型,在CPU上推理测试的话,需要在加载模型时使用map_location。如model = torch.load(“model.pth”, map_location=torch.device(“cpu”))
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the
最新推荐文章于 2023-11-22 10:20:05 发布