code: def test_scheduler_serialization():
      lr_scheduler = tf.keras.optimizers.schedules.ExponentialDecay(
          1e-3, 50, 0.5
      )
      wd_scheduler = tf.keras.optimizers.schedules.InverseTimeDecay(
          2e-3, 25, 0.25
      )
  
      optimizer = RectifiedAdam(
          learning_rate=lr_scheduler, weight_decay=wd_scheduler
      )
      config = tf.keras.optimizers.serialize(optimizer)
      new_optimizer = tf.keras.optimizers.deserialize(config)
      assert new_optimizer.get_config() == optimizer.get_config()
  
      # TODO: Remove after 2.13 is oldest version supported due to new serialization
      if Version(tf.__version__) >= Version("2.13"):
          assert new_optimizer.get_config()["learning_rate"] == {
              "class_name": "ExponentialDecay",
              "config": lr_scheduler.get_config(),
              "module": "keras.optimizers.schedules",
              "registered_name": None,
          }
          assert new_optimizer.get_config()["weight_decay"] == {
              "class_name": "InverseTimeDecay",
              "config": wd_scheduler.get_config(),
              "module": "keras.optimizers.schedules",
              "registered_name": None,
          }
  
      else:
          assert new_optimizer.get_config()["learning_rate"] == {
              "class_name": "ExponentialDecay",
              "config": lr_scheduler.get_config(),
          }
  
          assert new_optimizer.get_config()["weight_decay"] == {
              "class_name": "InverseTimeDecay",
              "config": wd_scheduler.get_config(),
          }
  
imports: import numpy
  import pytest
  from packaging.version import Version
  import tensorflow
  from tensorflow_addons.optimizers import RectifiedAdam, Lookahead
label_desc: Use image node_id 16 for calling a global function with example usage: test_scheduler_serialization() without return types