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

Method __init__

modules/fastspeech/pe.py:45–60  ·  view source on GitHub ↗
(self, idim=80, n_chans=256, kernel_size=3, stride=1, norm='gn', dropout=0)

Source from the content-addressed store, hash-verified

43
44class ConvBlock(nn.Module):
45 def __init__(self, idim=80, n_chans=256, kernel_size=3, stride=1, norm='gn', dropout=0):
46 super().__init__()
47 self.conv = ConvNorm(idim, n_chans, kernel_size, stride=stride)
48 self.norm = norm
49 if self.norm == 'bn':
50 self.norm = nn.BatchNorm1d(n_chans)
51 elif self.norm == 'in':
52 self.norm = nn.InstanceNorm1d(n_chans, affine=True)
53 elif self.norm == 'gn':
54 self.norm = nn.GroupNorm(n_chans // 16, n_chans)
55 elif self.norm == 'ln':
56 self.norm = LayerNorm(n_chans // 16, n_chans)
57 elif self.norm == 'wn':
58 self.conv = torch.nn.utils.weight_norm(self.conv.conv)
59 self.dropout = nn.Dropout(dropout)
60 self.relu = nn.ReLU()
61
62 def forward(self, x):
63 """

Callers

nothing calls this directly

Calls 3

ConvNormClass · 0.85
LayerNormClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected