(self, x)
| 50 | self.layerNormal_2 = torch.nn.LayerNorm(d_model) |
| 51 | |
| 52 | def forward(self, x): |
| 53 | residual = x |
| 54 | q = residual |
| 55 | if self.channel_wise: |
| 56 | x_r = self.conv(x.permute(0, 2, 1)).transpose(1, 2) |
| 57 | k = x_r |
| 58 | v = x_r |
| 59 | else: |
| 60 | k = residual |
| 61 | v = residual |
| 62 | x, score = self.MHA(q, k, v, attn_mask=None) |
| 63 | x = self.dropout(x) |
| 64 | x = self.layerNormal_1(x + residual) |
| 65 | |
| 66 | residual = x |
| 67 | x = self.feedforward(residual) |
| 68 | x = self.dropout(x) |
| 69 | x = self.layerNormal_2(x + residual) |
| 70 | |
| 71 | return x, score |
| 72 | |
| 73 | |
| 74 | class Model(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected