code: def test_get_regularisation_loss_gradients(
      art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack
  ):
      try:
          classifier = image_dl_estimator_for_attack(ShadowAttack)
  
          attack = ShadowAttack(
              estimator=classifier,
              sigma=0.5,
              nb_steps=3,
              learning_rate=0.1,
              lambda_tv=0.3,
              lambda_c=1.0,
              lambda_s=0.5,
              batch_size=32,
              targeted=True,
              verbose=False,
          )
  
          (x_train_mnist, _, _, _) = fix_get_mnist_subset
  
          gradients = attack._get_regularisation_loss_gradients(
              x_train_mnist[0:1]
          )
  
          gradients_expected = np.array(
              [
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  -0.27294118,
                  -0.36906054,
                  0.83799828,
                  0.40741005,
                  0.65682181,
                  -0.13141348,
                  -0.39729583,
                  -0.12235294,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
                  0.0,
              ]
          )
  
          if attack.framework == "pytorch":
              np.testing.assert_array_almost_equal(
                  gradients[0, 0, 14, :], gradients_expected, decimal=3
              )
          else:
              np.testing.assert_array_almost_equal(
                  gradients[0, 14, :, 0], gradients_expected, decimal=3
              )
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/evasion/test_shadow_attack.py
imports: import logging
  import pytest
  import numpy
  from art.attacks.evasion import ShadowAttack
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.classification.classifier import ClassifierMixin
  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_get_regularisation_loss_gradients(art_warning, fix_get_mnist_subset, image_dl_estimator_for_attack) without return types