code: def testVarianceAllowNanStatsTrueReturnsNaNforUndefinedBatchMembers(
      self,
  ):
      # df = 0.5 ==> undefined mean ==> undefined variance.
      # df = 1.5 ==> infinite variance.
      df = [0.5, 1.5, 3.0, 5.0, 7.0]
      loc = [-2, 0.0, 1.0, 3.3, 4.4]
      sigma = [5.0, 4.0, 3.0, 2.0, 1.0]
      half_student = half_student_t.HalfStudentT(
          df=df,
          loc=loc,
          scale=sigma,
          allow_nan_stats=True,
          validate_args=True,
      )
      var = self.evaluate(half_student.variance())
      # Verify edge cases work as intended.
      expected_var = _true_variance(df, sigma)
      expected_var[0] = np.nan
      expected_var[1] = np.inf
      self.assertAllClose(expected_var, var, atol=1e-5)
  
imports: import math
  import numpy
  from scipy import stats
  from scipy.special import gamma
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import half_student_t
  from tensorflow_probability.python.distributions.internal import statistical_testing
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 15 for calling the HalfStudentTTest obj's underlying member method code with example usage: obj.testVarianceAllowNanStatsTrueReturnsNaNforUndefinedBatchMembers() without return types