Solved by ptrblck in post #2 
              
              
                You are right in the assumption that passing the output of one model to the other would keep the computation graph intact and model1 should get valid gradients as long as the computation graph is not detached. 
I don’t know what model1.generate does so could you check, if output has a valid .grad_fn?…