[docs]classBayesianHyperparameter:""" Represents a single Bayesian hyperparameter. """
[docs]def__init__(self,raw_name:str,raw_shape:torch.Size,constraint:Optional[constraints.Interval],prior_mean:float,prior_variance:float,)->None:""" Initialise self. :param raw_name: The raw name for the parameter. :param raw_shape: The shape of the raw parameter. :param constraint: The constraint (if any) placed on the parameter. :param prior_mean: The mean of the diagonal normal prior on the raw parameter. :param prior_variance: The variance of the diagonal normal prior on the raw parameter. """self.raw_name=raw_nameself.raw_shape=raw_shapeself.constraint=constraintself.prior_mean=prior_meanself.prior_variance=prior_variance
[docs]defnumel(self)->int:"""Return the number of elements in the parameter."""returnself.raw_shape.numel()