linmult.core.ffn¶
FFN residual block: two linear layers with GELU activation and residual connection.
Classes¶
Two-layer FFN with GELU activation, dropout, and residual connection. |
Module Contents¶
- class linmult.core.ffn.FFNResidual(dim: int, dropout: float = 0.0)[source]¶
Bases:
torch.nn.ModuleTwo-layer FFN with GELU activation, dropout, and residual connection.
Computes
x + fc2(dropout(gelu(fc1(x)))).- Parameters:
dim (int) – Input and output feature dimension.
dropout (float) – Dropout probability applied after the first linear layer. Defaults to
0.0.
Initialize internal Module state, shared by both nn.Module and ScriptModule.