code: def test_fgm_gradient_max(self):
      input_dim = 2
      nb_classes = 3
      batch_size = 4
      rng = np.random.RandomState([2017, 8, 23])
      x = tf.placeholder(tf.float32, [batch_size, input_dim])
      weights = tf.placeholder(tf.float32, [input_dim, nb_classes])
      logits = tf.matmul(x, weights)
      probs = tf.nn.softmax(logits)
      adv_x = fgm(x, probs)
      random_example = rng.randint(batch_size)
      random_feature = rng.randint(input_dim)
      output = tf.slice(adv_x, [random_example, random_feature], [1, 1])
      (dx,) = tf.gradients(output, x)
      # The following line catches GitHub issue #243
      self.assertIsNotNone(dx)
      dx = self.sess.run(
          dx, feed_dict=random_feed_dict(rng, [x, weights])
      )
      ground_truth = np.zeros((batch_size, input_dim))
      ground_truth[random_example, random_feature] = 1.0
      self.assertClose(dx, ground_truth)
  
imports: from functools import partial
  import unittest
  import numpy
  import tensorflow
  from cleverhans.devtools.checks import CleverHansTest
  from cleverhans.attacks_tf import fgm, pgd_attack, UnrolledAdam, UnrolledGradientDescent, parallel_apply_transformations
  from cleverhans.devtools.mocks import random_feed_dict
  from cleverhans.model import Model
label_desc: Use image node_id 2 for calling the TestAttackTF obj's underlying member method code with example usage: obj.test_fgm_gradient_max() without return types