MCPcopy Create free account
hub / github.com/TPCD/DCCL / AverageMeter

Class AverageMeter

project_utils/general_utils.py:12–29  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

10from datetime import datetime
11
12class AverageMeter(object):
13 """Computes and stores the average and current value"""
14 def __init__(self):
15 self.reset()
16
17 def reset(self):
18
19 self.val = 0
20 self.avg = 0
21 self.sum = 0
22 self.count = 0
23
24 def update(self, val, n=1):
25
26 self.val = val
27 self.sum += val * n
28 self.count += n
29 self.avg = self.sum / self.count
30
31
32def seed_torch(seed=1029):

Callers 2

extract_featuresFunction · 0.70
extract_features2Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected