onnxruntime
a894893f - Address MaxUnpool shortcomings msrc116345 (#28550)

Commit
62 days ago
Address MaxUnpool shortcomings msrc116345 (#28550) This pull request enhances the robustness of the `MaxUnpool` operator in ONNX Runtime by adding additional input validation and expanding test coverage for invalid input scenarios. The changes improve error handling for mismatched shapes, invalid dimensions, and other edge cases, ensuring the operator fails gracefully and predictably when given incorrect inputs. **Operator input validation improvements:** * Added runtime checks in `MaxUnpool::Compute` to ensure the `kernel_shape` rank matches the expected pooling dimensions, and that the indices tensor is present and correctly shaped. * Added validation to ensure that computed output dimensions are positive, with descriptive error messages if not. * Enforced that the `output_shape` tensor, if provided, must have the same number of elements as the rank of the input tensor. **Test coverage enhancements:** * Introduced multiple new tests in `unpool_op_test.cc` to cover invalid input cases, including mismatched indices shapes, rank-0 and rank-2 input tensors, negative indices, and incorrect `output_shape` element counts. These tests confirm that the operator fails with appropriate error messages in these scenarios. **References** https://github.com/onnx/onnx/pull/7997 https://github.com/microsoft/onnxruntime/pull/28524
Author
Parents
Loading