-
Notifications
You must be signed in to change notification settings - Fork 97
Cleanup elimination of redundant scatter-nd: consolidate rules and improve organization #2426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: gramalingam <[email protected]>
Copilot
AI
changed the title
[WIP] Cleanup elimination of redundant scatter-nd
Cleanup elimination of redundant scatter-nd: consolidate rules and improve organization
Jun 30, 2025
justinchuby
approved these changes
Jun 30, 2025
gramalingam
approved these changes
Jun 30, 2025
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
titaiwangms
reviewed
Jun 30, 2025
Collaborator
|
Run lintrunner |
Co-authored-by: justinchuby <[email protected]>
Contributor
Author
Fixed all linting issues - removed trailing whitespace, added type ignore for import, and applied formatting fixes. Commit: 6c1c151 |
justinchuby
reviewed
Jul 1, 2025
gramalingam
approved these changes
Jul 1, 2025
titaiwangms
approved these changes
Jul 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR consolidates redundant ScatterND elimination logic into a dedicated module and improves code organization as requested in the issue.
Changes Made
1. Moved redundant ScatterND rule from
collapse_slices.pytoredundant_scatter_nd.py_potential_redundant_scatternd,_identity_to_updates, and_check_if_redundant_scatterndfunctionsScatterAllStaticrule for consistency with existing patternscollapse_slices.pyrules list2. Distinguished between static vs dynamic scenarios with clear naming:
ScatterAllDynamic(renamed fromScatterAll): Handles cases where indices are constructed dynamically using Range operations but axis dimension is statically knownScatterAllStatic(new): Handles cases where indices are statically known constants in form[[0], [1], ..., [n-1]]3. Moved corresponding test case from
collapse_slices_test.pytoredundant_scatter_nd_test.pytest_redundant_scatter_nd_static_indicesfor claritytest_redundant_scatter_nd_dynamic_indices4. Updated documentation to clearly explain both rules and their use cases
Key Benefits
Verification
All tests pass, including:
The changes maintain full backward compatibility while improving code organization and clarity.
Fixes #2425.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.