beanmachine.ppl.distributions.delta module

class beanmachine.ppl.distributions.delta.Delta(v, log_density=0.0, event_dim=0, validate_args=None)

Bases: torch.distributions.distribution.Distribution

arg_constraints = {'log_density': Real(), 'v': Real()}
property event_dim
expand(batch_shape, _instance=None)

Returns a new distribution instance (or populates an existing instance provided by a derived class) with batch dimensions expanded to batch_shape. This method calls expand on the distribution’s parameters. As such, this does not allocate new memory for the expanded distribution instance. Additionally, this does not repeat any args checking or parameter broadcasting in __init__.py, when an instance is first created.

Parameters
  • batch_shape (torch.Size) – the desired expanded size.

  • _instance – new instance provided by subclasses that need to override .expand.

Returns

New distribution instance with batch dimensions expanded to batch_size.

has_rsample = True
log_prob(x)

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

Parameters

value (Tensor) –

property mean

Returns the mean of the distribution.

rsample(sample_shape=torch.Size([]))

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

shape(sample_shape=torch.Size([]))
support = Real()
property variance

Returns the variance of the distribution.

beanmachine.ppl.distributions.delta.sum_rightmost(value, dim)