Skip to content

Commit

Permalink
Update on "[JIT] Add API for ignoring arbitrary module attributes"
Browse files Browse the repository at this point in the history
**Summary**
This commit adds an API for ignoring arbitrary module attributes during
scripting. A class attribute named `ignored_attributes` containing names
of attributes to ignore can be added to the class of the instance being
scripted. Attributes ignored in this fashion cannot be used in
`forward`, methods used by `forward` or by `@exported` methods. They
are, however, copied to the `RecursiveScriptModule` wrapper and can be
used by `@ignored` methods and regular Python code.

**Test Plan**
This commit adds unit tests to `TestScriptPy3` to test this new API.

Differential Revision: [D23971882](https://our.internmc.facebook.com/intern/diff/D23971882)

[ghstack-poisoned]
  • Loading branch information
Meghan Lele committed Sep 30, 2020
2 parents 7e9137f + 83f08e1 commit f728b0f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions torch/_C/__init__.pyi.in
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class ConcreteModuleTypeBuilder:
def add_failed_attribute(self, name: str, failure_reason: str): ...
def add_function_attribute(self, name: str, ty: JitType, func: Callable[..., Any]): ...
def add_ignored_attribute(self, name: str): ...
def add_ignored_attributes(self, names: List[str]): ...

class ConcreteModuleType:
def get_constants(self) -> Dict[str, Any]: ...
Expand Down

0 comments on commit f728b0f

Please sign in to comment.