espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingLayer
Less than 1 minute
espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingLayer
class espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingLayer(in_channels: int = 192, hidden_channels: int = 192, kernel_size: int = 5, base_dilation: int = 1, layers: int = 5, stacks: int = 1, global_channels: int = -1, dropout_rate: float = 0.0, use_weight_norm: bool = True, bias: bool = True, use_only_mean: bool = True)
Bases: Module
Residual affine coupling layer.
Initialzie ResidualAffineCouplingLayer module.
- Parameters:
- in_channels (int) – Number of input channels.
- hidden_channels (int) – Number of hidden channels.
- kernel_size (int) – Kernel size for WaveNet.
- base_dilation (int) – Base dilation factor for WaveNet.
- layers (int) – Number of layers of WaveNet.
- stacks (int) – Number of stacks of WaveNet.
- global_channels (int) – Number of global channels.
- dropout_rate (float) – Dropout rate.
- use_weight_norm (bool) – Whether to use weight normalization in WaveNet.
- bias (bool) – Whether to use bias paramters in WaveNet.
- use_only_mean (bool) – Whether to estimate only mean.
forward(x: Tensor, x_mask: Tensor, g: Tensor | None = None, inverse: bool = False) → Tensor | Tuple[Tensor, Tensor]
Calculate forward propagation.
- Parameters:
- x (Tensor) – Input tensor (B, in_channels, T).
- x_lengths (Tensor) – Length tensor (B,).
- g (Optional *[*Tensor ]) – Global conditioning tensor (B, global_channels, 1).
- inverse (bool) – Whether to inverse the flow.
- Returns: Output tensor (B, in_channels, T). Tensor: Log-determinant tensor for NLL (B,) if not inverse.
- Return type: Tensor