code: def test_Alpha_Suffix(alpha: float):
      model = initialize_model()
      params = model.collect_params()
      loss_list = [5, 4, 3, 2, 3, 3, 3, 3, 3, 3, 3]
      avg_strategy = Alpha_Suffix(epochs=len(loss_list), alpha=alpha)
      for i, loss in enumerate(loss_list):
          for k, v in params.items():
              for arr in v.list_data():
                  arr[:] = i
          avg_strategy.update_average_trigger(epoch=i + 1)
          avg_strategy.apply(model)
      # nothing is cached yet, thus load_cached_model won't change anything
      # test cached model
      avg_strategy.load_cached_model(model)
      for k, v in params.items():
          for arr in v.list_data():
              # the last model should have 10 in all coordinates
              assert mx.nd.norm(arr - 10).asscalar() < 1e-30
      # test averaged model
      avg_strategy.load_averaged_model(model)
      n = max(int(math.ceil(len(loss_list) * (1 - alpha))), 1)
      if n > len(loss_list):
          # average never happens, model is not changed
          for k, v in params.items():
              for arr in v.list_data():
                  # the last model should have 10 in all coordinates
                  assert mx.nd.norm(arr - 10).asscalar() < 1e-30
      else:
          for k, v in params.items():
              for arr in v.list_data():
                  val = (n + 9) / 2.0
                  assert mx.nd.norm(arr - val).asscalar() < 1e-30
      # test cached model
      avg_strategy.load_cached_model(model)
      for k, v in params.items():
          for arr in v.list_data():
              # the last model should have 10 in all coordinates
              assert mx.nd.norm(arr - 10).asscalar() < 1e-30
  
file_path: gluonts/test/mx/trainer/test_model_iteration_averaging.py
imports: import math
  import mxnet
  import mxnet.gluon.nn
  import numpy
  import pandas
  import pytest
  from gluonts.dataset.common import ListDataset
  from gluonts.mx import SimpleFeedForwardEstimator
  from gluonts.mx.trainer import Trainer
  from gluonts.mx.trainer.model_iteration_averaging import NTA, Alpha_Suffix
label_desc: Use image node_id 3 for calling a global function with example usage: test_Alpha_Suffix(alpha) without return types