fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.19k stars 390 forks source link

add a default weight_size #772

Closed jmitrevs closed 1 year ago

jmitrevs commented 1 year ago

Description

It's possible to read the variable before writing. This sets a default value

Type of change

Tests

Standard tests should be enough

Checklist

jmitrevs commented 1 year ago

I believe an error was triggered with batch norms in Quartus, with weight_size being undefined. This fix treats BatchNorm weights as being small, which might not be the best fix in all cases. Nevertheless, we should not read a variable without making sure that each possible branch has it defined.

vloncar commented 1 year ago

0.7.0?

jmitrevs commented 1 year ago

I think so. It's a 1-line change, which prevents a crash.