Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,6 @@ def _impl_v1(cls, inputs, attr, params):
msg = 'Value {} in attribute "auto_pad" of operator Conv is invalid.'
raise tvm.error.OpAttributeInvalid(msg.format(attr["auto_pad"]))
attr.pop("auto_pad")
elif len(attr["kernel_shape"]) == 2:
sym_pad = True
if "pads" in attr:
padding = attr["pads"]
else:
padding = [0, 0, 0, 0]
for i in range(0, len(padding), 2):
sym_pad = sym_pad and padding[i] == padding[i + 1]

if sym_pad:
attr["pads"] = padding[0::2]

out = AttrCvt(
op_name=dimension_picker("conv"),
Expand Down
10 changes: 10 additions & 0 deletions tests/python/frontend/onnx/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,16 @@ def repeat(N, D):
repeat(1, D),
repeat(1, D),
)
# Convolution with assymetric padding
verify_conv(
(1, 1) + repeat(5, D),
(1, 1) + repeat(3, D),
(1, 1) + repeat(4, D),
repeat(0, D) + repeat(1, D),
repeat(3, D),
repeat(1, D),
repeat(1, D),
)
# Convolution without padding
verify_conv(
(1, 1) + repeat(5, D),
Expand Down