Distribution

class paddle.distribution. Distribution ( batch_shape: Sequence[int] = (), event_shape: Sequence[int] = () ) [source]

The abstract base class for probability distributions. Functions are implemented in specific distributions.

Parameters
  • batch_shape (Sequence[int], optional) – independent, not identically distributed draws, aka a “collection” or “bunch” of distributions.

  • event_shape (Sequence[int], optional) – the shape of a single draw from the distribution; it may be dependent across dimensions. For scalar distributions, the event shape is []. For n-dimension multivariate distribution, the event shape is [n].

property batch_shape : Sequence[int]

Returns batch shape of distribution

Returns

batch shape

Return type

Sequence[int]

property event_shape : Sequence[int]

Returns event shape of distribution

Returns

event shape

Return type

Sequence[int]

property mean : Tensor

Mean of distribution

property variance : Tensor

Variance of distribution

sample ( shape: Sequence[int] = [] ) Tensor

sample

Sampling from the distribution.

rsample ( shape: Sequence[int] = [] ) Tensor

rsample

reparameterized sample

entropy ( ) Tensor

entropy

The entropy of the distribution.

kl_divergence ( other: Distribution ) Tensor [source]

kl_divergence

The KL-divergence between self distributions and other.

prob ( value: Tensor ) Tensor

prob

Probability density/mass function evaluated at value.

Parameters

value (Tensor) – value which will be evaluated

log_prob ( value: Tensor ) Tensor

log_prob

Log probability density/mass function.

probs ( value: Tensor ) Tensor

probs

Probability density/mass function.

Note

This method will be deprecated in the future, please use prob instead.