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.
