Method
__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
Source from the content-addressed store, hash-verified
| 68 | |
| 69 | class MLP(nn.Module): |
| 70 | def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.): |
| 71 | super().__init__() |
| 72 | out_features = out_features or in_features |
| 73 | hidden_features = hidden_features or in_features |
| 74 | self.fc1 = nn.Linear(in_features, hidden_features) |
| 75 | self.act = act_layer() |
| 76 | self.fc2 = nn.Linear(hidden_features, out_features) |
| 77 | self.drop = nn.Dropout(drop) |
| 78 | |
| 79 | def forward(self, x): |
| 80 | x = self.fc1(x) |
Tested by
no test coverage detected