From 3c712cf77dc96c59b6df9d8415c43ab13e70213c Mon Sep 17 00:00:00 2001 From: Laurent Berger Date: Tue, 27 Feb 2024 12:15:11 +0100 Subject: [PATCH] Merge pull request #25100 from LaurentBerger:I25077 Fix issue #25077 #25100 Fixes https://github.com/opencv/opencv/issues/25077 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] 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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- modules/dnn/src/layers/einsum_layer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/dnn/src/layers/einsum_layer.cpp b/modules/dnn/src/layers/einsum_layer.cpp index 6faaae7ae2..7f8eb47112 100644 --- a/modules/dnn/src/layers/einsum_layer.cpp +++ b/modules/dnn/src/layers/einsum_layer.cpp @@ -547,7 +547,7 @@ public: MatShape realOutputDims = shape(result); size_t realProd = std::accumulate(realOutputDims.begin(), realOutputDims.end(), 1, std::multiplies()); - CV_CheckEQ(reqProd, realProd, "Real output can not be shaped in to requred output"); + CV_CheckEQ(reqProd, realProd, "Real output can not be shaped in to required output"); // reduce dimentions result = result.reshape(1, einsumOutDims.size(), einsumOutDims.data()); @@ -1280,11 +1280,12 @@ Mat LayerEinsumImpl::pairwiseOperandProcess( // Covered by ExplicitEinsumAsTensorContractionReshapeFinal. output = output.reshape(1, reshaped_dims.size(), reshaped_dims.data()); } - } else { - output = Transpose( - output, - outputDims, - outputPermutation); + else { + output = Transpose( + output, + outputDims, + outputPermutation); + } } } else { // This is the final pair - Transpose directly to the output ordering required and copy the contents to the op's output // not sure if this finalize shape is needed at all