clear_cache_hook(self)
return super().train(mode=mode)
def __call__(self, x, prior=False):
// If we"re in prior mode, then we"re done!
if prior:
return self.model.forward(x)
// Delete previously cached items from the training distribution
if self.training:
clear_cache_hook(self)
// (Maybe) initialize variational distribution
if not self.variational_params_initialized.item():
prior_dist = self.prior_distribution
self._variational_distribution.initialize_variational_distribution(prior_dist)