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

[JIT] Add test for ignored class type property #45233

Closed
6 changes: 6 additions & 0 deletions test/jit/test_class_type.py
Expand Up @@ -1167,13 +1167,19 @@ def free_function(x: int) -> int:

@torch.jit.script
class Properties(object):
__ignored_properties__ = ["unsupported"]
Copy link
Contributor

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?

Copy link
Author

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?

Copy link
Contributor

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)


def __init__(self, a: int):
self.a = a

@property
def attr(self) -> int:
return self.a - 1

@property
def unsupported(self) -> int:
return sum([self.a])

@attr.setter
def attr(self, value: int):
self.a = value + 3
Expand Down