Pytorch pruning tutorial. Where in process does this happen?

I was looking at the Pytorch pruning tutorial ( and I am left confused about where in the process this pruning happens.

  1. Does the setup in the tutorial happen before training, and then it is trained with the pruning method somewhere in the loop
  2. Do the strategies in the tutorial happen after training when we have the final network weights?


This tutorial shows how to use pruning for the weights that are used during training.
It is not a pre or post processing technique.

In particular, the prunning happen when you access the weights where you registered the prunning, they will automatically get prunned.

Thanks, so just to verify, I would follow the tutorial, and then make a normal training loop without any other modification and the model will automatically be pruned while training?

Yes this is the goal!