(self, x, attn_mask=None, tau=None, delta=None)
| 37 | self.activation = F.relu if activation == "relu" else F.gelu |
| 38 | |
| 39 | def forward(self, x, attn_mask=None, tau=None, delta=None): |
| 40 | new_x, attn = self.attention( |
| 41 | x, x, x, |
| 42 | attn_mask=attn_mask, |
| 43 | tau=tau, delta=delta |
| 44 | ) |
| 45 | x = x + self.dropout(new_x) |
| 46 | |
| 47 | y = x = self.norm1(x) |
| 48 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 49 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 50 | |
| 51 | return self.norm2(x + y), attn |
| 52 | |
| 53 | |
| 54 | class Encoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected