code: def test_config():
      if hasattr(tf.keras.optimizers, "legacy"):
          sgd_opt = tf.keras.optimizers.legacy.SGD(
              lr=2.0, nesterov=True, momentum=0.3, decay=0.1
          )
      else:
          sgd_opt = tf.keras.optimizers.SGD(
              lr=2.0, nesterov=True, momentum=0.3, decay=0.1
          )
      opt = MovingAverage(
          sgd_opt,
          average_decay=0.5,
          num_updates=None,
          start_step=5,
          dynamic_decay=True,
      )
      config = opt.get_config()
  
      assert config["average_decay"] == 0.5
      assert config["num_updates"] is None
      assert config["start_step"] == 5
      assert config["dynamic_decay"] is True
  
      new_opt = MovingAverage.from_config(config)
      old_sgd_config = opt._optimizer.get_config()
      new_sgd_config = new_opt._optimizer.get_config()
  
      for k1, k2 in zip(old_sgd_config, new_sgd_config):
          assert old_sgd_config[k1] == new_sgd_config[k2]
  
imports: import numpy
  import pytest
  import tensorflow
  from packaging.version import Version
  from tensorflow_addons.optimizers import MovingAverage
label_desc: Use image node_id 8 for calling a global function with example usage: test_config() without return types