Question about modifying graph model

Having some pretrained CNNs, I plan to add RNN’s between certain layers of the CNN. A way to do it is to parse the original model and rewrite code to map old parameters to those in a new network, but that would require a lot of redundant code and also infeasible for all of the models I have.

Another way to do it seems to be by using torch.fx. Conceptually, I should be able to just convert pretrained CNN’s to graph models, add the RNN’s as new nodes in the graph and recompile. But after reading the tutorial from pytorch I’m still not sure how to do this. I’m not sure if it’s possible to add new submodules to a module. Can someone give a pointer to whether this is possible and how this could be achieved?