From e0490fcb35351d3047029213dffcfaf6f2af1556 Mon Sep 17 00:00:00 2001 From: Meghan Lele Date: Wed, 23 Sep 2020 14:26:33 -0700 Subject: [PATCH] [JIT] Add test for ignored class type property **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] --- test/jit/test_class_type.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/jit/test_class_type.py b/test/jit/test_class_type.py index 3fcd89347091..dda6916b5591 100644 --- a/test/jit/test_class_type.py +++ b/test/jit/test_class_type.py @@ -1167,6 +1167,8 @@ def free_function(x: int) -> int: @torch.jit.script class Properties(object): + __ignored_properties__ = ["unsupported"] + def __init__(self, a: int): self.a = a @@ -1174,6 +1176,10 @@ def __init__(self, a: int): 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