Skip to content

Commit

Permalink
Merge pull request #575 from robertknight/auto-pad-valid
Browse files Browse the repository at this point in the history
Support `auto_pad=VALID`
  • Loading branch information
robertknight authored Feb 4, 2025
2 parents e48df48 + 0c75f93 commit 1e6b6c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rten-convert/rten_convert/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@ def read_pads(op_reader: ONNXOperatorReader, attrs: PadAttrs) -> None:
pads = op_reader.get_attr("pads", "ints", [0, 0, 0, 0])
if len(pads) not in [2, 4]:
raise Exception('"padding" attribute must have 2 or 4 values')
case "VALID":
# "VALID" means no padding. Map this to fixed padding of zero,
# using `kernel_shape` to infer the number of dimensions.
auto_pad = sg.AutoPad.NotSet
kernel_shape = op_reader.require_attr("kernel_shape", "ints")
pads = [0, 0] * len(kernel_shape)

case other:
raise Exception(f"Unsupported auto_pad value {other}")

Expand Down

0 comments on commit 1e6b6c8

Please sign in to comment.