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

Method __init__

ldm/modules/attention.py:60–73  ·  view source on GitHub ↗
(self, dim, dim_out=None, mult=4, glu=False, dropout=0.)

Source from the content-addressed store, hash-verified

58
59class FeedForward(nn.Module):
60 def __init__(self, dim, dim_out=None, mult=4, glu=False, dropout=0.):
61 super().__init__()
62 inner_dim = int(dim * mult)
63 dim_out = default(dim_out, dim)
64 project_in = nn.Sequential(
65 nn.Linear(dim, inner_dim),
66 nn.GELU()
67 ) if not glu else GEGLU(dim, inner_dim)
68
69 self.net = nn.Sequential(
70 project_in,
71 nn.Dropout(dropout),
72 nn.Linear(inner_dim, dim_out)
73 )
74
75 def forward(self, x):
76 return self.net(x)

Callers

nothing calls this directly

Calls 3

GEGLUClass · 0.85
defaultFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected