MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / FeedForward

Class FeedForward

sat/sgm/modules/attention.py:92–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91
92class FeedForward(nn.Module):
93 def __init__(self, dim, dim_out=None, mult=4, glu=False, dropout=0.0):
94 super().__init__()
95 inner_dim = int(dim * mult)
96 dim_out = default(dim_out, dim)
97 project_in = nn.Sequential(nn.Linear(dim, inner_dim), nn.GELU()) if not glu else GEGLU(dim, inner_dim)
98
99 self.net = nn.Sequential(project_in, nn.Dropout(dropout), nn.Linear(inner_dim, dim_out))
100
101 def forward(self, x):
102 return self.net(x)
103
104
105def zero_module(module):

Callers 3

__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected