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

Method __init__

diff2flow/models/unet/attention.py:58–71  ·  view source on GitHub ↗
(self, dim, dim_out=None, mult=4, glu=False, dropout=0.)

Source from the content-addressed store, hash-verified

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