Skip to content

[ez] Expose FOLDED_FROM_KEY to onnxscript.optimizer public API#2773

Merged
justinchuby merged 2 commits into
mainfrom
copilot/expose-folded-from-key
Jan 20, 2026
Merged

[ez] Expose FOLDED_FROM_KEY to onnxscript.optimizer public API#2773
justinchuby merged 2 commits into
mainfrom
copilot/expose-folded-from-key

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 16, 2026

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

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.

Original prompt

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)


💡 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 in the docs.

Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Copilot AI changed the title [WIP] Expose FOLDED_FROM_KEY to onnxscript.optimizer Expose FOLDED_FROM_KEY to onnxscript.optimizer public API Jan 16, 2026
Copilot AI requested a review from justinchuby January 16, 2026 22:42
@justinchuby justinchuby marked this pull request as ready for review January 16, 2026 23:12
@justinchuby justinchuby changed the title Expose FOLDED_FROM_KEY to onnxscript.optimizer public API [ez] Expose FOLDED_FROM_KEY to onnxscript.optimizer public API Jan 16, 2026
@justinchuby justinchuby added topic: api merge at lgtm Reviewers can merge when they approve labels Jan 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.46%. Comparing base (e45724c) to head (c17e046).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2773   +/-   ##
=======================================
  Coverage   70.45%   70.46%           
=======================================
  Files         228      228           
  Lines       27252    27256    +4     
  Branches     2759     2759           
=======================================
+ Hits        19201    19205    +4     
  Misses       7099     7099           
  Partials      952      952           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justinchuby justinchuby enabled auto-merge (squash) January 17, 2026 00:22
@justinchuby justinchuby merged commit 5db32c0 into main Jan 20, 2026
54 of 58 checks passed
@justinchuby justinchuby deleted the copilot/expose-folded-from-key branch January 20, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge at lgtm Reviewers can merge when they approve topic: api

Projects

Development

Successfully merging this pull request may close these issues.

Expose FOLDED_FROM_KEY to public

3 participants