-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Reference implementation of ONNX Reduce sum square is mismatch with ONNX Spec when noop_with_empty_axes == 1 #6103
Comments
The expected behavior is mentioned here as well. |
Absolutely. Contributions are welcome and appreciated |
This is complicated. Agree that there is a mismatch, but is the bug in the specification or implementation? My personal interpretation is that this is a bug in the specification, not implementation, for the following reason: the attributes serve to define the set of axes being reduced: specifically, it is a flag to allow the empty list to indicate that all axes must be reduced (or that no axes must be reduced). Now, even if zero axes are reduced, it makes sense to compute the square. ReduceSumSquare is not actually a reduction-op: it is a reduction-op Sum applied to the square of the input. I think the bug was in reusing the ReduceSum documentation for all ops ... it is correct for basic Reduction ops, but not ReduceSumSquare. Of course, we can test with other backends/implementations (like onnxruntime, or even pytorch/tensorflow etc. IF they have such an option). |
### Description This PR aligns the op implementation for `ReduceSumSquare18` when `axes` are not specified and `noop_with_empty_axes != 0` with that of the reference. ### Motivation and Context Current implementation of `ReduceSumSquare18` when axes are empty and `noop_with_empty_axes != 1` squares the input data and then returns it, when according to the reference it should just return the input data with no changes. This addresses issue #6103 Signed-off-by: Aman K Shihab <amanshihab276@gmail.com>
### Description This PR aligns the op implementation for `ReduceSumSquare18` when `axes` are not specified and `noop_with_empty_axes != 0` with that of the reference. ### Motivation and Context Current implementation of `ReduceSumSquare18` when axes are empty and `noop_with_empty_axes != 1` squares the input data and then returns it, when according to the reference it should just return the input data with no changes. This addresses issue onnx#6103 Signed-off-by: Aman K Shihab <amanshihab276@gmail.com> Signed-off-by: isdanni <leedanni@gmail.com>
…#6125) Reverts onnx#6121 onnx#6103 cc @xadupre @gramalingam Signed-off-by: isdanni <leedanni@gmail.com>
Following the discussion, I think it's reasonable to correct the spec. Out of curiosity, was there any reason you would expect the behavior to be different than the current one @RunnerZhong ? |
I agree with below idea. So maybe we need to modify the spec of ops like ReduceSumSquare(ReduceLogSum, ReduceLogSumExp).
|
Bug Report
Is the issue related to model conversion?
No
Describe the bug
When noop_with_empty_axes == 1 & axes is empty, in ONNX spec, it will return input tensor directly.
But in reference in onnx, it is mismatch. it returned np.square of the input tensor
System information
Reproduction instructions
Expected behavior
return input tensor directly
Notes
The text was updated successfully, but these errors were encountered: