We do not provide any way for the user to modify the computational graph.
This is mainly because it is merely an implementation detail of the autograd engine and can (and do) change regularly.
What is the application for which you want to be able to do such things?
Thank you for the reply. Suppose we have z = y + x and we want to do z = f(y) + f(x) (f is a customized nn.Module) everywhere in the network forward. How can we achieve that?
It depends what your original network is. But you most likely only need to modify the .forward() method on the original network and add the appropriate calls to your new module.
If you could share how the original function is defined, that would help.