Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[torch/package_importer] add compatibility name mapping (pytorch#134376)
Summary: This enables patching extern modules to provide compatibility with serialized code depending on different versions of those extern modules. The main motivation is to enable Numpy upgrade. In the recent release many alias to builtin types were deprecated and removed [1]. This breaks loading pickled modules that reference the removed aliases. While the proper solution is to re-generate pickled modules, it's not always feasible. This proposes a way to define mapping with a new type, for a module member. It is only set if it's not present in the loaded module, thus removes the need to check for exact versions. https://numpy.org/doc/stable/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated Differential Revision: D61556888 Pull Request resolved: pytorch#134376 Approved by: https://github.com/SherlockNoMad
- Loading branch information