title: Generator's gradients are none with pretrained discriminator
body: <p>I'm trying to make a GAN, but my gradients_of_generator is always a list of none values. I get the following ValueError: &quot;No gradients provided for any variable&quot;. Currently I'm putting in one loss value at a time into tape.gradient. Is this possible?</p>
  <p>I assume the generator gets a gradient from the differentiable loss function that wraps the discriminator's model output.</p>
  <pre><code>loss_func=tf.keras.losses.BinaryCrossentropy(from_logits=True)
  @tf.function
  def train_step():
      
      try:
          disc_out= ***Run some other pre-trained model to get a float***
          
      except:
          disc_out=1
  
      target1=np.array(1).reshape([1,1])
      
      with tf.GradientTape() as gen_tape:
          tf1=tf.convert_to_tensor(disc_out,dtype=tf.float32)
          loss_val=tf.cast(loss_func(target1,tf1),dtype=tf.float32)
          
      gradients_of_generator = gen_tape.gradient(loss_val, gen_model.trainable_variables)
      optimizer.apply_gradients(zip(gradients_of_generator, gen_model.trainable_variables))
  </code></pre>
  <p>Then I run</p>
  <pre><code>train_step()
  </code></pre>