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/11/25 16:18:43 UTC

[GitHub] [tvm] ekalda commented on a change in pull request #9577: [microNPU] Add support for unary elementwise CLZ

ekalda commented on a change in pull request #9577:
URL: https://github.com/apache/tvm/pull/9577#discussion_r757019311



##########
File path: python/tvm/relay/backend/contrib/ethosu/te/unary_elementwise.py
##########
@@ -111,7 +112,11 @@ def unary_elementwise_compute(
         "rounding_mode": rounding_mode,
     }
 
-    operators = {"ABS": te.abs}
+    def clz_imp(inp):
+        # Assuming that it's a 32 bit int
+        return 32 - te.log2(inp)

Review comment:
       Yes, the `inp` can be negative, but for the operators we turn into `extern_calls` the actual correctness of the compute expression doesn't really matter since we will pass to the NPU the parameters of the operation, but no specifics about the actual compute. That's probably why a "close enough" operation is used here...




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