Method
__init__
(self, in_dim, hidden_dim, out_chans=None, act_layer=nn.GELU, dropout=0.)
Source from the content-addressed store, hash-verified
| 314 | |
| 315 | class FeedForward(nn.Module): |
| 316 | def __init__(self, in_dim, hidden_dim, out_chans=None, act_layer=nn.GELU, dropout=0.): |
| 317 | super().__init__() |
| 318 | |
| 319 | out_chans = out_chans or in_dim |
| 320 | hidden_dim = hidden_dim or in_dim |
| 321 | |
| 322 | self.net = nn.Sequential( |
| 323 | nn.Linear(in_dim, hidden_dim), |
| 324 | act_layer(), |
| 325 | nn.Dropout(dropout), |
| 326 | nn.Linear(hidden_dim, out_chans), |
| 327 | nn.Dropout(dropout) |
| 328 | ) |
| 329 | |
| 330 | def forward(self, x): |
| 331 | return self.net(x) |
Callers
nothing calls this directly
Tested by
no test coverage detected