Skip to content

Commit

Permalink
fix bug when rounding weights (lava-nc#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidel-p committed May 8, 2023
1 parent 552387a commit 0650613
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lava/utils/weightutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def truncate_weights(weights: ty.Union[np.ndarray, spmatrix],
weights = (weights >> num_truncate_bits) << num_truncate_bits
elif isinstance(weights, spmatrix):
weights.data = (weights.data >> num_truncate_bits) << num_truncate_bits
weights.eliminate_zeros()

if sign_mode == SignMode.INHIBITORY:
weights = -weights
Expand Down

0 comments on commit 0650613

Please sign in to comment.