FCLayers¶
-
class
scvi.models.modules.
FCLayers
(n_in, n_out, n_cat_list=None, n_layers=1, n_hidden=128, dropout_rate=0.1, use_batch_norm=True, use_relu=True, bias=True)[source]¶ Bases:
torch.nn.modules.module.Module
A helper class to build fully-connected layers for a neural network.
- Parameters
n_cat_list (
Iterable
[int
],None
Optional
[Iterable
[int
]]) – A list containing, for each category of interest, the number of categories. Each category will be included using a one-hot encoding.n_layers (
int
int
) – The number of fully-connected hidden layersdropout_rate (
float
float
) – Dropout rate to apply to each of the hidden layersuse_batch_norm (
bool
bool
) – Whether to have BatchNorm layers or notbias (
bool
bool
) – Whether to learn bias in linear layers or not
Methods Summary
forward
(x, *cat_list[, instance_id])Forward computation on
x
.Methods Documentation
-
forward
(x, *cat_list, instance_id=0)[source]¶ Forward computation on
x
.- Parameters
x (torch.Tensor) – tensor of values with shape
(n_in,)
cat_list (
int
int
) – list of category membership(s) for this sampleinstance_id (
int
int
) – Use a specific conditional instance normalization (batchnorm)x –
- Returns
py:class:torch.Tensor tensor of shape
(n_out,)