- class scvi.module.base.PyroBaseModuleClass¶
Base module class for Pyro models.
In Pyro, model and guide should have the same signature. Out of convenience, the forward function of this class passes through to the forward of the model.
There are two ways this class can be equipped with a model and a guide. First, model and guide can be class attributes that are
PyroModuleinstances. The implemented model and guide class method can then return the (private) attributes. Second, model and guide methods can be written directly (see Pyro scANVI example) https://pyro.ai/examples/scanvi.html.
The model and guide may also be equipped with n_obs attributes, which can be set to None (e.g., self.n_obs = None). This attribute may be helpful in designating the size of observation-specific Pyro plates. The value will be updated automatically by
PyroTrainingPlan, provided that it is given the number of training examples upon initialization.
Model annotation for minibatch training with pyro plate.
Passthrough to Pyro model.