Shortcuts

HiFiGANVocoder

class torchaudio.prototype.models.HiFiGANVocoder(in_channels: int, upsample_rates: Tuple[int, ...], upsample_initial_channel: int, upsample_kernel_sizes: Tuple[int, ...], resblock_kernel_sizes: Tuple[int, ...], resblock_dilation_sizes: Tuple[Tuple[int, ...], ...], resblock_type: int, lrelu_slope: float)[source]

DEPRECATED

Warning

This class is deprecated from version 2.8. It will be removed in the 2.9 release. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information.

Generator part of HiFi GAN [Kong et al., 2020].

Source: https://github.com/jik876/hifi-gan/blob/4769534d45265d52a904b850da5a622601885777/models.py#L75

Note:

To build the model, please use one of the factory functions: hifigan_vocoder(), hifigan_vocoder_v1(), hifigan_vocoder_v2(), hifigan_vocoder_v3().

Args:

in_channels (int): Number of channels in the input features. upsample_rates (tuple of int): Factors by which each upsampling layer increases the time dimension. upsample_initial_channel (int): Number of channels in the input feature tensor. upsample_kernel_sizes (tuple of int): Kernel size for each upsampling layer. resblock_kernel_sizes (tuple of int): Kernel size for each residual block. resblock_dilation_sizes (tuple of tuples of int): Dilation sizes for each 1D convolutional layer in each

residual block. For resblock type 1 inner tuples should have length 3, because there are 3 convolutions in each layer. For resblock type 2 they should have length 2.

resblock_type (int, 1 or 2): Determines whether ResBlock1 or ResBlock2 will be used. lrelu_slope (float): Slope of leaky ReLUs in activations.

Methods

forward

HiFiGANVocoder.forward(x: Tensor) Tensor[source]
Parameters

x (Tensor) – Feature input tensor of shape (batch_size, num_channels, time_length).

Returns

Tensor of shape (batch_size, 1, time_length * upsample_rate), where upsample_rate is the product of upsample rates for all layers.

Factory Functions

hifigan_vocoder

DEPRECATED

hifigan_vocoder_v1

DEPRECATED

hifigan_vocoder_v2

DEPRECATED

hifigan_vocoder_v3

DEPRECATED

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources