Univnet loss
UnivnetLoss
Bases: Module
UnivnetLoss is a PyTorch Module that calculates the generator and discriminator losses for Univnet.
Source code in training/loss/univnet_loss.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
__init__()
Initializes the UnivnetLoss module.
Source code in training/loss/univnet_loss.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
forward(audio, fake_audio, res_fake, period_fake, res_real, period_real)
Calculate the losses for the generator and discriminator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
audio |
Tensor
|
The real audio samples. |
required |
fake_audio |
Tensor
|
The generated audio samples. |
required |
res_fake |
List[Tuple[Tensor, Tensor]]
|
The discriminator's output for the fake audio. |
required |
period_fake |
List[Tuple[Tensor, Tensor]]
|
The discriminator's output for the fake audio in the period. |
required |
res_real |
List[Tuple[Tensor, Tensor]]
|
The discriminator's output for the real audio. |
required |
period_real |
List[Tuple[Tensor, Tensor]]
|
The discriminator's output for the real audio in the period. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
Tuple[Tensor, Tensor, Tensor, Tensor, Tensor, Tensor]
|
A tuple containing the univnet loss, discriminator loss, STFT loss, score loss, ESR, SISDR, SNR and SDSDR losses. |
Source code in training/loss/univnet_loss.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|