From b142592c309a8ed55a2e4b1af9b5befbc36c3b07 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 5 May 2023 07:34:57 -0700 Subject: [PATCH] fix bug when rounding weights --- src/lava/utils/weightutils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lava/utils/weightutils.py b/src/lava/utils/weightutils.py index 009e7a29c..0230da93e 100644 --- a/src/lava/utils/weightutils.py +++ b/src/lava/utils/weightutils.py @@ -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