code: def backend_targeted_images(attack, fix_get_mnist_subset):
      (
          x_train_mnist,
          y_train_mnist,
          x_test_mnist,
          y_test_mnist,
      ) = fix_get_mnist_subset
      targets = random_targets(
          y_test_mnist, attack.estimator.nb_classes
      )
      x_test_adv = attack.generate(
          x_test_mnist, y=targets, x_init=x_train_mnist
      )
      assert bool((x_test_mnist == x_test_adv).all()) is False
  
      y_test_pred_adv = get_labels_np_array(
          attack.estimator.predict(x_test_adv)
      )
  
      assert targets.shape == y_test_pred_adv.shape
      assert (targets == y_test_pred_adv).sum() >= (
          x_test_mnist.shape[0] // 2
      )
  
      check_adverse_example_x(x_test_adv, x_test_mnist)
  
      y_pred_adv = np.argmax(
          attack.estimator.predict(x_test_adv), axis=1
      )
  
      target = np.argmax(targets, axis=1)
      assert (target == y_pred_adv).any()
  
file_path: adversarial-robustness-toolbox/tests/attacks/utils.py
imports: import pytest
  import numpy
  import logging
  import keras.backend
  from art.utils import random_targets, get_labels_np_array
  from art.exceptions import EstimatorError
  from tests.utils import check_adverse_example_x, check_adverse_predicted_sample_y
label_desc: Use image node_id 1 for calling a global function with example usage: backend_targeted_images(attack, fix_get_mnist_subset) without return types