onnxruntime
a29da166 - Validate SkipLayerNorm prepacked lengths (#31676)

Commit
31 days ago
Validate SkipLayerNorm prepacked lengths (#31676) This pull request improves the robustness and correctness of the `SkipLayerNorm` operator in ONNX Runtime by adding stricter validation of prepacked tensor sizes and enhancing test coverage for these checks. The changes ensure that mismatches in tensor dimensions are detected early, preventing potential runtime errors. **Validation and Error Checking Enhancements:** * Added explicit size validation for prepacked tensors (`skip`, `gamma`, `beta`, `bias`) in `SkipLayerNorm::Compute`, ensuring their lengths match the expected `hidden_size` and providing clear error messages when mismatches occur. * Introduced new member variables to track the sizes of prepacked `gamma`, `beta`, and `bias` tensors, and updated their management in the constructor and `PrePack` method. [[1]](diffhunk://#diff-efe341d72f1c3c6bf27021372beaeb3f0dee45cff488d5f2917a1a9ad2219375R117-R119) [[2]](diffhunk://#diff-2b3c9f0e42906b33f0eba5c151270bd7c7f89ab6f80729f5af16ca3bf4d49482R25-R27) [[3]](diffhunk://#diff-efe341d72f1c3c6bf27021372beaeb3f0dee45cff488d5f2917a1a9ad2219375R291-R305) **Testing Improvements:** * Added two new unit tests to verify that the operator correctly rejects prepacked tensors with incorrect sizes for `gamma` and `skip`, confirming that the new validation logic works as intended. Co-authored-by: Copilot <223556219@users.noreply.github.com>
Author
Parents
Loading