From fe693b4799cc48476d720fca5bb9fbf00fe58b23 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 11 Sep 2023 22:12:41 +0200 Subject: Remove separate ff class --- text_recognizer/network/transformer/ff.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 text_recognizer/network/transformer/ff.py (limited to 'text_recognizer/network') 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) -- cgit v1.2.3-70-g09d2