(self, dim, dropout = 0.)
| 320 | |
| 321 | class FeedForward(nn.Module): |
| 322 | def __init__(self, dim, dropout = 0.): |
| 323 | super().__init__() |
| 324 | self.net = nn.Sequential( |
| 325 | nn.Linear(dim, dim), |
| 326 | nn.GELU(), |
| 327 | nn.Dropout(dropout), |
| 328 | nn.Linear(dim, dim), |
| 329 | nn.Dropout(dropout) |
| 330 | ) |
| 331 | def forward(self, x): |
| 332 | x = self.net(x) |
| 333 | return x |