Skip to content

Commit

Permalink
Fixed SET negativity pruning. See #19.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDettmers committed Sep 11, 2020
1 parent 6b97851 commit f99c2f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sparselearning/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def magnitude_and_negativity_prune(masking, mask, weight, name):

# remove the most negative weights
x, idx = torch.sort(weight.data.view(-1))
mask.data.view(-1)[idx[:math.ceil(num_remove/2.0)]] = 0.0
mask.data.view(-1)[idx[math.ceil(num_remove/2.0):]] = 0.0

return mask

Expand Down

0 comments on commit f99c2f2

Please sign in to comment.