MCPcopy Create free account
hub / github.com/AtlasAnalyticsLab/AdaFisher / AverageMeter

Class AverageMeter

Image_Classification/src/train.py:460–480  ·  view source on GitHub ↗

Computes and stores the average and current value

Source from the content-addressed store, hash-verified

458
459
460class AverageMeter:
461 """Computes and stores the average and current value"""
462 val: float
463 avg: float
464 sum: float
465 count: int
466
467 def __init__(self):
468 self.reset()
469
470 def reset(self):
471 self.val = 0
472 self.avg = 0
473 self.sum = 0
474 self.count = 0
475
476 def update(self, val: float, n: int = 1):
477 self.val = val
478 self.sum += val * n
479 self.count += n
480 self.avg = self.sum / self.count
481
482
483def accuracy(output, target, topk=(1,)):

Callers 2

epoch_iterationMethod · 0.85
validateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected