Skip to content
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

Clarify default value of axis for DequantizeLinear when input rank is 1 #6067

Closed
mgehre-amd opened this issue Apr 3, 2024 · 1 comment · Fixed by #6095
Closed

Clarify default value of axis for DequantizeLinear when input rank is 1 #6067

mgehre-amd opened this issue Apr 3, 2024 · 1 comment · Fixed by #6095
Labels
contributions welcome question Questions about ONNX spec clarification Clarification of the ONNX spec needed

Comments

@mgehre-amd
Copy link

Ask a Question

Question

DequantizeLinear says both that

  • the default value of axis is 1
  • and that for axis, the accepted range is [-r, r-1] where r = rank(input).

What happens when the rank of the input is 1 and axis is not specified?
According to the spec, this seems to be illegal.
onnxruntime successfully executes such models.

@mgehre-amd mgehre-amd added the question Questions about ONNX label Apr 3, 2024
@gramalingam
Copy link
Contributor

Good question! It is a bit mystifying. Looking at the rest of the spec., my interpretation is that axis is a relevant attribute only when not doing a per-tensor quantization (that is, when doing a per-axis or blocked-quantization). And that rank of the x_scale input is being used to determine if it is per-tensor quantization or not. And that the default-value of axis applies only if it is not per-tensor quantization.

It would be great to improve the documentation, but the behavior seems reasonable (with some minor tradeoff to having a default-value ... it might have been better not to have a default-value and produced a warning message if the attribute is specified for per-tensor quantization).

@justinchuby justinchuby added spec clarification Clarification of the ONNX spec needed contributions welcome labels Apr 5, 2024
@justinchuby justinchuby changed the title Default value of axis for DequantizeLinear when input rank is 1 Clarify default value of axis for DequantizeLinear when input rank is 1 Apr 5, 2024
github-merge-queue bot pushed a commit that referenced this issue May 6, 2024
### Description

Close #6067

Signed-off-by: isdanni <leedanni@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome question Questions about ONNX spec clarification Clarification of the ONNX spec needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants