Closed XuehaiPan closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
10842aa
) to head (b089dad
). Report is 25 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The API shape here looks pretty good to me, I think it meets the needs discussed in https://github.com/pytorch/pytorch/issues/113378
Description
Describe your changes in detail.
This PR adds a new method
accessors
toPyTreeSpec
objects.The
path
to a leaf node is a tuple of entries, where an entry can be a raw index or dictionary key.The newly added
accessor
will associate the corresponding node type to the entry. Anaccessor
to a leaf node is a tuple of triples(entry, type, kind)
. For example:Motivation and Context
Why is this change required? What problem does it solve? If it fixes an open issue, please link to the issue here. You can use the syntax
close #15213
if this solves the issue #15213[X] I have raised an issue to propose this change (required for new features and bug fixes)
pytorch/pytorch#113378
Types of changes
What types of changes does your code introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!make format
. (required)make lint
. (required)make test
pass. (required)