class_docstr: Implementation of "Prior Convictions"
  Paper: https://arxiv.org/pdf/1807.07978.pdf
  
  Gradients for nearby points are correlated.  Thus we can reduce the number
  of samples we need to compute the gradient, since the previous gradient
  estimate can be used a prior.  The gradient is learned online, alongside
  the adversarial example.
  
  :param predict: forward pass function.
  :param eps: maximum distortion.
  :param order: the order of maximum distortion (inf or 2)
  :param fd_eta: step-size used for fd grad estimate (default 0.01)
  :param exploration: scales the exploration around prior (default 0.01)
  :param online_lr: learning rate for the prior (default 0.1)
  :param loss_fn: loss function, defaults to CrossEntropyLoss
      - The reduction must be set to 'none,' to ensure the per-sample
      loss is accessible.
  :param nb_iter: number of iterations (default 40)
  :param eps_iter: attack step size (default 0.01)
  :param clip_min: mininum value per input dimension (default 0.)
  :param clip_max: mininum value per input dimension (default 1.)
  :param targeted:bool: if the attack is targeted (default False)
code: def __init__(
      self,
      predict,
      eps: float,
      order,
      fd_eta=0.01,
      exploration=0.01,
      online_lr=0.1,
      loss_fn=None,
      nb_iter=40,
      eps_iter=0.01,
      clip_min=0.0,
      clip_max=1.0,
      targeted: bool = False,
  ):
      if loss_fn is not None:
          warnings.warn(
              "This Attack currently do not support a different loss"
              " function other than the default. Setting loss_fn manually"
              " is not effective."
          )
  
      loss_fn = nn.CrossEntropyLoss(reduction="none")
      super().__init__(predict, loss_fn, clip_min, clip_max)
  
      self.eps = eps
      self.order = order
      self.fd_eta = fd_eta
      self.exploration = exploration
      self.online_lr = online_lr
      self.targeted = targeted
      self.nb_iter = nb_iter
      self.eps_iter = eps_iter
  
file_path: advertorch/advertorch/attacks/blackbox/bandits.py
imports: import warnings
  from math import inf
  from typing import Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from advertorch.attacks.base import Attack
  from advertorch.attacks.base import LabelMixin
  from .utils import _check_param, _flatten, _make_projector
label_desc: Use image node_id 1 to create a new BanditAttack object from inherited base classes: Attack, LabelMixin with example: obj = BanditAttack(predict, eps, order, fd_eta, exploration, online_lr, loss_fn, nb_iter, eps_iter, clip_min, clip_max, targeted)