Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding specification unclear for Convolution/AveragePool/MaxPool #1651

Closed
tlepley-cadence opened this issue Nov 27, 2018 · 2 comments
Closed
Labels
operator Issues related to ONNX operators stale

Comments

@tlepley-cadence
Copy link

tlepley-cadence commented Nov 27, 2018

For Convolution, AveragePool, MaxPool operators, the definition of the 'pads' property is unclear and suggests that padding should be given for all dimensions, not just for spatial dimensions. But all the tools I've used (for instance TF2ONNX and Glow) agree that only the padding for spatial dimensions needs to be given.

I think the ONNX specification would need some clarification.

Convolution 'pads' property:

[...] pads format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis i and xi_end, the number of pixels added at the end of axis i

For the Pad operator, ONNX tells explicitly that the padding information needs to be provided for all dimensions, so it is clear:

[...] pads rank should be double of the input's rank. pads format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axis i and xi_end, the number of pixels added at the end of axis i.

As an example, in some of the ONNX models I've used, for 4D tensors, I got a 4 element pads array for Convolution&Maxpool and a 8 element pads' array for Pad`

  • Convolution op: attribute = name: "pads" ints: 1 ints: 1 ints: 1 ints: 1 type: INTS
  • Maxpool op: attribute = name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 type: INTS
  • Pad op: attribute = name: "pads" ints: 0 ints: 0 ints: 1 ints: 1 ints: 0 ints: 0 ints: 1 ints: 1 type: INTS
@tlepley-cadence tlepley-cadence changed the title Padding specification unclear for Convolution/AveragePool.MaxPool Padding specification unclear for Convolution/AveragePool/MaxPool Nov 27, 2018
@charanpool
Copy link

Hey, @tlepley-cadence did you find the padding specifications?

@prasanthpul prasanthpul added the operator Issues related to ONNX operators label Jul 14, 2019
@stale
Copy link

stale bot commented Mar 28, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Mar 28, 2022
@stale stale bot closed this as completed Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operator Issues related to ONNX operators stale
Projects
None yet
Development

No branches or pull requests

3 participants