code: def test_patch(art_warning, get_pytorch_yolo):
      try:
          from art.attacks.evasion import AdversarialPatchPyTorch
  
          rotation_max = 0.0
          scale_min = 0.1
          scale_max = 0.3
          distortion_scale_max = 0.0
          learning_rate = 1.99
          max_iter = 2
          batch_size = 16
          patch_shape = (3, 5, 5)
          patch_type = "circle"
          optimizer = "pgd"
  
          object_detector, x_test, y_test = get_pytorch_yolo
  
          ap = AdversarialPatchPyTorch(
              estimator=object_detector,
              rotation_max=rotation_max,
              scale_min=scale_min,
              scale_max=scale_max,
              optimizer=optimizer,
              distortion_scale_max=distortion_scale_max,
              learning_rate=learning_rate,
              max_iter=max_iter,
              batch_size=batch_size,
              patch_shape=patch_shape,
              patch_type=patch_type,
              verbose=True,
              targeted=False,
          )
  
          _, _ = ap.generate(x=x_test, y=y_test)
  
          patched_images = ap.apply_patch(x_test, scale=0.4)
          result = object_detector.predict(patched_images)
  
          assert result[0]["scores"].shape == (10647,)
          expected_detection_scores = np.asarray(
              [
                  4.3653536e-08,
                  3.3987994e-06,
                  2.5681820e-06,
                  3.9782722e-06,
                  2.1766680e-05,
                  2.6138965e-05,
                  6.3377396e-05,
                  7.6248516e-06,
                  4.3447722e-06,
                  3.6515078e-06,
              ]
          )
          np.testing.assert_raises(
              AssertionError,
              np.testing.assert_array_almost_equal,
              result[0]["scores"][:10],
              expected_detection_scores,
              6,
          )
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/estimators/object_detection/test_pytorch_yolo.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import numpy
  import pytest
  from tests.utils import ARTTestException
label_desc: Use image node_id 9 for calling a global function with example usage: test_patch(art_warning, get_pytorch_yolo) without return types