docstr: Variance is avg squared distance to mean. Thus it should be positive.
  This test is to ensure this is the case.
  
  To test it, we will we make a skewed distribution leaning to one end
  (either very large or small values).
  
  We will also compare to numpy and ensure it is approximately the same.
  This is assuming numpy is correct, for which it should be.
docstr_tok: ["Variance","is","avg","squared","distance","to","mean",".","Thus","it","should","be","positive",".","This","test","is","to","ensure","this","is","the","case",".","To","test","it",",","we","will","we","make","a","skewed","distribution","leaning","to","one","end","(","either","very","large","or","small","values",")",".","We","will","also","compare","to","numpy","and","ensure","it","is","approximately","the","same",".","This","is","assuming","numpy","is","correct",",","for","which","it","should","be","."]
code: def test_var_defin(self) -> None:
      """
      Variance is avg squared distance to mean. Thus it should be positive.
      This test is to ensure this is the case.
  
      To test it, we will we make a skewed distribution leaning to one end
      (either very large or small values).
  
      We will also compare to numpy and ensure it is approximately the same.
      This is assuming numpy is correct, for which it should be.
      """
      SMALL_VAL = -10000
      BIG_VAL = 10000
      AMOUNT_OF_SMALLS = [100, 10]
      AMOUNT_OF_BIGS = [10, 100]
      for sm, big in zip(AMOUNT_OF_SMALLS, AMOUNT_OF_BIGS):
          summ = Summarizer([Var()])
          values = []
          for _ in range(sm):
              values.append(SMALL_VAL)
              summ.update(torch.tensor(SMALL_VAL, dtype=torch.float64))
  
          for _ in range(big):
              values.append(BIG_VAL)
              summ.update(torch.tensor(BIG_VAL, dtype=torch.float64))
  
          actual_var = torch.var(
              torch.tensor(values).double(), unbiased=False
          )
  
          var = summ.summary["variance"]
  
          assertTensorAlmostEqual(self, var, actual_var)
          self.assertTrue((var > 0).all())
  
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 2 for calling the Test obj's underlying member method code with example usage: obj.test_var_defin() without return types