I solved it, it was some python syntax error. Sorry for the trouble.
But I do have a logical question in “pruning”. So my line of thinking is I will compute mask for the specified layers and store it as the layer buffer and then implement a hook which will multiply the weight matrix with the mask thus essentially making the weights zero at that position.
And hence they will not contribute to the output… The question is whether this hook is applied after the forward of the layer or before, because in my before will make sense.
If this thinking is not right direction, would you please suggest me a way to achieve the desired behaviour?