torch_blue.vi.UniformNormalDivergence
- class torch_blue.vi.UniformNormalDivergence
Bases:
KullbackLeiblerModuleKullback-Leibler divergence between a uniform and normal distribution.
Calculates the KL-Divergence between a
UniformPriorand aMeanFieldNormalVarDist.- static forward(prior_mean: None, variational_mean: torch.Tensor, variational_log_std: torch.Tensor) torch.Tensor
Calculate the Kullback-Leibler divergence.
All input tensors must have the same shape.
This calculation is affected by
_globals._USE_NORM_CONSTANTS, which can be set withuse_norm_constants().- Parameters:
prior_mean (None) – Always None, exists for technical reasons.
variational_mean (Tensor) – Means of the variational distribution.
variational_log_std (Tensor) – Standard deviations of the variational distribution.
- Returns:
The KL-Divergence of the two distributions.
- Return type:
Tensor