CoolFace
Apppublic

meng2003/music2dance

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
shell_util.py23 linesDownload Raw Back to util
1class AverageMeter(object):2    """Computes and stores the average and current value.3 4    Adapted from: https://github.com/pytorch/examples/blob/master/imagenet/train.py5    """6    def __init__(self):7        self.val = 0.8        self.avg = 0.9        self.sum = 0.10        self.count = 0.11 12    def reset(self):13        self.val = 0.14        self.avg = 0.15        self.sum = 0.16        self.count = 0.17 18    def update(self, val, n=1):19        self.val = val20        self.sum += val * n21        self.count += n22        self.avg = self.sum / self.count23