Merge pull request #1500 from nguyenhoan1988/main

Remove inplace operators when calculating the loss
pull/1502/head
Ross Wightman 2 years ago committed by GitHub
commit 8a1ba67a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,7 +85,7 @@ class AsymmetricLossSingleLabel(nn.Module):
log_preds = log_preds * asymmetric_w
if self.eps > 0: # label smoothing
self.targets_classes.mul_(1 - self.eps).add_(self.eps / num_classes)
self.targets_classes = self.targets_classes.mul(1 - self.eps).add(self.eps / num_classes)
# loss calculation
loss = - self.targets_classes.mul(log_preds)

Loading…
Cancel
Save