-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[pytree][Easy] preserve dict
keys in insertion order in CXX pytree
#130140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/130140
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c21880a with merge base 6a9a02a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: b0fea16 Pull Request resolved: pytorch#130140
ghstack-source-id: b0fea16 Pull Request resolved: pytorch#130140
ghstack-source-id: e37db61 Pull Request resolved: pytorch#130140
ghstack-source-id: e37db61 Pull Request resolved: pytorch#130140
dict
keys in insertion order in CXX pytreedict
keys in insertion order in CXX pytree
ghstack-source-id: e37db61 Pull Request resolved: pytorch#130140
ghstack-source-id: da12e8f Pull Request resolved: pytorch#130140
ghstack-source-id: 813b328 Pull Request resolved: pytorch#130140
ghstack-source-id: 782fe2b Pull Request resolved: pytorch#130140
ghstack-source-id: 50a63f4 Pull Request resolved: pytorch#130140
ghstack-source-id: 50a63f4 Pull Request resolved: pytorch#130140
__TORCH_DICT_SESSION = optree.dict_insertion_ordered(True, namespace="torch") | ||
__TORCH_DICT_SESSION.__enter__() # enable globally and permanently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @zou3519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're sure about this. The fun thing is if someone imports torch cxx_pytree and uses optree then they will override the optree behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only affects optree functions that passed with namespace="torch"
.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…130140) `optree` and JAX pytree traversal the `dict` in sorted key ordering (see [Key Ordering for Dictionaries](https://github.com/metaopt/optree#key-ordering-for-dictionaries)). While in PyTorch Python pytree, we traversal the `dict` in insertion order. See also: - #114392 This aligns the behavior of CXX pytree with Python pytree. Pull Request resolved: #130140 Approved by: https://github.com/zou3519
…ytorch#130140) `optree` and JAX pytree traversal the `dict` in sorted key ordering (see [Key Ordering for Dictionaries](https://github.com/metaopt/optree#key-ordering-for-dictionaries)). While in PyTorch Python pytree, we traversal the `dict` in insertion order. See also: - pytorch#114392 This aligns the behavior of CXX pytree with Python pytree. Pull Request resolved: pytorch#130140 Approved by: https://github.com/zou3519
…ytorch#130140) `optree` and JAX pytree traversal the `dict` in sorted key ordering (see [Key Ordering for Dictionaries](https://github.com/metaopt/optree#key-ordering-for-dictionaries)). While in PyTorch Python pytree, we traversal the `dict` in insertion order. See also: - pytorch#114392 This aligns the behavior of CXX pytree with Python pytree. Pull Request resolved: pytorch#130140 Approved by: https://github.com/zou3519
optree
and JAX pytree traversal thedict
in sorted key ordering (see Key Ordering for Dictionaries). While in PyTorch Python pytree, we traversal thedict
in insertion order. See also:dict
s do not imply equal leaves and equal treespecs #114392This aligns the behavior of CXX pytree with Python pytree.
Stack from ghstack (oldest at bottom):
torch.utils.pytree
by default #138056torch.distributed
#144332torch.func
#137884torch.utils._pytree
->torch.utils.pytree.python
#144405torch.utils.pytree
#137400dict
keys in insertion order in CXX pytree #130140cc @zou3519