Skip to content
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

Fix for QActivations passed as an argument #553

Merged

Conversation

AdrianAlan
Copy link
Contributor

Fix for QKeras layers with QActivations passed as an argument.

Right now these models fail to compile with TypeError in the keras_to_hls method as the method expects the layer['activation'] to be a string, not a dict.

@thesps
Copy link
Contributor

thesps commented May 23, 2022

Thanks for this! Could you adapt the test to do some check on the output more than just compilation? I would suggest testing this functionality in existing test_keras_api.py, following the pattern of constructing a model, compiling, running prediction with some random inputs, checking the output Keras vs hls4ml, and doing some explicit checking that the converted model makes sense (ie here that the activation is what you expect).

1 similar comment
@thesps
Copy link
Contributor

thesps commented May 23, 2022

Thanks for this! Could you adapt the test to do some check on the output more than just compilation? I would suggest testing this functionality in existing test_keras_api.py, following the pattern of constructing a model, compiling, running prediction with some random inputs, checking the output Keras vs hls4ml, and doing some explicit checking that the converted model makes sense (ie here that the activation is what you expect).

@AdrianAlan
Copy link
Contributor Author

I moved it to test_qkeras.py, I thought it may belong there, rather than test_keras_api.py. Let me know if you have some other quantizers in mind. BTW, it solves #248

@thesps thesps merged commit d5c88b7 into fastmachinelearning:master Jun 7, 2022
calad0i pushed a commit to calad0i/hls4ml that referenced this pull request Jul 1, 2023
* Fix handling of QKeras activations passed as an argument

* Add a test for QKeras activations passed as an argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants