between backward() and step(), you can check .grad of all named_parameters() to locate the problematic segment where gradients disappear
or, add hooks (either to tensors or modules) to do a similar analysis on non-parameter tensors (i.e. intermediate outputs) - this requires more effort, but you’ll be able to narrow it down to individual operations, if necessary
though, it is likely that your “two network” link is the problem point.