code: def _perturb_func(
      inputs: TensorOrTupleOfTensorsGeneric,
  ) -> Union[Tensor, Tuple[Tensor, ...]]:
      def perturb_ratio(input):
          return (
              torch.arange(
                  -torch.numel(input[0]) // 2,
                  torch.numel(input[0]) // 2,
              )
              .view(input[0].shape)
              .float()
              / 100
          )
  
      input2 = None
      if isinstance(inputs, tuple):
          input1 = inputs[0]
          input2 = inputs[1]
      else:
          input1 = cast(Tensor, inputs)
  
      perturbed_input1 = input1 + perturb_ratio(input1)
  
      if input2 is None:
          return perturbed_input1
  
      return perturbed_input1, input2 + perturb_ratio(input2)
  
imports: import typing
  from typing import Any, Callable, cast, List, Tuple, Union
  import torch
  from captum._utils.typing import BaselineType, TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr import DeepLift, GradientShap, GuidedBackprop, IntegratedGradients, Saliency
  from captum.metrics import sensitivity_max
  from captum.metrics._core.sensitivity import default_perturb_func
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModel2, BasicModel4_MultiArgs, BasicModel_ConvNet_One_Conv, BasicModel_MultiLayer
  from torch import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: _perturb_func(inputs) and returns: perturbed_input1,  unknown, unknown, perturbed_input1