code: def testNegativeBinomialSample(self):
      probs = [0.3, 0.9]
      total_count = [4.0, 11.0]
      n = int(100e3)
      negbinom = negative_binomial.NegativeBinomial(
          total_count=total_count, probs=probs, validate_args=True
      )
  
      samples = negbinom.sample(n, seed=test_util.test_seed())
      self.assertEqual([n, 2], samples.shape)
  
      sample_mean = tf.reduce_mean(samples, axis=0)
      sample_var = tf.reduce_mean(
          (samples - sample_mean[tf.newaxis, ...]) ** 2.0, axis=0
      )
      sample_min = tf.reduce_min(samples)
      [sample_mean_, sample_var_, sample_min_] = self.evaluate(
          [sample_mean, sample_var, sample_min]
      )
      self.assertAllEqual(
          np.ones(sample_min_.shape, dtype=np.bool_), sample_min_ >= 0.0
      )
      for i in range(2):
          self.assertAllClose(
              sample_mean_[i],
              stats.nbinom.mean(total_count[i], 1 - probs[i]),
              atol=0.0,
              rtol=0.02,
          )
          self.assertAllClose(
              sample_var_[i],
              stats.nbinom.var(total_count[i], 1 - probs[i]),
              atol=0.0,
              rtol=0.02,
          )
  
imports: import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import negative_binomial
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 18 for calling the NegativeBinomialTest obj's underlying member method code with example usage: obj.testNegativeBinomialSample() without return types