MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / FFN

Class FFN

mogen/models/transformers/remodiffuse.py:15–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class FFN(nn.Module):
16
17 def __init__(self, latent_dim, ffn_dim, dropout):
18 super().__init__()
19 self.linear1 = nn.Linear(latent_dim, ffn_dim)
20 self.linear2 = zero_module(nn.Linear(ffn_dim, latent_dim))
21 self.activation = nn.GELU()
22 self.dropout = nn.Dropout(dropout)
23
24 def forward(self, x, **kwargs):
25 y = self.linear2(self.dropout(self.activation(self.linear1(x))))
26 y = x + y
27 return y
28
29
30class EncoderLayer(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected