class scvi.module.base.PyroBaseModuleClass[source]

Bases: torch.nn.modules.module.Module

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 PyroModule instances. 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)

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.


create_predictive([model, …])

Creates a Predictive object.

forward(*args, **kwargs)

Passthrough to Pyro model.