pytorch调用inception-v3报错 'max() received an invalid combination of arguments'

pytorch调用inception-v3报错:

1
2
3
4
5
6
7
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

解决办法: