scvi.nn.Encoder.forward

Encoder.forward(x, *cat_list)[source]

The forward computation for a single sample.

  1. Encodes the data into latent space using the encoder network

  2. Generates a mean \( q_m \) and variance \( q_v \)

  3. Samples a new value from an i.i.d. multivariate normal \( \sim Ne(q_m, \mathbf{I}q_v) \)

Parameters
x : TensorTensor

tensor with shape (n_input,)

cat_list : intint

list of category membership(s) for this sample

Returns

3-tuple of torch.Tensor tensors of shape (n_latent,) for mean and var, and sample