onnxruntime
5135b607 - Validate LayerNormalization axis bounds (#32555)

Commit
4 days ago
Validate LayerNormalization axis bounds (#32555) This pull request addresses validation and testing improvements for the `LayerNormalization` operator, specifically handling invalid axis values. The main change ensures that the operator correctly detects and reports an error when the `axis` attribute exceeds the input tensor's rank. Additionally, a new unit test is added to verify this behavior. **Validation logic update:** * Updated the axis validation in `onnx/defs/nn/defs.cc` to check if `axis` is less than 0 or greater than or equal to the input tensor rank, and to fail shape inference with an appropriate error message if so. **Unit testing:** * Added a new test case `LayerNorm_AxisExceedsRank` in `onnxruntime/test/contrib_ops/layer_norm_op_test.cc` to ensure that providing an out-of-bounds axis value results in a failure with the expected error message.
Author
Parents
Loading