Skip to content

Commit

Permalink
Update iwan.py to fix thuml#201
Browse files Browse the repository at this point in the history
  • Loading branch information
thucbx99 committed Nov 27, 2023
1 parent b308c0f commit dcb6fd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tllib/reweight/iwan.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_importance_weight(self, feature):
instance weight in shape :math:`(N, 1)`
"""
weight = 1. - self.discriminator(feature)
weight = weight / weight.mean()
weight = weight / (weight.mean() + 1e-5)
weight = weight.detach()
return weight

Expand Down

0 comments on commit dcb6fd9

Please sign in to comment.