espnet2.gan_svs.vits.length_regulator.LengthRegulator
Less than 1 minute
espnet2.gan_svs.vits.length_regulator.LengthRegulator
class espnet2.gan_svs.vits.length_regulator.LengthRegulator(pad_value=0.0)
Bases: Module
Length Regulator
Initilize length regulator module.
- Parameters:pad_value (float , optional) – Value used for padding.
LR(x, duration, use_state_info=False)
Length regulates input mel-spectrograms to match duration.
- Parameters:
- x (Tensor) – Input tensor (B, dim, T).
- duration (Tensor) – Duration tensor (B, T).
- use_state_info (bool , optional) – Whether to use position information or not.
- Returns: Output tensor (B, dim, D_frame). Tensor: Output length (B,).
- Return type: Tensor
expand(batch, predicted, use_state_info=False)
Expand input mel-spectrogram based on the predicted duration.
- Parameters:
- batch (Tensor) – Input tensor (T, dim).
- predicted (Tensor) – Predicted duration tensor (T,).
- use_state_info (bool , optional) – Whether to use position information or not.
- Returns: Output tensor (D_frame, dim).
- Return type: Tensor
forward(x, duration, use_state_info=False)
Forward pass through the length regulator module.
- Parameters:
- x (Tensor) – Input tensor (B, dim, T).
- duration (Tensor) – Duration tensor (B, T).
- use_state_info (bool , optional) – Whether to use position information or not.
- Returns: Output tensor (B, dim, D_frame). Tensor: Output length (B,).
- Return type: Tensor