-
Notifications
You must be signed in to change notification settings - Fork 424
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
Generalize pooling accumulator inference #947
Conversation
Do we need a corresponding fix for Quartus? hls4ml/hls4ml/templates/quartus/firmware/nnet_utils/nnet_pooling.h Lines 38 to 74 in f41951c
|
pre-commit.ci autofix |
Currently, there is an Maybe we should converge on whether to set pooling accumulator size with |
Actually I think it also needs to be done for vitis (which has its own implementation) in addition to quartus. |
What did we decide to do about accum_t vs template matching? |
My general feeling is to prefer the #973 style solution, though implementation details may still need to be addressed. |
We decided to go with #973 so I will close this PR. |
Currently, pooling uses a wider data type for accumulation inferred based on the input type and the number of elements. However, we only implemented this for
ap_fixed<W,I>
andap_int<W>
and the template matching fails forap_uint<W>
andap_ufixed<W,I,Q,O>
andap_fixed<W,I,Q,O>
(ifQ
andO
are not the default values). This PR (hopefully) makes it so it matches all those additional types.Type of change
Tests
Example before this fix:
Example after this fix:
Checklist
pre-commit
on the files I edited or added.@Brainz22 @ddiaz006 @AnthonyAportela @danprim