MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / update

Method update

ADHMR/lib/models/ema.py:32–51  ·  view source on GitHub ↗

Update currently maintained parameters. Call this every time the parameters are updated, such as the result of the `optimizer.step()` call. Args: parameters: Iterable of `torch.nn.Parameter`; usually the same set of parameters used to initialize this object.

(self, parameters)

Source from the content-addressed store, hash-verified

30 self.collected_params = []
31
32 def update(self, parameters):
33 """
34 Update currently maintained parameters.
35
36 Call this every time the parameters are updated, such as the result of
37 the `optimizer.step()` call.
38
39 Args:
40 parameters: Iterable of `torch.nn.Parameter`; usually the same set of
41 parameters used to initialize this object.
42 """
43 decay = self.decay
44 if self.num_updates is not None:
45 self.num_updates += 1
46 decay = min(decay, (1 + self.num_updates) / (10 + self.num_updates))
47 one_minus_decay = 1.0 - decay
48 with torch.no_grad():
49 parameters = [p for p in parameters if p.requires_grad]
50 for s_param, param in zip(self.shadow_params, parameters):
51 s_param.sub_(one_minus_decay * (s_param - param))
52
53 def copy_to(self, parameters):
54 """

Callers 13

saveMethod · 0.45
get_tposeMethod · 0.45
trainMethod · 0.45
sampleMethod · 0.45
trainMethod · 0.45
sampleMethod · 0.45
sampleMethod · 0.45
__getitem__Method · 0.45
load_ptMethod · 0.45
__getitem__Method · 0.45
__getitem__Method · 0.45
saveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected