espnet2.gan_tts.style_melgan.style_melgan.StyleMelGANGenerator
espnet2.gan_tts.style_melgan.style_melgan.StyleMelGANGenerator
class espnet2.gan_tts.style_melgan.style_melgan.StyleMelGANGenerator(in_channels: int = 128, aux_channels: int = 80, channels: int = 64, out_channels: int = 1, kernel_size: int = 9, dilation: int = 2, bias: bool = True, noise_upsample_scales: List[int] = [11, 2, 2, 2], noise_upsample_activation: str = 'LeakyReLU', noise_upsample_activation_params: Dict[str, Any] = {'negative_slope': 0.2}, upsample_scales: List[int] = [2, 2, 2, 2, 2, 2, 2, 2, 1], upsample_mode: str = 'nearest', gated_function: str = 'softmax', use_weight_norm: bool = True)
Bases: Module
Style MelGAN generator module.
Initilize StyleMelGANGenerator module.
- Parameters:
- in_channels (int) – Number of input noise channels.
- aux_channels (int) – Number of auxiliary input channels.
- channels (int) – Number of channels for conv layer.
- out_channels (int) – Number of output channels.
- kernel_size (int) – Kernel size of conv layers.
- dilation (int) – Dilation factor for conv layers.
- bias (bool) – Whether to add bias parameter in convolution layers.
- noise_upsample_scales (List *[*int ]) – List of noise upsampling scales.
- noise_upsample_activation (str) – Activation function module name for noise upsampling.
- noise_upsample_activation_params (Dict *[*str , Any ]) – Hyperparameters for the above activation function.
- upsample_scales (List *[*int ]) – List of upsampling scales.
- upsample_mode (str) – Upsampling mode in TADE layer.
- gated_function (str) – Gated function used in TADEResBlock (“softmax” or “sigmoid”).
- use_weight_norm (bool) – Whether to use weight norm. If set to true, it will be applied to all of the conv layers.
apply_weight_norm()
Apply weight normalization module from all of the layers.
forward(c: Tensor, z: Tensor | None = None) → Tensor
Calculate forward propagation.
- Parameters:
- c (Tensor) – Auxiliary input tensor (B, channels, T).
- z (Tensor) – Input noise tensor (B, in_channels, 1).
- Returns: Output tensor (B, out_channels, T ** prod(upsample_scales)).
- Return type: Tensor
inference(c: Tensor) → Tensor
Perform inference.
- Parameters:c (Tensor) – Input tensor (T, in_channels).
- Returns: Output tensor (T ** prod(upsample_scales), out_channels).
- Return type: Tensor
remove_weight_norm()
Remove weight normalization module from all of the layers.
reset_parameters()
Reset parameters.