pytorch调用inception-v3报错:
error:
train_model(model, criterion, optimizer, scheduler, num_epochs)
37 outputs = model(inputs)
---> 38 _, preds = torch.max(outputs, 1)
39 loss = criterion(outputs, labels)
TypeError: max() received an invalid combination of arguments - got (InceptionOutputs, int), but expected one of: ...
软件版本:
- python: 3.7.7
- pytorch: 1.4.0
- torchvision: 0.5.0
解决办法:
-
model_ft = models.inception_v3(pretrained=True) # 加入下面这一行 model_ft.aux_logits=False
网友评论