code: def test_images_unconstrained_adam(
      art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack
  ):
      try:
          import torch
  
          (
              x_train_mnist,
              y_train_mnist,
              x_test_mnist,
              y_test_mnist,
          ) = fix_get_mnist_subset
  
          classifier = image_dl_estimator_for_attack(
              FeatureAdversariesPyTorch, functional=True
          )
  
          attack = FeatureAdversariesPyTorch(
              classifier,
              delta=1.0,
              layer=1,
              batch_size=32,
              optimizer=torch.optim.Adam,
              max_iter=1,
              random_start=False,
          )
          x_train_mnist_adv = attack.generate(
              x=x_train_mnist[0:3], y=x_test_mnist[0:3]
          )
  
          assert np.mean(x_train_mnist[0:3]) == pytest.approx(
              0.13015705, 0.01
          )
          assert (
              np.mean(np.abs(x_train_mnist_adv - x_train_mnist[0:3]))
              != 0.0
          )
  
          with pytest.raises(ValueError):
              attack.generate(x=x_train_mnist[0:3], y=None)
          with pytest.raises(ValueError):
              attack.generate(x=x_train_mnist[0:3], y=x_test_mnist[0:2])
          with pytest.raises(ValueError):
              attack.generate(
                  x=x_train_mnist[0:3, 0:5, 0:5, :], y=x_test_mnist[0:3]
              )
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/evasion/feature_adversaries/test_feature_adversaries_pytorch.py
imports: import logging
  import numpy
  import pytest
  from art.attacks.evasion import FeatureAdversariesPyTorch
  from art.estimators.estimator import BaseEstimator, NeuralNetworkMixin
  from tests.attacks.utils import backend_test_classifier_type_check_fail
  from tests.utils import ARTTestException
label_desc: Use image node_id 3 for calling a global function with example usage: test_images_unconstrained_adam(art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack) without return types