Skip to content

Commit

Permalink
[Conv2MatMul] default pad handling for convs
Browse files Browse the repository at this point in the history
  • Loading branch information
maltanar authored Apr 5, 2024
1 parent c5bd87f commit 6b8b4ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/qonnx/transformation/lower_convs_to_matmul.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def apply(self, model):
auto_pad = auto_pad.s.decode("utf-8")
if auto_pad == "NOTSET":
# use specified padding
pad = get_by_name(n.attribute, "pads").ints
pad = get_by_name(n.attribute, "pads")
pad = pad.ints if pad is not None else [0, 0, 0, 0]
else:
pad = auto_pad_to_explicit_padding(
auto_pad,
Expand All @@ -95,7 +96,8 @@ def apply(self, model):
)
else:
# use specified padding
pad = get_by_name(n.attribute, "pads").ints
pad = get_by_name(n.attribute, "pads")
pad = pad.ints if pad is not None else [0, 0, 0, 0]

# If len(pad) == 2, assume no padding for other dimension
if len(pad) == 2: # only one dimension should be padded
Expand Down

0 comments on commit 6b8b4ec

Please sign in to comment.