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 2022/11/30 23:28:02 UTC

[GitHub] [tvm] farshidsp commented on a diff in pull request #13414: [Hexagon] Enable depthwise conv2d NHWC with an HWIO kernel layout

farshidsp commented on code in PR #13414:
URL: https://github.com/apache/tvm/pull/13414#discussion_r1036548582


##########
python/tvm/topi/nn/depthwise_conv2d.py:
##########
@@ -252,8 +253,18 @@ def depthwise_conv2d_nhwc(Input, Filter, stride, padding, dilation, out_dtype=No
         dilation_h, dilation_w = dilation
 
     batch, in_height, in_width, in_channel = Input.shape
+
+    dim = len(Input.shape) - 2
+
     # shape of dilated kernel
-    filter_height, filter_width, filter_channel, channel_multiplier = Filter.shape
+    if kernel_layout == "HWOI":
+        filter_height, filter_width, filter_channel, channel_multiplier = Filter.shape
+        kernel_permutation_to = [0, 1] + list(range(2, dim + 2))
+    elif kernel_layout == "HWIO":
+        filter_height, filter_width, channel_multiplier, filter_channel = Filter.shape
+        kernel_permutation_to = [dim + 1, dim] + list(range(dim))

Review Comment:
   @Lunderberg  You are right, my bad. Not sure why I thought this would result in `HWIO`. Thanks so much for catching this bug. 



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