Yes, to the best of my knowledge, because there is no reason the computational graph should break by doing the f(x). Yes, if you pass both the model’s parameters to the optimizer, the the loss.backward() will calculate the gradients of both the networks.