Skip to content

Commit

Permalink
Fix supersimplenet's SSNLoss device issue
Browse files Browse the repository at this point in the history
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
  • Loading branch information
samet-akcay committed Jan 8, 2025
1 parent afecf6e commit 76dd186
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/anomalib/models/image/supersimplenet/loss.py
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ def trunc_l1_loss(self, pred: torch.Tensor, target: torch.Tensor) -> torch.Tenso
# push anomalous towards positive numbers
fake_loss = torch.clip(-anomalous_scores + self.th, min=0)

true_loss = true_loss.mean() if len(true_loss) else torch.Tensor(0)
fake_loss = fake_loss.mean() if len(fake_loss) else torch.Tensor(0)
true_loss = true_loss.mean() if len(true_loss) else torch.tensor(0)
fake_loss = fake_loss.mean() if len(fake_loss) else torch.tensor(0)

return true_loss + fake_loss

0 comments on commit 76dd186

Please sign in to comment.