// measure accuracy and record loss
prec1, prec5 = accuracy(output.data, target, topk=(1, 5))
losses.update(loss.data[0], input.size(0))
top1.update(prec1[0], input.size(0))
top5.update(prec5[0], input.size(0))
// measure elapsed time
After Change
if dist.is_initialized():
dist.all_reduce(val, dist.reduce_op.SUM)
val /= count.item()
meter.update(val.item(), count.item())
// measure elapsed time
batch_time.update(time.time() - end)
end = time.time()