-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic type inference for param_t
in Parametrised Activations
#1139
base: main
Are you sure you want to change the base?
Conversation
I see some tests related to oneAPI fails; it's hard to me to understand why they fail, how should I proceed? |
If you have a linux setup it should be pretty straightforward to install oneAPI, and then you can run the pytest. But we can wait to look at the other issues first. Maybe it will clear itself. |
@@ -1,4 +1,5 @@ | |||
import math | |||
import struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Struct is much too low level for what we are doing here. We have a python float. We should use it, not look at the bits.
inferred_types.append('param_t') | ||
def get_man_exp(f): | ||
f = np.abs(f) | ||
s = struct.pack('>f', f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use calculations: based on the value, you can easily determine how many bits you need. Going to structs is hard to follow.
Note the utility we have in hls4ml already: |
I wanted to try to install oneAPI myself, so I played with this PR a bit. The issue seems to be that the precision for the parameter of the leaky ReLU is reduced significantly, from
So we need to make sure to take this into account when inferring the precision for the parameters. |
This small PR implement the inference of W and I parameter for a given floating point constant. It is exploited in parametrised activations
Type of change
Tests
I run some tests related to Parametrised Activations, already present in the pytests of hls4ml.
Checklist
pre-commit
on the files I edited or added.