class_docstr: SPSA Attack (Uesato et al. 2018).
  Based on: https://arxiv.org/abs/1802.05666
  
  :param predict: predict function (single argument: input).
  :param eps: the L_inf budget of the attack.
  :param delta: scaling parameter of SPSA.
  :param lr: the learning rate of the `Adam` optimizer.
  :param nb_iter: number of iterations of the attack.
  :param nb_sample: number of samples for SPSA gradient approximation.
  :param max_batch_size: maximum batch size to be evaluated at once.
  :param targeted: [description]
  :param loss_fn: loss function (dual arguments: output, target).
  :param clip_min: upper bound of image values.
  :param clip_max: lower bound of image values.
class_docstr_tok: ["SPSA","Attack","(","Uesato","et","al",".","2018",")",".","Based","on",":","https",":","\/\/arxiv.org\/abs\/1802.05666",":","param","predict",":","predict","function","(","single","argument",":","input",")",".",":","param","eps",":","the","L_inf","budget","of","the","attack",".",":","param","delta",":","scaling","parameter","of","SPSA",".",":","param","lr",":","the","learning","rate","of","the","`","Adam","`","optimizer",".",":","param","nb_iter",":","number","of","iterations","of","the","attack",".",":","param","nb_sample",":","number","of","samples","for","SPSA","gradient","approximation",".",":","param","max_batch_size",":","maximum","batch","size","to","be","evaluated","at","once",".",":","param","targeted",":","[","description","]",":","param","loss_fn",":","loss","function","(","dual","arguments",":","output",",","target",")",".",":","param","clip_min",":","upper","bound","of","image","values",".",":","param","clip_max",":","lower","bound","of","image","values","."]
code: def __init__(
      self,
      predict,
      eps,
      delta=0.01,
      lr=0.01,
      nb_iter=1,
      nb_sample=128,
      max_batch_size=64,
      targeted=False,
      loss_fn=None,
      clip_min=0.0,
      clip_max=1.0,
  ):
      if loss_fn is None:
          loss_fn = MarginalLoss(reduction="none")
      elif (
          hasattr(loss_fn, "reduction")
          and getattr(loss_fn, "reduction") != "none"
      ):
          warnings.warn(
              "`loss_fn` is recommended to have "
              "reduction='none' when used in SPSA attack"
          )
  
      super(LinfSPSAAttack, self).__init__(
          predict, loss_fn, clip_min, clip_max
      )
  
      assert is_float_or_torch_tensor(eps)
      assert is_float_or_torch_tensor(delta)
      assert is_float_or_torch_tensor(lr)
  
      self.eps = float(eps)
      self.delta = float(delta)
      self.lr = float(lr)
      self.nb_iter = int(nb_iter)
      self.nb_sample = int(nb_sample)
      self.max_batch_size = int(max_batch_size)
      self.targeted = bool(targeted)
  
file_path: advertorch/advertorch/attacks/spsa.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import warnings
  import torch
  from .base import Attack
  from .base import LabelMixin
  from .utils import MarginalLoss
  from ..utils import is_float_or_torch_tensor, batch_clamp, clamp
label_desc: Use image node_id 1 to create a new LinfSPSAAttack object from inherited base classes: Attack, LabelMixin with example: obj = LinfSPSAAttack(predict, eps, delta, lr, nb_iter, nb_sample, max_batch_size, targeted, loss_fn, clip_min, clip_max)