Skip to content

Commit 5f37cc1

Browse files
vinx13tqchen
authored andcommitted
[Relay][Op] Add group conv2d dispatch to topi function (#2870)
* [Relay][Op] Add group conv2d dispatch to topi function * Rerun tests
1 parent d04c41c commit 5f37cc1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/tvm/relay/op/nn/_nn.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ def compute_conv2d(attrs, inputs, out_type, target):
9696
get_const_int(inputs[1].shape[3]) == 1:
9797
out = topi.nn.depthwise_conv2d_nhwc(
9898
inputs[0], inputs[1], strides, padding, dilation, out_dtype=out_dtype)
99+
elif layout in ['NCHW', 'NCHW4c']:
100+
out = topi.nn.group_conv2d_nchw(inputs[0], inputs[1], strides, padding, dilation, groups,
101+
out_dtype=out_dtype)
99102
else:
100103
raise ValueError("not support arbitrary group number for now")
101104
return [out]
@@ -120,6 +123,8 @@ def schedule_conv2d(attrs, outs, target):
120123
return topi.generic.schedule_depthwise_conv2d_nchw(outs)
121124
if layout == "NHWC" and kernel_layout == "HWOI":
122125
return topi.generic.schedule_depthwise_conv2d_nhwc(outs)
126+
if layout == "NCHW4c":
127+
return topi.generic.schedule_group_conv2d_nchw(outs)
123128
raise ValueError("No compatible schedule")
124129

125130

0 commit comments

Comments
 (0)