Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend][Relay][Keras] fix a wrong assertion about the kernal_layout of DepthwiseConv2D #15124

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion python/tvm/relay/op/strategy/x86.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def conv2d_strategy_cpu(attrs, inputs, out_type, target):
assert _OIHWio_matcher.match(kernel_layout) # check if kernel is OIHWio
return conv2d_NCHWc_strategy_cpu(attrs, inputs, out_type, target)
elif layout == "NHWC":
assert kernel_layout == "HWIO"
assert kernel_layout == "HWOI"
if (not need_auto_scheduler_layout) and (not need_meta_schedule_layout):
logger.warning("conv2d NHWC layout is not optimized for x86 with autotvm.")
if "dnnl" in target.libs:
Expand Down
8 changes: 8 additions & 0 deletions tests/python/frontend/keras/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ def test_forward_conv(self, keras_mod):
x = conv_func(data)
keras_model = keras_mod.models.Model(data, x)
verify_keras_frontend(keras_model)
# check the DepthwiseConv2D with single-channel
data = keras_mod.layers.Input(shape=(32, 32, 1))
conv_func = keras_mod.layers.DepthwiseConv2D(
kernel_size=(2, 2), strides= (2, 2), data_format="channels_last"
)
x = conv_func(data)
keras_model = keras_mod.models.Model(data, x)
verify_keras_frontend(keras_model)

def test_forward_conv_transpose(self, keras_mod):
"""test_forward_conv_transpose"""
Expand Down