code: def get_adversarial_acc_metric(model, fgsm, fgsm_params):
      def adv_acc(y, _):
          # Generate adversarial examples
          x_adv = fgsm.generate(model.input, **fgsm_params)
          # Consider the attack to be constant
          x_adv = tf.stop_gradient(x_adv)
  
          # Accuracy on the adversarial examples
          preds_adv = model(x_adv)
          return keras.metrics.categorical_accuracy(y, preds_adv)
  
      return adv_acc
  
file_path: cleverhans/cleverhans_v3.1.0/cleverhans_tutorials/mnist_tutorial_keras.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import tensorflow
  from tensorflow import keras
  from cleverhans.attacks import FastGradientMethod
  from cleverhans.compat import flags
  from cleverhans.dataset import MNIST
  from cleverhans.utils import AccuracyReport
  from cleverhans.utils_keras import cnn_model
  from cleverhans.utils_keras import KerasModelWrapper
label_desc: Use image node_id 2 for calling a global function with example usage: get_adversarial_acc_metric(model, fgsm, fgsm_params) and returns: adv_acc, keras