onnxruntime
3d3cfa6c - Fix Whisper encoder input diagnostic (#32037)

Commit
2 days ago
Fix Whisper encoder input diagnostic (#32037) This pull request introduces a small refactor to the Whisper encoder subgraph validation logic and adds a new unit test to improve code clarity and test coverage. The main changes are the extraction of input name validation into a dedicated function and the addition of a test to check for invalid input names. **Refactoring and validation improvements:** * Extracted the input name validation logic from `WhisperEncoderSubgraph::Validate` into a new helper function `ValidateWhisperEncoderInputNames` in `subgraph_whisper_encoder.cc` and declared it in the header file `subgraph_whisper_encoder.h` for improved code reuse and readability. [[1]](diffhunk://#diff-1c7fc3b879a5909572c7a602415544b6b8a37c15efdec3b1b417bdb3dc47a491R17-R24) [[2]](diffhunk://#diff-ca786f63a9d798e56cbc0905436e0c7c675e30d2a88144f77721ecbdff1d329cR13-R14) * Updated `WhisperEncoderSubgraph::Validate` to use the new `ValidateWhisperEncoderInputNames` function, simplifying the validation code and fixing an error in the previous input name check for the decoder input. **Testing improvements:** * Added a new unit test `WhisperEncoderSubgraphTest.ReportsInvalidSecondInputName` in `beam_search_test.cc` to verify that the validation function correctly reports an error when the decoder input name is incorrect. This increases test coverage for the new validation logic. [[1]](diffhunk://#diff-782b3e352d8957cd1226d1b87f2127c58efd5ba7a6472528afbdd6baa8232198R6) [[2]](diffhunk://#diff-782b3e352d8957cd1226d1b87f2127c58efd5ba7a6472528afbdd6baa8232198R16) [[3]](diffhunk://#diff-782b3e352d8957cd1226d1b87f2127c58efd5ba7a6472528afbdd6baa8232198R27-R36)
Author
Parents
Loading