espnet2.gan_tts.wavenet.residual_block.ResidualBlock
Less than 1 minute
espnet2.gan_tts.wavenet.residual_block.ResidualBlock
class espnet2.gan_tts.wavenet.residual_block.ResidualBlock(kernel_size: int = 3, residual_channels: int = 64, gate_channels: int = 128, skip_channels: int = 64, aux_channels: int = 80, global_channels: int = -1, dropout_rate: float = 0.0, dilation: int = 1, bias: bool = True, scale_residual: bool = False)
Bases: Module
Residual block module in WaveNet.
Initialize ResidualBlock module.
- Parameters:
- kernel_size (int) – Kernel size of dilation convolution layer.
- residual_channels (int) – Number of channels for residual connection.
- skip_channels (int) – Number of channels for skip connection.
- aux_channels (int) – Number of local conditioning channels.
- dropout (float) – Dropout probability.
- dilation (int) – Dilation factor.
- bias (bool) – Whether to add bias parameter in convolution layers.
- scale_residual (bool) – Whether to scale the residual outputs.
forward(x: Tensor, x_mask: Tensor | None = None, c: Tensor | None = None, g: Tensor | None = None) → Tuple[Tensor, Tensor]
Calculate forward propagation.
- Parameters:
- x (Tensor) – Input tensor (B, residual_channels, T).
- Optional**[torch.Tensor]** (x_mask) – Mask tensor (B, 1, T).
- c (Optional *[*Tensor ]) – Local conditioning tensor (B, aux_channels, T).
- g (Optional *[*Tensor ]) – Global conditioning tensor (B, global_channels, 1).
- Returns: Output tensor for residual connection (B, residual_channels, T). Tensor: Output tensor for skip connection (B, skip_channels, T).
- Return type: Tensor