code: def test_adversarial_trainer_oaat_pytorch_fit_and_predict(
      get_adv_trainer_oaat, fix_get_mnist_subset, label_format
  ):
      (
          x_train_mnist,
          y_train_mnist,
          x_test_mnist,
          y_test_mnist,
      ) = fix_get_mnist_subset
      x_test_mnist_original = x_test_mnist.copy()
  
      if label_format == "one_hot":
          assert y_train_mnist.shape[-1] == 10
          assert y_test_mnist.shape[-1] == 10
      if label_format == "numerical":
          y_train_mnist = np.argmax(y_train_mnist, axis=1)
          y_test_mnist = np.argmax(y_test_mnist, axis=1)
  
      trainer = get_adv_trainer_oaat()
      if trainer is None:
          logging.warning(
              "Couldn't perform  this test because no trainer is defined for this framework configuration"
          )
          return
  
      predictions = np.argmax(trainer.predict(x_test_mnist), axis=1)
  
      if label_format == "one_hot":
          accuracy = (
              np.sum(predictions == np.argmax(y_test_mnist, axis=1))
              / x_test_mnist.shape[0]
          )
      else:
          accuracy = (
              np.sum(predictions == y_test_mnist)
              / x_test_mnist.shape[0]
          )
  
      trainer.fit(
          x_train_mnist, y_train_mnist, nb_epochs=20, batch_size=16
      )
      predictions_new = np.argmax(trainer.predict(x_test_mnist), axis=1)
  
      if label_format == "one_hot":
          accuracy_new = (
              np.sum(predictions_new == np.argmax(y_test_mnist, axis=1))
              / x_test_mnist.shape[0]
          )
      else:
          accuracy_new = (
              np.sum(predictions_new == y_test_mnist)
              / x_test_mnist.shape[0]
          )
  
      np.testing.assert_array_almost_equal(
          float(np.mean(x_test_mnist_original - x_test_mnist)),
          0.0,
          decimal=4,
      )
  
      assert accuracy == 0.32
      assert accuracy_new > 0.32
  
      trainer.fit(
          x_train_mnist,
          y_train_mnist,
          nb_epochs=20,
          validation_data=(x_train_mnist, y_train_mnist),
          batch_size=16,
      )
  
file_path: adversarial-robustness-toolbox/tests/defences/trainer/test_adversarial_trainer_oaat_pytorch.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import pytest
  import logging
  import numpy
  from art.defences.trainer import AdversarialTrainerOAATPyTorch
  from art.attacks.evasion import ProjectedGradientDescent
label_desc: Use image node_id 3 for calling a global function with example usage: test_adversarial_trainer_oaat_pytorch_fit_and_predict(get_adv_trainer_oaat, fix_get_mnist_subset, label_format) without return types