MCPcopy Create free account
hub / github.com/microsoft/Cream / Mlp

Class Mlp

AutoFormerV2/model/SSS.py:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class Mlp(nn.Module):
8 def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
9 super().__init__()
10 out_features = out_features or in_features
11 hidden_features = hidden_features or in_features
12 self.fc1 = nn.Linear(in_features, hidden_features)
13 self.act = act_layer()
14 self.fc2 = nn.Linear(hidden_features, out_features)
15 self.drop = nn.Dropout(drop)
16
17 def forward(self, x):
18 x = self.fc1(x)
19 x = self.act(x)
20 x = self.drop(x)
21 x = self.fc2(x)
22 x = self.drop(x)
23 return x
24
25
26def window_partition(x, window_size):

Callers 2

__init__Method · 0.70
__init__Method · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected