MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / Mlp

Class Mlp

openrec/modeling/common.py:106–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105
106class Mlp(nn.Module):
107
108 def __init__(
109 self,
110 in_features,
111 hidden_features=None,
112 out_features=None,
113 act_layer=nn.GELU,
114 drop=0.0,
115 ):
116 super().__init__()
117 out_features = out_features or in_features
118 hidden_features = hidden_features or in_features
119 self.fc1 = nn.Linear(in_features, hidden_features)
120 self.act = act_layer()
121 self.fc2 = nn.Linear(hidden_features, out_features)
122 self.drop = nn.Dropout(drop)
123
124 def forward(self, x):
125 x = self.fc1(x)
126 x = self.act(x)
127 x = self.drop(x)
128 x = self.fc2(x)
129 x = self.drop(x)
130 return x
131
132
133class Attention(nn.Module):

Callers 15

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected