(self, x, attn_mask=None)
| 58 | self.activation = F.relu if activation == "relu" else F.gelu |
| 59 | |
| 60 | def forward(self, x, attn_mask=None): |
| 61 | new_x, attn = self.attention( |
| 62 | x, x, x, |
| 63 | attn_mask=attn_mask |
| 64 | ) |
| 65 | x = x + self.dropout(new_x) |
| 66 | |
| 67 | y = x = self.norm1(x) |
| 68 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 69 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 70 | |
| 71 | return self.norm2(x + y), attn |
| 72 | |
| 73 | |
| 74 | class Encoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected