Skip to content

Conversation

@BruceDai
Copy link
Contributor

@BruceDai BruceDai commented Nov 25, 2025

This is a Spec change PR for #879 where we're discussing about the lack of widespread support for the current negative scale of dequantizeLinear and quantizeLinear across all backend.

@fdwr @reillyeon @huningxin PTAL, thanks!


Preview | Diff

index.bs Outdated
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}.
1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}.
1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}.
1. If |scale|'s values contain non-positive values, then [=exception/throw=] a {{TypeError}}.
Copy link
Contributor

Choose a reason for hiding this comment

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

given scale is an MLOperand, not sure if we can synchronously throw a TypeError, . Is it ok to say if the scale contains non-positive values, it's implementation dependent on how the error is handled?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, the spec should just say they are unsupported in prose. We can't actually validate this until runtime.

Copy link
Member

Choose a reason for hiding this comment

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

...unless we introduce the concept of an MLOperand parameter that must be a build-time constant.

Copy link
Collaborator

@fdwr fdwr Nov 25, 2025

Choose a reason for hiding this comment

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

unless we introduce the concept of an MLOperand parameter that must be a build-time constant

There still remain dynamic cases when these inputs can be computed from another operator's output, but a constant property in the MLOperand may be informative for optimization purposes - for some precedent, there's already the isConstant slot and constant property getter from CreateConstantTensor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your reviewing! I've updated these descriptions in new commit, please take another look! ☕

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's implementation dependent on how the error is handled

@philloooo: 👀I see one existing case with argMin/argMax, "In case of ties, the identity of the return value is implementation dependent". So we could update the current text "Values must be positive and nonzero" to something more like "Values must be positive and nonzero, or else results are implementation dependent"?

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.

👀

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.

👍 LGTM after 2 comments.

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.

4 participants