nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/onnx/onnx_importer.cpp
**Change Type:** modified
**Context:** PR #24765: dnn onnx: add mod

**Code Changes:**
```diff
@@ -2830,6 +2830,11 @@ void ONNXImporter::parseElementWise(LayerParams& layerParams, const opencv_onnx:
 
     layerParams.type = "NaryEltwise";
     layerParams.set("operation", toLowerCase(node_proto.op_type()));
+    if (node_proto.op_type() == "Mod") {
+        if (layerParams.get<int>("fmod", 0)) {
+            layerParams.set("operation", "fmod");
+        };
+    }
 
```

Review comment:
```suggestion if (layerParams.get<int>("fmod", 0)) { ```
**File:** modules/dnn/src/layers/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24765: dnn onnx: add mod

**Code Changes:**
```diff
@@ -24,6 +24,16 @@ namespace cv
 namespace dnn
 {
 
+namespace {
+static int _mod(int x, int y) {
+    int res = x % y;
+    if ((res < 0 && y > 0) || (res > 0 && y < 0)) {
+        res += y;
+    }
```

Review comment:
Maybe `ngraph::op::Convert` can help here?
**File:** modules/dnn/src/layers/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24765: dnn onnx: add mod

**Code Changes:**
```diff
@@ -24,6 +24,16 @@ namespace cv
 namespace dnn
 {
 
+namespace {
+static int _mod(int x, int y) {
+    int res = x % y;
+    if ((res < 0 && y > 0) || (res > 0 && y < 0)) {
+        res += y;
+    }
```

Review comment:
It should work. Let me have a try on this.
**File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -1118,6 +1118,13 @@ CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
  */
 CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
 
+/** @brief Broadcast the given Mat to the given shape.
+ * @param src input array
+ * @param shape target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
+ * @param dst output array that has the given shape
+ */
+CV_EXPORTS_W void broadcast(InputArray src, InputArray shape, OutputArray dst);
```

Review comment:
Please use OpenCV naming conventions. Should be `broadcastTo`
**File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -1118,6 +1118,13 @@ CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
  */
 CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
 
+/** @brief Broadcast the given Mat to the given shape.
+ * @param src input array
+ * @param shape target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
+ * @param dst output array that has the given shape
+ */
+CV_EXPORTS_W void broadcast(InputArray src, InputArray shape, OutputArray dst);
```

Review comment:
> Please use OpenCV naming conventions. Should be broadcastTo Done.
**File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -1118,6 +1118,13 @@ CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
  */
 CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
 
+/** @brief Broadcast the given Mat to the given shape.
+ * @param src input array
+ * @param shape target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
+ * @param dst output array that has the given shape
+ */
+CV_EXPORTS_W void broadcast(InputArray src, InputArray shape, OutputArray dst);
```

Review comment:
``` const std::vector<int>& shape ``` Why does `InputArray` not work here? (at least it could support `std::array<>` too).
**File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -1118,6 +1118,13 @@ CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
  */
 CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
 
+/** @brief Broadcast the given Mat to the given shape.
+ * @param src input array
+ * @param shape target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
+ * @param dst output array that has the given shape
+ */
+CV_EXPORTS_W void broadcast(InputArray src, InputArray shape, OutputArray dst);
```

Review comment:
1. I followed what `transposeND` does: https://github.com/opencv/opencv/blob/3aeaa3402389fc55e53fbc6f5741ca29f51032ee/modules/core/include/opencv2/core.hpp#L1758-L1766 2. `shape` should be a list of intergers and the signature `const std::vector<int>&` helps those who read the document to be aware of that. 3. I would say using `std::array` is minor case. `const std::vector<int>&` satisfies most usages.
**File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -1118,6 +1118,13 @@ CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
  */
 CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
 
+/** @brief Broadcast the given Mat to the given shape.
+ * @param src input array
+ * @param shape target shape. Should be a list of CV_32S numbers. Note that negative values are not supported.
+ * @param dst output array that has the given shape
+ */
+CV_EXPORTS_W void broadcast(InputArray src, InputArray shape, OutputArray dst);
```

Review comment:
int32 -> CV_32S
**File:** modules/core/src/matrix_transform.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -7,6 +7,7 @@
 #include "opencv2/core/detail/dispatch_helper.impl.hpp"
 
 #include <algorithm> // std::swap_ranges
+#include <numeric> // std::accumulate
 
 namespace cv {
 
@@ -857,6 +858,223 @@ void flipND(InputArray _src, OutputArray _dst, int _axis)
     flipNDImpl(dst.ptr(), dst.size.p, dst.step.p, axis);
```

