Add boundary checks for input validation

Merged
AP
5mo ago
+6-0

This pull request introduces an important input validation in the multihead_attention_helper.h file to ensure the integrity of the past_sequence_length parameter. The main change is an additional check that validates the value of past_sequence_length to prevent invalid or out-of-bounds values.

Input validation improvements:

  • Added a check to ensure that past_sequence_length is non-negative and less than max_sequence_length, returning an error status if the condition is not met in Status CheckPast in onnxruntime/contrib_ops/cpu/bert/multihead_attention_helper.h.