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

[ONNX] Fix circular padding to support dynamic axes #95647

Conversation

ilyasher
Copy link
Contributor

This commit fixes a bug where the ONNX exporter for circular padding queried the input tensor shape in order to get the correct 'end' index for a slice node. This doesn't work when the axis in question is has dynamic size. The commit fixes this by setting the 'end' index to INT_MAX, which is the recommended way of slicing to the end of a dimension with unknown size per ONNX spec.

See https://onnx.ai/onnx/operators/onnx__Slice.html

Also adds a regression test.

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 27, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/95647

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit f877b1d:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 27, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label Feb 27, 2023
@H-Huang H-Huang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 28, 2023
@BowenBao BowenBao added the module: onnx Related to torch.onnx label Feb 28, 2023
Copy link
Collaborator

@BowenBao BowenBao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution! You need to sign EasyCLA for me to merge it.

@BowenBao
Copy link
Collaborator

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased dev-ilyasher-onnx-circular-pad-dyn-axes onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout dev-ilyasher-onnx-circular-pad-dyn-axes && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the dev-ilyasher-onnx-circular-pad-dyn-axes branch from 39894d2 to d72682b Compare February 28, 2023 17:32
@ilyasher
Copy link
Contributor Author

LGTM, thanks for your contribution! You need to sign EasyCLA for me to merge it.

Thanks, I'm trying to get that sorted out right now.

@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 1, 2023

/easycla

@BowenBao
Copy link
Collaborator

BowenBao commented Mar 1, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 1, 2023

I wonder if it's because the other commit has a different author email address.

Good thinking, I will complete the CLA with my other email.

@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 1, 2023

/easycla

@BowenBao
Copy link
Collaborator

BowenBao commented Mar 2, 2023

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased dev-ilyasher-onnx-circular-pad-dyn-axes onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout dev-ilyasher-onnx-circular-pad-dyn-axes && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the dev-ilyasher-onnx-circular-pad-dyn-axes branch from a69e3ea to 5f7806e Compare March 2, 2023 00:19
@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 2, 2023

The commit shows my email as
Author: Ilya Sherstyuk 46343317+ilyasher@users.noreply.github.com

I will fix the commit with the correct email and force-push

@ilyasher ilyasher force-pushed the dev-ilyasher-onnx-circular-pad-dyn-axes branch from 5f7806e to fcc854d Compare March 2, 2023 00:33
@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 2, 2023

/easycla

1 similar comment
@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 8, 2023

/easycla

@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 8, 2023

@pytorchbot rebase

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 8, 2023

You don't have permissions to rebase this PR since you are a first time contributor. If you think this is a mistake, please contact PyTorch Dev Infra.

@ilyasher
Copy link
Contributor Author

ilyasher commented Mar 8, 2023

@BowenBao I finally got the CLA approved, what else do I need to do to merge this PR? Thanks for all your help.

@BowenBao
Copy link
Collaborator

BowenBao commented Mar 8, 2023

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a rebase job. Check the current status here

ilyasher and others added 2 commits March 8, 2023 23:50
This commit fixes a bug where the ONNX exporter for circular padding
queried the input tensor shape in order to get the correct 'end' index
for a slice node. This doesn't work when the axis in question is
has dynamic size. The commit fixes this by setting the 'end' index to INT_MAX,
which is the recommended way of slicing to the end of a dimension
with unknown size per ONNX spec.
Co-authored-by: Bowen Bao <bowbao@microsoft.com>
@pytorchmergebot
Copy link
Collaborator

Successfully rebased dev-ilyasher-onnx-circular-pad-dyn-axes onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout dev-ilyasher-onnx-circular-pad-dyn-axes && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the dev-ilyasher-onnx-circular-pad-dyn-axes branch from fcc854d to f877b1d Compare March 8, 2023 23:50
@BowenBao
Copy link
Collaborator

BowenBao commented Mar 8, 2023

@pytorchbot merge -g

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 8, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Not merging any PRs at the moment because there is a merge blocking https://github.com/pytorch/pytorch/labels/ci:%20sev issue open at:
#96371

Details for Dev Infra team Raised by workflow job

@BowenBao
Copy link
Collaborator

@pytorchbot merge -g

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

cyyever pushed a commit to cyyever/pytorch_private that referenced this pull request Mar 12, 2023
This commit fixes a bug where the ONNX exporter for circular padding queried the input tensor shape in order to get the correct 'end' index for a slice node. This doesn't work when the axis in question is has dynamic size. The commit fixes this by setting the 'end' index to INT_MAX, which is the recommended way of slicing to the end of a dimension with unknown size per ONNX spec.

See https://onnx.ai/onnx/operators/onnx__Slice.html

Also adds a regression test.

Pull Request resolved: pytorch/pytorch#95647
Approved by: https://github.com/BowenBao
@ilyasher ilyasher deleted the dev-ilyasher-onnx-circular-pad-dyn-axes branch May 1, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged module: onnx Related to torch.onnx open source release notes: onnx torch.onnx related changes that should show up in the release notes triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants