MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / update

Method update

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

Source from the content-addressed store, hash-verified

53 self.count = 0
54
55 def update(self, val, n=1, decay=0):
56 self.val = val
57 if decay:
58 alpha = math.exp(-n / decay) # exponential decay over 100 updates
59 self.sum = alpha * self.sum + (1 - alpha) * val * n
60 self.count = alpha * self.count + (1 - alpha) * n
61 else:
62 self.sum += val * n
63 self.count += n
64 self.avg = self.sum / self.count

Callers 8

mainFunction · 0.45
change_vocabFunction · 0.45
change_vocabFunction · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
_get_args_from_configFunction · 0.45
from_configMethod · 0.45
forwardMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected