Jovan Mitrevski
Jovan Mitrevski
Should we discuss @vloncar's suggestion? It seems like there is quite a bit of interest in this PR so it will be good to get it in.
This was merged on the Vivado side but not on the Quartus side. Leaving it open till it's fixed there.
I agree about moving the logic to an optimizer pass, but that would be for all the quantizers, not just for quantized tanh and sigmoid. Basically all QKeras info is...
Let me do a few more tests first, then I'll push to a local branch.
The issue that we are seeing is that the hls4ml sigmoid really seems to approximate `1/1+exp(-x)`, but the QKeras one is quite different in a way I don't currently understand.
So qkeras uses the hard sigmoid by default: https://github.com/google/qkeras/blob/master/qkeras/quantizers.py#L192-L237 I have to see if hls4ml implements it; otherwise, it's easy to do: `clip(0.5 * x + 0.5, 0.0, 1.0)`.
This resulted in more changes than I expected. Please take a look to see if this is reasonable.
I am not sure how the matplotlib import came into this pull request. It should not be there. I will fix that.
Merged in master to fix pytest setup. Not sure why the tests aren't starting, though.
I pushed the changes to pr/569