peal.global_utils.reset_weights

peal.global_utils.reset_weights(model)[source]

Re-initialise a model by calling reset_parameters recursively.

Descends through the module tree and calls reset_parameters on every layer that has one, so that a pretrained model can be turned back into a randomly initialised one of the same architecture.

Parameters:

model (torch.nn.Module) – Model modified in place.