code: def tf_v_ae_mnist(request):
      # load and preprocess MNIST data
      (X_train, _), (X_test, _) = tf.keras.datasets.mnist.load_data()
      X = X_train.reshape(60000, input_dim)[
          :1000
      ]  # only train on 1000 instances
      X = X.astype(np.float32)
      X /= 255
  
      # init model, predict with untrained model, train and predict with trained model
      model = request.param
      X_recon_untrained = model(X).numpy()
      model_weights = model.weights[1].numpy().copy()
      model.compile(optimizer="adam", loss="mse")
      model.fit(X, X, epochs=5)
      X_recon = model(X).numpy()
      assert (model_weights != model.weights[1].numpy()).any()
      assert np.sum((X - X_recon_untrained) ** 2) > np.sum(
          (X - X_recon) ** 2
      )
  
file_path: alibi-detect/alibi_detect/models/tensorflow/tests/test_autoencoder_tf.py
imports: import numpy
  import pytest
  import tensorflow
  from tensorflow.keras.layers import Dense, InputLayer
  from alibi_detect.models.tensorflow.autoencoder import AE, AEGMM, VAE, VAEGMM, Seq2Seq, EncoderLSTM, DecoderLSTM
  from alibi_detect.models.tensorflow.losses import loss_aegmm, loss_vaegmm
  from alibi_detect.models.tensorflow.trainer import trainer
label_desc: Use image node_id 1 for calling a global function with example usage: tf_v_ae_mnist(request) without return types