code: def testNegativeBinomialFromMeanDispersionTapeSafe(self):
      total_count = 5.0
      dispersion = np.float32(1 / total_count)
      p_fail = np.float32(1 - np.repeat(0.2, 3))
      x = np.array([4.0, 5.0, 6.0], dtype=np.float32)
  
      mean = tf.convert_to_tensor(
          stats.nbinom.mean(total_count, p_fail).astype(np.float32)
      )
      dispersion = tf.convert_to_tensor(dispersion)
  
      dist = negative_binomial.NegativeBinomial.experimental_from_mean_dispersion(
          mean, dispersion, validate_args=True
      )
      with tf.GradientTape() as tape:
          tape.watch((mean, dispersion))
          lp = dist.log_prob(x)
      grads = tape.gradient(lp, (mean, dispersion))
      self.assertAllNotNone(grads)
  
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 12 for calling the NegativeBinomialTest obj's underlying member method code with example usage: obj.testNegativeBinomialFromMeanDispersionTapeSafe() without return types