mango_clfd / utils.py
alihamzajutt's picture
Check new
4302c60
Raw
History Blame Contribute Delete
387 Bytes
"""
@author: Yanzuo Lu
@author: oliveryanzuolu@gmail.com
"""
import logging
logger = logging.getLogger()
class AverageMeter:
def __init__(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.val = val
self.sum += val * n
self.count += n
self.avg = self.sum / self.count