MCPcopy Create free account
hub / github.com/SLDGroup/EMCAD / update

Method update

utils/utils.py:61–66  ·  view source on GitHub ↗
(self, val, n=1)

Source from the content-addressed store, hash-verified

59 self.losses = []
60
61 def update(self, val, n=1):
62 self.val = val
63 self.sum += val * n
64 self.count += n
65 self.avg = self.sum / self.count
66 self.losses.append(val)
67
68 def show(self):
69 return torch.mean(torch.stack(self.losses[np.maximum(len(self.losses)-self.num, 0):]))

Callers 2

trainFunction · 0.95
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected