MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / GEGLU

Class GEGLU

ldm/modules/attention.py:49–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48# feedforward
49class GEGLU(nn.Module):
50 def __init__(self, dim_in, dim_out):
51 super().__init__()
52 self.proj = nn.Linear(dim_in, dim_out * 2)
53
54 def forward(self, x):
55 x, gate = self.proj(x).chunk(2, dim=-1)
56 return x * F.gelu(gate)
57
58
59class FeedForward(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected