code: def test_eot_contrast_pytorch(art_warning, fix_get_mnist_subset):
      try:
          import torch
          from art.preprocessing.expectation_over_transformation.natural_corruptions.contrast.pytorch import (
              EoTContrastPyTorch,
          )
  
          x_train_mnist, y_train_mnist, _, _ = fix_get_mnist_subset
          x_train_mnist = np.transpose(
              x_train_mnist, (0, 2, 3, 1)
          )  # transpose to NHWC
  
          nb_samples = 3
  
          eot = EoTContrastPyTorch(
              nb_samples=nb_samples,
              contrast_factor=(0.2, 0.2),
              clip_values=(0.0, 1.0),
          )
          x_eot, y_eot = eot.forward(
              x=torch.from_numpy(x_train_mnist),
              y=torch.from_numpy(y_train_mnist),
          )
  
          assert x_eot.shape[0] == nb_samples * x_train_mnist.shape[0]
          assert y_eot.shape[0] == nb_samples * y_train_mnist.shape[0]
  
          x_eot_expected = np.array(
              [
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.17367348,
                  0.29837936,
                  0.30857542,
                  0.30857542,
                  0.20347738,
                  0.1297519,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
                  0.11014406,
              ]
          )
  
          np.testing.assert_almost_equal(
              x_eot.numpy()[0, 14, :, 0], x_eot_expected
          )
  
          x_eot, y_eot = eot.forward(
              x=torch.from_numpy(
                  np.repeat(x_train_mnist, repeats=3, axis=1)
              ),
              y=torch.from_numpy(y_train_mnist),
          )
  
          assert x_eot.shape[0] == nb_samples * x_train_mnist.shape[0]
          assert y_eot.shape[0] == nb_samples * y_train_mnist.shape[0]
  
          with pytest.raises(ValueError):
              _ = EoTContrastPyTorch(
                  nb_samples=nb_samples,
                  contrast_factor=(0.2, 0.2, 0.3),
                  clip_values=(0.0, 1.0),
              )
  
      except ARTTestException as e:
          art_warning(e)
  
imports: import logging
  import numpy
  import pytest
  from tests.utils import ARTTestException
label_desc: Use image node_id 2 for calling a global function with example usage: test_eot_contrast_pytorch(art_warning, fix_get_mnist_subset) without return types