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

[Relay][Frontend][ONNX] Add ConvInteger support. #8456

Merged
merged 5 commits into from
Jul 14, 2021

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Jul 12, 2021

While playing with onnxruntime's quantization tools I found that ConvInteger nodes were heavily used and pretty easy to map to qnn.conv2d. This PR adds support for that op.

@jwfromm
Copy link
Contributor Author

jwfromm commented Jul 12, 2021

@mbrookhart @AndrewZhaoLuo can you guys take a look at this PR?

@mbrookhart
Copy link
Contributor

@jwfromm I have some of the same changes for conv_transpose in #8304 . Unfortunately, the version of onnxrutnime in CI doesn't support this properly, so we need to wait until we can update the ORT version. Perhaps we can pull the conv transpose parts out of this PR and just focus on Conv Integer?

@mbrookhart
Copy link
Contributor

I'm having trouble getting the docker images in CI updated due to a TF update.

@jwfromm
Copy link
Contributor Author

jwfromm commented Jul 13, 2021

@mbrookhart that makes sense, I've removed all changes to convtranspose from this PR.

@jwfromm jwfromm changed the title [Relay][Frontend][ONNX] Add ConvInteger support and fix some ConvTranspose padding bugs. [Relay][Frontend][ONNX] Add ConvInteger support. Jul 13, 2021
out_channels = kernel_shape[0]
dilation = attr.get("dilations", [1] * (ndim - 2))
strides = attr.get("strides", [1] * (ndim - 2))
padding = attr["pads"] if "pads" in attr else 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we throw if both pads and auto_pad are present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, this is the same logic used in all other convolutions though (where we overwrite pads with auto_padding if both are present). I personally think that defaulting to auto_pad if present is reasonable behavior but am open to other takes. @mbrookhart what do you think?

Copy link
Contributor

@AndrewZhaoLuo AndrewZhaoLuo Jul 13, 2021

Choose a reason for hiding this comment

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

Thought about it a bit more. So the onnx spec has it so you cannot have both. I think it's safe to assume the converter will only hit well formed onnx models so I think this current behavior is fine.

@mbrookhart
Copy link
Contributor

Thanks @jwfromm @AndrewZhaoLuo

@mbrookhart mbrookhart merged commit e1b3ff4 into apache:main Jul 14, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* Add ConvInteger support and fix some ConvTranspose padding bugs.

* Simplify pads check.

* Fix style.

* Remove changes to conv_transpose.
zxy844288792 pushed a commit to zxy844288792/tvm that referenced this pull request Mar 4, 2022
* Add ConvInteger support and fix some ConvTranspose padding bugs.

* Simplify pads check.

* Fix style.

* Remove changes to conv_transpose.
@jwfromm jwfromm deleted the onnx_convinteger branch April 12, 2023 15:55
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.

3 participants