MCPcopy Index your code
hub / github.com/Sense-GVT/DeCLIP / update

Method update

prototype/utils/misc.py:42–56  ·  view source on GitHub ↗
(self, val, num=1)

Source from the content-addressed store, hash-verified

40 self.update(tensor.item(), num=num)
41
42 def update(self, val, num=1):
43 if self.length > 0:
44 # currently assert num==1 to avoid bad usage, refine when there are some explict requirements
45 assert num == 1
46 self.history.append(val)
47 if len(self.history) > self.length:
48 del self.history[0]
49
50 self.val = self.history[-1]
51 self.avg = np.mean(self.history)
52 else:
53 self.val = val
54 self.sum += val*num
55 self.count += num
56 self.avg = self.sum / self.count
57
58
59def makedir(path):

Callers 15

reduce_updateMethod · 0.95
inferenceMethod · 0.45
param_group_allFunction · 0.45
send_infoFunction · 0.45
text_transformersFunction · 0.45
visual_transformer_B32Function · 0.45
visual_transformer_B16Function · 0.45
modified_resnet_R50Function · 0.45
modified_resnet_R101Function · 0.45
modified_resnet_R50Function · 0.45
modified_resnet_R101Function · 0.45
build_samplerFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected