Skip to content

Commit 021d978

Browse files
committed
Update imagenet_eval.py to torch 1.0.x
1 parent 3fc49a5 commit 021d978

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/imagenet_eval.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ def validate(val_loader, model, criterion):
229229

230230
# measure accuracy and record loss
231231
prec1, prec5 = accuracy(output.data, target.data, topk=(1, 5))
232-
losses.update(loss.data[0], input.size(0))
233-
top1.update(prec1[0], input.size(0))
234-
top5.update(prec5[0], input.size(0))
232+
losses.update(loss.data.item(), input.size(0))
233+
top1.update(prec1.item(), input.size(0))
234+
top5.update(prec5.item(), input.size(0))
235235

236236
# measure elapsed time
237237
batch_time.update(time.time() - end)

0 commit comments

Comments
 (0)