Skip to content

Bugfix: Add missing data type validations for QDQ ops#922

Merged
huningxin merged 1 commit intowebmachinelearning:mainfrom
huningxin:fix_dq
Mar 3, 2026
Merged

Bugfix: Add missing data type validations for QDQ ops#922
huningxin merged 1 commit intowebmachinelearning:mainfrom
huningxin:fix_dq

Conversation

@huningxin
Copy link
Contributor

@huningxin huningxin commented Mar 2, 2026

Validate zeroPoint's data type is the same as input's for dequantizeLinear.
Validate scale's data type is the same as input's for quantizeLinear.

Fix: #921


Preview | Diff

Validate zeroPoint's data type is the same as input's for dequantizeLinear.
Validate scale's data type is the same as input's for quantizeLinear.

Fix: webmachinelearning#921
@huningxin huningxin requested a review from fdwr March 2, 2026 02:34
@fdwr
Copy link
Collaborator

fdwr commented Mar 2, 2026

Was it not already covered by this step below? Anyway, tis fine to add explicitly to the steps.

If zeroPoint’s dataType is not one of its allowed data types (according to this table), then throw a TypeError.

image

Copy link
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@huningxin
Copy link
Contributor Author

@fdwr

Was it not already covered by this step below?

I suppose it was not covered.

If zeroPoint’s dataType is not one of its allowed data types (according to this table), then throw a TypeError.

For example, zeroPoint data type is int32 which is allowed, while input data type is int8 which is different from zeroPoint's.

@fdwr
Copy link
Collaborator

fdwr commented Mar 2, 2026

But if dequantizeLinear's input is int32, then according to the table, zero point must be int32 too ("same as input"). So the extra check is redundant If zeroPoint's MLOperand/dataType is not equal to input's MLOperand/dataType, then exception/throw a TypeError. Again though, I don't mind it being there for clarity - merge at will.

@huningxin huningxin requested a review from reillyeon March 2, 2026 23:56
@huningxin
Copy link
Contributor Author

@reillyeon , please take a look, this PR aligns spec steps with Chromium implementation, see details in #921.

@huningxin
Copy link
Contributor Author

@fdwr @reillyeon , thanks for the review and approvals. I am going to merge it.

@huningxin huningxin merged commit 32a1770 into webmachinelearning:main Mar 3, 2026
2 checks passed
github-actions bot added a commit that referenced this pull request Mar 3, 2026
SHA: 32a1770
Reason: push, by huningxin

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

dequantizeLinear algorithm steps should validate zeroPoint's data type is the same as input's

3 participants