You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Aleksei-grovety (via GitHub)" <gi...@apache.org> on 2023/05/19 14:56:41 UTC

[GitHub] [tvm] Aleksei-grovety commented on a diff in pull request #14861: [microNPU][ETHOSU] Add offloading to the NPU the nn.avg_pool2d operator with a stride > 3

Aleksei-grovety commented on code in PR #14861:
URL: https://github.com/apache/tvm/pull/14861#discussion_r1199033918


##########
python/tvm/relay/backend/contrib/ethosu/legalize.py:
##########
@@ -618,6 +618,34 @@ def callback(
         # Activations requiring LUT is currently not supported, so setting it to an empty list
         lut = relay.const([], dtype="int8")
 
+        # If ethosu.avgpool2d has strides which are not supported by the NPU, convert
+        # ethosu.avgpool2d composite functions to ethosu_pooling operator with stride=[1, 1].
+        # Since the spatial dimensions of ifm and the pooling kernel coincide and the padding
+        # is [0, 0, 0, 0], the application of the pooling kernel will be done only once,
+        # which will give us the desired output
+        if params.pooling_type == "AVG" and (params.strides[0] > 3 or params.strides[1] > 3):
+            new_strides = [1, 1]

Review Comment:
   Maybe add strides variable to leave one return in the function.



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