Skip to content

Commit

Permalink
Fix wrong loss
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorSusmelj committed Sep 16, 2023
1 parent eb1b784 commit e8c5d7d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lightly/loss/tico_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def forward(

# compute loss
C = self.beta * self.C + (1 - self.beta) * B
loss = (
1
- (z_a * z_b).sum(dim=1).mean()
+ self.rho * (torch.mm(z_a, C) * z_a).sum(dim=1).mean()
)

transformative_invariance_loss = -(z_a * z_b).sum(dim=1).mean()
covariance_contrast_loss = self.rho * (torch.mm(z_a, C) * z_a).sum(dim=1).mean()

loss = transformative_invariance_loss + covariance_contrast_loss

# update covariance matrix
if update_covariance_matrix:
Expand Down

0 comments on commit e8c5d7d

Please sign in to comment.