farshidsp commented on code in PR #13414:
URL: https://github.com/apache/tvm/pull/13414#discussion_r1036550184
##########
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))
+
+ kernel_permutation_from = np.argsort(kernel_permutation_to)
Review Comment:
I tried to follow
[this](https://github.com/apache/tvm/blob/6782a35018d5df63486569f17296737d75eedc55/python/tvm/topi/nn/conv2d.py#L837)
as much as possible so in the future we can add more features if needed. If
you think this is not the best way I could change it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]