class_docstr: NegativeBinomial distribution.
  
  The NegativeBinomial distribution is related to the experiment of performing
  Bernoulli trials in sequence. Given a Bernoulli trial with probability `p` of
  success, the NegativeBinomial distribution represents the distribution over
  the number of successes `s` that occur until we observe `f` failures.
  
  The probability mass function (pmf) is,
  
  ```none
  pmf(s; f, p) = p**s (1 - p)**f / Z
  Z = s! (f - 1)! / (s + f - 1)!
  ```
  
  where:
  * `total_count = f`,
  * `probs = p`,
  * `Z` is the normalizaing constant, and,
  * `n!` is the factorial of `n`.
code: def _sample_n(self, n, seed=None):
      # Here we use the fact that if:
      # lam ~ Gamma(concentration=total_count, rate=(1-probs)/probs)
      # then X ~ Poisson(lam) is Negative Binomially distributed.
      logits = self._logits_parameter_no_checks()
      gamma_seed, poisson_seed = samplers.split_seed(
          seed, salt="NegativeBinomial"
      )
      # TODO(b/152785714): For some reason switching to gamma_lib.random_gamma
      # makes tests time out. Note: observed similar in jax_transformation_test.
      rate = samplers.gamma(
          shape=[n],
          alpha=self.total_count,
          beta=tf.math.exp(-logits),
          dtype=self.dtype,
          seed=gamma_seed,
      )
      return samplers.poisson(
          shape=[], lam=rate, dtype=self.dtype, seed=poisson_seed
      )
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.math import special
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 9 for calling the NegativeBinomial obj's underlying member method code with example usage: obj._sample_n(n, seed) and returns: samplers