MCPcopy Create free account
hub / github.com/10Ring/LAA-Net / AverageMeter

Class AverageMeter

lib/core_function.py:14–29  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

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

Callers 3

test.pyFile · 0.90
trainFunction · 0.85
validateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected