class_docstr: Reduces the contrast of the input using a linear search to find the
  smallest adversarial perturbation
class_docstr_tok: ["Reduces","the","contrast","of","the","input","using","a","linear","search","to","find","the","smallest","adversarial","perturbation"]
code: def run(
      self,
      model: Model,
      inputs: T,
      criterion: Union[Criterion, T],
      *,
      early_stop: Optional[float] = None,
      **kwargs: Any,
  ) -> T:
      raise_if_kwargs(kwargs)
      x, restore_type = ep.astensor_(inputs)
      del inputs, kwargs
  
      verify_input_bounds(x, model)
  
      criterion = get_criterion(criterion)
      is_adversarial = get_is_adversarial(criterion, model)
  
      min_, max_ = model.bounds
      target = min_ + self.target * (max_ - min_)
      direction = target - x
  
      best = ep.ones(x, len(x))
  
      epsilon = 0.0
      stepsize = 1.0 / self.steps
      for _ in range(self.steps):
          # TODO: reduce the batch size to the ones that have not yet been sucessful
  
          is_adv = is_adversarial(x + epsilon * direction)
          is_best_adv = ep.logical_and(is_adv, best == 1)
          best = ep.where(is_best_adv, epsilon, best)
  
          if (best < 1).all():
              break  # pragma: no cover
  
          epsilon += stepsize
  
      eps = atleast_kd(best, x.ndim)
      xp = x + eps * direction
      return restore_type(xp)
  
file_path: foolbox/foolbox/attacks/contrast_min.py
imports: from typing import Union, Any, Optional
  import eagerpy
  from ..devutils import atleast_kd
  from ..models import Model
  from ..criteria import Criterion
  from ..distances import Distance
  from .base import FlexibleDistanceMinimizationAttack
  from .base import T
  from .base import get_is_adversarial
  from .base import get_criterion
  from .base import raise_if_kwargs
  from .base import verify_input_bounds
label_desc: Use image node_id 2 for calling the LinearSearchContrastReductionAttack obj's underlying member method code with example usage: obj.run(model, inputs, criterion) and returns: restore_type