Review comment:
For memory layout `contiguous` is more right wording.
**File:** modules/core/src/matrix_transform.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -7,6 +7,7 @@
 #include "opencv2/core/detail/dispatch_helper.impl.hpp"
 
 #include <algorithm> // std::swap_ranges
+#include <numeric> // std::accumulate
 
 namespace cv {
 
@@ -857,6 +858,223 @@ void flipND(InputArray _src, OutputArray _dst, int _axis)
     flipNDImpl(dst.ptr(), dst.size.p, dst.step.p, axis);
```

Review comment:
`CV_Check(esz, esz == 1 || esz == 2 || esz == 4 || esz == 8, "not supported");` should provide more convenient error message to users.
**File:** modules/core/src/matrix_transform.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast
**Review Line:** 1031

**Code Changes:**
```diff
+                OPENCV_CORE_BROADCAST_LOOP(int32_t);
+            } else if (esz == 8) {
+                OPENCV_CORE_BROADCAST_LOOP(int64_t);
+            } else {
+                CV_Error(cv::Error::StsNotImplemented, "");
+            }
+            #undef OPENCV_CORE_BROADCAST_LOOP
+        }
+    } else {
+        // initial copy (src to dst)
+        std::vector<size_t> step_src{src.step.p, src.step.p + dims_src};
```

Review comment:
``` else { CV_Error(cv::Error::StsNotImplemented, ""); } ``` for sanity check.
**File:** modules/core/test/test_arithm.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -2268,6 +2268,139 @@ INSTANTIATE_TEST_CASE_P(Arithm, FlipND, testing::Combine(
     testing::Values(perf::MatType(CV_8UC1), CV_32FC1)
 ));
 
+TEST(BroadcastTo, basic) {
+    std::vector<int> shape_src{2, 1};
+    std::vector<int> data_src{1, 2};
+    Mat src(static_cast<int>(shape_src.size()), shape_src.data(), CV_32SC1, data_src.data());
+
+    auto get_index = [](const std::vector<int>& shape, size_t cnt) {
```

Review comment:
capture by reference?
**File:** modules/core/test/test_arithm.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -2268,6 +2268,139 @@ INSTANTIATE_TEST_CASE_P(Arithm, FlipND, testing::Combine(
     testing::Values(perf::MatType(CV_8UC1), CV_32FC1)
 ));
 
+TEST(BroadcastTo, basic) {
+    std::vector<int> shape_src{2, 1};
+    std::vector<int> data_src{1, 2};
+    Mat src(static_cast<int>(shape_src.size()), shape_src.data(), CV_32SC1, data_src.data());
+
+    auto get_index = [](const std::vector<int>& shape, size_t cnt) {
```

Review comment:
> 2.f, 2.f, 2.f, 2.f It makes sense to avoid repeated values in input/src
**File:** modules/core/perf/perf_arithm.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -5,8 +5,35 @@ namespace opencv_test
 {
 using namespace perf;
 
+using BroadcastTest = perf::TestBaseWithParam<std::tuple<std::vector<int>, perf::MatType, std::vector<int>>>;
 typedef Size_MatType BinaryOpTest;
 
+PERF_TEST_P_(BroadcastTest, basic)
+{
+    std::vector<int> shape_src = get<0>(GetParam());
```

Review comment:
Please ensure that samples are less that 10ms on modern systems (avoid large test).
**File:** modules/core/perf/perf_arithm.cpp
**Change Type:** modified
**Context:** PR #23965: core: add broadcast

**Code Changes:**
```diff
@@ -5,8 +5,35 @@ namespace opencv_test
 {
 using namespace perf;
 
+using BroadcastTest = perf::TestBaseWithParam<std::tuple<std::vector<int>, perf::MatType, std::vector<int>>>;
 typedef Size_MatType BinaryOpTest;
 
+PERF_TEST_P_(BroadcastTest, basic)
+{
+    std::vector<int> shape_src = get<0>(GetParam());
```

Review comment:
Done. Scale down to target scale {10, 100, 1000}, which takes <10ms on my M1 mac.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding
**Review Line:** 459

**Code Changes:**
```diff
@@ -456,7 +456,7 @@ OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support"
 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
   VISIBLE_IF TRUE
   VERIFY HAVE_IMGCODEC_PFM)
-OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
+OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" OFF
   VISIBLE_IF TRUE
   VERIFY HAVE_QUIRC)
 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
```

Review comment:
Shall I remove Quirc completely in this PR or it make sense to keep together for a while at least for test purpose?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding
**Review Line:** 459

**Code Changes:**
```diff
@@ -456,7 +456,7 @@ OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support"
 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
   VISIBLE_IF TRUE
   VERIFY HAVE_IMGCODEC_PFM)
-OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
+OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" OFF
   VISIBLE_IF TRUE
   VERIFY HAVE_QUIRC)
 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
```

Review comment:
I think we can keep it for a while.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
Can the `corrected` varaible cause data race?
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
Similar issue with `codewords`, does it support concurrent modification?
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
Moved copy outside of `parallel_for_`
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding
**Review Line:** 459

**Code Changes:**
```diff
@@ -456,7 +456,7 @@ OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support"
 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
   VISIBLE_IF TRUE
   VERIFY HAVE_IMGCODEC_PFM)
-OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
+OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" OFF
   VISIBLE_IF TRUE
   VERIFY HAVE_QUIRC)
 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
```

Review comment:
As all the tests passed on CI, I restored default value to make sure nothing break on the release
**File:** modules/objdetect/test/test_qrcode_encode.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -118,9 +118,7 @@ TEST(Objdetect_QRCode_Encode, generate_test_data)
         }
 
         std::string decoded_info = "";
-#ifdef HAVE_QUIRC
         EXPECT_TRUE(decodeQRCode(resized_src, corners, decoded_info, straight_barcode)) << "The QR code cannot be decoded: " << image_path;
-#endif
         file_config << "info" << decoded_info;
         file_config << "}";
     }
```

Review comment:
I propose to implement it as parameterized test. In case of failure the case is visible in logs.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
please add reference to the constant origin or how it was generated.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
You can use `cv::Hamming::operator()` from core for this, but need to drop the last bin in input, because `MAX_FORMAT_LENGTH=15`
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** modified
**Context:** PR #24299: In-house QR codes decoding

**Code Changes:**
```diff
@@ -6,6 +6,8 @@
 
 #include "precomp.hpp"
 #include "qrcode_encoder_table.inl.hpp"
+#include "graphical_code_detector_impl.hpp"
+
 namespace cv
 {
 using std::vector;
@@ -19,6 +21,7 @@ const uint8_t INVALID_REGION_VALUE = 110;
```

Review comment:
This is a mask similar to https://github.com/opencv/opencv/blob/2c1ec4245dc793153c50fcbd255863dd1382c961/modules/objdetect/src/qrcode_encoder.cpp#L435.
**File:** modules/dnn/test/test_backends.cpp
**Change Type:** modified
**Context:** PR #24283: dnn: merge tests from test_halide_layers to test_backends
**Review Line:** 1035

**Code Changes:**
```diff
+        l1 = 0.015;
+
+    testLayer(lp, input, backendId, targetId, false, l1, lInf);
+}
+
+INSTANTIATE_TEST_CASE_P(Layer_Test_Backends, FullyConnected, testing::Combine(
+/*batch*/        testing::Values(1, 2, 4, 8, 16),
+/*in channels*/  testing::Values(3, 4),
+/*in size*/      testing::Values(Size(5, 4), Size(4, 5), Size(1, 1)),
+/*out channels*/ testing::Values(3, 4),
+/*has bias*/     testing::Bool(),
```

Review comment:
I took a look on the recent changes on this file, and it looks like the `FullyConnected.Accuracy` is the only test case that got updated.
**File:** modules/dnn/test/test_backends.cpp
**Change Type:** modified
**Context:** PR #24283: dnn: merge tests from test_halide_layers to test_backends
**Review Line:** 1035

**Code Changes:**
```diff
+        l1 = 0.015;
+
+    testLayer(lp, input, backendId, targetId, false, l1, lInf);
+}
+
+INSTANTIATE_TEST_CASE_P(Layer_Test_Backends, FullyConnected, testing::Combine(
+/*batch*/        testing::Values(1, 2, 4, 8, 16),
+/*in channels*/  testing::Values(3, 4),
+/*in size*/      testing::Values(Size(5, 4), Size(4, 5), Size(1, 1)),
+/*out channels*/ testing::Values(3, 4),
+/*has bias*/     testing::Bool(),
```

Review comment:
All tests are green now.
**File:** platforms/android/build_static_aar.py
**Change Type:** modified
**Context:** PR #24554: Android AAR package build and test with CI
**Review Line:** 235

**Code Changes:**
```diff
     opencv_libs = get_list_of_opencv_libs(sdk_dir)
     external_libs = get_list_of_3rdparty_libs(sdk_dir, abis)
 
@@ -224,6 +234,8 @@ def main(args):
     parser.add_argument('--android_min_sdk', default="21")
     parser.add_argument('--android_target_sdk', default="26")
     parser.add_argument('--java_version', default="1_8")
+    parser.add_argument('--ndk_location', default="")
+    parser.add_argument('--cmake_location', default="")
     args = parser.parse_args()
 
```

Review comment:
Maybe? ```suggestion parser.add_argument('--android_target_sdk', default="31") ``` It would be really good to combine these two scripts into one to reduce duplication.
**File:** samples/android/tutorial-3-cameracontrol/build.gradle.in
**Change Type:** modified
**Context:** PR #24554: Android AAR package build and test with CI

**Code Changes:**
```diff
@@ -29,8 +29,10 @@ android {
 dependencies {
     //implementation fileTree(dir: 'libs', include: ['*.jar'])
     if (gradle.opencv_source == "sdk_path") {
+        println 'Using OpenCV from SDK'
         implementation project(':opencv')
     } else if (gradle.opencv_source == "maven_local" || gradle.opencv_source == "maven_cenral") {
+        println 'Using OpenCV from Maven repo'
         implementation 'org.opencv:opencv:@OPENCV_VERSION_PLAIN@'
     }
```

Review comment:
I like "Using OpenCV from ..." line used in `tutorial-2-mixedprocessing/jni/CMakeLists.txt` more :slightly_smiling_face:
**File:** modules/dnn/test/test_tflite_importer.cpp
**Change Type:** modified
**Context:** PR #24196: Use ngraph::Output in OpenVINO backend wrapper
**Review Line:** 162

**Code Changes:**
```diff
-    else {
-        net.forward(outs, {"p_re_lu_1", "max_pooling_with_argmax2d", "conv2d_86", "max_unpooling2d_2"});
-    }
+    net.forward(outs, {"p_re_lu_1", "max_pooling_with_argmax2d", "conv2d_86", "max_unpooling2d_2"});
 
     ASSERT_EQ(outs.size(), 4);
     ASSERT_EQ(outs[0].size(), 1);
```

Review comment:
"conv2d_transpose_4" is missing for IE backend.
**File:** modules/dnn/test/test_tflite_importer.cpp
**Change Type:** modified
**Context:** PR #24196: Use ngraph::Output in OpenVINO backend wrapper
**Review Line:** 162

**Code Changes:**
```diff
-    else {
-        net.forward(outs, {"p_re_lu_1", "max_pooling_with_argmax2d", "conv2d_86", "max_unpooling2d_2"});
-    }
+    net.forward(outs, {"p_re_lu_1", "max_pooling_with_argmax2d", "conv2d_86", "max_unpooling2d_2"});
 
     ASSERT_EQ(outs.size(), 4);
     ASSERT_EQ(outs[0].size(), 1);
```

Review comment:
`conv2d_transpose_4` is not used in this test. It's removed by the next line to resolve OpenVINO bug which was fixed in this PR.
**File:** platforms/android/build_java_shared_aar.py
**Change Type:** added
**Context:** PR #24456: Added scripts for creating an AAR package and a local Maven repository with OpenCV library - Added scripts for creating an AAR package and ...
**Review Line:** 1

**Code Changes:**
```diff
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+
+import argparse
+from os import path
+import os
+import re
```

Review comment:
```suggestion #!/usr/bin/env python3 ``` I'd suggest using _pathlib_ for all path/file related operations (https://docs.python.org/3.8/library/pathlib.html#correspondence-to-tools-in-the-os-module). We support python 3.8+, do we?
**File:** platforms/android/build_static_aar.py
**Change Type:** added
**Context:** PR #24456: Added scripts for creating an AAR package and a local Maven repository with OpenCV library - Added scripts for creating an AAR package and ...
**Review Line:** 1

**Code Changes:**
```diff
@@ -0,0 +1,229 @@
+#!/usr/bin/env python
+
+import argparse
+import json
+from os import path
+import os
```

Review comment:
At first glance this file seem to repeat `build_java_shared_aar.py` in many aspects, is it possible to join these files into a single script with `--static/--dynamic` flag?
**File:** modules/dnn/src/layers/einsum_layer.cpp
**Change Type:** modified
**Context:** PR #24322: Ellipses supported added for Einsum Layer

**Code Changes:**
```diff
@@ -32,16 +32,15 @@ static bool IsTransposeReshapeForEinsum(const std::vector<size_t>& perm,
     return true;
 }
 
-Mat batchwiseMatMul(
+static Mat batchwiseMatMul(
     const Mat& input1,
     const MatShape& input1ShapeOverride,
     const Mat& input2,
     const MatShape& input2ShapeOverride)
```

Review comment:
``` int first_dim = std::min(dim1, dim2); int second_dim = std::max(dim1, dim2); ```
**File:** modules/dnn/src/layers/einsum_layer.cpp
**Change Type:** modified
**Context:** PR #24322: Ellipses supported added for Einsum Layer

**Code Changes:**
```diff
@@ -32,16 +32,15 @@ static bool IsTransposeReshapeForEinsum(const std::vector<size_t>& perm,
     return true;
 }
 
-Mat batchwiseMatMul(
+static Mat batchwiseMatMul(
     const Mat& input1,
     const MatShape& input1ShapeOverride,
     const Mat& input2,
     const MatShape& input2ShapeOverride)
```

Review comment:
most probably int64_t is redundant.
**File:** modules/dnn/src/layers/einsum_layer.cpp
**Change Type:** modified
**Context:** PR #24322: Ellipses supported added for Einsum Layer
**Review Line:** 674

**Code Changes:**
```diff
@@ -32,16 +32,15 @@ static bool IsTransposeReshapeForEinsum(const std::vector<size_t>& perm,
     return true;
 }
 
-Mat batchwiseMatMul(
+static Mat batchwiseMatMul(
     const Mat& input1,
     const MatShape& input1ShapeOverride,
     const Mat& input2,
     const MatShape& input2ShapeOverride)
 {
 
     // Sanity checks before the actual MatMul
-    //input_1.DataType() == input_2.DataType(), "Data types of the inputs must match for MatMul");
-
```

Review comment:
The function still does nothing, but check state. It does not much the function name.
**File:** modules/dnn/src/layers/einsum_layer.cpp
**Change Type:** modified
**Context:** PR #24322: Ellipses supported added for Einsum Layer
**Review Line:** 211

**Code Changes:**
```diff
+template <typename T>
+Mat DiagonalDataAssignment(Mat input) {
+
+    int rank = input.dims;
+    CV_Assert(rank >= 2);
+    CV_Assert(input.size[rank - 1] == input.size[rank - 2]);
+    MatShape original_dims = shape(input);
+
+    if (rank > 3){
+        //reshape to 3D mat
+        int collapsed_size = 1;
```

Review comment:
I propose to add `CV_Assert(rank >=2);`
**File:** modules/dnn/src/layers/einsum_layer.cpp
**Change Type:** modified
**Context:** PR #24322: Ellipses supported added for Einsum Layer

**Code Changes:**
```diff
@@ -32,16 +32,15 @@ static bool IsTransposeReshapeForEinsum(const std::vector<size_t>& perm,
     return true;
 }
 
-Mat batchwiseMatMul(
+static Mat batchwiseMatMul(
     const Mat& input1,
     const MatShape& input1ShapeOverride,
     const Mat& input2,
     const MatShape& input2ShapeOverride)
```

Review comment:
Word is missing in the message.