code: def build_gan_graph(
      learning_rate, latent_encoding_length, batch_size=None
  ):
      if batch_size is None:
          batch_size = 200
      # INPUT VARIABLES
      x_ph = tf.placeholder(tf.float32, shape=(None, 28, 28, 1))
      z_ph = tf.placeholder(
          tf.float32,
          shape=(None, latent_encoding_length),
          name="z_input",
      )
  
      # Building Generator and Discriminator
      generator_tf = create_generator_layers(z_ph)
      disc_real_tf, disc_real_logits_tf = create_discriminator_layers(
          x_ph
      )
      disc_fake_tf, disc_fake_logits_tf = create_discriminator_layers(
          generator_tf
      )
  
      # CREATE LOSSES
      disc_loss_real_tf = tf.losses.sigmoid_cross_entropy(
          multi_class_labels=tf.ones([batch_size, 1, 1, 1]),
          logits=disc_real_logits_tf,
      )
  
      disc_loss_fake_tf = tf.losses.sigmoid_cross_entropy(
          multi_class_labels=tf.zeros([batch_size, 1, 1, 1]),
          logits=disc_fake_logits_tf,
      )
      disc_loss_tf = disc_loss_real_tf + disc_loss_fake_tf
      gen_loss = tf.losses.sigmoid_cross_entropy(
          multi_class_labels=tf.ones([batch_size, 1, 1, 1]),
          logits=disc_fake_logits_tf,
      )
  
      # CREATE OPTIMIZERS
      # We only want generator variables to be trained when running the generator and not discriminator variables etc.
      trainable_variables = tf.trainable_variables()
      disc_trainable_vars = [
          var
          for var in trainable_variables
          if var.name.startswith("discriminator")
      ]
      gen_trainable_vars = [
          var
          for var in trainable_variables
          if var.name.startswith("generator")
      ]
  
      # CREATE OPTIMIZERS
      disc_opt_tf = tf.train.AdamOptimizer(
          learning_rate, beta1=0.5
      ).minimize(disc_loss_tf, var_list=disc_trainable_vars)
      gen_opt_tf = tf.train.AdamOptimizer(
          learning_rate, beta1=0.5
      ).minimize(gen_loss, var_list=gen_trainable_vars)
  
      return (
          generator_tf,
          z_ph,
          gen_loss,
          gen_opt_tf,
          disc_loss_tf,
          disc_opt_tf,
          x_ph,
      )
  
file_path: adversarial-robustness-toolbox/utils/resources/create_inverse_gan_models.py
imports: import logging
  import time
  import os
  import numpy
  import tensorflow
  from art.utils import load_mnist
label_desc: Use image node_id 7 for calling a global function with example usage: build_gan_graph(learning_rate, latent_encoding_length, batch_size) and returns: generator_tf,  z_ph,  gen_loss,  gen_opt_tf,  disc_loss_tf,  disc_opt_tf,  x_ph