class_docstr: Implementation of a particular variation of the DPatch attack.
  It follows Lee & Kolter (2019) in using sign gradients with expectations over transformations.
  The particular transformations supported in this implementation are cropping, rotations by multiples of 90 degrees,
  and changes in the brightness of the image.
  
  | Paper link (original DPatch): https://arxiv.org/abs/1806.02299v4
  | Paper link (physical-world patch from Lee & Kolter): https://arxiv.org/abs/1906.11897
class_docstr_tok: ["Implementation","of","a","particular","variation","of","the","DPatch","attack",".","It","follows","Lee","&","Kolter","(","2019",")","in","using","sign","gradients","with","expectations","over","transformations",".","The","particular","transformations","supported","in","this","implementation","are","cropping",",","rotations","by","multiples","of","90","degrees",",","and","changes","in","the","brightness","of","the","image",".","|","Paper","link","(","original","DPatch",")",":","https",":","\/\/arxiv.org\/abs\/1806.02299v4","|","Paper","link","(","physical-world","patch","from","Lee","&","Kolter",")",":","https",":","\/\/arxiv.org\/abs\/1906.11897"]
code: def _check_params(self) -> None:
      if not isinstance(self.patch_shape, (tuple, list)) or not all(
          isinstance(s, int) for s in self.patch_shape
      ):
          raise ValueError(
              "The patch shape must be either a tuple or list of integers."
          )
      if len(self.patch_shape) != 3:
          raise ValueError("The length of patch shape must be 3.")
  
      if not isinstance(self.learning_rate, float):
          raise ValueError("The learning rate must be of type float.")
      if self.learning_rate <= 0.0:
          raise ValueError(
              "The learning rate must be greater than 0.0."
          )
  
      if not isinstance(self.max_iter, int):
          raise ValueError(
              "The number of optimization steps must be of type int."
          )
      if self.max_iter <= 0:
          raise ValueError(
              "The number of optimization steps must be greater than 0."
          )
  
      if not isinstance(self.batch_size, int):
          raise ValueError("The batch size must be of type int.")
      if self.batch_size <= 0:
          raise ValueError("The batch size must be greater than 0.")
  
      if not isinstance(self.verbose, bool):
          raise ValueError(
              "The argument `verbose` has to be of type bool."
          )
  
      if not isinstance(self.patch_location, (tuple, list)) or not all(
          isinstance(s, int) for s in self.patch_location
      ):
          raise ValueError(
              "The patch location must be either a tuple or list of integers."
          )
      if len(self.patch_location) != 2:
          raise ValueError("The length of patch location must be 2.")
  
      if not isinstance(self.crop_range, (tuple, list)) or not all(
          isinstance(s, int) for s in self.crop_range
      ):
          raise ValueError(
              "The crop range must be either a tuple or list of integers."
          )
      if len(self.crop_range) != 2:
          raise ValueError("The length of crop range must be 2.")
  
      if self.crop_range[0] > self.crop_range[1]:
          raise ValueError(
              "The first element of the crop range must be less or equal to the second one."
          )
  
      if (
          self.patch_location[0] < self.crop_range[0]
          or self.patch_location[1] < self.crop_range[1]
      ):
          raise ValueError(
              "The patch location must be outside the crop range."
          )
  
      if not isinstance(
          self.brightness_range, (tuple, list)
      ) or not all(isinstance(s, float) for s in self.brightness_range):
          raise ValueError(
              "The brightness range must be either a tuple or list of floats."
          )
      if len(self.brightness_range) != 2:
          raise ValueError("The length of brightness range must be 2.")
  
      if self.brightness_range[0] < 0.0:
          raise ValueError("The brightness range must be >= 0.0.")
  
      if self.brightness_range[0] > self.brightness_range[1]:
          raise ValueError(
              "The first element of the brightness range must be less or equal to the second one."
          )
  
      if not isinstance(
          self.rotation_weights, (tuple, list)
      ) or not all(
          isinstance(s, (float, int)) for s in self.rotation_weights
      ):
          raise ValueError(
              "The rotation sampling weights must be provided as tuple or list of float or int values."
          )
      if len(self.rotation_weights) != 4:
          raise ValueError(
              "The number of rotation sampling weights must be 4."
          )
  
      if not all(s >= 0.0 for s in self.rotation_weights):
          raise ValueError(
              "The rotation sampling weights must be non-negative."
          )
  
      if all(s == 0.0 for s in self.rotation_weights):
          raise ValueError(
              "At least one of the rotation sampling weights must be strictly greater than zero."
          )
  
      if not isinstance(self.sample_size, int):
          raise ValueError("The EOT sample size must be of type int.")
      if self.sample_size <= 0:
          raise ValueError(
              "The EOT sample size must be greater than 0."
          )
  
      if not isinstance(self.targeted, bool):
          raise ValueError(
              "The argument `targeted` has to be of type bool."
          )
  
file_path: adversarial-robustness-toolbox/art/attacks/evasion/dpatch_robust.py
imports: import logging
  import math
  import random
  from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.object_detection.object_detector import ObjectDetectorMixin
  from art import config
  from art.summary_writer import SummaryWriter
label_desc: Use image node_id 6 for calling the RobustDPatch obj's underlying member method code with example usage: obj._check_params() without return types