def bin_concrete(self, name, temperature, logits, n_samples=None, group_ndims=0, is_reparameterized=True, check_numerics=False, **kwargs): """ Add a stochastic node in this :class:`BayesianNet` that follows the BinConcrete distribution. :param name: The name of the stochastic node. Must be unique in a :class:`BayesianNet`. See :class:`~zhusuan.distributions.univariate.BinConcrete` for more information about the other arguments. :return: A :class:`StochasticTensor` instance. """ dist = distributions.BinConcrete(temperature, logits, group_ndims=group_ndims, is_reparameterized=is_reparameterized, check_numerics=check_numerics, **kwargs) return self.stochastic(name, dist, n_samples=n_samples, **kwargs)
def __init__(self, name, temperature, logits, n_samples=None, group_event_ndims=0, is_reparameterized=True, check_numerics=False): bin_concrete = distributions.BinConcrete( temperature, logits, group_event_ndims=group_event_ndims, is_reparameterized=is_reparameterized, check_numerics=check_numerics, ) super(BinConcrete, self).__init__(name, bin_concrete, n_samples)