Hi, thanks for the quick reply.
Say I have a single model and want to obtain gradient values from it. I can do it as I showed in main post general.
Now I have the model as two nn.Module instances, one computing the first part and one computing the second part.
I want to obtain the gradient values from both parts and combine them. Bit of a weird problem but should be possible in some way.