(self, x, cross, x_mask=None, cross_mask=None)
| 94 | self.activation = F.relu if activation == "relu" else F.gelu |
| 95 | |
| 96 | def forward(self, x, cross, x_mask=None, cross_mask=None): |
| 97 | x = x + self.dropout(self.self_attention( |
| 98 | x, x, x, |
| 99 | attn_mask=x_mask |
| 100 | )[0]) |
| 101 | x = self.norm1(x) |
| 102 | |
| 103 | x = x + self.dropout(self.cross_attention( |
| 104 | x, cross, cross, |
| 105 | attn_mask=cross_mask |
| 106 | )[0]) |
| 107 | |
| 108 | y = x = self.norm2(x) |
| 109 | y = self.dropout(self.activation(self.conv1(y.transpose(-1, 1)))) |
| 110 | y = self.dropout(self.conv2(y).transpose(-1, 1)) |
| 111 | |
| 112 | return self.norm3(x + y) |
| 113 | |
| 114 | |
| 115 | class Decoder(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected