code: def test_batched_generator(self) -> None:
      def sample_operator(
          inputs, additional_forward_args, target_ind, scale
      ):
          return (
              scale * (sum(inputs)),
              scale * sum(additional_forward_args),
              target_ind,
          )
  
      array1 = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
      array2 = [[6, 7, 8], [0, 1, 2], [3, 4, 5]]
      array3 = [[0, 1, 2], [0, 0, 0], [0, 0, 0]]
      inp1, inp2, inp3 = (
          torch.tensor(array1),
          torch.tensor(array2),
          torch.tensor(array3),
      )
      for index, (inp, add, targ) in enumerate(
          _batched_generator((inp1, inp2), (inp3, 5), 7, 1)
      ):
          assertTensorAlmostEqual(self, inp[0], [array1[index]])
          assertTensorAlmostEqual(self, inp[1], [array2[index]])
          assertTensorAlmostEqual(self, add[0], [array3[index]])
          self.assertEqual(add[1], 5)
          self.assertEqual(targ, 7)
  
file_path: captum/tests/attr/test_utils_batching.py
imports: import torch
  from captum.attr._utils.batching import _batched_generator, _batched_operator, _tuple_splice_range
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
label_desc: Use image node_id 3 for calling the Test obj's underlying member method code with example usage: obj.test_batched_generator() and returns: unknown,  unknown,  target_ind