code: def build_inverse_gan_graph(
      learning_rate, generator_tf, z_ph, latent_encoding_length
  ):
      z_ts = create_encoder_layers2(
          generator_tf, net_dim=64, latent_dim=latent_encoding_length
      )
  
      # Reusing exisint nodes with a different input in order to call at inference time
      image_to_encode_ph = tf.placeholder(
          tf.float32,
          shape=(None, 28, 28, 1),
          name="image_to_encode_input",
      )
      encoder_tf = create_encoder_layers2(
          image_to_encode_ph,
          net_dim=64,
          latent_dim=latent_encoding_length,
      )
  
      # CREATE LOSSES
      latent_encoder_loss = tf.reduce_mean(
          tf.square(z_ts - z_ph), axis=[1]
      )
  
      # CREATE OPTIMIZERS
      trainable_variables = tf.trainable_variables()
      encoder_trainable_vars = [
          var
          for var in trainable_variables
          if var.name.startswith("encoder")
      ]
  
      encoder_optimizer = tf.train.AdamOptimizer(
          learning_rate, beta1=0.5
      ).minimize(latent_encoder_loss, var_list=encoder_trainable_vars)
  
      return (
          encoder_tf,
          image_to_encode_ph,
          latent_encoder_loss,
          encoder_optimizer,
      )
  
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 8 for calling a global function with example usage: build_inverse_gan_graph(learning_rate, generator_tf, z_ph, latent_encoding_length) and returns: encoder_tf,  image_to_encode_ph,  latent_encoder_loss,  encoder_optimizer