Skip to content

Conversation

@hariprasadravi
Copy link
Contributor

This PR is a more robust fix for the issue captured in #4380 .

Essentially, torch.ops.aten.convolution lowering to tosa, linalg and stablehlo fail if stride, padding, dilation or output_padding is a tuple with a singleton element, but convolution operates on 2 or 3 spatial dimensions.

In the failing case, torch.nn.Conv2d with padding= 'valid' generates a torch.ops.aten.conv2d.padding op in ExportedProgram, which is later decomposed to torch.ops.aten.convolution.default with a single padding value of [0] after running ep.run_decompositions().

In #4380, I attempted to fix just the torch-to-tosa pass, but I later realised that this is a more general bug in all the backends for multiple params (thanks to #4380 (comment)).

Fix:

I followed #4250 to canonicalize aten.convolution if it operates on 2 or 3 spatial dims but params are singleton. For example, if aten.convolution is 2D but padding == [0], we canonicalize it to padding == [0, 0]

@hariprasadravi
Copy link
Contributor Author

@sahas3 @sjarus @zjgarvey and @vivekkhandelwal1 . Please let me know if you have any thoughts.

@hariprasadravi hariprasadravi force-pushed the canonicalizeConvValidPadding branch from fe49a45 to 328c6e4 Compare November 25, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant