code: def get_data_and_model(optimizer="moving_avg"):
      x = tf.random.normal([TRAIN_SAMPLES, INPUT_DIM])
      y = tf.random.normal([TRAIN_SAMPLES, NUM_CLASSES])
      moving_avg = MovingAverage(get_legacy_sgd(2.0), average_decay=0.5)
      if optimizer == "moving_avg":
          optimizer = moving_avg
      inputs = keras.layers.Input(INPUT_DIM)
      hidden_layer = keras.layers.Dense(
          NUM_HIDDEN, input_dim=INPUT_DIM, activation="relu"
      )(inputs)
      outputs = keras.layers.Dense(NUM_CLASSES, activation="softmax")(
          hidden_layer
      )
      model = keras.Model(inputs=inputs, outputs=outputs)
      model.compile(
          loss="categorical_crossentropy",
          optimizer=optimizer,
          metrics=["acc"],
      )
      return x, y, model
  
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 2 for calling a global function with example usage: get_data_and_model(optimizer) and returns: x,  y,  model