MCPcopy Index your code
hub / github.com/HobbitLong/PyContrast / AverageMeter

Class AverageMeter

pycontrast/learning/util.py:6–21  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

4
5
6class AverageMeter(object):
7 """Computes and stores the average and current value"""
8 def __init__(self):
9 self.reset()
10
11 def reset(self):
12 self.val = 0
13 self.avg = 0
14 self.sum = 0
15 self.count = 0
16
17 def update(self, val, n=1):
18 self.val = val
19 self.sum += val * n
20 self.count += n
21 self.avg = self.sum / self.count
22
23
24def accuracy(output, target, topk=(1,)):

Callers 4

_train_mocoMethod · 0.85
_train_memMethod · 0.85
trainMethod · 0.85
validateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected