Skip to content

Restore match template for newer IPP and ICV packages - #4

Merged
andreyfe1 merged 1 commit into
4.xfrom
andreyfe1/restore_match_template
Aug 28, 2026
Merged

andreyfe1 merged 1 commit into
4.xfrom
andreyfe1/restore_match_template

Conversation

@andreyfe1

@andreyfe1 andreyfe1 commented Aug 11, 2026 •

Copy link
Copy Markdown

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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@andreyfe1
andreyfe1 requested a review from victorget August 11, 2026 16:53
@andreyfe1
andreyfe1 merged commit f63983d into 4.x Aug 28, 2026
7 of 30 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants