def generate(self, x: np.ndarray, y: np.ndarray | None = 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

        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
        
art/attacks/evasion/laser_attack/laser_attack.py