Is it possible to create a branch in a torch::nn::Sequential model?

I have a single torch::nn::Sequential object to which I am adding each layer of ResNet50 model. For example, the third module that I need to add to Sequential object should take the output of the first layer and not the second. Is this even possible? In essence can we create branches in the model? If yes, how?

Thank you

I tried to split one sequential model into two seperate Sequential, and add branch after the first one. And merge the two branch at the end. It worked for me.

However, I find the training time nearly doubled, while the #params is almost the same.

I wonder if there are any better solutions.