Skip to content

Commit

Permalink
rm .data and .cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
ljk628 committed Sep 18, 2018
1 parent 733137f commit f6a4c4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def eval_loss(net, criterion, loader, use_cuda=False):
loss = criterion(outputs, targets)
total_loss += loss.item()*batch_size
_, predicted = torch.max(outputs.data, 1)
correct += predicted.eq(targets.data).cpu().sum().item()
correct += predicted.eq(targets).sum().item()

elif isinstance(criterion, nn.MSELoss):
for batch_idx, (inputs, targets) in enumerate(loader):
Expand Down

0 comments on commit f6a4c4f

Please sign in to comment.