espnet.nets.pytorch_backend.e2e_tts_tacotron2.Tacotron2Loss
Less than 1 minute
espnet.nets.pytorch_backend.e2e_tts_tacotron2.Tacotron2Loss
class espnet.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