class_docstr: Reduces the contrast of the input using a binary search to find the
  smallest adversarial perturbation
  
  Args:
      distance : Distance measure for which minimal adversarial examples are searched.
      binary_search_steps : Number of iterations in the binary search.
          This controls the precision of the results.
      target : Target relative to the bounds from 0 (min) to 1 (max)
          towards which the contrast is reduced
class_docstr_tok: ["Reduces","the","contrast","of","the","input","using","a","binary","search","to","find","the","smallest","adversarial","perturbation","Args",":","distance",":","Distance","measure","for","which","minimal","adversarial","examples","are","searched",".","binary_search_steps",":","Number","of","iterations","in","the","binary","search",".","This","controls","the","precision","of","the","results",".","target",":","Target","relative","to","the","bounds","from","0","(","min",")","to","1","(","max",")","towards","which","the","contrast","is","reduced"]
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
  
      lower_bound = ep.zeros(x, len(x))
      upper_bound = ep.ones(x, len(x))
      epsilons = lower_bound
      for _ in range(self.binary_search_steps):
          eps = atleast_kd(epsilons, x.ndim)
          is_adv = is_adversarial(x + eps * direction)
          lower_bound = ep.where(is_adv, lower_bound, epsilons)
          upper_bound = ep.where(is_adv, epsilons, upper_bound)
          epsilons = (lower_bound + upper_bound) / 2
  
      epsilons = upper_bound
      eps = atleast_kd(epsilons, 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 BinarySearchContrastReductionAttack obj's underlying member method code with example usage: obj.run(model, inputs, criterion) and returns: restore_type