onnxruntime
a9c73342 - Validate initializers before shape propagation (#32653)

Commit
50 days ago
Validate initializers before shape propagation (#32653) This pull request introduces a validation step to ensure that embedded tensor initializers have data sizes matching their declared shapes before shape propagation occurs. Additionally, a new unit test is added to verify that malformed initializers are correctly rejected. These changes help prevent silent errors during shape inference caused by invalid initializer data. Validation improvements for tensor initializers: * Added a check in `graph.cc` to validate the data size and shape of embedded (non-external) tensor initializers using `utils::ValidateEmbeddedTensorProtoDataSizeAndShape` before using them in shape propagation. Testing for malformed initializers: * Introduced a new test in `shape_inference_test.cc` (`ShapeInferenceDataPropagationTest.RejectsMalformedInitializerBeforeUnpacking`) to verify that the graph resolution fails with an appropriate error message when an initializer's data field count does not match the expected shape.
Author
Parents
Loading