class_docstr: This class implements either the Basic Iterative Method
  (Kurakin et al. 2016) when rand_init is set to 0. or the
  Madry et al. (2017) method when rand_minmax is larger than 0.
  Paper link (Kurakin et al. 2016): https://arxiv.org/pdf/1607.02533.pdf
  Paper link (Madry et al. 2017): https://arxiv.org/pdf/1706.06083.pdf
  
  :param model: cleverhans.model.Model
  :param sess: optional tf.Session
  :param dtypestr: dtype of the data
  :param default_rand_init: whether to use random initialization by default
  :param kwargs: passed through to super constructor
class_docstr_tok: ["This","class","implements","either","the","Basic","Iterative","Method","(","Kurakin","et","al",".","2016",")","when","rand_init","is","set","to","0.","or","the","Madry","et","al",".","(","2017",")","method","when","rand_minmax","is","larger","than","0",".","Paper","link","(","Kurakin","et","al",".","2016",")",":","https",":","\/\/arxiv.org\/pdf\/1607.02533.pdf","Paper","link","(","Madry","et","al",".","2017",")",":","https",":","\/\/arxiv.org\/pdf\/1706.06083.pdf",":","param","model",":","cleverhans.model.Model",":","param","sess",":","optional","tf.Session",":","param","dtypestr",":","dtype","of","the","data",":","param","default_rand_init",":","whether","to","use","random","initialization","by","default",":","param","kwargs",":","passed","through","to","super","constructor"]
docstr: Take in a dictionary of parameters and applies attack-specific checks
  before saving them as attributes.
  
  Attack-specific parameters:
  
  :param eps: (optional float) maximum distortion of adversarial example
              compared to original input
  :param eps_iter: (optional float) step size for each attack iteration
  :param nb_iter: (optional int) Number of attack iterations.
  :param y: (optional) A tensor with the true labels.
  :param y_target: (optional) A tensor with the labels to target. Leave
                   y_target=None if y is also set. Labels should be
                   one-hot-encoded.
  :param ord: (optional) Order of the norm (mimics Numpy).
              Possible values: np.inf, 1 or 2.
  :param loss_fn: Loss function that takes (labels, logits) as arguments and returns loss
  :param clip_min: (optional float) Minimum input component value
  :param clip_max: (optional float) Maximum input component value
  :param rand_init: (optional) Start the gradient descent from a point chosen
                    uniformly at random in the norm ball of radius
                    rand_init_eps
  :param rand_init_eps: (optional float) size of the norm ball from which
                        the initial starting point is chosen. Defaults to eps
  :param clip_grad: (optional bool) Ignore gradient components at positions
                    where the input is already at the boundary of the domain,
                    and the update step will get clipped out.
  :param sanity_checks: bool Insert tf asserts checking values
      (Some tests need to run with no sanity checks because the
       tests intentionally configure the attack strangely)
