class_docstr: The finite discrete distribution.
  
  The FiniteDiscrete distribution is parameterized by either probabilities or
  log-probabilities of a set of `K` possible outcomes, which is defined by
  a strictly ascending list of `K` values.
  
  Note: log_prob, prob, cdf, mode, and entropy are differentiable with respect
  to `logits` or `probs` but not with respect to `outcomes`.
  
  #### Mathematical Details
  
  The probability mass function (pmf) is,
  
  ```none
  pmf(x; pi, qi) = prod_j pi_j**[x == qi_j]
  ```
  
  #### Examples
  
  ```python
  
  # Initialize a discrete distribution with 4 possible outcomes and the 2nd
  # outcome being most likely.
  dist = FiniteDiscrete([1., 2., 4., 8.], probs=[0.1, 0.4, 0.3, 0.2])
  dist.prob(2.)
  # ==> 0.4
  
  # Using logits to initialize a discrete distribution with 4 possible outcomes
  # and the 2nd outcome being most likely.
  dist = FiniteDiscrete([1., 2., 4., 8.], logits=np.log([0.1, 0.4, 0.3, 0.2]))
  dist.prob(2.)
  # ==> 0.4
  ```
docstr: Construct a finite discrete contribution.
  
  Args:
    outcomes: A 1-D floating or integer `Tensor`, representing a list of
      possible outcomes in strictly ascending order.
    logits: A floating N-D `Tensor`, `N >= 1`, representing the log
      probabilities of a set of FiniteDiscrete distributions. The first `N -
      1` dimensions index into a batch of independent distributions and the
      last dimension represents a vector of logits for each discrete value.
      Only one of `logits` or `probs` should be passed in.
    probs: A floating  N-D `Tensor`, `N >= 1`, representing the probabilities
      of a set of FiniteDiscrete distributions. The first `N - 1` dimensions
      index into a batch of independent distributions and the last dimension
      represents a vector of probabilities for each discrete value. Only one
      of `logits` or `probs` should be passed in.
    rtol: `Tensor` with same `dtype` as `outcomes`. The relative tolerance for
      floating number comparison. Only effective when `outcomes` is a floating
      `Tensor`. Default is `10 * eps`.
    atol: `Tensor` with same `dtype` as `outcomes`. The absolute tolerance for
      floating number comparison. Only effective when `outcomes` is a floating
      `Tensor`. Default is `10 * eps`.
    validate_args:  Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may 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.
    name: Python `str` name prefixed to Ops created by this class.
docstr_tok: ["Construct","a","finite","discrete","contribution",".","Args",":","outcomes",":","A","1-D","floating","or","integer","`","Tensor","`",",","representing","a","list","of","possible","outcomes","in","strictly","ascending","order",".","logits",":","A","floating","N-D","`","Tensor","`",",","`","N",">","=","1","`",",","representing","the","log","probabilities","of","a","set","of","FiniteDiscrete","distributions",".","The","first","`","N","-","1","`","dimensions","index","into","a","batch","of","independent","distributions","and","the","last","dimension","represents","a","vector","of","logits","for","each","discrete","value",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","probs",":","A","floating","N-D","`","Tensor","`",",","`","N",">","=","1","`",",","representing","the","probabilities","of","a","set","of","FiniteDiscrete","distributions",".","The","first","`","N","-","1","`","dimensions","index","into","a","batch","of","independent","distributions","and","the","last","dimension","represents","a","vector","of","probabilities","for","each","discrete","value",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","rtol",":","`","Tensor","`","with","same","`","dtype","`","as","`","outcomes","`",".","The","relative","tolerance","for","floating","number","comparison",".","Only","effective","when","`","outcomes","`","is","a","floating","`","Tensor","`",".","Default","is","`","10","*","eps","`",".","atol",":","`","Tensor","`","with","same","`","dtype","`","as","`","outcomes","`",".","The","absolute","tolerance","for","floating","number","comparison",".","Only","effective","when","`","outcomes","`","is","a","floating","`","Tensor","`",".","Default","is","`","10","*","eps","`",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","When","`","True","`","distribution","parameters","are","checked","for","validity","despite","possibly","degrading","runtime","performance",".","When","`","False","`","invalid","inputs","may","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",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","class","."]
code: def __init__(
      self,
      outcomes,
      logits=None,
      probs=None,
      rtol=None,
      atol=None,
      validate_args=False,
      allow_nan_stats=True,
      name="FiniteDiscrete",
  ):
      """Construct a finite discrete contribution.
  
      Args:
        outcomes: A 1-D floating or integer `Tensor`, representing a list of
          possible outcomes in strictly ascending order.
        logits: A floating N-D `Tensor`, `N >= 1`, representing the log
          probabilities of a set of FiniteDiscrete distributions. The first `N -
          1` dimensions index into a batch of independent distributions and the
          last dimension represents a vector of logits for each discrete value.
          Only one of `logits` or `probs` should be passed in.
        probs: A floating  N-D `Tensor`, `N >= 1`, representing the probabilities
          of a set of FiniteDiscrete distributions. The first `N - 1` dimensions
          index into a batch of independent distributions and the last dimension
          represents a vector of probabilities for each discrete value. Only one
          of `logits` or `probs` should be passed in.
        rtol: `Tensor` with same `dtype` as `outcomes`. The relative tolerance for
          floating number comparison. Only effective when `outcomes` is a floating
          `Tensor`. Default is `10 * eps`.
        atol: `Tensor` with same `dtype` as `outcomes`. The absolute tolerance for
          floating number comparison. Only effective when `outcomes` is a floating
          `Tensor`. Default is `10 * eps`.
        validate_args:  Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may 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.
        name: Python `str` name prefixed to Ops created by this class.
      """
      parameters = dict(locals())
      with tf.name_scope(name) as name:
          outcomes_dtype = dtype_util.common_dtype(
              [outcomes], dtype_hint=tf.float32
          )
          self._outcomes = tensor_util.convert_nonref_to_tensor(
              outcomes, dtype_hint=outcomes_dtype, name="outcomes"
          )
  
          if dtype_util.is_floating(self._outcomes.dtype):
              eps = np.finfo(
                  dtype_util.as_numpy_dtype(outcomes_dtype)
              ).eps
              self._rtol = 10 * eps if rtol is None else rtol
              self._atol = 10 * eps if atol is None else atol
          else:
              self._rtol = None
              self._atol = None
  
          self._categorical = categorical.Categorical(
              logits=logits,
              probs=probs,
              dtype=tf.int32,
              validate_args=validate_args,
              allow_nan_stats=allow_nan_stats,
          )
      super(FiniteDiscrete, self).__init__(
          dtype=self._outcomes.dtype,
          reparameterization_type=reparameterization.NOT_REPARAMETERIZED,
          validate_args=validate_args,
          allow_nan_stats=allow_nan_stats,
          parameters=parameters,
          name=name,
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import ascending
  from tensorflow_probability.python.bijectors import softmax_centered
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import categorical
  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 prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 1 to create a new FiniteDiscrete object from inherited base classes: distribution, distribution with example: obj = FiniteDiscrete(outcomes, logits, probs, rtol, atol, validate_args, allow_nan_stats, name)