class_docstr: Return a tensor that constructs adversarial examples for the given
  input. Generate uses tf.py_func in order to operate over tensors.
  :param sess: a TF session.
  :param x: A tensor with the inputs.
  :param logits: A tensor with model's output logits.
  :param targeted_label: A tensor with the target labels.
  :param binary_search_steps: The number of times we perform binary
                              search to find the optimal tradeoff-
                              constant between norm of the purturbation
                              and cross-entropy loss of classification.
  :param max_iterations: The maximum number of iterations.
  :param initial_const: The initial tradeoff-constant to use to tune the
                        relative importance of size of the purturbation
                        and cross-entropy loss of the classification.
  :param clip_min: Minimum input component value
  :param clip_max: Maximum input component value
  :param num_labels: The number of classes in the model's output.
  :param batch_size: Number of attacks to run simultaneously.
code: def __init__(
      self,
      sess,
      x,
      logits,
      targeted_label,
      targeted_attack,
      binary_search_steps,
      max_iterations,
      initial_const,
      clip_min,
      clip_max,
      nb_classes,
      batch_size,
  ):
      self.sess = sess
      self.x = x
      self.logits = logits
      assert logits.op.type != "Softmax"
      self.targeted_label = targeted_label
      self.targeted_attack = targeted_attack
      self.binary_search_steps = binary_search_steps
      self.max_iterations = max_iterations
      self.initial_const = initial_const
      self.clip_min = clip_min
      self.clip_max = clip_max
      self.batch_size = batch_size
  
      self.repeat = self.binary_search_steps >= 10
      self.shape = tuple(
          [self.batch_size] + list(self.x.get_shape().as_list()[1:])
      )
      self.ori_img = tf.Variable(
          np.zeros(self.shape), dtype=tf_dtype, name="ori_img"
      )
      self.const = tf.Variable(
          np.zeros(self.batch_size), dtype=tf_dtype, name="const"
      )
  
      self.score = softmax_cross_entropy_with_logits(
          labels=self.targeted_label, logits=self.logits
      )
      self.l2dist = reduce_sum(tf.square(self.x - self.ori_img))
      # small self.const will result small adversarial perturbation
      # targeted attack aims at minimize loss against target label
      # untargeted attack aims at maximize loss against True label
      if self.targeted_attack:
          self.loss = reduce_sum(self.score * self.const) + self.l2dist
      else:
          self.loss = -reduce_sum(self.score * self.const) + self.l2dist
      (self.grad,) = tf.gradients(self.loss, self.x)
  
file_path: cleverhans/cleverhans_v3.1.0/cleverhans/attacks/lbfgs.py
imports: import numpy
  import tensorflow
  from cleverhans.attacks.attack import Attack
  from cleverhans.compat import reduce_sum, softmax_cross_entropy_with_logits
  from cleverhans.model import CallableModelWrapper, Model, wrapper_warning
  from cleverhans import utils
  from cleverhans import utils_tf
label_desc: Use image node_id 1 to create a new LBFGS_impl object from inherited base classes: object with example: obj = LBFGS_impl(sess, x, logits, targeted_label, targeted_attack, binary_search_steps, max_iterations, initial_const, clip_min, clip_max, nb_classes, batch_size)