code: def get_optimizer(learning_rate=None, global_step=None, hparams=None):
      """Creates a optimizer instance.
  
      Args:
          learning_rate (float or Tensor, optional): If `None`, learning rate
              specified in :attr:`hparams`, or the default learning rate
              of the optimizer (if exists) is used.
          global_step (optional): A scalar int Tensor. Step counter to update on
              each step unless :attr:`increment_global_step` is `False`.
              Learning rate decay uses :attr:`global_step`.
              If `None`, it will be fetched from the default graph (see
              :tf_main:`tf.train.get_global_step <train/get_global_step>` for
              more details). If it has not been created, no step will be
              incremented with each weight update.
          hparams (dict or HParams, optional): hyperparameters. Missing
              hyperparameters are set to default values automatically. See
              :func:`~texar.tf.core.default_optimization_hparams` for
              all hyperparameters and default values.
  
      Returns:
          optimizer: the tf.train.Optimizer instance specified in hparams.
      """
      hparams = HParams(hparams, default_optimization_hparams())
  
      opt_hparams = hparams["optimizer"]
      optimizer_fn, optimizer_class = get_optimizer_fn(opt_hparams)
  
      static_lr = _get_static_lr(
          learning_rate, optimizer_class, hparams
      )
  
      lr_decay_fn = get_learning_rate_decay_fn(
          hparams["learning_rate_decay"]
      )
      if lr_decay_fn is not None:
          learning_rate = lr_decay_fn(
              learning_rate=static_lr, global_step=global_step
          )
      else:
          learning_rate = static_lr
  
      tf.summary.scalar("learning_rate", learning_rate)
  
      optimizer = optimizer_fn(learning_rate=learning_rate)
  
      return optimizer
  
file_path: texar/texar/tf/core/optimization.py
imports: import re
  import tensorflow
  from texar.tf.hyperparams import HParams
  from texar.tf.utils import utils
label_desc: Use image node_id 6 for calling a global function with example usage: get_optimizer(learning_rate, global_step, hparams) and returns: optimizer