espnet2.gan_svs.pits.ying_decoder.YingDecoder
espnet2.gan_svs.pits.ying_decoder.YingDecoder
class espnet2.gan_svs.pits.ying_decoder.YingDecoder(hidden_channels, kernel_size, dilation_rate, n_layers, yin_start, yin_scope, yin_shift_range, gin_channels=0)
Bases: Module
Ying decoder module.
Initialize the YingDecoder module.
- Parameters:
- hidden_channels (int) – Number of hidden channels.
- kernel_size (int) – Size of the convolutional kernel.
- dilation_rate (int) – Dilation rate of the convolutional layers.
- n_layers (int) – Number of convolutional layers.
- yin_start (int) – Start point of the yin target signal.
- yin_scope (int) – Scope of the yin target signal.
- yin_shift_range (int) – Maximum number of frames to shift the yin target signal.
- gin_channels (int , optional) – Number of global conditioning channels. Defaults to 0.
crop_scope(x, yin_start, scope_shift)
Crop the input tensor.
- Parameters:
- x (torch.Tensor) – Input tensor of shape [B, C, T].
- yin_start (int) – Starting point of the yin target signal.
- scope_shift (torch.Tensor) – Shift tensor of shape [B].
- Returns: Cropped tensor of shape [B, C, yin_scope].
- Return type: torch.Tensor
forward(z_yin, yin_gt, z_mask, g=None)
Forward pass of the decoder.
Parameters:
- z_yin (torch.Tensor) – The input yin note sequence of shape (B, C, T_yin).
- yin_gt (torch.Tensor) – The ground truth yin note sequence of shape (B, C, T_yin).
- z_mask (torch.Tensor) – The mask tensor of shape (B, 1, T_yin).
- g (torch.Tensor) – The global conditioning tensor.
Returns: The predicted yin note sequence of shape (B, C, T_yin). torch.Tensor: The shifted ground truth yin note sequence of shape
(B, C, T_yin).
torch.Tensor: The cropped ground truth yin note sequence of shape : (B, C, T_yin).
torch.Tensor: The cropped input yin note sequence of shape (B, C, T_yin). torch.Tensor: The scope shift tensor of shape (B,).
Return type: torch.Tensor
infer(z_yin, z_mask, g=None)
Generate yin prediction.
- Parameters:
- z_yin (torch.Tensor) – Input yin target tensor of shape [B, yin_scope, C].
- z_mask (torch.Tensor) – Input mask tensor of shape [B, yin_scope, 1].
- g (torch.Tensor , optional) – Global conditioning tensor of shape [B, gin_channels, 1]. Defaults to None.
- Returns: Predicted yin tensor of shape [B, yin_scope, C].
- Return type: torch.Tensor