in models/src/wavegrad/upsampling.py [0:0]
def __init__(self, in_channels, out_channels, factor, dilations):
super(UpsamplingBlock, self).__init__()
self.first_block_main_branch = torch.nn.ModuleDict(
{
"upsampling": torch.nn.Sequential(
*[
torch.nn.LeakyReLU(0.2),
InterpolationBlock(
scale_factor=factor, mode="linear", align_corners=False
),
Conv1dWithInitialization(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=3,
stride=1,
padding=dilations[0],
dilation=dilations[0],
),
]
),
"modulation": BasicModulationBlock(out_channels, dilation=dilations[1]),
}
)
self.first_block_residual_branch = torch.nn.Sequential(
*[
Conv1dWithInitialization(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=1,
stride=1,
),
InterpolationBlock(
scale_factor=factor, mode="linear", align_corners=False
),
]
)
self.second_block_main_branch = torch.nn.ModuleDict(
{
f"modulation_{idx}": BasicModulationBlock(
out_channels, dilation=dilations[2 + idx]
)
for idx in range(2)
}
)