mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: To get source for a particular module, the "correct" thing to do is to check the module's spec and use `get_source` if it's a SourceFileLoader, since subclasses may look elsewhere than the `__file__`, and the spec will give the source of truth. For torch packager, however, we prefer to use linecache, but the loader could still change the file, so we figure out the file for the module using the spec's loader rather than using `module.__file__`, if possible. Test Plan: This code path will get exercised by CI. Also added a test for remapped files. Differential Revision: D41412983 Pull Request resolved: https://github.com/pytorch/pytorch/pull/90258 Approved by: https://github.com/PaliC
2 lines
34 B
Python
2 lines
34 B
Python
result = "module_a_remapped_path"
|