class_docstr: A wrapper for the SparseL1Attack from Cleverhans.
class_docstr_tok: ["A","wrapper","for","the","SparseL1Attack","from","Cleverhans","."]
docstr: Constructs an Attack object wrapping the SparseL1Attack from Cleverhans.
  
  Args:
    num_iter: Number of iterations to run the attack.
    epsilon: The epsilon ball to clip to.
    step_size: The step size for the attack.
    q: Sparsity of the gradient update step in percent. Gradient values larger
      than this percentile are retained.
    num_classes: Number of classes in the label space.
docstr_tok: ["Constructs","an","Attack","object","wrapping","the","SparseL1Attack","from","Cleverhans",".","Args",":","num_iter",":","Number","of","iterations","to","run","the","attack",".","epsilon",":","The","epsilon","ball","to","clip","to",".","step_size",":","The","step","size","for","the","attack",".","q",":","Sparsity","of","the","gradient","update","step","in","percent",".","Gradient","values","larger","than","this","percentile","are","retained",".","num_classes",":","Number","of","classes","in","the","label","space","."]
code: def __init__(self, num_iter, epsilon, step_size, q, num_classes):
      """Constructs an Attack object wrapping the SparseL1Attack from Cleverhans.
  
      Args:
        num_iter: Number of iterations to run the attack.
        epsilon: The epsilon ball to clip to.
        step_size: The step size for the attack.
        q: Sparsity of the gradient update step in percent. Gradient values larger
          than this percentile are retained.
        num_classes: Number of classes in the label space.
      """
      self.q = q
      self.eps = epsilon
      self.eps_iter = step_size
      self.nb_iter = num_iter
      self.num_classes = num_classes
      logging.info("L1 CONFIG CREATION: %s", self.__dict__)
  
imports: from absl import logging
  import gin
  import neural_structured_learning
  from multi_representation_adversary.cleverhans_adapter import sparse_l1_descent
  from multi_representation_adversary.cleverhans_adapter import utils_tf
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 1 to create a new SparseL1Attack object from inherited base classes: Attack with example: obj = SparseL1Attack(num_iter, epsilon, step_size, q, num_classes)