TAPE
TapeModule
Bases: Module
TapeModule is a simple implementation of the TAPE model from the original implementation.
paper: https://www.nature.com/articles/s41467-022-34550-9
Source code in src/pydeconv/model/nn/tape.py
signature_matrix: torch.Tensor
property
Pseudo property to get the signature matrix from the model.
Returns:
Type | Description |
---|---|
Tensor
|
Signature matrix from the model. |
__init__(input_dim, output_dim, adaptative=False)
TapeModule is a simple implementation of the TAPE model from the original implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_dim
|
int
|
Input dimension. |
required |
output_dim
|
int
|
Output dimension. |
required |
adaptative
|
bool
|
Adaptative step for predicting the model, by default True. |
False
|
Source code in src/pydeconv/model/nn/tape.py
forward(x)
Forward pass of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
Input tensor. |
required |
Returns:
Type | Description |
---|---|
Union[Tensor, Tuple[Tensor, Tensor]]
|
Output tensor or tuple of output tensor and reconstructed tensor. |
Source code in src/pydeconv/model/nn/tape.py
adaptative_step(model, data, n_steps=10, n_iter=5, device='cpu', lr=0.0001)
Adaptive stage for training the model from the original implementation. https://github.com/poseidonchan/TAPE/blob/8ffb2f4600e1cbc689c6b1b1f428e1ddac773c6e/TAPE/train.py#L42
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
TapeModule
|
The model to adapt. |
required |
data
|
Tensor
|
Input data. |
required |
n_steps
|
int
|
Number of steps to perform, by default 10 |
10
|
n_iter
|
int
|
Number of iterations to perform, by default 5 |
5
|
device
|
Union[str, device]
|
Device to use for the computation, by default "cpu" |
'cpu'
|
lr
|
float
|
Learning rate, by default 1e-4 |
0.0001
|