espnet2.gan_tts.hifigan.hifigan.HiFiGANPeriodDiscriminator
espnet2.gan_tts.hifigan.hifigan.HiFiGANPeriodDiscriminator
class espnet2.gan_tts.hifigan.hifigan.HiFiGANPeriodDiscriminator(in_channels: int = 1, out_channels: int = 1, period: int = 3, kernel_sizes: List[int] = [5, 3], channels: int = 32, downsample_scales: List[int] = [3, 3, 3, 3, 1], max_downsample_channels: int = 1024, bias: bool = True, 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
HiFiGAN period discriminator module.
Initialize HiFiGANPeriodDiscriminator module.
- Parameters:
- in_channels (int) – Number of input channels.
- out_channels (int) – Number of output channels.
- period (int) – Period.
- kernel_sizes (list) – Kernel sizes of initial conv layers and the final conv layer.
- channels (int) – Number of initial channels.
- downsample_scales (List *[*int ]) – List of downsampling scales.
- max_downsample_channels (int) – Number of maximum downsampling channels.
- use_additional_convs (bool) – Whether to use additional conv layers in residual blocks.
- bias (bool) – Whether to add bias parameter in convolution layers.
- 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) → Tensor
Calculate forward propagation.
- Parameters:c (Tensor) – Input tensor (B, in_channels, T).
- Returns: List of each layer’s tensors.
- Return type: list