MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / Mlp

Class Mlp

modules/SVTR.py:88–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88class Mlp(nn.Module):
89 def __init__(self,
90 in_features,
91 hidden_features=None,
92 out_features=None,
93 act_layer=nn.GELU,
94 drop=0.):
95 super().__init__()
96 out_features = out_features or in_features
97 hidden_features = hidden_features or in_features
98 self.fc1 = nn.Linear(in_features, hidden_features)
99 self.act = act_layer()
100 self.fc2 = nn.Linear(hidden_features, out_features)
101 self.drop = nn.Dropout(drop)
102
103 def forward(self, x):
104 x = self.fc1(x)
105 x = self.act(x)
106 x = self.drop(x)
107 x = self.fc2(x)
108 x = self.drop(x)
109 return x
110
111
112class ConvMixer(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected