pytorch
caf23d11 - [JIT] Unshare types for modules that define() in __init__ (#44233)

Commit
5 years ago
[JIT] Unshare types for modules that define() in __init__ (#44233) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44233 **Summary** By default, scripting tries to share concrete and JIT types across compilations. However, this can lead to incorrect results if a module extends `torch.jit.ScriptModule`, and injects instance variables into methods defined using `define`. This commit detects when this has happened and disables type sharing for the compilation of the module that uses `define` in `__init__`. **Test Plan** This commit adds a test to TestTypeSharing that tests this scenario. **Fixes** This commit fixes #43580. Test Plan: Imported from OSS Reviewed By: bertmaher Differential Revision: D23553870 Pulled By: SplitInfinity fbshipit-source-id: d756e87fcf239befa0012998ce29eeb25728d3e1
Author
Meghan Lele
Parents
Loading