You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "arina-grovety (via GitHub)" <gi...@apache.org> on 2023/05/18 10:28:52 UTC
[GitHub] [tvm] arina-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
arina-grovety commented on code in PR #14861:
URL: https://github.com/apache/tvm/pull/14861#discussion_r1197658557
##########
python/tvm/relay/op/contrib/ethosu.py:
##########
@@ -650,12 +650,33 @@ def is_valid(self):
"""
This function checks whether AvgPool2D has compatible attributes with the NPU
"""
+
+ def check_extra_strides():
+ """
+ This function checks whether AvgPool2D could be legalized as ethosu_pooling
+ supported by the NPU.
+ We consider only specific case: when there is no AvgPool2D padding, the spatial
+ dimensions of ifm and the shape of pooling are equal, but stride size exceed 3
+ by any of dimensions, e.g:
+ ifm: (1, 8, 8, _), strides: (8, 8), pool_shape: (8, 8)
+ ifm: (1, 25, 5, _), strides: (25, 5), pool_shape: (25, 5)
+ """
+ if self.pooling_type != "AVG":
+ return False
+ if list(self.padding) != [0, 0, 0, 0]:
+ return False
+ if [self.ifm.shape[1], self.ifm.shape[2]] != list(self.pool_shape):
+ return False
+ if list(self.strides) != list(self.pool_shape):
Review Comment:
Yes, you're right, now I see redundancy as well.
--
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