Please show us the entire exception trace that you are getting.
But it looks like what that assertion is checking is that you detached the generator, so that gradients will not be accumulated. This is in the section where you are training the discriminator. The point is that in that case you do not need the gradients of the generator. Here’s a thread which talks about why that is.