Gaurav_Prasad:

I do not want to retrain the model using forward hook.


I’m not sure how “retrain” is related to forward hooks, but in case you don’t want to use hooks you could write a custom nn.Module and override the forward method with your logic (i.e. return the desired intermediate tensors additionally yo the model output).