espnet2.gan_tts.hifigan.hifigan.HiFiGANScaleDiscriminator
espnet2.gan_tts.hifigan.hifigan.HiFiGANScaleDiscriminator
class espnet2.gan_tts.hifigan.hifigan.HiFiGANScaleDiscriminator(in_channels: int = 1, out_channels: int = 1, kernel_sizes: List[int] = [15, 41, 5, 3], channels: int = 128, max_downsample_channels: int = 1024, max_groups: int = 16, bias: int = True, downsample_scales: List[int] = [2, 2, 4, 4, 1], nonlinear_activation: str = 'LeakyReLU', nonlinear_activation_params: Dict[str, Any] = {'negative_slope': 0.1}, use_weight_norm: bool = True, use_spectral_norm: bool = False)
Bases: Module
HiFi-GAN scale discriminator module.
Initilize HiFiGAN scale discriminator module.
- Parameters:
- in_channels (int) – Number of input channels.
- out_channels (int) – Number of output channels.
- kernel_sizes (List *[*int ]) – List of four kernel sizes. The first will be used for the first conv layer, and the second is for downsampling part, and the remaining two are for the last two output layers.
- channels (int) – Initial number of channels for conv layer.
- max_downsample_channels (int) – Maximum number of channels for downsampling layers.
- bias (bool) – Whether to add bias parameter in convolution layers.
- downsample_scales (List *[*int ]) – List of downsampling scales.
- nonlinear_activation (str) – Activation function module name.
- nonlinear_activation_params (Dict *[*str , Any ]) – Hyperparameters for activation function.
- use_weight_norm (bool) – Whether to use weight norm. If set to true, it will be applied to all of the conv layers.
- use_spectral_norm (bool) – Whether to use spectral norm. If set to true, it will be applied to all of the conv layers.
apply_spectral_norm()
Apply spectral normalization module from all of the layers.
apply_weight_norm()
Apply weight normalization module from all of the layers.
forward(x: Tensor) → List[Tensor]
Calculate forward propagation.
- Parameters:x (Tensor) – Input noise signal (B, 1, T).
- Returns: List of output tensors of each layer.
- Return type: List[Tensor]
remove_spectral_norm()
Remove spectral normalization module from all of the layers.
remove_weight_norm()
Remove weight normalization module from all of the layers.