I’m not deeply familiar with Tensorflow, but since stop_gradient ops were used, they would be equivalent to a detached tensor. If could be the right approach to detach g_loss (unsure, as I don’t fully understand the TF code) and the exploding loss might have another root cause.
Were you able to validate that you are indeed trying to use stale gradients to update already updated parameters?