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/12/08 16:49:23 UTC

[GitHub] [tvm] ashutosh-arm commented on a change in pull request #9682: [CMSIS-NN] Fixed return data type from pattern callback function

ashutosh-arm commented on a change in pull request #9682:
URL: https://github.com/apache/tvm/pull/9682#discussion_r765043641



##########
File path: python/tvm/relay/op/contrib/cmsisnn.py
##########
@@ -227,7 +227,7 @@ def binary_op_pattern(op):
 
     def check_qnn_binary_op(extract):
         """Check if multiply is supported by CMSIS-NN."""
-        return (
+        return bool(

Review comment:
       The problem originated because of checks for Conv2D function: check_qnn_conv2d()
   
   Here is how it looks :
   ```
       conv2d.attrs.out_dtype == "int32"
               and conv2d.attrs.padding[2] == 0
               and conv2d.attrs.padding[3] == 0
               and conv2d_input.checked_type.dtype == "int8"
               and conv2d_weight.checked_type.dtype == "int8"
               and pattern.checked_type.dtype == "int8"
               and bias_dtype == "int32"
               and all([zp == 0 for zp in kernel_zp])
               and (not is_depthwise or bias_add is not None)
   ```
   This check _conv2d.attrs.padding[2] == 0_ returns _IntImm_ type instead of _bool_. So, the fix could just be casting just _conv2d.attrs.padding[2]_ instead of casting around the whole complex boolean expression. Just to be safe always, I chose to go with the latter choice for all the operators which involves accessing attributes.
   
   




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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

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