espnet2.gan_tts.hifigan.loss.FeatureMatchLoss
Less than 1 minute
espnet2.gan_tts.hifigan.loss.FeatureMatchLoss
class espnet2.gan_tts.hifigan.loss.FeatureMatchLoss(average_by_layers: bool = True, average_by_discriminators: bool = True, include_final_outputs: bool = False)
Bases: Module
Feature matching loss module.
Initialize FeatureMatchLoss module.
- Parameters:
- average_by_layers (bool) – Whether to average the loss by the number of layers.
- average_by_discriminators (bool) – Whether to average the loss by the number of discriminators.
- include_final_outputs (bool) – Whether to include the final output of each discriminator for loss calculation.
forward(feats_hat: List[List[Tensor]] | List[Tensor], feats: List[List[Tensor]] | List[Tensor]) → Tensor
Calculate feature matching loss.
- Parameters:
- feats_hat (Union *[*List *[*List *[*Tensor ] ] , List *[*Tensor ] ]) – List of list of discriminator outputs or list of discriminator outputs calcuated from generator’s outputs.
- feats (Union *[*List *[*List *[*Tensor ] ] , List *[*Tensor ] ]) – List of list of discriminator outputs or list of discriminator outputs calcuated from groundtruth..
- Returns: Feature matching loss value.
- Return type: Tensor