onnxruntime
68aa29c5 - Validate FastGelu fusion scale node (#32016)

Commit
88 days ago
Validate FastGelu fusion scale node (#32016) This pull request improves the robustness of the FastGelu fusion optimization by ensuring malformed nodes are properly skipped and adds a test to verify this behavior. The main changes include stricter input validation in the fusion logic and a new unit test. **Fusion logic improvements:** * Added explicit checks for the number of inputs (`InputDefs().size()`) in `Mul` and `Pow` nodes within the `FastGeluFusion` optimizer to ensure only well-formed nodes are considered for fusion. [[1]](diffhunk://#diff-8f18e5c2ad33a6cc11a340f2c0ff3ce5ad63beed1dcc31ea49f1ff409ef030c9R39) [[2]](diffhunk://#diff-8f18e5c2ad33a6cc11a340f2c0ff3ce5ad63beed1dcc31ea49f1ff409ef030c9L89-R91) [[3]](diffhunk://#diff-8f18e5c2ad33a6cc11a340f2c0ff3ce5ad63beed1dcc31ea49f1ff409ef030c9R119) **Testing enhancements:** * Introduced a new test, `FastGeluFusionSkipsMalformedScaleMul`, that modifies a model to create a malformed `Mul` node and verifies that the fusion optimizer correctly skips it (i.e., does not produce a `FastGelu` node).
Author
Parents
Loading