PyTorch – AttributeError: ‘bool‘ object has no attribute ‘sum‘

The reason is that torch.max() is changed to torch.argmax()

	out = model(img)
    loss = criterion(out, label)
    eval_loss += loss.data.item()*label.size(0)
    pred = torch.argmax(out, 1)
    num_correct = (pred == label).sum()


Read More: