-
Notifications
You must be signed in to change notification settings - Fork 451
Fix the axis of inserted QDQ for ConvTranspose #2134
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
Merged
fatcat-z
merged 2 commits into
onnx:main
from
sdua-nv:dev-sdua-fix-contranspose-qdq-axis
Mar 15, 2023
Merged
Fix the axis of inserted QDQ for ConvTranspose #2134
fatcat-z
merged 2 commits into
onnx:main
from
sdua-nv:dev-sdua-fix-contranspose-qdq-axis
Mar 15, 2023
Conversation
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
a25de24
to
a78e1d2
Compare
The unit_test CI failure was not caused by your change, will fix it soon. |
fatcat-z
reviewed
Mar 13, 2023
fatcat-z
reviewed
Mar 13, 2023
fatcat-z
reviewed
Mar 13, 2023
fatcat-z
reviewed
Mar 13, 2023
fatcat-z
reviewed
Mar 13, 2023
fatcat-z
reviewed
Mar 13, 2023
ecbdc78
to
429ecb0
Compare
The quantization axis of QDQ nodes that are being inserted before the kernel weights of all Conv nodes is currently 0. This is incorrect; ConvTranspose requires axis=1. Signed-off-by: Sirej Dua <[email protected]>
429ecb0
to
e8413c7
Compare
fatcat-z
approved these changes
Mar 15, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contributions!
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.
Hi, I noticed a problem in the tf2onnx converter. This is regarding ConvTranspose converter (https://github.com/onnx/tensorflow-onnx/blob/main/tf2onnx/onnx_opset/nn.py#L428). When ConvTranspose is quantized, the converter should take a ConvTranspose layer and convert it as follows.
These Q_w/DQ_w nodes that are inserted have the wrong axis set when they are modified by the tf2onnx converter. For ConvTranspose, the axis should be set to 1. This is the number of filters, which is Cout. (The kernel shape here is Cin x Cout x kH x kW)
For Conv, the axis should be (and is correctly) set to 0. (The kernel shape here is Cout x Cin x kH x kW)
Instead, this axis is unconditionally set to 0 for all conv layers that use the
conv_convert_inputs()
routine.I've provided a fix in this PR. I had some trouble with the tests I added so I needed to add a mechanism to skip checking shapes in
Tf2OnnxBackendTestBase.run_test_case
; it seems that no other test setscheck_shape=False
so this shouldn't change the behavior of anything else.