code: def get_optimizer(learning_rate, hparams):
      """Get the tf.train.Optimizer for this optimizer string.
  
      Args:
        learning_rate: The learning_rate tensor.
        hparams: tf.contrib.training.HParams object with the optimizer and
            momentum values.
  
      Returns:
        optimizer: The tf.train.Optimizer based on the optimizer string.
      """
      return {
          "rmsprop": tf.RMSPropOptimizer(
              learning_rate,
              decay=0.95,
              momentum=hparams.momentum,
              epsilon=1e-4,
          ),
          "adam": tf.AdamOptimizer(
              learning_rate, beta1=0.9, beta2=0.999, epsilon=1e-8
          ),
          "adagrad": tf.AdagradOptimizer(
              learning_rate, initial_accumulator_value=1.0
          ),
          "mom": tf.MomentumOptimizer(
              learning_rate, momentum=hparams.momentum
          ),
          "sgd": tf.GradientDescentOptimizer(learning_rate),
      }.get(hparams.optimizer)
  
imports: import importlib
  import os
  import librosa
  import numpy
  import tensorflow.compat.v1
  import tf_slim
label_desc: Use image node_id 8 for calling a global function with example usage: get_optimizer(learning_rate, hparams) and returns: dict