Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed out-of-bound access in Einsum layer for 0d #25617

Merged
merged 1 commit into from
May 22, 2024

Conversation

Abdurrahheem
Copy link
Contributor

This PR fixes Einsum layer 0D failure case for Openvino backend

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

@Abdurrahheem Abdurrahheem added this to the 5.0 milestone May 22, 2024
@Abdurrahheem Abdurrahheem self-assigned this May 22, 2024
@@ -541,7 +541,7 @@ class LayerEinsumImpl CV_FINAL : public EinsumLayer
// Use either the preprocessed inputs (if it is available) or the corresponding raw inputs
result = pairwiseOperandProcess(!result.empty() ? result : rawInputs[0],
!result.empty() ? tmpResult : homogenizedInputDims[0],
!preProcessedInputs[input].empty() ? preProcessedInputs[input] : rawInputs[input],
(!preProcessedInputs.empty() && !preProcessedInputs[input].empty()) ? preProcessedInputs[input] : rawInputs[input],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are not in OpenVINO part. How problem is reproduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before these changes, 0D test case would fail on OpenCV build with the openvino 2024 backend. @asmorkalov noticed it on his testing units.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it fails not only on OpenVINO backend because of access to 0th element from empty vector. Just reproduced on OV backend. So I suggest rename a PR, because the change is generic.

@asmorkalov asmorkalov changed the title Fixes for Einsum layer on OpenVino backend Fixed out-of-bound access in Einsum layer for 0d May 22, 2024
@asmorkalov asmorkalov marked this pull request as ready for review May 22, 2024 09:37
@asmorkalov asmorkalov merged commit 5bc450d into opencv:5.x May 22, 2024
24 of 25 checks passed
@asmorkalov asmorkalov assigned dkurt and unassigned Abdurrahheem May 22, 2024
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.

None yet

3 participants