class_docstr: Tests optimization.
      
docstr: Tests get_optimizer.
          
code: def test_get_optimizer(self):
      """Tests get_optimizer."""
      default_optimizer_fn, optimizer_class = opt.get_optimizer_fn(
          opt.default_optimization_hparams()["optimizer"]
      )
      default_optimizer = default_optimizer_fn(1.0)
      self.assertTrue(optimizer_class, tf.train.Optimizer)
      self.assertIsInstance(default_optimizer, tf.train.AdamOptimizer)
  
      hparams = {
          "type": "MomentumOptimizer",
          "kwargs": {
              "learning_rate": 0.001,
              "momentum": 0.9,
              "use_nesterov": True,
          },
      }
      momentum_optimizer_fn, _ = opt.get_optimizer_fn(hparams)
      momentum_optimizer = momentum_optimizer_fn()
      self.assertIsInstance(
          momentum_optimizer, tf.train.MomentumOptimizer
      )
  
      hparams = {
          "type": tf.train.MomentumOptimizer,
          "kwargs": {"momentum": 0.9, "use_nesterov": True},
      }
      momentum_optimizer_fn, _ = opt.get_optimizer_fn(hparams)
      momentum_optimizer = momentum_optimizer_fn(0.001)
      self.assertIsInstance(
          momentum_optimizer, tf.train.MomentumOptimizer
      )
  
      hparams = {"type": tf.train.MomentumOptimizer(0.001, 0.9)}
      momentum_optimizer, _ = opt.get_optimizer_fn(hparams)
      self.assertIsInstance(
          momentum_optimizer, tf.train.MomentumOptimizer
      )
  
file_path: texar/tests/core/optimization_test.py
imports: import numpy
  import tensorflow
  import texar.tf.core.optimization
  from texar.tf.utils import utils
label_desc: Use image node_id 1 for calling the OptimizationTest obj's underlying member method code with example usage: obj.test_get_optimizer() without return types