-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[pytree] Add public pytree module torch.utils.pytree
#137400
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
base: gh/XuehaiPan/179/base
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/137400
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 087c7b2 with merge base cb5f31a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: ea0d2b6 Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 656e242 Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: db25160 Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 65bf5dc Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 2718a77 Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 57d7a7b Pull Request resolved: #137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 000d799 Pull Request resolved: pytorch#137400
__all__ = [ | ||
"PyTreeSpec", | ||
"register_pytree_node", | ||
"tree_flatten", |
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.
what about tree_flatten_with_spec and register_dataclass?
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.
I'm not sure if they are exposed APIs or only used internally. If it should be exposed and stabilized in torch.utils.pytree
, I can add it in a follow-up.
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 42d47d5 Pull Request resolved: pytorch#137400
@@ -11,6 +11,7 @@ | |||
data as data, | |||
deterministic as deterministic, | |||
hooks as hooks, | |||
pytree as pytree, |
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.
Because we are offering an API to swap between python and C++ pytree in this PR, for this PR, I would like us to have finished making Python treespec and C++ treespec interoperable.
That is, one should be able to pass a treespec created from Python pytree to C++-pytree and vice versa. Otherwise there will be pain switching between the two APIs.
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.
Prepended a new PR in the stack to resolve this:
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 4778e60 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 684f8c3 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 684f8c3 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 5d2275d Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 952db83 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 7db73f6 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 661af0f Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 661af0f Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 0ead633 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: 0ead633 Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: e075efa Pull Request resolved: pytorch#137400
Populate APIs from `torch.utils._pytree` (default) or `torch.utils._cxx_pytree` to a new public module `torch.utils.pytree`. There is a environment varaible `PYTORCH_USE_CXX_PYTREE` (disabled by default) to control this. Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using `torch.utils.pytree`. ghstack-source-id: f21d8ee Pull Request resolved: pytorch#137400
Stack from ghstack (oldest at bottom):
__module__
#148328torch.pytree
#148180torch.utils.pytree
#137400tree_*
functions accept both Python and C++PyTreeSpec
#152624Populate APIs from
torch.utils._pytree
(default) ortorch.utils._cxx_pytree
to a new public moduletorch.utils.pytree
. There is an environment variablePYTORCH_USE_CXX_PYTREE
(disabled by default) to control this.Since the CXX pytree is now Dynamo traceable, the users can change the underlining pytree implementation by flipping the environment variable while using
torch.utils.pytree
.Resolves #65761
cc @zou3519 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @rec