-
Notifications
You must be signed in to change notification settings - Fork 24.3k
[pytree] hardcode values for none_is_leaf
and namespace
in C++ pytree
#114858
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
…tree [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/114858
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5e0601d with merge base 25b8352 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…` in C++ pytree" [ghstack-poisoned]
@XuehaiPan, what's the plan for after this stack is done? It would be cool to move to having C++ pytree turned on by default for PyTorch. In order to get there, we'll need to figure out:
|
…` in C++ pytree" [ghstack-poisoned]
…` in C++ pytree" [ghstack-poisoned]
…` in C++ pytree" [ghstack-poisoned]
…` in C++ pytree" [ghstack-poisoned]
…tree ghstack-source-id: 1817ee8 Pull Request resolved: pytorch#114858
@pytorchbot merge |
@zou3519 I think the submodule approach would be fine for me.
To the best of my knowledge, the Python pytree is required by dynamo. We still have many polyfill implementations for the CPython builtin functions. pytorch/torch/_dynamo/polyfill.py Lines 1 to 28 in 7b3429d
Here is a minimal list of required Python implementations for the pytree API: https://github.com/metaopt/optree/blob/main/optree/_C.pyi def flatten(tree: PyTree[T]) -> tuple[list[T], PyTreeSpec]: ...
def is_namedtuple(obj: object | type) -> bool: ...
def is_namedtuple_class(cls: type) -> bool: ...
def is_structseq(obj: object | type) -> bool: ...
def is_structseq_class(cls: type) -> bool: ...
class PyTreeSpec:
num_nodes: int
num_leaves: int
num_children: int
type: builtins.type | None
def unflatten(self, leaves: Iterable[T]) -> PyTree[T]: ...
def flatten_up_to(self, full_tree: PyTree[T]) -> list[PyTree[T]]: ...
def paths(self) -> list[tuple[Any, ...]]: ...
def entries(self) -> list[Any]: ...
def children(self) -> list[PyTreeSpec]: ...
def is_leaf(self, strict: bool = True) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def register_node(
cls: type,
flatten_func: FlattenFunc,
unflatten_func: UnflattenFunc,
) -> None: ... |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@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 |
Merge failedReason: 1 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
…` in C++ pytree" [ghstack-poisoned]
@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 |
Merge failedReason: PR #113257 has not been reviewed yet |
…` in C++ pytree" [ghstack-poisoned]
@pytorchbot merge |
…tree ghstack-source-id: e4e3c3d Pull Request resolved: pytorch#114858
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 |
…tree (pytorch#114858) Pull Request resolved: pytorch#114858 Approved by: https://github.com/zou3519
Stack from ghstack (oldest at bottom):
none_is_leaf
andnamespace
in C++ pytree #114858