#7721·onnx

Shape Inference returns incorrect output for Conv with asymmetric padding and strides

Author: Aditya-138-12Created Mar 7, 2026Updated Sep 24, 2026
Labelsbug

Bug Report

I observed a potential bug in the shape inference for Conv operator when using asymmetric padding with strides.

Is the issue related to model conversion?

No

Describe the bug

Minimal graph:

Input: x : [1,1,7,5]

Weights: W : [1,1,3,3]

Conv attributes: kernel_shape = [3,3] pads = [1,0,1,0] strides = [2,2]

Output shape reported by ONNX:

y -> [1,1,5,5]

System information

  • OS: Ubuntu 24.04 LTS
  • ONNX version: 1.17.0
  • Python version: 3.12.3

Reproduction instructions

Model link: link

Expected behavior

However according to the convolution formula:

H_out = floor((7 + 1 + 1 - 2 - 1)/2 + 1) = 4 W_out = floor((5 + 0 + 0 - 2 - 1)/2 + 1) = 2

So the expected output should be:

[1,1,4,2]

Notes

I would love to help for resolving the issue.