Skip to content

Fix output spec adjustment for fixed qparams ops#22

Open
crowbat wants to merge 1 commit into
apple:mainfrom
crowbat:u/k_hsieh/fix_ranges_for_fixed_qparam_ops
Open

Fix output spec adjustment for fixed qparams ops#22
crowbat wants to merge 1 commit into
apple:mainfrom
crowbat:u/k_hsieh/fix_ranges_for_fixed_qparam_ops

Conversation

@crowbat

@crowbat crowbat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the output qspec adjustment behavior for ops with known ranges like relu, relu6, sigmoid, tanh, etc.
Previously the code did not properly perform the adjustment. Qscheme was not being set correctly, and no fixed ranges were ever in place.

This PR handles correctly setting the qscheme and float range as applicable for each op.
Refactoring was also done to remove the independent qscheme attribute of fake quantize, instead having it read directly from its qparams_calculator.qscheme instead.

Note: the mnist test accuracy expectation post-prepare was updated from < 88% to < 94%. I checked that this large difference was due only to the hardtanh output quantizers now being set to asymmetric with float range (0.0, 1.0).

@crowbat crowbat force-pushed the u/k_hsieh/fix_ranges_for_fixed_qparam_ops branch from 3fac694 to 462226c Compare July 1, 2026 16:21
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.

3 participants