After applying pruning to the layers of a model, by iterating over all modules and applying:
prune.l1_unstructured(layer, name='weight', amount=0.1) prune.l1_unstructured(layer, name='bias', amount=0.1)
to nn.Linear modules.
I get the error
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment, when trying to
nn.Sequential model, or rather, an object containing said