Skip to content

Conversation

@justinchuby
Copy link
Collaborator

When Identity fails to merge shapes, allow the constant folder to proceed by ignoring the conflicting shape. Also improve error message to show node information if constant folding fails.

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling and debugging capabilities in the constant folding optimizer. The changes add better error messages and exception handling to make debugging easier when constant folding operations fail.

  • Adds try-catch block around shape merging in Identity node processing with detailed warning messages
  • Enhances error message in _merge_shapes to include actual shape values when rank mismatch occurs
  • Wraps optimizer calls in try-catch to provide better context when constant folding fails
  • Fixes logging inconsistency by passing node object instead of node.name

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.43%. Comparing base (8a7de40) to head (c749a55).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnxscript/optimizer/_constant_folding.py 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2670      +/-   ##
==========================================
- Coverage   70.43%   70.43%   -0.01%     
==========================================
  Files         224      224              
  Lines       26765    26771       +6     
  Branches     2680     2680              
==========================================
+ Hits        18853    18855       +2     
- Misses       6981     6985       +4     
  Partials      931      931              

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

@justinchuby justinchuby merged commit 9b699ae into main Oct 31, 2025
39 checks passed
@justinchuby justinchuby deleted the justinchu/shape-inf branch October 31, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants