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
[JIT] Add test for ignored class type property #45233
Conversation
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
@@ -1167,13 +1167,19 @@ def free_function(x: int) -> int: | |||
|
|||
@torch.jit.script | |||
class Properties(object): | |||
__ignored_properties__ = ["unsupported"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC, is __ignored_properties__
the API we want users to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. As @ppwwyyxx mentioned it should be easy to enable ignoring properties with a decorator, which is more intuitive because it's similar to how someone would ignore
a function: D23797598.
Should we do it for this release or wait for the next?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be good to do for this release - i don't think it's particularly risky (although mabye unused
is a better fit)
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 9902bff (more details on the Dr. CI page):
❄️ 1 failure tentatively classified as flakybut reruns have not yet been triggered to confirm: pytorch_ios_11_2_1_x86_64_build (1/1)Step: "Update Homebrew" (full log | diagnosis details | 🔁 rerun) ❄️
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question that was raised by a user internally on your previous PR - should we make the public api __jit_ignored_properties__
? or _jit_ignored_attributes
? (if we extend this to also work for ignored class attributes which we should)
Or any other name suggestions?
If we go through with D23797598, the public API will be decorator-based. Will we still need this class attribute API for ignoring properties? I think something like |
SGTM |
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
Just a little opinion here, for other libraries based on PyTorch, instead of writing decorators everywhere, it is good to have class attribute API for ignoring properties to be able to ignore them in the respective files in one place. |
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
**Summary** This commit modifies `TestClassType.test_properties` to check that properties on class types can be ignored with the same syntax as ignoring properties on `Modules`. **Test Plan** `python test/test_jit.py TestClassType.test_properties` [ghstack-poisoned]
Is this PR still necessary with |
This PR adds the test (which didn't exist at all before and is necessary IMO), and the PR above renames the class property from |
@SplitInfinity merged this pull request in a0f0cb1. |
Stack from ghstack:
Summary
This commit modifies
TestClassType.test_properties
to check thatproperties on class types can be ignored with the same syntax as
ignoring properties on
Modules
.Test Plan
python test/test_jit.py TestClassType.test_properties
Differential Revision: D23971885