MCPcopy Index your code
hub / github.com/DingXiaoH/RepVGG / AverageMeter

Class AverageMeter

utils.py:12–33  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

10import os
11
12class AverageMeter(object):
13 """Computes and stores the average and current value"""
14 def __init__(self, name, fmt=':f'):
15 self.name = name
16 self.fmt = fmt
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
30
31 def __str__(self):
32 fmtstr = '{name} {val' + self.fmt + '} ({avg' + self.fmt + '})'
33 return fmtstr.format(**self.__dict__)
34
35
36class ProgressMeter(object):

Callers 5

train_one_epochFunction · 0.90
validateFunction · 0.90
insert_bnFunction · 0.90
trainFunction · 0.85
validateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected