scyan.module.RealNVP
Bases: LightningModule
Normalizing flow module (more specifically the RealNVP transformation \(f_{\phi}\)).
Attributes:
Name | Type | Description |
---|---|---|
module |
Sequential
|
Sequence of coupling layers. |
Source code in scyan/module/real_nvp.py
__init__(input_size, hidden_size, output_size, n_hidden_layers, n_layers)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_size |
int
|
Input size, i.e. number of markers + covariates |
required |
hidden_size |
int
|
MLP ( |
required |
output_size |
int
|
Output size, i.e. number of markers. |
required |
n_hidden_layers |
int
|
Number of hidden layers for the MLP ( |
required |
n_layers |
int
|
Number of coupling layers. |
required |
Source code in scyan/module/real_nvp.py
forward(x, covariates)
Forward implementation, i.e. \(f_{\phi}\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
Inputs of size \((B, M)\). |
required |
covariates |
Tensor
|
Covariates of size \((B, M_c)\) |
required |
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor, Tensor]
|
Tuple of (outputs, covariates, lod_det_jacobian sum) |
Source code in scyan/module/real_nvp.py
inverse(u, covariates)
Go through the RealNVP in reverse direction, i.e. \(f_{\phi}^{-1}\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
u |
Tensor
|
Latent expressions of size \((B, M)\). |
required |
covariates |
Tensor
|
Covariates of size \((B, M_c)\) |
required |
Returns:
Type | Description |
---|---|
Tensor
|
Outputs of size \((B, M)\). |