MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / Mlp

Class Mlp

slowfast/models/uniformer.py:49–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49class Mlp(nn.Module):
50 def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
51 super().__init__()
52 out_features = out_features or in_features
53 hidden_features = hidden_features or in_features
54 self.fc1 = nn.Linear(in_features, hidden_features)
55 self.act = act_layer()
56 self.fc2 = nn.Linear(hidden_features, out_features)
57 self.drop = nn.Dropout(drop)
58
59 def forward(self, x):
60 x = self.fc1(x)
61 x = self.act(x)
62 x = self.drop(x)
63 x = self.fc2(x)
64 x = self.drop(x)
65 return x
66
67
68class Attention(nn.Module):

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected