(self, module)
| 9 | self.shadow = {} |
| 10 | |
| 11 | def register(self, module): |
| 12 | if isinstance(module, nn.DataParallel): |
| 13 | module = module.module |
| 14 | for name, param in module.named_parameters(): |
| 15 | if param.requires_grad: |
| 16 | self.shadow[name] = param.data.clone() |
| 17 | |
| 18 | def update(self, module): |
| 19 | if isinstance(module, nn.DataParallel): |