MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / forward

Method forward

modules/commons/common_layers.py:503–522  ·  view source on GitHub ↗
(self, x, incremental_state=None)

Source from the content-addressed store, hash-verified

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
525class BatchNorm1dTBC(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected