docstr: tests that calling `influence` with `aggregate=True`
  does give the same result as calling it with `aggregate=False`, and then
  summing
docstr_tok: ["tests","that","calling","`","influence","`","with","`","aggregate=True","`","does","give","the","same","result","as","calling","it","with","`","aggregate=False","`",",","and","then","summing"]
code: def test_tracin_aggregate_influence(
      self,
      reduction: str,
      tracin_constructor: Callable,
      unpack_inputs: bool,
  ) -> None:
      """
      tests that calling `influence` with `aggregate=True`
      does give the same result as calling it with `aggregate=False`, and then
      summing
      """
      with tempfile.TemporaryDirectory() as tmpdir:
          (
              net,
              train_dataset,
          ) = get_random_model_and_data(
              tmpdir,
              unpack_inputs,
              return_test_data=False,
          )
  
          # create a dataloader that yields batches from the dataset
          train_dataset = DataLoader(train_dataset, batch_size=5)
  
          # create tracin instance
          criterion = nn.MSELoss(reduction=reduction)
          batch_size = 5
  
          tracin = tracin_constructor(
              net,
              train_dataset,
              tmpdir,
              batch_size,
              criterion,
          )
  
          train_scores = tracin.influence(
              train_dataset, aggregate=False
          )
          aggregated_train_scores = tracin.influence(
              train_dataset, aggregate=True
          )
  
          assertTensorAlmostEqual(
              self,
              torch.sum(train_scores, dim=0, keepdim=True),
              aggregated_train_scores,
              delta=1e-3,  # due to numerical issues, we can't set this to 0.0
              mode="max",
          )
  
file_path: captum/tests/influence/_core/test_tracin_aggregate_influence.py
imports: import tempfile
  from typing import Callable
  import torch
  import torch.nn
  from captum.influence._core.tracincp import TracInCP
  from parameterized import parameterized
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
  from tests.influence._utils.common import build_test_name_func, DataInfluenceConstructor, get_random_model_and_data
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling the TestTracInAggregateInfluence obj's underlying member method code with example usage: obj.test_tracin_aggregate_influence(reduction, tracin_constructor, unpack_inputs) without return types