code: def test_stats_random_data(self):
      N = 1000
      BIG_VAL = 100000
      _values = list(get_values(lo=-BIG_VAL, hi=BIG_VAL, n=N))
      values = torch.tensor(_values, dtype=torch.float64)
      stats_to_test = [
          Mean(),
          Var(),
          Var(order=1),
          StdDev(),
          StdDev(order=1),
          Min(),
          Max(),
          Sum(),
          MSE(),
      ]
      stat_names = [
          "mean",
          "variance",
          "sample_variance",
          "std_dev",
          "sample_std_dev",
          "min",
          "max",
          "sum",
          "mse",
      ]
      gt_fns = [
          torch.mean,
          lambda x: torch.var(x, unbiased=False),
          lambda x: torch.var(x, unbiased=True),
          lambda x: torch.std(x, unbiased=False),
          lambda x: torch.std(x, unbiased=True),
          torch.min,
          torch.max,
          torch.sum,
          lambda x: torch.sum((x - torch.mean(x)) ** 2),
      ]
  
      for stat, name, gt in zip(stats_to_test, stat_names, gt_fns):
          summ = Summarizer([stat])
          actual = gt(values)
          for x in values:
              summ.update(x)
          stat_val = summ.summary[name]
          # rounding errors is a serious issue (moreso for MSE)
          assertTensorAlmostEqual(self, stat_val, actual, delta=0.005)
  
file_path: captum/tests/attr/test_stat.py
imports: import random
  import torch
  from captum.attr import Max, Mean, Min, MSE, StdDev, Sum, Summarizer, Var
  from tests.helpers.basic import assertTensorAlmostEqual, BaseTest
label_desc: Use image node_id 4 for calling the Test obj's underlying member method code with example usage: obj.test_stats_random_data() without return types