class_docstr: This class implements a GAN with the TensorFlow v2 framework.
class_docstr_tok: ["This","class","implements","a","GAN","with","the","TensorFlow","v2","framework","."]
docstr: Creates a generative model
  
  :param x: the secret backdoor trigger that will produce the target
  :param y: the target to produce when using the trigger
  :param batch_size: batch_size of images used to train generator
  :param nb_epochs: total number of iterations for performing the attack
docstr_tok: ["Creates","a","generative","model",":","param","x",":","the","secret","backdoor","trigger","that","will","produce","the","target",":","param","y",":","the","target","to","produce","when","using","the","trigger",":","param","batch_size",":","batch_size","of","images","used","to","train","generator",":","param","nb_epochs",":","total","number","of","iterations","for","performing","the","attack"]
code: def fit(
      self,
      x: np.ndarray,
      y: np.ndarray,
      batch_size: int = 128,
      nb_epochs: int = 20,
      **kwargs,
  ) -> None:
      """
      Creates a generative model
  
      :param x: the secret backdoor trigger that will produce the target
      :param y: the target to produce when using the trigger
      :param batch_size: batch_size of images used to train generator
      :param nb_epochs: total number of iterations for performing the attack
      """
      import tensorflow as tf
  
      z_trigger = x
      for _ in range(nb_epochs):
          train_imgs = kwargs.get("images")
          train_set = (
              tf.data.Dataset.from_tensor_slices(train_imgs)
              .shuffle(train_imgs.shape[0])  # type: ignore
              .batch(batch_size)
          )
  
          for images_batch in train_set:
              # generating noise from a normal distribution
              noise = tf.random.normal(
                  [images_batch.shape[0], z_trigger.shape[1]]
              )
  
              with tf.GradientTape() as gen_tape, tf.GradientTape() as disc_tape:
                  generated_images = self.generator.model(
                      noise, training=True
                  )
                  real_output = self.discriminator.model(images_batch, training=True)  # type: ignore
  
                  generated_output = self.discriminator.model(generated_images, training=True)  # type: ignore
  
                  gen_loss = self._generator_loss(generated_output)
                  disc_loss = self._discriminator_loss(
                      real_output, generated_output
                  )
  
              gradients_of_generator = gen_tape.gradient(
                  gen_loss, self.generator.model.variables
              )
              gradients_of_discriminator = disc_tape.gradient(
                  disc_loss, self.discriminator.model.variables  # type: ignore
              )
  
              self.generator_optimizer_fct.apply_gradients(
                  zip(gradients_of_generator, self.estimator.model.trainable_variables)  # type: ignore
              )
              self.discriminator_optimizer_fct.apply_gradients(
                  zip(gradients_of_discriminator, self.discriminator.model.variables)  # type: ignore
              )
  
file_path: adversarial-robustness-toolbox/art/estimators/gan/tensorflow.py
imports: from typing import Tuple, TYPE_CHECKING, Union
  import numpy
  from art.estimators.tensorflow import TensorFlowV2Estimator
label_desc: Use image node_id 4 for calling the TensorFlowV2GAN obj's underlying member method code with example usage: obj.fit(x, y, batch_size, nb_epochs) without return types