espnet2.gan_tts.hifigan.loss.GeneratorAdversarialLoss
Less than 1 minute
espnet2.gan_tts.hifigan.loss.GeneratorAdversarialLoss
class espnet2.gan_tts.hifigan.loss.GeneratorAdversarialLoss(average_by_discriminators: bool = True, loss_type: str = 'mse')
Bases: Module
Generator adversarial loss module.
Initialize GeneratorAversarialLoss module.
- Parameters:
- average_by_discriminators (bool) – Whether to average the loss by the number of discriminators.
- loss_type (str) – Loss type, “mse” or “hinge”.
forward(outputs: List[List[Tensor]] | List[Tensor] | Tensor) → Tensor
Calcualate generator adversarial loss.
- Parameters:outputs (Union *[*List *[*List *[*Tensor ] ] , List *[*Tensor ] , Tensor ]) – Discriminator outputs, list of discriminator outputs, or list of list of discriminator outputs..
- Returns: Generator adversarial loss value.
- Return type: Tensor