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 dtype for NonMaxSuppression #7056

Merged
merged 10 commits into from Feb 15, 2023

Conversation

justinchuby
Copy link
Contributor

@justinchuby justinchuby commented Dec 31, 2022

Explicitly cast inputs to NonMaxSuppression to float32 to accommodate float64 inputs because NonMaxSuppression only supports float32 coordinates. This is necessary to unblock pytorch/pytorch#78442 and pytorch/pytorch#86146.

  • Also removed the use of deprecated _cast_Long.

cc @neginraoof @BowenBao @mruberry

@justinchuby justinchuby marked this pull request as ready for review December 31, 2022 16:14
justinchuby added a commit to pytorch/pytorch that referenced this pull request Dec 31, 2022
…ch eager execution "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Dec 31, 2022
…on "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
@BowenBao
Copy link
Contributor

BowenBao commented Jan 1, 2023

Explicitly cast inputs to NonMaxSuppression to float32 to accommodate float64 inputs because NonMaxSuppression only supports float32 coordinates.

Should we do this in scalar_type_analysis pass, wdyt?

@justinchuby
Copy link
Contributor Author

That's a good point. I will see how it can be done

justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 13, 2023
…ch eager execution "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 13, 2023
…on "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
@justinchuby
Copy link
Contributor Author

@BowenBao I think this change is a much more efficient one. Can we resurrect this change?

@BowenBao
Copy link
Contributor

@datumbox please take a look.

@justinchuby
Copy link
Contributor Author

justinchuby commented Feb 14, 2023

@datumbox @pmeier
this is needed for the pytorch 2.0 release. Could you help getting the reviews needed? Thanks a lot!

@justinchuby justinchuby mentioned this pull request Feb 14, 2023
49 tasks
@datumbox
Copy link
Contributor

@justinchuby I'm no longer in the maintainer group to offer a stamp and help you merge.

Not sure if any of the remaining folks from EU are online now. Perhaps @malfet @atalman could stamp?

@datumbox
Copy link
Contributor

Also it seems that one of the tests is failing? Could be related.

@malfet
Copy link
Contributor

malfet commented Feb 14, 2023

@datumbox I can send you an invite, if you need one.

@NicolasHug
Copy link
Member

Thanks for the PR @justinchuby

Moved symbolic functions to the module scope and cleaned up imports for symplicity.

Any chance we could revert this change? It makes the diff a little difficult to review

@pmeier
Copy link
Collaborator

pmeier commented Feb 14, 2023

Thanks for the PR @justinchuby. Could you clarify what review you need from us? Happy to help get this merged before our branch cut on Feb 17. As @datumbox mentioned, we have a (previously undetected) ONNX failure: #7247.

@NicolasHug I think we need to prioritize getting this landed and CI green over potential style nits given that our branch cut is looming ahead. Happy to revisit afterwards.

@justinchuby
Copy link
Contributor Author

justinchuby commented Feb 14, 2023

Thanks for the PR @justinchuby. Could you clarify what review you need from us? Happy to help get this merged before our branch cut on Feb 17. As @datumbox mentioned, we have a (previously undetected) ONNX failure: #7247.

@NicolasHug I think we need to prioritize getting this landed and CI green over potential style nits given that our branch cut is looming ahead. Happy to revisit afterwards.

thanks! I will work on this today. We need the "Fix dtype for NonMaxSuppression" fix to allow pytorch/pytorch#86146 to land because otherwise a vision test would fail.

@justinchuby justinchuby changed the title [ONNX] Fix dtype for NonMaxSuppression; misc improvements [ONNX] Fix dtype for NonMaxSuppression Feb 15, 2023
@justinchuby
Copy link
Contributor Author

@pmeier @NicolasHug I changed this PR to be minimal and found the cause for the test failure. We need pytorch/pytorch#94870 then this then pytorch/pytorch#86146, in this order. Thanks a lot!

pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Feb 15, 2023
The assert statement blocks tensors with unknown ranks. This change unblocks those cases. Needed for pytorch/vision#7056

Verified against pytorch/vision#7056
Pull Request resolved: #94870
Approved by: https://github.com/BowenBao
@pmeier
Copy link
Collaborator

pmeier commented Feb 15, 2023

Since pytorch/pytorch#94870 is already merged, we should have access to it with todays nightly release in roughly a couple of hours. Will merge then if CI is green. Just so I understand correctly, #7249 is not strictly needed but improves code quality, right? Meaning, it would be good to merge soon, but can wait until after the branch cut?

@pmeier
Copy link
Collaborator

pmeier commented Feb 15, 2023

ONNX test is green: https://app.circleci.com/pipelines/github/pytorch/vision/23230/workflows/c3c3853e-6c98-4571-aae7-760bb6c36967/jobs/1829412 🎉

@pmeier pmeier merged commit f627b9d into pytorch:main Feb 15, 2023
@github-actions
Copy link

Hey @pmeier!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

@justinchuby justinchuby deleted the justinchuby/onnx branch February 15, 2023 15:34
@justinchuby
Copy link
Contributor Author

Just so I understand correctly, #7249 is not strictly needed but improves code quality, right? Meaning, it would be good to merge soon, but can wait until after the branch cut?

That's accurate

pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Feb 16, 2023
…ch eager execution "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Feb 16, 2023
…on "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 24, 2023
…ch eager execution "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 24, 2023
…on "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 24, 2023
…ch eager execution "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
justinchuby added a commit to pytorch/pytorch that referenced this pull request Feb 24, 2023
…on "


- Fixes #78442
- Change floor_divide to round down to match eager. The old behavior for floor_divide (which was actually trunc divide) is deprecated and removed in eager mode. (See #78442)
- Remove division logic in opset 10 because it is duplicated from opset 9.
- Add tests to `remainder`, `div`, `floor_divide` and `true_divide`

### Blocked by

- pytorch/vision#7056

[ghstack-poisoned]
facebook-github-bot pushed a commit that referenced this pull request Mar 28, 2023
Summary:

Reviewed By: vmoens

Differential Revision: D44416637

fbshipit-source-id: c06807ab7d9d71f2272761bf366411268ed5b462

Co-authored-by: Nikita Shulga <nshulga@fb.com>
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants