code: def testPdfOfSample(self):
      half_student = half_student_t.HalfStudentT(
          df=3.0, loc=np.pi, scale=1.0, validate_args=True
      )
      num = 20000
      samples = half_student.sample(num, seed=test_util.test_seed())
      pdfs = half_student.prob(samples)
      mean = half_student.mean()
      mean_pdf = half_student.prob(half_student.mean())
      sample_vals, pdf_vals, mean_val, mean_pdf_val = self.evaluate(
          [samples, pdfs, half_student.mean(), mean_pdf]
      )
      self.assertEqual(samples.shape, (num,))
      self.assertEqual(pdfs.shape, (num,))
      self.assertEqual(mean.shape, ())
      true_mean = _true_mean(3.0, np.pi, 1.0)
      self.assertNear(true_mean, np.mean(sample_vals), err=0.1)
      self.assertNear(true_mean, mean_val, err=1e-6)
      # Verify integral over sample*pdf ~= 1.
      # Tolerance increased since eager was getting a value of 1.002041.
      self._assertIntegral(sample_vals, pdf_vals, err=5e-2)
      self.assertNear(
          2 * sp_stats.t.pdf(true_mean, 3.0, loc=np.pi),
          mean_pdf_val,
          err=1e-6,
      )
  
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 19 for calling the HalfStudentTTest obj's underlying member method code with example usage: obj.testPdfOfSample() without return types