espnet2.legacy.nets.pytorch_backend.e2e_tts_tacotron2.Tacotron2Loss
Less than 1 minute
espnet2.legacy.nets.pytorch_backend.e2e_tts_tacotron2.Tacotron2Loss
class espnet2.legacy.nets.pytorch_backend.e2e_tts_tacotron2.Tacotron2Loss(use_masking=True, use_weighted_masking=False, bce_pos_weight=20.0)
Bases: Module
Loss function module for Tacotron2.
Initialize Tactoron2 loss module.
- Parameters:
- use_masking (bool) β Whether to apply masking for padded part in loss calculation.
- use_weighted_masking (bool) β Whether to apply weighted masking in loss calculation.
- bce_pos_weight (float) β Weight of positive sample of stop token.
forward(after_outs, before_outs, logits, ys, labels, olens)
Calculate forward propagation.
- Parameters:
- after_outs (Tensor) β Batch of outputs after postnets (B, Lmax, odim).
- before_outs (Tensor) β Batch of outputs before postnets (B, Lmax, odim).
- logits (Tensor) β Batch of stop logits (B, Lmax).
- ys (Tensor) β Batch of padded target features (B, Lmax, odim).
- labels (LongTensor) β Batch of the sequences of stop token labels (B, Lmax).
- olens (LongTensor) β Batch of the lengths of each target (B,).
- Returns: L1 loss value. Tensor: Mean square error loss value. Tensor: Binary cross entropy loss value.
- Return type: Tensor
