pytorch
ae4ec7de - Fix and update type hints for `make_functional.py` (#91579)

Commit
1 year ago
Fix and update type hints for `make_functional.py` (#91579) Changes in details: - Fix and update some out-of-date type hints in `_functorch/make_functional.py`. - ~Explicitly use `OrderedDict` for order-sensitive mappings.~ In `create_names_map()`, `_swap_state()`, and `FunctionalModuleWithBuffers.__init__()`, the unordered `dict` was used. The key order should be preserved for `dict.items()` while it is required to `zip` with a tuple of `params`/`buffers`. Although since Python 3.6, the built-in dictionary is insertion ordered ([PEP 468](https://peps.python.org/pep-0468)). Explicit is better than implicit. Pull Request resolved: https://github.com/pytorch/pytorch/pull/91579 Approved by: https://github.com/zou3519
Author
Committer
Parents
Loading