class_docstr: OneHotCategorical distribution.
  
  The categorical distribution is parameterized by the log-probabilities
  of a set of classes. The difference between OneHotCategorical and Categorical
  distributions is that OneHotCategorical is a discrete distribution over
  one-hot bit vectors whereas Categorical is a discrete distribution over
  positive integers. OneHotCategorical is equivalent to Categorical except
  Categorical has event_dim=() while OneHotCategorical has event_dim=K, where
  K is the number of classes.
  
  This class provides methods to create indexed batches of OneHotCategorical
  distributions. If the provided `logits` or `probs` is rank 2 or higher, for
  every fixed set of leading dimensions, the last dimension represents one
  single OneHotCategorical distribution. When calling distribution
  functions (e.g. `dist.prob(x)`), `logits` and `x` are broadcast to the
  same shape (if possible). In all cases, the last dimension of `logits,x`
  represents single OneHotCategorical distributions.
  
  #### Examples
  
  Creates a 3-class distribution, with the 2nd class, the most likely to be
  drawn from.
  
  ```python
  p = [0.1, 0.5, 0.4]
  dist = OneHotCategorical(probs=p)
  ```
  
  Creates a 3-class distribution, with the 2nd class the most likely to be
  drawn from, using logits.
  
  ```python
  logits = [-2, 2, 0]
  dist = OneHotCategorical(logits=logits)
  ```
  
  Creates a 3-class distribution, with the 3rd class is most likely to be drawn.
  
  ```python
  # counts is a scalar.
  p = [0.1, 0.4, 0.5]
  dist = OneHotCategorical(probs=p)
  dist.prob([0,1,0])  # Shape []
  
  # p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match.
  samples = [[0,1,0], [1,0,0]]
  dist.prob(samples)  # Shape [2]
  ```
docstr: Initialize OneHotCategorical distributions using class log-probabilities.
  
  Args:
    logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities of a
      set of Categorical distributions. The first `N - 1` dimensions index
      into a batch of independent distributions and the last dimension
      represents a vector of logits for each class. Only one of `logits` or
      `probs` should be passed in.
    probs: An N-D `Tensor`, `N >= 1`, representing the probabilities of a set
      of Categorical distributions. The first `N - 1` dimensions index into a
      batch of independent distributions and the last dimension represents a
      vector of probabilities for each class. Only one of `logits` or `probs`
      should be passed in.
    dtype: The type of the event samples (default: int32).
    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.
    name: Python `str` name prefixed to Ops created by this class.
code: def __init__(
      self,
      logits=None,
      probs=None,
      dtype=tf.int32,
      validate_args=False,
      allow_nan_stats=True,
      name="OneHotCategorical",
  ):
      """Initialize OneHotCategorical distributions using class log-probabilities.
  
      Args:
        logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities of a
          set of Categorical distributions. The first `N - 1` dimensions index
          into a batch of independent distributions and the last dimension
          represents a vector of logits for each class. Only one of `logits` or
          `probs` should be passed in.
        probs: An N-D `Tensor`, `N >= 1`, representing the probabilities of a set
          of Categorical distributions. The first `N - 1` dimensions index into a
          batch of independent distributions and the last dimension represents a
          vector of probabilities for each class. Only one of `logits` or `probs`
          should be passed in.
        dtype: The type of the event samples (default: int32).
        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.
        name: Python `str` name prefixed to Ops created by this class.
      """
      parameters = dict(locals())
      with tf.name_scope(name) as name:
          self._probs = tensor_util.convert_nonref_to_tensor(
              probs, dtype_hint=tf.float32, name="probs"
          )
          self._logits = tensor_util.convert_nonref_to_tensor(
              logits, dtype_hint=tf.float32, name="logits"
          )
          if (self._probs is None) == (self._logits is None):
              raise ValueError(
                  "Must pass `probs` or `logits`, but not both."
              )
          super(OneHotCategorical, 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 softmax_centered
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  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 samplers
  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 OneHotCategorical object from inherited base classes: distribution, distribution with example: obj = OneHotCategorical(logits, probs, dtype, validate_args, allow_nan_stats, name)