[Core] Add correctness tests for SpaceToDepth and MobileClip Attention fusion#28168
[Core] Add correctness tests for SpaceToDepth and MobileClip Attention fusion#28168hariharans29 merged 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades existing optimizer fusion tests to validate semantic correctness (fused vs. unfused outputs), not just that the fusion pattern triggered. It targets the SpaceToDepth fusion and the MobileClip Attention fusion added in prior PRs.
Changes:
- Convert SpaceToDepth fusion tests from
TestGraphTransformergraph-structure-only checks toTransformerTesteroutput comparisons plus transformed-graph assertions. - Convert MobileClip Attention fusion tests to
TransformerTesterfor correctness verification on CPU and CUDA (when available). - Add small adapter helpers to run existing
Status-based graph validators fromTransformerTester’svoid(InferenceSessionWrapper&)callback.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tianleiwu
left a comment
There was a problem hiding this comment.
Reviewed the updated fusion tests against the current head.
The switch to TransformerTester improves these cases by checking unfused-vs-fused output equivalence while still asserting the expected transformed graph shape. I also checked the CUDA path carefully, and the new session-based flow is consistent with the current MobileCLIP fusion logic for unassigned nodes before partitioning.
I did not find any actionable issues in the current patch.
Description
Add correctness tests for fusions introduced in #27883 and #27747. The tests introduced in those PRs only check if fusion went through but not if the fused nodes produced semantically right results as the unfused subgraphs. Adding those tests to prevent accidental breakage in case something changed in the fused node's backing kernel implementation.
Motivation and Context
Adress test coverage gap