docstr_tok: ["Take","in","a","dictionary","of","parameters","and","applies","attack-specific","checks","before","saving","them","as","attributes",".","Attack-specific","parameters",":",":","param","eps",":","(","optional","float",")","maximum","distortion","of","adversarial","example","compared","to","original","input",":","param","eps_iter",":","(","optional","float",")","step","size","for","each","attack","iteration",":","param","nb_iter",":","(","optional","int",")","Number","of","attack","iterations",".",":","param","y",":","(","optional",")","A","tensor","with","the","true","labels",".",":","param","y_target",":","(","optional",")","A","tensor","with","the","labels","to","target",".","Leave","y_target=None","if","y","is","also","set",".","Labels","should","be","one-hot-encoded",".",":","param","ord",":","(","optional",")","Order","of","the","norm","(","mimics","Numpy",")",".","Possible","values",":","np.inf",",","1","or","2.",":","param","loss_fn",":","Loss","function","that","takes","(","labels",",","logits",")","as","arguments","and","returns","loss",":","param","clip_min",":","(","optional","float",")","Minimum","input","component","value",":","param","clip_max",":","(","optional","float",")","Maximum","input","component","value",":","param","rand_init",":","(","optional",")","Start","the","gradient","descent","from","a","point","chosen","uniformly","at","random","in","the","norm","ball","of","radius","rand_init_eps",":","param","rand_init_eps",":","(","optional","float",")","size","of","the","norm","ball","from","which","the","initial","starting","point","is","chosen",".","Defaults","to","eps",":","param","clip_grad",":","(","optional","bool",")","Ignore","gradient","components","at","positions","where","the","input","is","already","at","the","boundary","of","the","domain",",","and","the","update","step","will","get","clipped","out",".",":","param","sanity_checks",":","bool","Insert","tf","asserts","checking","values","(","Some","tests","need","to","run","with","no","sanity","checks","because","the","tests","intentionally","configure","the","attack","strangely",")"]
code: def parse_params(
      self,
      eps=0.3,
      eps_iter=0.05,
      nb_iter=10,
      y=None,
      ord=np.inf,
      loss_fn=softmax_cross_entropy_with_logits,
      clip_min=None,
      clip_max=None,
      y_target=None,
      rand_init=None,
      rand_init_eps=None,
      clip_grad=False,
      sanity_checks=True,
      **kwargs,
  ):
      """
      Take in a dictionary of parameters and applies attack-specific checks
      before saving them as attributes.
  
      Attack-specific parameters:
  
      :param eps: (optional float) maximum distortion of adversarial example
                  compared to original input
      :param eps_iter: (optional float) step size for each attack iteration
      :param nb_iter: (optional int) Number of attack iterations.
      :param y: (optional) A tensor with the true labels.
      :param y_target: (optional) A tensor with the labels to target. Leave
                       y_target=None if y is also set. Labels should be
                       one-hot-encoded.
      :param ord: (optional) Order of the norm (mimics Numpy).
                  Possible values: np.inf, 1 or 2.
      :param loss_fn: Loss function that takes (labels, logits) as arguments and returns loss
      :param clip_min: (optional float) Minimum input component value
      :param clip_max: (optional float) Maximum input component value
      :param rand_init: (optional) Start the gradient descent from a point chosen
                        uniformly at random in the norm ball of radius
                        rand_init_eps
      :param rand_init_eps: (optional float) size of the norm ball from which
                            the initial starting point is chosen. Defaults to eps
      :param clip_grad: (optional bool) Ignore gradient components at positions
                        where the input is already at the boundary of the domain,
                        and the update step will get clipped out.
      :param sanity_checks: bool Insert tf asserts checking values
          (Some tests need to run with no sanity checks because the
           tests intentionally configure the attack strangely)
      """
  
      # Save attack-specific parameters
      self.eps = eps
      if rand_init is None:
          rand_init = self.default_rand_init
      self.rand_init = rand_init
      if rand_init_eps is None:
          rand_init_eps = self.eps
      self.rand_init_eps = rand_init_eps
  
      self.eps_iter = eps_iter
      self.nb_iter = nb_iter
      self.y = y
      self.y_target = y_target
      self.ord = ord
      self.loss_fn = loss_fn
      self.clip_min = clip_min
      self.clip_max = clip_max
      self.clip_grad = clip_grad
  
      if isinstance(eps, float) and isinstance(eps_iter, float):
          # If these are both known at compile time, we can check before anything
          # is run. If they are tf, we can't check them yet.
          assert eps_iter <= eps, (eps_iter, eps)
  
      if self.y is not None and self.y_target is not None:
          raise ValueError("Must not set both y and y_target")
      # Check if order of the norm is acceptable given current implementation
      if self.ord not in [np.inf, 1, 2]:
          raise ValueError("Norm order must be either np.inf, 1, or 2.")
  
      if self.clip_grad and (
          self.clip_min is None or self.clip_max is None
      ):
          raise ValueError(
              "Must set clip_min and clip_max if clip_grad is set"
          )
  
      self.sanity_checks = sanity_checks
  
      if len(kwargs.keys()) > 0:
          warnings.warn(
              "kwargs is unused and will be removed on or after "
              "2019-04-26."
          )
  
      return True
  
file_path: cleverhans/cleverhans_v3.1.0/cleverhans/attacks/projected_gradient_descent.py
imports: import warnings
  import numpy
  import tensorflow
  from cleverhans.attacks.attack import Attack
  from cleverhans.attacks.fast_gradient_method import FastGradientMethod
  from cleverhans import utils_tf
  from cleverhans.compat import softmax_cross_entropy_with_logits
  from cleverhans.utils_tf import clip_eta, random_lp_vector
label_desc: Use image node_id 3 for calling the ProjectedGradientDescent obj's underlying member method code with example usage: obj.parse_params(eps, eps_iter, nb_iter, y, ord, loss_fn, clip_min, clip_max, y_target, rand_init, rand_init_eps, clip_grad, sanity_checks) and returns: True