code: def test_swap_ema_weights_on_epoch(self):
      # using SwapEMAWeights together with ModelCheckpoint
      model = self._get_compiled_model()
      with tempfile.TemporaryDirectory() as temp_dir:
          model.fit(
              self.x_train,
              self.y_train,
              epochs=2,
              callbacks=[
                  callbacks.SwapEMAWeights(swap_on_epoch=True),
                  callbacks.ModelCheckpoint(
                      temp_dir + "/{epoch:1d}.keras"
                  ),
              ],
              validation_data=(self.x_train, self.y_train),
          )
          model2 = saving.load_model(temp_dir + "/2.keras")
  
      logs = model.evaluate(
          self.x_train, self.y_train, return_dict=True
      )
      logs2 = model2.evaluate(
          self.x_train, self.y_train, return_dict=True
      )
      # saved checkpoint will be applied by EMA weights
      self.assertEqual(
          logs["mean_squared_error"],
          logs2["mean_squared_error"],
      )
  
imports: import tempfile
  import pytest
  import tensorflow
  from tensorflow.python.eager import context
  from keras import backend
  from keras import callbacks
  from keras import layers
  from keras import losses
  from keras import metrics
  from keras import optimizers
  from keras import saving
  from keras import testing
  from keras.models import Sequential
  from keras.testing import test_utils
  from keras.utils import numerical_utils
label_desc: Use image node_id 5 for calling the SwapEMAWeightsTest obj's underlying member method code with example usage: obj.test_swap_ema_weights_on_epoch() without return types