@albanD, thanks for your response. I have a nested structure and additionally I am worried to put code in the forward function.
I was hoping if I can use some of the torch.jit utilities for this and if there is a good example that I can use. If I am able to construct a network graph then it would help me with handling different residual branches as well.
Appreciate some pointers on this one. Thanks!