Hi ! 
I’m working on quantizing models and I came across a technical issue. I would like for any given nn.Module to quantize/modify the tensor at each step of the forward ops.
Is there a way to do so from outside the model, i.e. not modifying the forward method of the model ? If I understood well, I can modify the forward like that (quantization would be binarization with the sign function):
def forward(self, x)
  x = self.fc(x)
  # here I could quantize before the non linearity if needed
  x = self.relu(x)
  x = sign(x) # quantize after non linearity
  return x

And as we can see, it can become tedious if the model is complex, whereas the goal would be to not intervene on the definition of the network.
Use case would be to apply seamlessly to any given model the quantization procedure so as to quickly test the results across a wide range of diverse models.
To be more precise, let’s suppose I want to apply a sign function (binarization). I can play around with the model.modules().weight to binarize the weights. How to do the same for the resulting tensors at each op ? If doable, can we differentiate between the layer types (linear, conv, relu, etc) ?
Let me know if I can input any necessary information !
Thanks !