Computes and stores the average and current value
| 703 | |
| 704 | |
| 705 | class AverageMeter(object): |
| 706 | """Computes and stores the average and current value""" |
| 707 | |
| 708 | def __init__(self): |
| 709 | self.reset() |
| 710 | |
| 711 | def reset(self): |
| 712 | self.val = 0 |
| 713 | self.avg = 0 |
| 714 | self.sum = 0 |
| 715 | self.count = 0 |
| 716 | self.avg_last_n = 0 |
| 717 | self.max_val = 0 |
| 718 | |
| 719 | def update(self, val, n=1): |
| 720 | self.val = val |
| 721 | self.max_val = max(self.max_val, val) |
| 722 | self.sum += val * n |
| 723 | self.count += n |
| 724 | self.avg = self.sum / self.count |
| 725 | |
| 726 | |
| 727 | def to_array(dali_out): |
no outgoing calls