class_docstr: Implementation of the imperceptible attack against a speech recognition model.
  
  | Paper link: http://proceedings.mlr.press/v97/qin19a.html
docstr: Create an instance of the :class:`.ImperceptibleASR`.
  
  The default parameters assume that audio input is in `int16` range. If using normalized audio input, parameters
  `eps` and `learning_rate_{1,2}` need to be scaled with a factor `2^-15`
  
  :param estimator: A trained speech recognition estimator.
  :param masker: A Psychoacoustic masker.
  :param eps: Initial max norm bound for adversarial perturbation.
  :param learning_rate_1: Learning rate for stage 1 of attack.
  :param max_iter_1: Number of iterations for stage 1 of attack.
  :param alpha: Initial alpha value for balancing stage 2 loss.
  :param learning_rate_2: Learning rate for stage 2 of attack.
  :param max_iter_2: Number of iterations for stage 2 of attack.
  :param loss_theta_min: If imperceptible loss reaches minimum, stop early. Works best with `batch_size=1`.
  :param decrease_factor_eps: Decrease factor for epsilon (Paper default: 0.8).
  :param num_iter_decrease_eps: Iterations after which to decrease epsilon if attack succeeds (Paper default: 10).
  :param increase_factor_alpha: Increase factor for alpha (Paper default: 1.2).
  :param num_iter_increase_alpha: Iterations after which to increase alpha if attack succeeds (Paper default: 20).
  :param decrease_factor_alpha: Decrease factor for alpha (Paper default: 0.8).
  :param num_iter_decrease_alpha: Iterations after which to decrease alpha if attack fails (Paper default: 50).
  :param batch_size: Batch size.
code: def __init__(
      self,
      estimator: "SPEECH_RECOGNIZER_TYPE",
      masker: "PsychoacousticMasker",
      eps: float = 2000.0,
      learning_rate_1: float = 100.0,
      max_iter_1: int = 1000,
      alpha: float = 0.05,
      learning_rate_2: float = 1.0,
      max_iter_2: int = 4000,
      loss_theta_min: float = 0.05,
      decrease_factor_eps: float = 0.8,
      num_iter_decrease_eps: int = 10,
      increase_factor_alpha: float = 1.2,
      num_iter_increase_alpha: int = 20,
      decrease_factor_alpha: float = 0.8,
      num_iter_decrease_alpha: int = 50,
      batch_size: int = 1,
  ) -> None:
      """
      Create an instance of the :class:`.ImperceptibleASR`.
  
      The default parameters assume that audio input is in `int16` range. If using normalized audio input, parameters
      `eps` and `learning_rate_{1,2}` need to be scaled with a factor `2^-15`
  
      :param estimator: A trained speech recognition estimator.
      :param masker: A Psychoacoustic masker.
      :param eps: Initial max norm bound for adversarial perturbation.
      :param learning_rate_1: Learning rate for stage 1 of attack.
      :param max_iter_1: Number of iterations for stage 1 of attack.
      :param alpha: Initial alpha value for balancing stage 2 loss.
      :param learning_rate_2: Learning rate for stage 2 of attack.
      :param max_iter_2: Number of iterations for stage 2 of attack.
      :param loss_theta_min: If imperceptible loss reaches minimum, stop early. Works best with `batch_size=1`.
      :param decrease_factor_eps: Decrease factor for epsilon (Paper default: 0.8).
      :param num_iter_decrease_eps: Iterations after which to decrease epsilon if attack succeeds (Paper default: 10).
      :param increase_factor_alpha: Increase factor for alpha (Paper default: 1.2).
      :param num_iter_increase_alpha: Iterations after which to increase alpha if attack succeeds (Paper default: 20).
      :param decrease_factor_alpha: Decrease factor for alpha (Paper default: 0.8).
      :param num_iter_decrease_alpha: Iterations after which to decrease alpha if attack fails (Paper default: 50).
      :param batch_size: Batch size.
      """
  
      # Super initialization
      super().__init__(estimator=estimator)
      self.masker = masker
      self.eps = eps
      self.learning_rate_1 = learning_rate_1
      self.max_iter_1 = max_iter_1
      self.alpha = alpha
      self.learning_rate_2 = learning_rate_2
      self.max_iter_2 = max_iter_2
      self._targeted = True
      self.batch_size = batch_size
      self.loss_theta_min = loss_theta_min
      self.decrease_factor_eps = decrease_factor_eps
      self.num_iter_decrease_eps = num_iter_decrease_eps
      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._check_params()
  
      # init some aliases
      self._window_size = masker.window_size
      self._hop_size = masker.hop_size
      self._sample_rate = masker.sample_rate
  
      self._framework: Optional[str] = None
  
      if isinstance(self.estimator, TensorFlowV2Estimator):
          import tensorflow.compat.v1 as tf1
  
          # set framework attribute
          self._framework = "tensorflow"
  
          # disable eager execution and use tensorflow.compat.v1 API, e.g. Lingvo uses TF2v1 AP
          tf1.disable_eager_execution()
  
          # TensorFlow placeholders
          self._delta = tf1.placeholder(
              tf1.float32, shape=[None, None], name="art_delta"
          )
          self._power_spectral_density_maximum_tf = tf1.placeholder(
              tf1.float32, shape=[None], name="art_psd_max"
          )
          self._masking_threshold_tf = tf1.placeholder(
              tf1.float32,
              shape=[None, None, None],
              name="art_masking_threshold",
          )
          # TensorFlow loss gradient ops
          self._loss_gradient_masking_threshold_op_tf = (
              self._loss_gradient_masking_threshold_tf(
                  self._delta,
                  self._power_spectral_density_maximum_tf,
                  self._masking_threshold_tf,
              )
          )
  
      elif isinstance(self.estimator, PyTorchEstimator):
          # set framework attribute
          self._framework = "pytorch"
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import TYPE_CHECKING, Optional, Tuple, Union
  import numpy
  import scipy.signal
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin, NeuralNetworkMixin
  from art.estimators.pytorch import PyTorchEstimator
  from art.estimators.speech_recognition.speech_recognizer import SpeechRecognizerMixin
  from art.estimators.tensorflow import TensorFlowV2Estimator
  from art.utils import pad_sequence_input
label_desc: Use image node_id 1 to create a new ImperceptibleASR object from inherited base classes: EvasionAttack with example: obj = ImperceptibleASR(estimator, masker, eps, learning_rate_1, max_iter_1, alpha, learning_rate_2, max_iter_2, loss_theta_min, decrease_factor_eps, num_iter_decrease_eps, increase_factor_alpha, num_iter_increase_alpha, decrease_factor_alpha, num_iter_decrease_alpha, batch_size)