Commit 5db32c0
[ez] Expose FOLDED_FROM_KEY to onnxscript.optimizer public API (#2773)
The `FOLDED_FROM_KEY` constant was previously only accessible from the
private `_constant_folding` module, making it difficult for users to
interact with constant folding metadata.
## Changes
- Exported `FOLDED_FROM_KEY` in `onnxscript/optimizer/__init__.py` by
adding it to `__all__` and importing from `_constant_folding`
- Added test coverage to ensure the constant remains publicly accessible
## Usage
```python
from onnxscript.optimizer import FOLDED_FROM_KEY
# Use the key to access metadata about folded constants
folded_values = output.meta.get(FOLDED_FROM_KEY, set())
```
The constant value is `"pkg.onnxscript.optimizer.folded_from"`, used to
track which values were folded during constant folding optimization.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Expose FOLDED_FROM_KEY to public</issue_title>
> <issue_description>Expose FOLDED_FROM_KEY to onnxscript.optimizer for
public consumption.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #2772
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>1 parent e45724c commit 5db32c0
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
0 commit comments