MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / register_weights

Method register_weights

StyleGAN/utils.py:112–119  ·  view source on GitHub ↗

Registers the weights of the model which will later be used when we take the moving average

(self, model)

Source from the content-addressed store, hash-verified

110 warnings.warn("Note that the exponential moving average weights will not be saved to a .pth file!")
111
112 def register_weights(self, model):
113 """
114 Registers the weights of the model which will
115 later be used when we take the moving average
116 """
117 for name, param in model.named_parameters():
118 if param.requires_grad:
119 self.registered[name] = param.clone().detach()
120
121 def __call__(self, model):
122 self.count += 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected