Download RigNet/utils/log_utils.py from ckc99u/Rignet: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/ckc99u/Rignet/resolve/main/RigNet/utils/log_utils.py
- Command line
-
hf download hf://spaces/ckc99u/Rignet/RigNet/utils/log_utils.py
-
curl -L -o log_utils.py https://huggingface.co/spaces/ckc99u/Rignet/resolve/main/RigNet/utils/log_utils.py
1.1 kB
| #------------------------------------------------------------------------------- | |
| # Name: mst_utils.py | |
| # Purpose: utilize class for log recording | |
| # RigNet Copyright 2020 University of Massachusetts | |
| # RigNet is made available under General Public License Version 3 (GPLv3), or under a Commercial License. | |
| # Please see the LICENSE README.txt file in the main directory for more information and instruction on using and licensing RigNet. | |
| #------------------------------------------------------------------------------- | |
| class AverageMeter(object): | |
| """Computes and stores the average and current value""" | |
| def __init__(self): | |
| self.reset() | |
| def reset(self): | |
| self.val = 0.0 | |
| self.avg = 0.0 | |
| self.sum = 0.0 | |
| self.count = 0.0 | |
| def update(self, val, n=1): | |
| self.val = val | |
| self.sum += val * n | |
| self.count += n | |
| self.avg = self.sum / self.count | |
| def accumulate(self, val, n=1): | |
| self.val = val | |
| self.sum += val | |
| self.count += n | |
| self.avg = self.sum / self.count |