espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingBlock
Less than 1 minute
espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingBlock
class espnet2.gan_tts.vits.residual_coupling.ResidualAffineCouplingBlock(in_channels: int = 192, hidden_channels: int = 192, flows: int = 4, kernel_size: int = 5, base_dilation: int = 1, layers: int = 4, 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 block module.
This is a module of residual affine coupling block, which used as “Flow” in Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech.
Initilize ResidualAffineCouplingBlock module.
- Parameters:
- in_channels (int) – Number of input channels.
- hidden_channels (int) – Number of hidden channels.
- flows (int) – Number of flows.
- 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
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).
- Return type: Tensor