diff options
Diffstat (limited to 'text_recognizer/network/transformer')
-rw-r--r-- | text_recognizer/network/transformer/ff.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/text_recognizer/network/transformer/ff.py b/text_recognizer/network/transformer/ff.py deleted file mode 100644 index 9181323..0000000 --- a/text_recognizer/network/transformer/ff.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Feedforward layer in transformer.""" -from torch import Tensor, nn - - -class FeedForward(nn.Module): - def __init__( - self, - dim: int, - inner_dim: int, - dropout_rate: float = 0.0, - ) -> None: - super().__init__() - self.ff = nn.Sequential( - nn.LayerNorm(dim), - nn.Linear(dim, inner_dim), - nn.GELU(), - nn.Dropout(dropout_rate), - nn.Linear(inner_dim, dim), - ) - - def forward(self, x: Tensor) -> Tensor: - return self.ff(x) |