metaopt / optree

OpTree: Optimized PyTree Utilities
https://optree.readthedocs.io
Apache License 2.0
146 stars 7 forks source link

feat(typing): expose Python implementation for C utilities for `namedtuple` and `PyStructSequence` #157

Closed XuehaiPan closed 1 month ago

XuehaiPan commented 1 month ago

Description

Describe your changes in detail.

Add a wrapped version that has attributes __cxx_implementation__ and __python_implementation__ can be accessible.

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

Expose Python implementation for PyTorch Dynamo support.

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!

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (0d2f38d) to head (f9e3c85). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #157 +/- ## ========================================== Coverage 100.00% 100.00% ========================================== Files 11 12 +1 Lines 1150 1274 +124 ========================================== + Hits 1150 1274 +124 ``` | [Flag](https://app.codecov.io/gh/metaopt/optree/pull/157/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/metaopt/optree/pull/157/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt) | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.