code: def test_apply_patch(art_warning, fix_get_goturn):
      try:
          goturn = fix_get_goturn
          attack = AdversarialTexturePyTorch(
              goturn,
              patch_height=4,
              patch_width=4,
              x_min=0,
              y_min=0,
              step_size=1.0 / 255.0,
              max_iter=500,
              batch_size=16,
              verbose=True,
          )
  
          nb_frames = 15
          patch = np.ones(shape=(4, 4, 3))
          foreground = np.ones(shape=(1, nb_frames, 10, 10, 3))
          foreground[:, :, 5, 5, :] = 0
          x = np.zeros(shape=(1, nb_frames, 10, 10, 3))
  
          patch_points = np.zeros((nb_frames, 4, 2))
          patch_points_0 = [[3, 2], [5, 2], [5, 5], [3, 5]]
  
          for i in range(nb_frames):
              patch_points[i, 0, 0] = patch_points_0[0][0]
              patch_points[i, 0, 1] = patch_points_0[0][1]
              patch_points[i, 1, 0] = patch_points_0[1][0]
              patch_points[i, 1, 1] = patch_points_0[1][1]
              patch_points[i, 2, 0] = patch_points_0[2][0]
              patch_points[i, 2, 1] = patch_points_0[2][1]
              patch_points[i, 3, 0] = patch_points_0[3][0]
              patch_points[i, 3, 1] = patch_points_0[3][1]
  
          patched_images = attack.apply_patch(
              x=x,
              patch_external=patch,
              foreground=foreground,
              patch_points=patch_points,
          )
  
          patch_sum_expected = nb_frames * 3 * (2 * 3)
          complement_sum_expected = 0.0
  
          patch_sum = np.sum(patched_images[0, :, 3:5, 2:5, :])
          complement_sum = np.sum(patched_images[0]) - patch_sum
  
          assert patch_sum == patch_sum_expected
          assert complement_sum == complement_sum_expected
  
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/attacks/evasion/test_adversarial_texture_pytorch.py
imports: import os
  import logging
  import numpy
  import pytest
  from art.attacks.evasion import AdversarialTexturePyTorch
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.object_tracking.object_tracker import ObjectTrackerMixin
  from art.estimators.object_tracking import PyTorchGoturn
  from tests.attacks.utils import backend_test_classifier_type_check_fail
  from tests.utils import ARTTestException
label_desc: Use image node_id 4 for calling a global function with example usage: test_apply_patch(art_warning, fix_get_goturn) without return types