Reset model weights - PyTorch Forums
discuss.pytorch.org › t › reset-model-weightsJun 04, 2018 · How to re-set alll parameters in a network. How to re-set the weights for the entire network, using the original pytorch weight initialization. @unnir. Here is the code with an example that runs: def lp_norm (mdl: nn.Module, p: int = 2) -> Tensor: lp_norms = [w.norm (p) for name, w in mdl.named_parameters ()] return sum (lp_norms) def reset_all ...