So when you call backward the first time it calculated all the gradients and gets rid of the computational graph from memory, so since you need guess_fake for loss_g, there is no computational graph for it, so I suggest recalculating guess_fake after one step of discriminator.
You could also do retain_graph = True but then all the graphs are retained in memory and this could cause CUDA out of memory error. So just re calculate whatever you need for the second backward()after the first backward().