Skip to content

Incorrect ConvTranspose2D padding behavior (forward padding vs. output crop) #420

@mhs4670go

Description

@mhs4670go

What

ConvTranspose2d padding was treated as input padding, which changes numerical results compared to PyTorch.

For transposed convolutions, PyTorch's padding parameter does not represent input padding — instead it represents a symmetric output crop.

Prior to this issue, the conversion pipeline inserted a Pad node before the transposed convolution when padding != 0. However, in a transposed convolution, adding input padding modifies the upsampling phase and kernel overlap pattern, which results in different values, even if the output shape matches.

This issue corrects the behavior by:

  • Never inserting input padding for transposed convolutions
  • Mapping the builtin op with VALID padding
  • Applying a Slice (NHWC) crop after the transposed convolution when needed

As a result, the converted model now produces values consistent with the original PyTorch model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions