MCPcopy
hub / github.com/Stability-AI/generative-models / GEGLU

Class GEGLU

sgm/modules/attention.py:82–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81# feedforward
82class GEGLU(nn.Module):
83 def __init__(self, dim_in, dim_out):
84 super().__init__()
85 self.proj = nn.Linear(dim_in, dim_out * 2)
86
87 def forward(self, x):
88 x, gate = self.proj(x).chunk(2, dim=-1)
89 return x * F.gelu(gate)
90
91
92class FeedForward(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected