lava icon indicating copy to clipboard operation
lava copied to clipboard

Conv ProcessModels Ignore weight_exp Parameter

Open Gavinator98 opened this issue 2 years ago • 1 comments

Describe the bug The conv process specifies a weight_exp parameter to scale the weights by a power of 2, similar to the dense process. The NcProcessModel (and seemingly all of the other Conv process models) do not utilize this weight_exp.

To reproduce current behavior

Specify a weight_exp

Conv(weight=np.ones((3, 1, 1, 3)), weight_exp=4)

Expected behavior Weights are scaled by weight_exp when applied.

Environment (please complete the following information):

  • Device: Intel Cloud
  • OS: Linux
  • Lava version 0.8.0
  • Lava for Loihi version 0.5.0

Gavinator98 avatar Oct 24 '23 00:10 Gavinator98

One alternative to having a weight_exp parameter in the Process could be to have the optimize_weight_bits take in floating point inputs and let it compute the weight_exp automatically. This line: https://github.com/lava-nc/lava/blob/f7796e7571204b89f59ab4b61774942a736fbc99/src/lava/utils/weightutils.py#L80 would need to be changed to something like:

weights = np.round(weights * 2**(-weight_exp)).astype(np.int32)

to prevent the weights from being unnecessarily truncated.

Gavinator98 avatar Oct 24 '23 21:10 Gavinator98