code: def test_serialization():
      start_averaging = 0
      average_period = 1
      if hasattr(tf.keras.optimizers, "legacy"):
          sgd = tf.keras.optimizers.legacy.SGD(lr=1.0)
      else:
          sgd = tf.keras.optimizers.SGD(lr=1.0)
      optimizer = SWA(sgd, start_averaging, average_period)
      config = tf.keras.optimizers.serialize(optimizer)
      new_optimizer = tf.keras.optimizers.deserialize(config)
      assert new_optimizer.get_config() == optimizer.get_config()
  
file_path: addons/tensorflow_addons/optimizers/tests/stochastic_weight_averaging_test.py
imports: import numpy
  import pytest
  import tensorflow
  from tensorflow_addons.optimizers import stochastic_weight_averaging
  from tensorflow_addons.optimizers.utils import fit_bn
label_desc: Use image node_id 7 for calling a global function with example usage: test_serialization() without return types