在调模型测试test代码中遇到的问题

1.test中出现的问题

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

原因:

model没有加载到cuda里面,而数据在cuda中。

解决:

在model.eval()之前加model.cuda()把模型加载到cuda里面

2.问题

TypeError: sigmoid(): argument 'input' (position 1) must be Tensor, not tuple
 原因:

tuple中有两个类型的张量

解决:

把prob=model(input)转化为prob,hv=model(input)


版权声明:本文为lajiumao原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。