| 43 | |
| 44 | class 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 | """ |