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/frontend/keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def _convert_convolution(inexpr, keras_layer, etab, data_layout, input_shape=Non

if data_layout == "NHWC":
if is_depthconv:
kernel_layout = "HWOI"
kernel_layout = "HWIO"
elif is_deconv:
kernel_layout = "HWOI"
else:
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 @@ -351,6 +351,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
Loading