code: def train_models(
      sess,
      x_train,
      gen_loss,
      gen_opt_tf,
      disc_loss_tf,
      disc_opt_tf,
      x_ph,
      z_ph,
      latent_encoder_loss,
      encoder_optimizer,
  ):
      train_epoch = 3
      latent_encoding_length = z_ph.get_shape()[1]
      batch_size = x_train.shape[0]
      # training-loop
      np.random.seed(int(time.time()))
      logging.info("Starting training")
  
      for epoch in range(train_epoch):
          gen_losses = []
          disc_losses = []
          epoch_start_time = time.time()
          for minibatch_count in range(x_train.shape[0] // batch_size):
              # update discriminator
              x_ = x_train[
                  minibatch_count
                  * batch_size : (minibatch_count + 1)
                  * batch_size
              ]
              z_ = np.random.normal(
                  0, 1, (batch_size, latent_encoding_length)
              )
  
              loss_d_, _ = sess.run(
                  [disc_loss_tf, disc_opt_tf], {x_ph: x_, z_ph: z_}
              )
              disc_losses.append(loss_d_)
  
              # update generator
              z_ = np.random.normal(
                  0, 1, (batch_size, latent_encoding_length)
              )
              loss_g_, _ = sess.run(
                  [gen_loss, gen_opt_tf], {z_ph: z_, x_ph: x_}
              )
              gen_losses.append(loss_g_)
  
          epoch_end_time = time.time()
          per_epoch_ptime = epoch_end_time - epoch_start_time
          logging.info(
              "[{0}/{1}] - epoch_time: {2} loss_discriminator: {3}, loss_generator: {4}".format(
                  (epoch + 1),
                  train_epoch,
                  round(per_epoch_ptime, 2),
                  round(np.mean(disc_losses), 2),
                  round(np.mean(gen_losses), 2),
              )
          )
  
      # Training inverse gan encoder
      for epoch in range(train_epoch):
          encoder_losses = []
          epoch_start_time = time.time()
          for minibatch_count in range(x_train.shape[0] // batch_size):
              z_ = np.random.normal(
                  0, 1, (batch_size, latent_encoding_length)
              )
              loss_encoder_value, _ = sess.run(
                  [latent_encoder_loss, encoder_optimizer], {z_ph: z_}
              )
              encoder_losses.append(loss_encoder_value)
  
          epoch_end_time = time.time()
          per_epoch_ptime = epoch_end_time - epoch_start_time
          logging.info(
              "[{0}/{1}] - epoch_time: {2} loss_encoder: {3}".format(
                  (epoch + 1),
                  train_epoch,
                  per_epoch_ptime,
                  round(np.mean(encoder_losses), 3),
              )
          )
  
      logging.info("Training finish!... save training results")
  
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 6 for calling a global function with example usage: train_models(sess, x_train, gen_loss, gen_opt_tf, disc_loss_tf, disc_opt_tf, x_ph, z_ph, latent_encoder_loss, encoder_optimizer) without return types