Computes and stores the average and current value
| 415 | |
| 416 | |
| 417 | class AverageMeter(object): |
| 418 | """Computes and stores the average and current value""" |
| 419 | |
| 420 | def __init__(self): |
| 421 | self.reset() |
| 422 | |
| 423 | def reset(self): |
| 424 | self.val = 0 |
| 425 | self.avg = 0 |
| 426 | self.sum = 0 |
| 427 | self.count = 0 |
| 428 | |
| 429 | def update(self, val, n=1): |
| 430 | self.val = val |
| 431 | self.sum += val * n |
| 432 | self.count += n |
| 433 | self.avg = self.sum / (self.count + 10e-5) |
| 434 | |
| 435 | def mkdir_p(path): |
| 436 | try: |
nothing calls this directly
no outgoing calls
no test coverage detected