You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/05/08 07:44:06 UTC

[GitHub] [tvm] huochaitiantang opened a new pull request #8007: [ONNX] QLinearConv Support

huochaitiantang opened a new pull request #8007:
URL: https://github.com/apache/tvm/pull/8007


   Thanks for contributing to TVM!   Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] huochaitiantang commented on pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
huochaitiantang commented on pull request #8007:
URL: https://github.com/apache/tvm/pull/8007#issuecomment-839378881


   @mbrookhart, thanks! The idea looks good, it could solve the issue!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart commented on pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on pull request #8007:
URL: https://github.com/apache/tvm/pull/8007#issuecomment-838852619


   Hmm, what do you think about checking to see if the scale is constant, and if it's not, doing dequantize -> quantize instead of requantize?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart commented on pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on pull request #8007:
URL: https://github.com/apache/tvm/pull/8007#issuecomment-840657758


   Thanks @huochaitiantang !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart commented on a change in pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
mbrookhart commented on a change in pull request #8007:
URL: https://github.com/apache/tvm/pull/8007#discussion_r629558634



##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -4217,6 +4228,8 @@ def verify_cumsum(indata, axis, exclusive=0, reverse=0, type="float32"):
     "test_maxpool_with_argmax_2d_precomputed_strides/",
     "test_maxunpool_export_with_output_shape/",
     "test_mvn/",
+    # For QLinearConv tests in ONNX, scale and zero_point input are placeholders,
+    # but qnn.conv2d requires scale and zero_point input to be scalar

Review comment:
       Can you explain this comment more?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] huochaitiantang commented on a change in pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
huochaitiantang commented on a change in pull request #8007:
URL: https://github.com/apache/tvm/pull/8007#discussion_r629828874



##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -4217,6 +4228,8 @@ def verify_cumsum(indata, axis, exclusive=0, reverse=0, type="float32"):
     "test_maxpool_with_argmax_2d_precomputed_strides/",
     "test_maxunpool_export_with_output_shape/",
     "test_mvn/",
+    # For QLinearConv tests in ONNX, scale and zero_point input are placeholders,
+    # but qnn.conv2d requires scale and zero_point input to be scalar

Review comment:
       I have tried to work around this issue but failed. For ONNX test model of QLinearConv, y_scale is input node and will be parsed to free_var in relay. It will cause an error while lowering requantize because it requires output_scale (y_scale) to be constant expr:
   ```
   E     1: tvm::relay::qnn::RequantizeLower(tvm::RelayExpr const&, tvm::RelayExpr const&, tvm::RelayExpr const&, tvm::RelayExpr const&, tvm::RelayExpr const&, tvm::relay::qnn::RequantizeAttrs const*, tvm::r
   untime::Array<tvm::PrimExpr, void> const&, tvm::runtime::DataType const&)
   E           at /home/liuliang/Desktop/tvms/tvm/src/relay/qnn/op/requantize.cc:148
   E     0: float tvm::relay::GetScalarFromConstant<float>(tvm::RelayExpr)
   E           at /home/liuliang/Desktop/tvms/tvm/src/relay/qnn/op/../../transforms/pattern_utils.h:514
   E     File "/home/liuliang/Desktop/tvms/tvm/src/relay/quantize/../transforms/pattern_utils.h", line 514
   E   TVMError: 
   E   ---------------------------------------------------------------
   E   An error occurred during the execution of TVM.
   E   For more information, please see: https://tvm.apache.org/docs/errors.html
   E   ---------------------------------------------------------------
   E     Check failed: (n) is false: Expr must be a constant expr - #[version = "0.0.5"]
   E   free_var %y_scale: float32;
   E   cast(%y_scale, dtype="float32") /* ty=float32 */
   ```
   Do you have some suggestions to solve it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbrookhart merged pull request #8007: [ONNX] QLinearConv Support

Posted by GitBox <gi...@apache.org>.
mbrookhart merged pull request #8007:
URL: https://github.com/apache/tvm/pull/8007


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org