Skip to content

Commit

Permalink
use torch for AngleProtoLoss
Browse files Browse the repository at this point in the history
  • Loading branch information
erogol committed Mar 30, 2021
1 parent 2b3e12e commit 892c3c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TTS/speaker_encoder/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ def forward(self, x):
cos_sim_matrix = F.cosine_similarity(out_positive.unsqueeze(-1).expand(-1, -1, num_speakers), out_anchor.unsqueeze(-1).expand(-1, -1, num_speakers).transpose(0, 2))
torch.clamp(self.w, 1e-6)
cos_sim_matrix = cos_sim_matrix * self.w + self.b
label = torch.from_numpy(np.asarray(range(0, num_speakers))).to(cos_sim_matrix.device)
label = torch.arange(num_speakers).to(cos_sim_matrix.device)
L = self.criterion(cos_sim_matrix, label)
return L

0 comments on commit 892c3c3

Please sign in to comment.