Registers the weights of the model which will later be used when we take the moving average
(self, model)
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected