I am using a resnet101 model from
import torchvision.models as models models.resnet101
I want to make certain modifications to the model in such a way that I remove certain layers from the model towards the end and replace them by some other layers(I have successfully done this).
Next, I wanted to take output of one of the intermediate layer and perform some activation on it.
The final output of the model would be the output from activation(intermediate layer) and the one obtained at the end of the network. However, I am not aware of any suitable way of doing this operation where I could take the output of intermediate layer and then perform some operation on it and then return it back.
I have come across some methods on forum where we can register hook and obtain the outcome, but I want to perform further operations after obtaining the output.
Thanks in advance.