(self, x, incremental_state=None)
| 501 | self.swish_fn = CustomSwish() |
| 502 | |
| 503 | def forward(self, x, incremental_state=None): |
| 504 | # x: T x B x C |
| 505 | if incremental_state is not None: |
| 506 | assert incremental_state is None, 'Nar-generation does not allow this.' |
| 507 | exit(1) |
| 508 | |
| 509 | x = self.ffn_1(x.permute(1, 2, 0)).permute(2, 0, 1) |
| 510 | x = x * self.kernel_size ** -0.5 |
| 511 | |
| 512 | if incremental_state is not None: |
| 513 | x = x[-1:] |
| 514 | if self.act == 'gelu': |
| 515 | x = F.gelu(x) |
| 516 | if self.act == 'relu': |
| 517 | x = F.relu(x) |
| 518 | if self.act == 'swish': |
| 519 | x = self.swish_fn(x) |
| 520 | x = F.dropout(x, self.dropout, training=self.training) |
| 521 | x = self.ffn_2(x) |
| 522 | return x |
| 523 | |
| 524 | |
| 525 | class BatchNorm1dTBC(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected