code: def test_pytorch_multiple_inputs(random_seed):
      """Test multi-input scenarios."""
  
      torch = pytest.importorskip("torch")
      from torch import nn
  
      torch.manual_seed(random_seed)
      batch_size = 10
      x1 = torch.ones(batch_size, 3)
      x2 = torch.ones(batch_size, 4)
  
      background = [
          torch.zeros(batch_size, 3),
          torch.zeros(batch_size, 4),
      ]
  
      class Net(nn.Module):
          """A test model."""
  
          def __init__(self):
              super().__init__()
              self.linear = nn.Linear(7, 1)
  
          def forward(self, x1, x2):
              """Run the model."""
              return self.linear(torch.cat((x1, x2), dim=-1))
  
      model = Net()
  
      e = shap.GradientExplainer(model, background)
      shap_x1, shap_x2 = e.shap_values([x1, x2])
  
      model.eval()
      model.zero_grad()
      with torch.no_grad():
          diff = (
              (model(x1, x2) - model(*background))
              .detach()
              .numpy()
              .mean(0)
          )
  
      sums = np.array(
          [
              shap_x1[i].sum() + shap_x2[i].sum()
              for i in range(len(shap_x1))
          ]
      )
      d = np.abs(sums - diff).sum()
      assert (
          d / (np.abs(diff).sum() + 0.01) < 0.1
      ), "Sum of SHAP values does not match difference! %f" % (
          d / np.abs(diff).sum()
      )
  
file_path: shap/tests/explainers/test_gradient.py
imports: from urllib.error import HTTPError
  import numpy
  import pandas
  import pytest
  import shap
label_desc: Use image node_id 3 for calling a global function with example usage: test_pytorch_multiple_inputs(random_seed) and returns: self