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

Class Mlp

PATH/core/models/backbones/vit.py:43–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42
43class Mlp(nn.Module):
44 def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
45 super().__init__()
46 out_features = out_features or in_features
47 hidden_features = hidden_features or in_features
48 self.fc1 = nn.Linear(in_features, hidden_features)
49 self.act = act_layer()
50 self.fc2 = nn.Linear(hidden_features, out_features)
51 self.drop = nn.Dropout(drop)
52
53 def forward(self, x):
54 x = self.fc1(x)
55 x = self.act(x)
56 # x = self.drop(x)
57 # commit this for the orignal BERT implement
58 x = self.fc2(x)
59 x = self.drop(x)
60 return x
61
62
63class Attention(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected