Skip to content

Bernoulli

source



Bernoulli distribution for sampling actions for 'MultiBinary' tasks.

Methods:

.probs

source

.probs()


Return probabilities.

.logits

source

.logits()


Returns the unnormalized log probabilities.

.sample

source

.sample(
   sample_shape: th.Size = th.Size()
)


Generates a sample_shape shaped sample or sample_shape shaped batch of samples if the distribution parameters are batched.

Args

  • sample_shape (th.Size) : The size of the sample to be drawn.

Returns

A sample_shape shaped sample.

.log_prob

source

.log_prob(
   actions: th.Tensor
)


Returns the log of the probability density/mass function evaluated at actions.

Args

  • actions (th.Tensor) : The actions to be evaluated.

Returns

The log_prob value.

.entropy

source

.entropy()


Returns the Shannon entropy of distribution.

.mode

source

.mode()


Returns the mode of the distribution.

.mean

source

.mean()


Returns the mean of the distribution.