(self, x, attn_mask=None)
| 124 | self.activation = F.relu if activation == "relu" else F.gelu |
| 125 | |
| 126 | def forward(self, x, attn_mask=None): |
| 127 | new_x, attn = self.attention( |
| 128 | x, x, x, |
| 129 | attn_mask=attn_mask |
| 130 | ) |
| 131 | x = x + self.dropout(new_x) |
| 132 | x, _ = self.decomp1(x) |
| 133 | y = x |
| 134 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 135 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 136 | res, _ = self.decomp2(x + y) |
| 137 | return res, attn |
| 138 | |
| 139 | |
| 140 | class Encoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected