class_docstr: Implementation of a generic laser attack case.
class_docstr_tok: ["Implementation","of","a","generic","laser","attack","case","."]
docstr: Generate adversarial examples.
  
  :param x: Images to attack as a tensor in NHWC order
  :param y: Array of correct classes
  :return: Array of adversarial images
docstr_tok: ["Generate","adversarial","examples",".",":","param","x",":","Images","to","attack","as","a","tensor","in","NHWC","order",":","param","y",":","Array","of","correct","classes",":","return",":","Array","of","adversarial","images"]
code: def generate(
      self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs
  ) -> np.ndarray:
      """
      Generate adversarial examples.
  
      :param x: Images to attack as a tensor in NHWC order
      :param y: Array of correct classes
      :return: Array of adversarial images
      """
  
      if x.ndim != 4:  # pragma: no cover
          raise ValueError(
              "Unrecognized input dimension. Only tensors NHWC are acceptable."
          )
  
      parameters = self.generate_parameters(x, y)
      adversarial_images = np.zeros_like(x)
      for image_index in range(x.shape[0]):
          laser_params, _ = parameters[image_index]
          if laser_params is None:
              adversarial_images[image_index] = x[image_index]
              continue
          adversarial_image = self._image_generator.update_image(
              x[image_index], laser_params
          )
          adversarial_images[image_index] = adversarial_image
  
      return adversarial_images
  
imports: import logging
  from typing import Callable, List, Optional, Tuple, Union, Any
  import numpy
  from art.attacks.attack import EvasionAttack
  from art.attacks.evasion.laser_attack.algorithms import greedy_search
  from art.attacks.evasion.laser_attack.utils import AdversarialObject, AdvObjectGenerator, DebugInfo, ImageGenerator, Line, wavelength_to_rgb
label_desc: Use image node_id 2 for calling the LaserAttack obj's underlying member method code with example usage: obj.generate(x, y) and returns: adversarial_images