Feat (export/onnx): fallback export to fake quantized weights#1395
Merged
nickfraser merged 5 commits intoXilinx:devfrom Oct 24, 2025
Merged
Feat (export/onnx): fallback export to fake quantized weights#1395nickfraser merged 5 commits intoXilinx:devfrom
nickfraser merged 5 commits intoXilinx:devfrom
Conversation
nickfraser
approved these changes
Oct 17, 2025
Collaborator
nickfraser
left a comment
There was a problem hiding this comment.
One comment about a duplicated function, otherwise LGTM!
Collaborator
|
FYI, the FINN integration issues are likely fixed in #1400 |
9555e11 to
7e92477
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for this PR
ONNX's QuantizeLinear node only supports ROUND as rounding function, but there are cases where we might be using FLOOR.
Changes Made in this PR
This PR addresses this issue by falling back to saving and exporting fake quantized weights.
With this trick, we use whatever interal rounding operation to pre-quantize the weights, so that round is basically a no-op during export time.
The drawback of this approach is that we effectively duplicate weights during export.
This could be remedied for example by destructively replacing the original weights with the fake quantized ones, with the obvious drawback that we lose access to the original model's weights.
Testing Summary
Added tests with floor rounding format for weights.
This effectively double the testing configurations and the testing time.