MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / update

Method update

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

Source from the content-addressed store, hash-verified

71 self.losses = []
72
73 def update(self, val, n=1):
74 self.val = val
75 self.sum += val * n
76 self.count += n
77 self.avg = self.sum / self.count
78 self.losses.append(val)
79
80 def show(self):
81 return torch.mean(torch.stack(self.losses[np.maximum(len(self.losses)-self.num, 0):]))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected