Skip to content

[ONNX][#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear - #9028

Merged
masahi merged 5 commits into
apache:mainfrom
arangasa:8838.QLinearSigmoid
Sep 17, 2021
Merged

[ONNX][#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear#9028
masahi merged 5 commits into
apache:mainfrom
arangasa:8838.QLinearSigmoid

Conversation

@arangasa

Copy link
Copy Markdown
Contributor

This PR implements com.microsoft.QLinearSigmoid (tracked here). This is implemented as dequantize->sigmoid->quantize for now.

This also fixes an issue with DequantizeLinear for tensors with rank=1. The current default axis of 1 for _impl_v13 leads to failures with rank=1 tensors. A new test is added for an existing op (QLinearMul) for this case.

@tmoreau89

Copy link
Copy Markdown
Contributor

@tmoreau89 tmoreau89 self-assigned this Sep 16, 2021

@mbrookhart mbrookhart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the bugfix with DequantizeLinear isn't quite correct, but the QLinearSigmoid stuff looks great! Thank you.

Comment thread python/tvm/relay/frontend/onnx.py Outdated

@AndrewZhaoLuo AndrewZhaoLuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@anwang2009 anwang2009 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm!

Comment thread python/tvm/relay/frontend/onnx.py Outdated
## and then requantize after:
## https://github.com/microsoft/onnxruntime/blob/master/onnxruntime/core/
## providers/dml/DmlExecutionProvider/src/GraphTransformer.cpp#L245
x = _qnn.op.dequantize(inputs[0], x_scale, x_zero_point)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
x = _qnn.op.dequantize(inputs[0], x_scale, x_zero_point)
x = _qnn.op.dequantize(x, x_scale, x_zero_point)

@mbrookhart

Copy link
Copy Markdown
Contributor

The de-quantize change did cause those tests to fail in CI. I think we need a better solution there, but otherwise, it looks good.

@arangasa

arangasa commented Sep 17, 2021

Copy link
Copy Markdown
Contributor Author

The de-quantize change did cause those tests to fail in CI. I think we need a better solution there, but otherwise, it looks good.

Thank you, @mbrookhart , @anwang2009 , @masahi , @AndrewZhaoLuo for reviewing, catching the issue with this change, and for suggesting a solution. Updated the PR to address your comments.

@masahi masahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mbrookhart mbrookhart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks!

@masahi
masahi merged commit a65bf34 into apache:main Sep 17, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
…izeLinear (apache#9028)

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…izeLinear (apache#9028)

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear

* [ONNX][apache#8838] QLinearSigmoid contrib op and Bug Fix for DequantizeLinear
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.

6 participants