nami.distributions.normal#
Classes
|
|
|
- class nami.distributions.normal.DiagonalNormal(loc, scale, *, event_ndim=1, validate_args=True)[source]#
Bases:
Distribution- Parameters:
loc (torch.Tensor)
scale (torch.Tensor)
event_ndim (int)
validate_args (bool)
- expand(batch_shape, _instance=None)[source]#
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
expandon 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 (
Size) – the desired expanded size._instance (
Distribution|None) – new instance provided by subclasses that need to override .expand.
- Return type:
- Returns:
New distribution instance with batch dimensions expanded to batch_size.
- has_rsample = True#
- log_prob(value)[source]#
Returns the log of the probability density/mass function evaluated at value.
- rsample(sample_shape=())[source]#
Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched.
- class nami.distributions.normal.StandardNormal(event_shape, *, batch_shape=None, device=None, dtype=None, validate_args=True)[source]#
Bases:
Distribution- Parameters:
device (torch.device | None)
dtype (torch.dtype | None)
validate_args (bool)
- expand(batch_shape, _instance=None)[source]#
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
expandon 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 (
Size) – the desired expanded size._instance (
Distribution|None) – new instance provided by subclasses that need to override .expand.
- Return type:
- Returns:
New distribution instance with batch dimensions expanded to batch_size.
- has_rsample = True#
- log_prob(value)[source]#
Returns the log of the probability density/mass function evaluated at value.
- rsample(sample_shape=())[source]#
Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched.