MCPcopy Create free account
hub / github.com/TEA-Lab/TwoByTwo / PositionwiseFeedForward

Class PositionwiseFeedForward

src/shape_assembly/models/train/transformer.py:135–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 return self.linears[-1](x)
134
135class PositionwiseFeedForward(pl.LightningModule):
136
137 def __init__(self, d_model, d_ff):
138 super().__init__()
139 self.w_1 = nn.Linear(d_model, d_ff)
140 self.norm = nn.Sequential()
141 self.w_2 = nn.Linear(d_ff, d_model)
142
143 def forward(self, x):
144 return self.w_2(self.norm(F.relu(self.w_1(x)).transpose(2, 1).contiguous()).transpose(2, 1).contiguous())
145
146class Transformer(pl.LightningModule):
147

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected