That’s just a warning for indexing a 0-dim tensor.
Just use .item() instead as suggested in the warning:
losses.update(loss.item(), input.size(0))
top1.update(prec1.item(), input.size(0))
top5.update(prec5.item(), input.size(0))