Skip to content

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

Merged
masahi merged 4 commits into
apache:mainfrom
gayatripk1:leakyrelu_contrib_op
Oct 2, 2021
Merged

[ONNX] [#8838] QLinearLeakyRelu contrib op #9063
masahi merged 4 commits into
apache:mainfrom
gayatripk1:leakyrelu_contrib_op

Conversation

@gayatripk1

@gayatripk1 gayatripk1 commented Sep 21, 2021

Copy link
Copy Markdown
Contributor

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

@mbrookhart

Copy link
Copy Markdown
Contributor

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

@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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@gayatripk1

Copy link
Copy Markdown
Contributor Author

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

Done

@AndrewZhaoLuo

Copy link
Copy Markdown
Contributor

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

@gayatripk1

Copy link
Copy Markdown
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

masahi commented Oct 2, 2021

Copy link
Copy Markdown
Member

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.

4 participants