def __init__(
        self,
        estimator: PyTorchDeepSpeech,
        eps: float = 0.05,
        max_iter_1: int = 10,
        max_iter_2: int = 4000,
        learning_rate_1: float = 0.001,
        learning_rate_2: float = 5e-4,
        optimizer_1: "torch.optim.Optimizer" | None = None,
        optimizer_2: "torch.optim.Optimizer" | None = None,
        global_max_length: int = 200000,
        initial_rescale: float = 1.0,
        decrease_factor_eps: float = 0.8,
        num_iter_decrease_eps: int = 1,
        alpha: float = 1.2,
        increase_factor_alpha: float = 1.2,
        num_iter_increase_alpha: int = 20,
        decrease_factor_alpha: float = 0.8,
        num_iter_decrease_alpha: int = 20,
        win_length: int = 2048,
        hop_length: int = 512,
        n_fft: int = 2048,
        batch_size: int = 32,
        use_amp: bool = False,
        opt_level: str = "O1",
    ):
        """
        Create a :class:`.ImperceptibleASRPyTorch` instance.

        :param estimator: A trained estimator.
        :param eps: Maximum perturbation that the attacker can introduce.
        :param max_iter_1: The maximum number of iterations applied for the first stage of the optimization of the
                           attack.
        :param max_iter_2: The maximum number of iterations applied for the second stage of the optimization of the
                           attack.
        :param learning_rate_1: The learning rate applied for the first stage of the optimization of the attack.
        :param learning_rate_2: The learning rate applied for the second stage of the optimization of the attack.
        :param optimizer_1: The optimizer applied for the first stage of the optimization of the attack. If `None`
                            attack will use `torch.optim.Adam`.
        :param optimizer_2: The optimizer applied for the second stage of the optimization of the attack. If `None`
                            attack will use `torch.optim.Adam`.
        :param global_max_length: The length of the longest audio signal allowed by this attack.
        :param initial_rescale: Initial rescale coefficient to speed up the decrease of the perturbation size during
                                the first stage of the optimization of the attack.
        :param decrease_factor_eps: The factor to adjust the rescale coefficient during the first stage of the
                                    optimization of the attack.
        :param num_iter_decrease_eps: Number of iterations to adjust the rescale coefficient, and therefore adjust the
                                      perturbation size.
        :param alpha: Value of the alpha coefficient used in the second stage of the optimization of the attack.
        :param increase_factor_alpha: The factor to increase the alpha coefficient used in the second stage of the
                                      optimization of the attack.
        :param num_iter_increase_alpha: Number of iterations to increase alpha.
        :param decrease_factor_alpha: The factor to decrease the alpha coefficient used in the second stage of the
                                      optimization of the attack.
        :param num_iter_decrease_alpha: Number of iterations to decrease alpha.
        :param win_length: Length of the window. The number of STFT rows is `(win_length // 2 + 1)`.
        :param hop_length: Number of audio samples between adjacent STFT columns.
        :param n_fft: FFT window size.
        :param batch_size: Size of the batch on which adversarial samples are generated.
        :param use_amp: Whether to use the automatic mixed precision tool to enable mixed precision training or
                        gradient computation, e.g. with loss gradient computation. When set to True, this option is
                        only triggered if there are GPUs available.
        :param opt_level: Specify a pure or mixed precision optimization level. Used when use_amp is True. Accepted
                          values are `O0`, `O1`, `O2`, and `O3`.
        """
        import torch
        from torch.autograd import Variable

        super().__init__(estimator=estimator)

        # Set attack attributes
        self._targeted = True
        self.eps = eps
        self.max_iter_1 = max_iter_1
        self.max_iter_2 = max_iter_2
        self.learning_rate_1 = learning_rate_1
        self.learning_rate_2 = learning_rate_2
        self.global_max_length = global_max_length
        self.initial_rescale = initial_rescale
        self.decrease_factor_eps = decrease_factor_eps
        self.num_iter_decrease_eps = num_iter_decrease_eps
        self.alpha = alpha
        self.increase_factor_alpha = increase_factor_alpha
        self.num_iter_increase_alpha = num_iter_increase_alpha
        self.decrease_factor_alpha = decrease_factor_alpha
        self.num_iter_decrease_alpha = num_iter_decrease_alpha
        self.win_length = win_length
        self.hop_length = hop_length
        self.n_fft = n_fft
        self.batch_size = batch_size
        self._use_amp = use_amp
        self._check_params()

        # Create the main variable to optimize
        if self.estimator.device.type == "cpu":
            self.global_optimal_delta = Variable(
                torch.zeros(self.batch_size, self.global_max_length).type(torch.FloatTensor),  # type: ignore
                requires_grad=True,
            )
        else:
            self.global_optimal_delta = Variable(
                torch.zeros(self.batch_size, self.global_max_length).type(torch.cuda.FloatTensor),  # type: ignore
                requires_grad=True,
            )

        self.global_optimal_delta.to(self.estimator.device)

        # Create the optimizers
        self._optimizer_arg_1 = optimizer_1
        if self._optimizer_arg_1 is None:
            self.optimizer_1 = torch.optim.Adam(params=[self.global_optimal_delta], lr=self.learning_rate_1)
        else:
            self.optimizer_1 = self._optimizer_arg_1(  # type: ignore
                params=[self.global_optimal_delta], lr=self.learning_rate_1
            )

        self._optimizer_arg_2 = optimizer_2
        if self._optimizer_arg_2 is None:
            self.optimizer_2 = torch.optim.Adam(params=[self.global_optimal_delta], lr=self.learning_rate_2)
        else:
            self.optimizer_2 = self._optimizer_arg_2(  # type: ignore
                params=[self.global_optimal_delta], lr=self.learning_rate_2
            )

        # Setup for AMP use
        if self._use_amp:  # pragma: no cover
            from apex import amp

            if self.estimator.device.type == "cpu":
                enabled = False
            else:
                enabled = True

            self.estimator._model, [self.optimizer_1, self.optimizer_2] = amp.initialize(
                models=self.estimator._model,
                optimizers=[self.optimizer_1, self.optimizer_2],
                enabled=enabled,
                opt_level=opt_level,
                loss_scale=1.0,
            )

        Create a :class:`.ImperceptibleASRPyTorch` instance.

        :param estimator: A trained estimator.
        :param eps: Maximum perturbation that the attacker can introduce.
        :param max_iter_1: The maximum number of iterations applied for the first stage of the optimization of the
                           attack.
        :param max_iter_2: The maximum number of iterations applied for the second stage of the optimization of the
                           attack.
        :param learning_rate_1: The learning rate applied for the first stage of the optimization of the attack.
        :param learning_rate_2: The learning rate applied for the second stage of the optimization of the attack.
        :param optimizer_1: The optimizer applied for the first stage of the optimization of the attack. If `None`
                            attack will use `torch.optim.Adam`.
        :param optimizer_2: The optimizer applied for the second stage of the optimization of the attack. If `None`
                            attack will use `torch.optim.Adam`.
        :param global_max_length: The length of the longest audio signal allowed by this attack.
        :param initial_rescale: Initial rescale coefficient to speed up the decrease of the perturbation size during
                                the first stage of the optimization of the attack.
        :param decrease_factor_eps: The factor to adjust the rescale coefficient during the first stage of the
                                    optimization of the attack.
        :param num_iter_decrease_eps: Number of iterations to adjust the rescale coefficient, and therefore adjust the
                                      perturbation size.
        :param alpha: Value of the alpha coefficient used in the second stage of the optimization of the attack.
        :param increase_factor_alpha: The factor to increase the alpha coefficient used in the second stage of the
                                      optimization of the attack.
        :param num_iter_increase_alpha: Number of iterations to increase alpha.
        :param decrease_factor_alpha: The factor to decrease the alpha coefficient used in the second stage of the
                                      optimization of the attack.
        :param num_iter_decrease_alpha: Number of iterations to decrease alpha.
        :param win_length: Length of the window. The number of STFT rows is `(win_length // 2 + 1)`.
        :param hop_length: Number of audio samples between adjacent STFT columns.
        :param n_fft: FFT window size.
        :param batch_size: Size of the batch on which adversarial samples are generated.
        :param use_amp: Whether to use the automatic mixed precision tool to enable mixed precision training or
                        gradient computation, e.g. with loss gradient computation. When set to True, this option is
                        only triggered if there are GPUs available.
        :param opt_level: Specify a pure or mixed precision optimization level. Used when use_amp is True. Accepted
                          values are `O0`, `O1`, `O2`, and `O3`.
        
art/attacks/evasion/imperceptible_asr/imperceptible_asr_pytorch.py