Repository navigation
Restore match template for newer IPP and ICV packages - #4
Merged
Merged
Conversation
victorget
approved these changes
Aug 19, 2026
andreyfe1
pushed a commit
that referenced
this pull request
Oct 13, 2026
The layer never read input #4, so a node with sequence_lens ran every batch entry to the end of the padded sequence: Y was not zero-padded past each entry's own length, and Y_h was the state after the whole sequence instead of the one that entry finished with. RNN2 is the only recurrent layer that implemented it. Take RNN2's semantics, which are the spec's: an entry stops updating once it reaches its length, keeping the state it finished with, and contributes zeros to Y from there on. That also holds for a lone reverse direction, where the scan starts at the last timestep but the valid range still ends at each entry's own length. Checked against ONNX Runtime 1.30 (CPU): GRU with sequence_lens - forward, reverse and bidirectionally, with and without linear_before_reset, with initial h and with fewer entries than the batch - agrees to 6e-8 - 1.9e-7 after the change (it was 0.2 - 0.9 off before). The new Layer_GRU_Test_Accuracy_.SequenceLens covers a sample at full length, a truncated one and an empty one, and fails on Y and Y_h without the patch. The ONNX conformance suite does not cover this: its test_gru_seq_length and test_rnn_seq_length cases are named for a longer test sequence but carry no sequence_lens input at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restore match template functionality that was switched off in opencv#29096
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.