ResidualBlock
- class ssm.model.block.residual_block.ResidualBlock(model)
Bases:
Module
Implementation of a residual block used in the S4 model.
This block is designed to efficiently model long sequences using selective state space models. Its selection mechanism allows it to focus on relevant parts of the input sequence, making it suitable for tasks such as selective copy.
The output is computed in an efficient manner by leveraging the parallel scan algorithm.
- forward(x)
Forward pass of the Residual Block.
- Parameters:
x (torch.Tensor) – The input tensor.
- Returns:
The output tensor.
- Return type:
torch.Tensor