class_docstr: Optimizer for gradient-free attacks in https://arxiv.org/abs/1802.05666.
  
  Gradients estimates are computed using Simultaneous Perturbation Stochastic Approximation (SPSA),
  combined with the ADAM update rule (https://arxiv.org/abs/1412.6980).
class_docstr_tok: ["Optimizer","for","gradient-free","attacks","in","https",":","\/\/arxiv.org\/abs\/1802.05666",".","Gradients","estimates","are","computed","using","Simultaneous","Perturbation","Stochastic","Approximation","(","SPSA",")",",","combined","with","the","ADAM","update","rule","(","https",":","\/\/arxiv.org\/abs\/1412.6980",")","."]
code: def __init__(
      self,
      lr=0.01,
      delta=0.01,
      num_samples=128,
      num_iters=1,
      compare_to_analytic_grad=False,
  ):
      super(SPSAAdam, self).__init__(lr=lr)
      assert num_samples % 2 == 0, "number of samples must be even"
      self._delta = delta
      self._num_samples = (
          num_samples // 2
      )  # Since we mirror +/- delta later
      self._num_iters = num_iters
      self._compare_to_analytic_grad = compare_to_analytic_grad
  
file_path: cleverhans/cleverhans/tf2/attacks/spsa.py
imports: import tensorflow
label_desc: Use image node_id 1 to create a new SPSAAdam object from inherited base classes: tf.optimizers with example: obj = SPSAAdam(lr, delta, num_samples, num_iters, compare_to_analytic_grad)