class_docstr: Test the ImperceptibleASR attack.
class_docstr_tok: ["Test","the","ImperceptibleASR","attack","."]
code: def test_create_imperceptible(
      self, art_warning, mocker, asr_dummy_estimator, audio_data
  ):
      try:
          test_input, test_target = audio_data
          test_adversarial = test_input
  
          estimator = asr_dummy_estimator()
          mocker.patch.object(
              estimator, "predict", return_value=test_target
          )
          mocker.patch.object(
              ImperceptibleASR,
              "_loss_gradient_masking_threshold",
              return_value=(
                  np.zeros_like(test_input),
                  [0] * test_input.shape[0],
              ),
          )
  
          imperceptible_asr = ImperceptibleASR(
              estimator=estimator,
              masker=PsychoacousticMasker(),
              max_iter_2=25,
              learning_rate_2=0.5,
          )
          # learning rate of zero ensures that adversarial example equals test input
          imperceptible_asr.learning_rate_2 = 0
          adversarial = imperceptible_asr._create_imperceptible(
              test_input, test_adversarial, test_target
          )
  
          # test shape and adversarial example result
          assert [x.shape for x in test_input] == [
              a.shape for a in adversarial
          ]
          assert [
              (x - a).sum() for a, x in zip(adversarial, test_input)
          ] == [0.0] * test_input.shape[0]
      except ARTTestException as e:
          art_warning(e)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
  from art.attacks.attack import EvasionAttack
  from art.attacks.evasion.imperceptible_asr.imperceptible_asr import ImperceptibleASR, PsychoacousticMasker
  from tests.utils import ARTTestException
label_desc: Use image node_id 6 for calling the TestImperceptibleASR obj's underlying member method code with example usage: obj.test_create_imperceptible(art_warning, mocker, asr_dummy_estimator, audio_data) without return types