code: def test_sparse_features(self) -> None:
      model = BasicModelWithSparseInputs()
      inp1 = torch.tensor([[1.0, -2.0, 3.0], [2.0, -1.0, 3.0]])
      # Length of sparse index list may not match # of examples
      inp2 = torch.tensor([1, 7, 2, 4, 5, 3, 6])
  
      feature_importance = FeaturePermutation(model)
      total_attr1, total_attr2 = feature_importance.attribute(
          (inp1, inp2)
      )
  
      for _ in range(50):
          attr1, attr2 = feature_importance.attribute((inp1, inp2))
          total_attr1 += attr1
          total_attr2 += attr2
      total_attr1 /= 50
      total_attr2 /= 50
      self.assertEqual(total_attr2.shape, (1,))
      assertTensorAlmostEqual(
          self, total_attr1, torch.zeros_like(total_attr1)
      )
      assertTensorAlmostEqual(self, total_attr2, [-6.0], delta=0.2)
  
file_path: captum/tests/attr/test_feature_permutation.py
imports: from typing import List, Tuple
  import torch
  from captum.attr._core.feature_permutation import _permute_feature, FeaturePermutation
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModelWithSparseInputs
  from torch import Tensor
label_desc: Use image node_id 10 for calling the Test obj's underlying member method code with example usage: obj.test_sparse_features() without return types