class_docstr: A unittest class for testing the Carlini L2 attack.
class_docstr_tok: ["A","unittest","class","for","testing","the","Carlini","L2","attack","."]
docstr: First test with the TensorFlowClassifier.
  :return:
docstr_tok: ["First","test","with","the","TensorFlowClassifier",".",":","return",":"]
code: def test_tensorflow_mnist_LInf(self):
      """
      First test with the TensorFlowClassifier.
      :return:
      """
      # Build TensorFlowClassifier
      tfc, sess = get_image_classifier_tf(from_logits=True)
  
      # First attack
      clinfm = CarliniLInfMethod(
          classifier=tfc,
          targeted=True,
          max_iter=10,
          initial_const=1,
          largest_const=1.1,
          verbose=False,
      )
      params = {"y": random_targets(self.y_test_mnist, tfc.nb_classes)}
      x_test_adv = clinfm.generate(self.x_test_mnist, **params)
      self.assertFalse((self.x_test_mnist == x_test_adv).all())
      self.assertLessEqual(np.amax(x_test_adv), 1.0)
      self.assertGreaterEqual(np.amin(x_test_adv), 0.0)
      target = np.argmax(params["y"], axis=1)
      y_pred_adv = np.argmax(tfc.predict(x_test_adv), axis=1)
      logger.debug("CW0 Target: %s", target)
      logger.debug("CW0 Actual: %s", y_pred_adv)
      logger.info(
          "CW0 Success Rate: %.2f",
          (np.sum(target == y_pred_adv) / float(len(target))),
      )
      self.assertTrue((target == y_pred_adv).any())
  
      # Second attack, no batching
      clinfm = CarliniLInfMethod(
          classifier=tfc,
          targeted=False,
          max_iter=10,
          initial_const=1,
          largest_const=1.1,
          verbose=False,
      )
      x_test_adv = clinfm.generate(self.x_test_mnist)
      self.assertLessEqual(np.amax(x_test_adv), 1.0)
      self.assertGreaterEqual(np.amin(x_test_adv), -1e-6)
      target = np.argmax(params["y"], axis=1)
      y_pred_adv = np.argmax(tfc.predict(x_test_adv), axis=1)
      logger.debug("CW0 Target: %s", target)
      logger.debug("CW0 Actual: %s", y_pred_adv)
      logger.info(
          "CW0 Success Rate: %.2f",
          (np.sum(target != y_pred_adv) / float(len(target))),
      )
      self.assertTrue((target != y_pred_adv).any())
  
      # Clean-up session
      if sess is not None:
          sess.close()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import unittest
  import numpy
  from art.attacks.evasion.carlini import CarliniL0Method, CarliniL2Method, CarliniLInfMethod
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassGradientsMixin
  from art.utils import random_targets
  from tests.utils import TestBase, master_seed
  from tests.utils import get_image_classifier_tf
  from tests.utils import get_image_classifier_pt
  from tests.attacks.utils import backend_test_classifier_type_check_fail
label_desc: Use image node_id 8 for calling the TestCarlini obj's underlying member method code with example usage: obj.test_tensorflow_mnist_LInf() without return types