espnet.nets.pytorch_backend.fastspeech.duration_predictor.DurationPredictorLoss
Less than 1 minute
espnet.nets.pytorch_backend.fastspeech.duration_predictor.DurationPredictorLoss
class espnet.nets.pytorch_backend.fastspeech.duration_predictor.DurationPredictorLoss(offset=1.0, reduction='mean')
Bases: Module
Loss function module for duration predictor.
The loss value is Calculated in log domain to make it Gaussian.
Initilize duration predictor loss module.
- Parameters:
- offset (float , optional) – Offset value to avoid nan in log domain.
- reduction (str) – Reduction type in loss calculation.
forward(outputs, targets)
Calculate forward propagation.
- Parameters:
- outputs (Tensor) – Batch of prediction durations in log domain (B, T)
- targets (LongTensor) – Batch of groundtruth durations in linear domain (B, T)
- Returns: Mean squared error loss value.
- Return type: Tensor
NOTE
outputs is in log domain but targets is in linear domain.