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`.
docstr: Construct NegativeBinomial distributions.
  
  Args:
    total_count: Positive floating-point `Tensor` with shape broadcastable to
      `[B1,..., Bb]` with `b >= 0` and the same dtype as `probs` or
      `logits`. Defines this as a batch of `N1 x ... x Nm` different Negative
      Binomial distributions. In practice, this represents the number of
      negative Bernoulli trials to stop at (the `total_count` of
      failures). Its components should be equal to integer values.
    logits: Floating-point `Tensor` with shape broadcastable to
      `[B1, ..., Bb]` where `b >= 0` indicates the number of batch dimensions.
      Each entry represents logits for the probability of success for
      independent Negative Binomial distributions and must be in the half-open
      interval `[-inf, inf)`. Only one of `logits` or `probs` should be
      specified.
    probs: Positive floating-point `Tensor` with shape broadcastable to
      `[B1, ..., Bb]` where `b >= 0` indicates the number of batch dimensions.
      Each entry represents the probability of success for independent
      Negative Binomial distributions and must be in the half-open interval
      `[0, 1)`. Only one of `logits` or `probs` should be specified.
    validate_args: Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may silently render incorrect
      outputs.
    allow_nan_stats: Python `bool`, default `True`. When `True`, statistics
      (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
      result is undefined. When `False`, an exception is raised if one or
      more of the statistic's batch members are undefined.
    require_integer_total_count: Python `bool`, default `True`.  When `True`,
      the total_count parameter is required to be integer.
    name: Python `str` name prefixed to Ops created by this class.
docstr_tok: ["Construct","NegativeBinomial","distributions",".","Args",":","total_count",":","Positive","floating-point","`","Tensor","`","with","shape","broadcastable","to","`","[","B1",",","...",",","Bb","]","`","with","`","b",">","=","0","`","and","the","same","dtype","as","`","probs","`","or","`","logits","`",".","Defines","this","as","a","batch","of","`","N1","x","...","x","Nm","`","different","Negative","Binomial","distributions",".","In","practice",",","this","represents","the","number","of","negative","Bernoulli","trials","to","stop","at","(","the","`","total_count","`","of","failures",")",".","Its","components","should","be","equal","to","integer","values",".","logits",":","Floating-point","`","Tensor","`","with","shape","broadcastable","to","`","[","B1",",","...",",","Bb","]","`","where","`","b",">","=","0","`","indicates","the","number","of","batch","dimensions",".","Each","entry","represents","logits","for","the","probability","of","success","for","independent","Negative","Binomial","distributions","and","must","be","in","the","half-open","interval","`","[","-inf",",","inf",")","`",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","specified",".","probs",":","Positive","floating-point","`","Tensor","`","with","shape","broadcastable","to","`","[","B1",",","...",",","Bb","]","`","where","`","b",">","=","0","`","indicates","the","number","of","batch","dimensions",".","Each","entry","represents","the","probability","of","success","for","independent","Negative","Binomial","distributions","and","must","be","in","the","half-open","interval","`","[","0",",","1",")","`",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","specified",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","When","`","True","`","distribution","parameters","are","checked","for","validity","despite","possibly","degrading","runtime","performance",".","When","`","False","`","invalid","inputs","may","silently","render","incorrect","outputs",".","allow_nan_stats",":","Python","`","bool","`",",","default","`","True","`",".","When","`","True","`",",","statistics","(","e.g.",",","mean",",","mode",",","variance",")","use","the","value","``","`","NaN","`","``","to","indicate","the","result","is","undefined",".","When","`","False","`",",","an","exception","is","raised","if","one","or","more","of","the","statistic","'s","batch","members","are","undefined",".","require_integer_total_count",":","Python","`","bool","`",",","default","`","True","`",".","When","`","True","`",",","the","total_count","parameter","is","required","to","be","integer",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","class","."]
code: def __init__(
      self,
      total_count,
      logits=None,
      probs=None,
      validate_args=False,
      allow_nan_stats=True,
      require_integer_total_count=True,
      name="NegativeBinomial",
  ):
      """Construct NegativeBinomial distributions.
  
      Args:
        total_count: Positive floating-point `Tensor` with shape broadcastable to
          `[B1,..., Bb]` with `b >= 0` and the same dtype as `probs` or
          `logits`. Defines this as a batch of `N1 x ... x Nm` different Negative
          Binomial distributions. In practice, this represents the number of
          negative Bernoulli trials to stop at (the `total_count` of
          failures). Its components should be equal to integer values.
        logits: Floating-point `Tensor` with shape broadcastable to
          `[B1, ..., Bb]` where `b >= 0` indicates the number of batch dimensions.
          Each entry represents logits for the probability of success for
          independent Negative Binomial distributions and must be in the half-open
          interval `[-inf, inf)`. Only one of `logits` or `probs` should be
          specified.
        probs: Positive floating-point `Tensor` with shape broadcastable to
          `[B1, ..., Bb]` where `b >= 0` indicates the number of batch dimensions.
          Each entry represents the probability of success for independent
          Negative Binomial distributions and must be in the half-open interval
          `[0, 1)`. Only one of `logits` or `probs` should be specified.
        validate_args: Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may silently render incorrect
          outputs.
        allow_nan_stats: Python `bool`, default `True`. When `True`, statistics
          (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
          result is undefined. When `False`, an exception is raised if one or
          more of the statistic's batch members are undefined.
        require_integer_total_count: Python `bool`, default `True`.  When `True`,
          the total_count parameter is required to be integer.
        name: Python `str` name prefixed to Ops created by this class.
      """
  
      parameters = dict(locals())
      if (probs is None) == (logits is None):
          raise ValueError(
              "Construct `NegativeBinomial` with `probs` or `logits` but not both."
          )
      with tf.name_scope(name) as name:
          dtype = dtype_util.common_dtype(
              [total_count, logits, probs], dtype_hint=tf.float32
          )
          self._probs = tensor_util.convert_nonref_to_tensor(
              probs, dtype=dtype, name="probs"
          )
          self._logits = tensor_util.convert_nonref_to_tensor(
              logits, dtype=dtype, name="logits"
          )
          self._total_count = tensor_util.convert_nonref_to_tensor(
              total_count, dtype=dtype, name="total_count"
          )
          self._require_integer_total_count = (
              require_integer_total_count
          )
  
          super(NegativeBinomial, self).__init__(
              dtype=dtype,
              reparameterization_type=reparameterization.NOT_REPARAMETERIZED,
              validate_args=validate_args,
              allow_nan_stats=allow_nan_stats,
              parameters=parameters,
              name=name,
          )
  
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 1 to create a new NegativeBinomial object from inherited base classes: distribution, distribution with example: obj = NegativeBinomial(total_count, logits, probs, validate_args, allow_nan_stats, require_integer_total_count, name)