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

Method update

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

Source from the content-addressed store, hash-verified

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

Callers 5

__init__Method · 0.80
__init__Method · 0.80
save_for_hfFunction · 0.80
get_norm_act_layerFunction · 0.80
get_norm_layerFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected