get_posterior#
- torchbayesian.bnn.utils.get_posterior(param: Tensor, posterior: str | Tuple[str, Dict[str, Any]]) VariationalPosterior#
Creates an instance of a ‘VariationalPosterior’ subclass to replace a given tensor. For use in ‘bnn.BayesianModule’.
Parameters#
- paramTensor
The tensor for which to initialize a variational posterior.
- posteriorstr | Tuple[str, Dict[str, Any]]
The variational posterior to instantiate. Either the posterior’s name (str) or a tuple of the name and a dictionary of keyword arguments for instantiation.
Returns#
- posterior_instanceVariationalPosterior
The instantiated variational posterior.