def __init__(
      self,
      temperature,
      logits=None,
      probs=None,
      validate_args=False,
      allow_nan_stats=True,
      name="ExpRelaxedOneHotCategorical"):
    """Initialize ExpRelaxedOneHotCategorical using class log-probabilities.

    Args:
      temperature: An 0-D `Tensor`, representing the temperature
        of a set of ExpRelaxedCategorical distributions. The temperature should
        be positive.
      logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities
        of a set of ExpRelaxedCategorical 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 ExpRelaxedCategorical 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.
      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:

      dtype = dtype_util.common_dtype([logits, probs, temperature], tf.float32)
      self._logits, self._probs = distribution_util.get_logits_and_probs(
          name=name,
          logits=logits,
          probs=probs,
          validate_args=validate_args,
          multidimensional=True,
          dtype=dtype)

      with tf.control_dependencies(
          [assert_util.assert_positive(temperature)] if validate_args else []):
        self._temperature = tf.convert_to_tensor(
            value=temperature, name="temperature", dtype=dtype)
        self._temperature_2d = tf.reshape(
            self._temperature, [-1, 1], name="temperature_2d")

      logits_shape_static = tensorshape_util.with_rank_at_least(
          self._logits.shape, 1)
      if tensorshape_util.rank(logits_shape_static) is not None:
        self._batch_rank = tf.convert_to_tensor(
            value=tensorshape_util.rank(logits_shape_static) - 1,
            dtype=tf.int32,
            name="batch_rank")
      else:
        with tf.name_scope("batch_rank"):
          self._batch_rank = tf.rank(self._logits) - 1

      with tf.name_scope("event_size"):
        self._event_size = tf.shape(input=self._logits)[-1]

    super(ExpRelaxedOneHotCategorical, self).__init__(
        dtype=dtype,
        reparameterization_type=reparameterization.FULLY_REPARAMETERIZED,
        validate_args=validate_args,
        allow_nan_stats=allow_nan_stats,
        parameters=parameters,
        graph_parents=[self._logits, self._probs, self._temperature],
        name=name)
def __init__ ( self , temperature , logits = None , probs = None , validate_args = False , allow_nan_stats = True , name = "ExpRelaxedOneHotCategorical" ) : parameters = dict ( locals ( ) ) with tf . name_scope ( name ) as name : dtype = dtype_util . common_dtype ( [ logits , probs , temperature ] , tf . float32 ) self . _logits , self . _probs = distribution_util . get_logits_and_probs ( name = name , logits = logits , probs = probs , validate_args = validate_args , multidimensional = True , dtype = dtype ) with tf . control_dependencies ( [ assert_util . assert_positive ( temperature ) ] if validate_args else [ ] ) : self . _temperature = tf . convert_to_tensor ( value = temperature , name = "temperature" , dtype = dtype ) self . _temperature_2d = tf . reshape ( self . _temperature , [ - 1 , 1 ] , name = "temperature_2d" ) logits_shape_static = tensorshape_util . with_rank_at_least ( self . _logits . shape , 1 ) if tensorshape_util . rank ( logits_shape_static ) is not None : self . _batch_rank = tf . convert_to_tensor ( value = tensorshape_util . rank ( logits_shape_static ) - 1 , dtype = tf . int32 , name = "batch_rank" ) else : with tf . name_scope ( "batch_rank" ) : self . _batch_rank = tf . rank ( self . _logits ) - 1 with tf . name_scope ( "event_size" ) : self . _event_size = tf . shape ( input = self . _logits ) [ - 1 ] super ( ExpRelaxedOneHotCategorical , self ) . __init__ ( dtype = dtype , reparameterization_type = reparameterization . FULLY_REPARAMETERIZED , validate_args = validate_args , allow_nan_stats = allow_nan_stats , parameters = parameters , graph_parents = [ self . _logits , self . _probs , self . _temperature ] , name = name )
Initialize ExpRelaxedOneHotCategorical using class log-probabilities.

    Args:
      temperature: An 0-D `Tensor`, representing the temperature
        of a set of ExpRelaxedCategorical distributions. The temperature should
        be positive.
      logits: An N-D `Tensor`, `N >= 1`, representing the log probabilities
        of a set of ExpRelaxedCategorical 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 ExpRelaxedCategorical 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.
      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.