MCPcopy Create free account
hub / github.com/deeplearning-wisc/MOOD / AverageMeter

Class AverageMeter

utils/msdnet_function.py:89–105  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

87 return losses.avg, top1[-1].avg, top5[-1].avg
88
89class AverageMeter(object):
90 """Computes and stores the average and current value"""
91
92 def __init__(self):
93 self.reset()
94
95 def reset(self):
96 self.val = 0
97 self.avg = 0
98 self.sum = 0
99 self.count = 0
100
101 def update(self, val, n=1):
102 self.val = val
103 self.sum += val * n
104 self.count += n
105 self.avg = self.sum / self.count
106
107def accuracy(output, target, topk=(1,)):
108 """Computes the error@k for the specified values of k"""

Callers 1

validateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected