(self, x, attn_mask=None)
| 85 | self.activation = F.relu if activation == "relu" else F.gelu |
| 86 | |
| 87 | def forward(self, x, attn_mask=None): |
| 88 | new_x, attn = self.attention( |
| 89 | x, x, x, |
| 90 | attn_mask=attn_mask |
| 91 | ) |
| 92 | x = x + self.dropout(new_x) |
| 93 | x, _ = self.decomp1(x) |
| 94 | y = x |
| 95 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 96 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 97 | res, _ = self.decomp2(x + y) |
| 98 | return res, attn |
| 99 | |
| 100 | |
| 101 | class Encoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected