Discover and check operator variants#76901
Discover and check operator variants#76901amjames wants to merge 9 commits intogh/amjames/3/basefrom
Conversation
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. ghstack-source-id: 67e7882 Pull Request resolved: #76901
🔗 Helpful links
✅ No Failures (0 Pending)As of commit 5f747a2 (more details on the Dr. CI page): Expand to see more💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
These PRs look great, @amjames! I triggered some additional tests (with the ciflow/all label) just in case. I also made one suggestion on comment readability -- which is not the fault of this PR, but while we're here I thought we might fix it, anyway, if you agree. Let me know your thoughts and then once these tests pass I think this is good to land! |
|
Are there operations that we were testing manually before and now they are being collected automatically? If so, could you remove the |
| self.operator_variant = getattr(operator, self.name, None) | ||
|
|
||
| if self.inplace_operator_variant is _NOTHING: | ||
| if self.inplace_variant is not None: |
There was a problem hiding this comment.
@mruberry This is the logic I think may warrant additional explanation.
There was a problem hiding this comment.
Sounds great -- it's hard to have too many comments
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: fc00066 Pull Request resolved: #76901
|
Doesn't this PR cover |
|
@lezcano I could not find any I did not add these reverse dunders to be auto-captured as they require additional kwargs to ensure they are not called with a |
Instead of additional kwargs we might just want to create a sample inputs function that's just for the reverse dunders. |
|
Just ping me when this is ready for the next review, @amjames |
|
On the r-looking variants: My concern is that, at the moment, we are writing OpInfos for them manually and that's not great. For example, for non-trivial ones, like the one for But again, perhaps merging the normal and r-looking operations is easier said than done, but yeah. |
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: a18df21 Pull Request resolved: #76901
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: c0a74e2 Pull Request resolved: #76901
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
|
Exploring more on the reverse dunders sounds cool but if the simplest solution is to keep them separate and give them their own sample inputs function that also sounds totally fine. Trying to have two sample inputs for already important and complicated operations like matmul might be too unreadable to be worthwhile. |
|
The inputs to rmatmul are those from matmul reversed. That's what led me to suggest automating all this really. |
| BinaryUfuncInfo('bitwise_or', | ||
| ref=np.bitwise_or, | ||
| dtypes=integral_types_and(torch.bool), | ||
| operator_variant=operator.or_, |
There was a problem hiding this comment.
Nice attention to the bitwise operators
mruberry
left a comment
There was a problem hiding this comment.
LGTM! We should wait for the tests to finish, but if they're OK you can merge this using @pytorchbot merge this
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: 5af2ac5 Pull Request resolved: #76901
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: 92cdba7 Pull Request resolved: #76901
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: b04f19c Pull Request resolved: #76901
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. [ghstack-poisoned]
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. ghstack-source-id: 6a73a9f Pull Request resolved: #76901
|
@pytorchbot merge this |
|
Hey @amjames. |
Summary: Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. Pull Request resolved: #76901 Approved by: https://github.com/mruberry Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/e5a752a6ca081045c25cd52afa9d245ed6582821 Reviewed By: atalman Differential Revision: D36412522 Pulled By: atalman fbshipit-source-id: cd8ca62d1e77f87b8d8d121f5d33dcffe82bf80d
Operator variants can now be explicitly specified in the OpInfo kwargs. When the operator name is not the same as the method/function form this will allow them to be discovered. The OpInfo is extended to also accept/discover the inplace operator variant. Operator and inplace operator variants are exercised in consistency tests when the sample does not contain any kwargs. Operations which require explicit declarations of operator and inplace operator variants have had them added to their OpInfos. Pull Request resolved: pytorch#76901 Approved by: https://github.com/mruberry
Stack from ghstack (oldest at bottom):
Operator variants can now be explicitly specified in the OpInfo kwargs.
When the operator name is not the same as the method/function form this
will allow them to be discovered.
The OpInfo is extended to also accept/discover the inplace operator
variant.
Operator and inplace operator variants are exercised in consistency
tests when the sample does not contain any kwargs.