scyan.module.CouplingLayer
Bases: LightningModule
One single coupling layer module.
Attributes:
Name | Type | Description |
---|---|---|
sfun |
Module
|
|
tfun |
Module
|
|
Source code in scyan/module/coupling_layer.py
__init__(input_size, hidden_size, output_size, n_hidden_layers, mask)
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 |
mask |
Tensor
|
Mask used to separate \(x\) into \((x^{(1)}, x^{(2)})\) |
required |
Source code in scyan/module/coupling_layer.py
forward(inputs)
Coupling layer forward function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Tuple[Tensor, Tensor, Optional[Tensor]]
|
cell-marker expressions, covariates, lod_det_jacobian sum |
required |
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor, Tensor]
|
outputs, covariates, lod_det_jacobian sum |
Source code in scyan/module/coupling_layer.py
inverse(y, covariates)
Go through the coupling layer in reverse direction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
Tensor
|
Inputs tensor or size \((B, M)\). |
required |
covariates |
Tensor
|
Covariates tensor of size \((B, M_c)\). |
required |
Returns:
Type | Description |
---|---|
Tensor
|
Outputs tensor. |