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

[ONNX] [#8838] QLinearLeakyRelu contrib op #9063

Merged
merged 4 commits into from
Oct 2, 2021

Conversation

gayatripk1
Copy link
Contributor

@gayatripk1 gayatripk1 commented Sep 21, 2021

This PR implements com.microsoft.QLinearLeakyRelu. This is implemented as dequantize->LeakyRelu->quantize for now.

@mbrookhart
Copy link
Contributor

You hit a known issue with CI's lint that was just fixed, rebase?

Copy link
Contributor

@mbrookhart mbrookhart left a comment

Choose a reason for hiding this comment

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

Minor request for documentation, otherwise looks good, thanks!

Comment on lines +3447 to +3452
a = _qnn.op.dequantize(inputs[0], a_scale, a_zero_point)
out = _op.nn.leaky_relu(a, alpha)
return _qnn.op.quantize(out, y_scale, y_zero_point, out_dtype=dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're dequantinzing, can you provide a link to ORT doing the same thing? if this is an ORT op and they're running it in int8, I'd prefer to import it in int8 here?f

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the ORT op definition from docs

Copy link
Contributor

Choose a reason for hiding this comment

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

If alpha is a power of two e.g. 1 / 16 or 1 / 8, then we can implement this via bit shift operations assuming zero can be represented in the quantization scheme. Not making a suggestion or anything, just thought it was an interesting point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be an interesting point to try out. Here, we wanted to reuse the existing function.

@AndrewZhaoLuo
Copy link
Contributor

@gayatripk1 can you jostle CI via an empty commit e.g. git commit -m 'jostle ci' --allow-empty

@gayatripk1
Copy link
Contributor Author

@gayatripk1 can you jostle CI via an empty commit e.g. git commit -m 'jostle ci' --allow-empty

Done

@AndrewZhaoLuo
Copy link
Contributor

@gayatripk1 think you need to jostle ci once more. Ci is a little flaky :/

@gayatripk1
Copy link
Contributor Author

@gayatripk1 think you need to jostle ci once more. Ci is a little flaky :/

Done

@masahi masahi merged commit 89e7b6f into apache:main Oct 2, 2021
@masahi
Copy link
Member

masahi commented Oct 2, 2021

thanks @gayatripk1

ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [ONNX] QLinearLeakyRelu contrib op

* Add comment

* jostle ci

* jostle ci
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [ONNX] QLinearLeakyRelu contrib op

* Add comment

* jostle ci

* jostle ci
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.

None yet

4 participants