MCPcopy Create free account
hub / github.com/CompVis/diff2flow / GEGLU

Class GEGLU

diff2flow/models/unet/attention.py:47–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected