code: def test_loss_scale_optimizer(tmp_path):
      test_model_filepath = str(tmp_path / "test_model.{epoch:02d}.h5")
      moving_avg = MovingAverage(get_legacy_sgd(2.0), average_decay=0.5)
      optimizer = tf.keras.mixed_precision.LossScaleOptimizer(
          moving_avg
      )
      x, y, model = get_data_and_model(optimizer)
      save_freq = "epoch"
      avg_model_ckpt = AverageModelCheckpoint(
          update_weights=False,
          filepath=test_model_filepath,
          save_freq=save_freq,
      )
      model.fit(
          x,
          y,
          epochs=EPOCHS,
          batch_size=BATCH_SIZE,
          validation_data=(x, y),
          callbacks=[avg_model_ckpt],
      )
      assert not os.path.exists(test_model_filepath)
  
file_path: addons/tensorflow_addons/callbacks/tests/avg_model_checkpoint_test.py
imports: import os
  import pytest
  import tensorflow
  from tensorflow import keras
  from tensorflow_addons.callbacks import AverageModelCheckpoint
  from tensorflow_addons.optimizers import MovingAverage
label_desc: Use image node_id 12 for calling a global function with example usage: test_loss_scale_optimizer(tmp_path) without return types