code: def _build_optimizer(optimizer, global_step):
      if optimizer is None and global_step is None:
          # Default optimizer always uses a global step variable.
          global_step = tf.Variable(
              0, trainable=False, name="global_step"
          )
  
      if isinstance(global_step, tf.Variable):
          starter_learning_rate = 0.1
          learning_rate = tf.train.exponential_decay(
              starter_learning_rate,
              global_step,
              100,
              0.9,
              staircase=True,
          )
      else:
          learning_rate = 0.01
  
      # Build optimizer.
      if optimizer is None:
          optimizer = tf.train.AdamOptimizer(learning_rate)
      elif isinstance(optimizer, str):
          if optimizer == "gradientdescent":
              optimizer = tf.train.GradientDescentOptimizer(
                  learning_rate
              )
          elif optimizer == "adadelta":
              optimizer = tf.train.AdadeltaOptimizer(learning_rate)
          elif optimizer == "adagrad":
              optimizer = tf.train.AdagradOptimizer(learning_rate)
          elif optimizer == "momentum":
              optimizer = tf.train.MomentumOptimizer(learning_rate, 0.9)
          elif optimizer == "adam":
              optimizer = tf.train.AdamOptimizer(learning_rate)
          elif optimizer == "ftrl":
              optimizer = tf.train.FtrlOptimizer(learning_rate)
          elif optimizer == "rmsprop":
              optimizer = tf.train.RMSPropOptimizer(learning_rate)
          else:
              raise ValueError("Optimizer class not found:", optimizer)
      elif not isinstance(optimizer, tf.train.Optimizer):
          raise TypeError(
              "Optimizer must be str, tf.train.Optimizer, or None."
          )
  
      return optimizer, global_step
  
file_path: edward/edward/inferences/gan_inference.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import six
  import tensorflow
  from edward.inferences.variational_inference import VariationalInference
  from edward.util import get_session
label_desc: Use image node_id 1 for calling a global function with example usage: _build_optimizer(optimizer, global_step) and returns: optimizer,  global_step