nareshmlx/opencv-pr huggingface dataset:
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
Actually, I've just done more reading, and in fact all pointer overflows are undefined behaviour, both signed and unsigned: https://wdtz.org/catching-pointer-overflow-bugs.html https://blog.regehr.org/archives/1395 Unsigned overflow is only well-defined for *integers*, not *pointers*. Here's a simple case: ```c++ #include <cstdint> #include <new> #include <iostream> #include <cassert> int main() { int* ptrStart = new int (1024); std::cout << "ptr start = " << (void*)ptrStart << "\n"; int* ptrEnd = ptrStart + 1024 * sizeof(int); std::cout << "ptr end = " << (void*)ptrEnd << "\n"; int* ptr = ptrStart + 512; // still inside std::cout << "ptr offset = " << (void*)ptr << "\n"; assert(ptr >= ptrStart); assert(ptr < ptrEnd); ptr += UINT64_MAX; // undefined std::cout << "ptr wrap = " << (void*)ptr << "\n"; assert(ptr >= ptrStart); assert(ptr < ptrEnd); return 0; } ``` when run: ``` % clang++ -fsanitize=pointer-overflow test.cxx; ./a.out ptr start = 0x600002d00040 ptr end = 0x600002d04040 ptr offset = 0x600002d00840 test.cxx:20:9: runtime error: addition of unsigned offset to 0x600002d00840 overflowed to 0x600002d0083c SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.cxx:20:9 in ptr wrap = 0x600002d0083c ``` So in fact this should not be suppressed, it should be fixed.
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
So I've changed this PR back to my original change (with a branch added). I've also done performance measurements and this function does not appear to be in a performance critical path, at least with my usage of it. I'm measuring the time to do: ```c++ cv::filter2D(region, imageDerivativeX, CV_64F, kernelX); cv::filter2D(region, imageDerivativeY, CV_64F, kernelY); ``` With OpenCV 4.6 built as release, it takes 118 µs on average (measured on about 2000 calls). With this PR (with the branch added) it takes 104 µs on average. That's within error bars I'd guess. I also checked with a profiler and 99% of `FilterEngine__apply` runtime is spent in its call to `FilterEngine__proceed`.
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
1. Use `ssize_t` cast to make signed arithmetic. 2. There is no ANY overflow anymore. 3. Profit. ```.diff -ptr += UINT64_MAX; // undefined +size_t step = 4; +int y = -1; +ptr += y * (ssize_t)step; ```
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
Finally, suppression should not be necessary at all.
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
we have tons of such code in OpenCV; are we going to refactor all of it?
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
Yes, we should. It's a bug. Pointer overflow is disallowed by C++. I only use a few OpenCV classes, but I have not encountered any other such overflows in my own use. Are you sure there are so many really?
**File:** modules/imgproc/src/filter.simd.hpp
**Change Type:** modified
**Context:** PR #23567: Reformulated some pointer arithmetic to avoid (unsigned) overflow - Although unsigned overflow is well-defined by the C++ standard, it is o...

**Code Changes:**
```diff
@@ -44,6 +44,8 @@
 #include "opencv2/core/hal/intrin.hpp"
 #include "filter.hpp"
 
+#include <cstddef>
+
 #if defined(CV_CPU_BASELINE_MODE)
 #if IPP_VERSION_X100 >= 710
 #define USE_IPP_SEP_FILTERS 1
@@ -304,7 +306,7 @@ void FilterEngine__apply(FilterEngine& this_, const Mat& src, Mat& dst, const Si
```

Review comment:
Just `src.ptr() + y * (ptrdiff_t)src.step` should be enough.
**File:** modules/dnn/src/int8layers/softmax_layer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn

**Code Changes:**
```diff
@@ -22,15 +22,29 @@ class SoftMaxLayerInt8Impl CV_FINAL : public SoftmaxLayerInt8
 
     SoftMaxLayerInt8Impl(const LayerParams& params)
     {
-        axisRaw = params.get<int>("axis", 1);
+        setParamsFrom(params);
+
+        axis = params.get<int>("axis", 1);
         logSoftMax = params.get<bool>("log_softmax", false);
+        coerced_2d = params.get<bool>("coerced_2d", false);
```

Review comment:
Please remove, if not needed.
**File:** modules/dnn/src/int8layers/softmax_layer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn

**Code Changes:**
```diff
@@ -22,15 +22,29 @@ class SoftMaxLayerInt8Impl CV_FINAL : public SoftmaxLayerInt8
 
     SoftMaxLayerInt8Impl(const LayerParams& params)
     {
-        axisRaw = params.get<int>("axis", 1);
+        setParamsFrom(params);
+
+        axis = params.get<int>("axis", 1);
         logSoftMax = params.get<bool>("log_softmax", false);
+        coerced_2d = params.get<bool>("coerced_2d", false);
```

Review comment:
It is needed. Working on enabling this lines.
**File:** modules/dnn/src/int8layers/softmax_layer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn
**Review Line:** 270

**Code Changes:**
```diff
-                    const int offset = srcOffset + cnDim * cnStep;
-                    for (size_t i = 0; i < innerSize; i++)
-                        expSum[i] += expPtr[srcPtr[offset + i] + 128];
+    };
+
+    template <bool with_log>
+    class SoftmaxInt8OutputFloatInvoker : public ParallelLoopBody {
+    public:
+        const Mat& src_;
+        Mat& dst_;
+
```

Review comment:
Why `with_log` is not an argument of SoftmaxInt8Invoker's constructor?
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn

**Code Changes:**
```diff
@@ -1985,6 +1985,12 @@ TEST_P(Test_ONNX_layers, OutputRegistration)
     testONNXModels("output_registration", npy, 0, 0, false, true, 2);
 }
 
+TEST_P(Test_ONNX_layers, QLinearSoftmax)
+{
+    testONNXModels("qlinearsoftmax_v11", npy, 0.002, 0.002); // 2D coerced
+    testONNXModels("qlinearsoftmax_v13", npy, 0.002, 0.002);
+}
+
```

Review comment:
Does this test cover all 4 scenarios? ```cpp SoftmaxInt8Invoker<true>::run(src, dst, blobs[0], N, D, output_sc, output_zp); SoftmaxInt8Invoker<false>::run(src, dst, blobs[0], N, D, output_sc, output_zp); SoftmaxInt8OutputFloatInvoker<true>::run(src, dst, blobs[0], N, D); SoftmaxInt8OutputFloatInvoker<false>::run(src, dst, blobs[0], N, D); ```
**File:** modules/dnn/src/int8layers/softmax_layer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn
**Review Line:** 270

**Code Changes:**
```diff
-                    const int offset = srcOffset + cnDim * cnStep;
-                    for (size_t i = 0; i < innerSize; i++)
-                        expSum[i] += expPtr[srcPtr[offset + i] + 128];
+    };
+
+    template <bool with_log>
+    class SoftmaxInt8OutputFloatInvoker : public ParallelLoopBody {
+    public:
+        const Mat& src_;
+        Mat& dst_;
+
```

Review comment:
To avoid if in inner loop.
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn

**Code Changes:**
```diff
@@ -1985,6 +1985,12 @@ TEST_P(Test_ONNX_layers, OutputRegistration)
     testONNXModels("output_registration", npy, 0, 0, false, true, 2);
 }
 
+TEST_P(Test_ONNX_layers, QLinearSoftmax)
+{
+    testONNXModels("qlinearsoftmax_v11", npy, 0.002, 0.002); // 2D coerced
+    testONNXModels("qlinearsoftmax_v13", npy, 0.002, 0.002);
+}
+
```

Review comment:
This test does not cover log softmax, but it is tested by the existing test `Test_Int8_layers.Softmax_log_ONNX/0` instead. The model architecture of this test is like `[input]->QuantizeLinear -> QLinearSoftmax -> DequantizeLinear -> [output]`. Since we have `tryFuse` in `SoftmaxInt8` which fuses `DequantizeLinear` and therefore we have output in float instead of int8 in the end, `SoftmaxInt8OutputFloatInvoker<false>::run(...)` is triggered here in the test. I tested locally with `tryFuse` disabled which triggers `SoftmaxInt8Invoker<false>::run(...)` and it passes. Do you think it necessary to add another test case for int8 output like `[input] -> QLinearSoftmax -> [output]`?
**File:** modules/dnn/src/int8layers/softmax_layer.cpp
**Change Type:** modified
**Context:** PR #23655: Support ONNX operator QLinearSoftmax in dnn
**Review Line:** 39

**Code Changes:**
```diff
         output_zp = params.get<int>("zeropoints");
-        setParamsFrom(params);
+
+        if (blobs.empty()) // if no lookUpTable is found
+        {
+            Mat lookUpTable(1, 256, CV_32F);
+            float* table = lookUpTable.ptr<float>();
+            for (int i = -128; i < 128; i++)
+            {
+                float x = input_sc * (i - 127); // ensures exp(x) is always between (0, 1)
+                table[i + 128] = std::exp(x);
```

Review comment:
Since the The softmax layer has a high correlation with model accuracy, I propose to change the `lookUpTable` from `float` to `double`. Reference from ORT: https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/contrib_ops/cpu/quantization/qlinear_softmax.cc#L37
**File:** modules/gapi/src/backends/fluid/gfluidutils.hpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 89

**Code Changes:**
```diff
@@ -86,6 +86,23 @@ using cv::gapi::own::rintd;
         return;                                            \
     }
 
+#define MERGE3_(T, OP, ...)                                \
+    if (cv::DataType<T>::depth == dst.meta().depth &&      \
+        cv::DataType<T>::depth == src1.meta().depth)       \
+    {                                                      \
+        GAPI_DbgAssert(dst.length() == src1.length());     \
+        GAPI_DbgAssert(dst.length() == src2.length());     \
```

Review comment:
Cannot find place where is it used, could you point me out?
**File:** modules/gapi/src/backends/fluid/gfluidutils.hpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 89

**Code Changes:**
```diff
@@ -86,6 +86,23 @@ using cv::gapi::own::rintd;
         return;                                            \
     }
 
+#define MERGE3_(T, OP, ...)                                \
+    if (cv::DataType<T>::depth == dst.meta().depth &&      \
+        cv::DataType<T>::depth == src1.meta().depth)       \
+    {                                                      \
+        GAPI_DbgAssert(dst.length() == src1.length());     \
+        GAPI_DbgAssert(dst.length() == src2.length());     \
```

Review comment:
Yes. It is used [here](https://github.com/opencv/opencv/pull/21797/files#diff-fe0ac6b5a07c1bec59c3756100eb186c9117a82dd1d951ef6997b8423a89943dR2413).
**File:** modules/gapi/src/backends/fluid/gfluidutils.hpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 89

**Code Changes:**
```diff
@@ -86,6 +86,23 @@ using cv::gapi::own::rintd;
         return;                                            \
     }
 
+#define MERGE3_(T, OP, ...)                                \
+    if (cv::DataType<T>::depth == dst.meta().depth &&      \
+        cv::DataType<T>::depth == src1.meta().depth)       \
+    {                                                      \
+        GAPI_DbgAssert(dst.length() == src1.length());     \
+        GAPI_DbgAssert(dst.length() == src2.length());     \
```

Review comment:
discussed offline: to move out repeated conditions into beginning of function to simplify condition calculation complexity in actual type dispatching routing
**File:** modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 255

**Code Changes:**
```diff
@@ -252,6 +252,7 @@ INSTANTIATE_TEST_CASE_P(Split4PerfTestCPU, Split4PerfTest,
 INSTANTIATE_TEST_CASE_P(Merge3PerfTestCPU, Merge3PerfTest,
     Combine(Values(AbsExact().to_compare_f()),
             Values(szSmall128, szVGA, sz720p, sz1080p),
+            Values(CV_8U),
             Values(cv::compile_args(CORE_CPU))));
 
 INSTANTIATE_TEST_CASE_P(Merge4PerfTestCPU, Merge4PerfTest,
```

Review comment:
Should other types be listed here?
**File:** modules/gapi/perf/cpu/gapi_core_perf_tests_cpu.cpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 255

**Code Changes:**
```diff
@@ -252,6 +252,7 @@ INSTANTIATE_TEST_CASE_P(Split4PerfTestCPU, Split4PerfTest,
 INSTANTIATE_TEST_CASE_P(Merge3PerfTestCPU, Merge3PerfTest,
     Combine(Values(AbsExact().to_compare_f()),
             Values(szSmall128, szVGA, sz720p, sz1080p),
+            Values(CV_8U),
             Values(cv::compile_args(CORE_CPU))));
 
 INSTANTIATE_TEST_CASE_P(Merge4PerfTestCPU, Merge4PerfTest,
```

Review comment:
..and in GPU tests, too.
**File:** modules/gapi/src/backends/fluid/gfluidutils.hpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 104

**Code Changes:**
```diff
+        GAPI_DbgAssert(1 == src3.meta().chan);             \
+        GAPI_DbgAssert(3 == dst.meta().chan);              \
+                                                           \
+        OP<T>(__VA_ARGS__);                                \
+        return;                                            \
+    }
+
 } // namespace fluid
 } // namespace gapi
 } // namespace cv
```

Review comment:
Macro function bodies considered harmful, is there any reasonable issues with rewriting it to templates?
**File:** modules/gapi/src/backends/fluid/gfluidutils.hpp
**Change Type:** modified
**Context:** PR #21797: GAPI Fluid SIMD:Add support of new several types for the Merge3. - - Support of the new several types was added. - Fixes for the Split/Merg...
**Review Line:** 95

**Code Changes:**
```diff
+    if (cv::DataType<T>::depth == dst.meta().depth &&      \
+        cv::DataType<T>::depth == src1.meta().depth)       \
+    {                                                      \
+        GAPI_DbgAssert(dst.length() == src1.length());     \
+        GAPI_DbgAssert(dst.length() == src2.length());     \
+        GAPI_DbgAssert(dst.length() == src3.length());     \
+                                                           \
+        GAPI_DbgAssert(1 == src1.meta().chan);             \
+        GAPI_DbgAssert(1 == src2.meta().chan);             \
+        GAPI_DbgAssert(1 == src3.meta().chan);             \
+        GAPI_DbgAssert(3 == dst.meta().chan);              \
```

Review comment:
what is the reason to verify this? normally in the framework we rely on our output buffers which are allocated per our needs. it is not coming somewhere from the outside.
**File:** modules/gapi/include/opencv2/gapi/infer/ov.hpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend

**Code Changes:**
```diff
@@ -0,0 +1,685 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2023 Intel Corporation
+
+#ifndef OPENCV_GAPI_INFER_OV_HPP
+#define OPENCV_GAPI_INFER_OV_HPP
+
```

Review comment:
Here we go again ...
**File:** modules/gapi/include/opencv2/gapi/infer/ov.hpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend
**Review Line:** 203

**Code Changes:**
```diff
+    to check information about specific plugin.
+
+    @param config Map of pairs: (config parameter name, config parameter value).
+    @return reference to this parameter structure.
+    */
+    Params<Net>& cfgPluginConfig(const detail::ParamDesc::PluginConfigT &config) {
+        m_desc.config = config;
+        return *this;
+    }
+
+    /** @brief Specifies tensor layout for an input layer.
```

Review comment:
Make sense to add test for plugin config as well
**File:** modules/gapi/include/opencv2/gapi/infer/ov.hpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend

**Code Changes:**
```diff
@@ -0,0 +1,685 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2023 Intel Corporation
+
+#ifndef OPENCV_GAPI_INFER_OV_HPP
+#define OPENCV_GAPI_INFER_OV_HPP
+
```

Review comment:
doc is copy-pasted
**File:** modules/gapi/include/opencv2/gapi/infer/ov.hpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend
**Review Line:** 301

**Code Changes:**
```diff
+            .output_model_layout = std::move(layout);
+        return *this;
+    }
+
+    /** @overload
+    @param layout_map Map of pairs: name of corresponding output layer
+    and its model layout ("NCHW", "NHWC", etc)
+    @return reference to this parameter structure.
+    */
+    Params<Net>&
+    cfgOutputModelLayout(detail::AttrMap<std::string> layout_map) {
```

Review comment:
here as well and everything below is also copy-paste
**File:** modules/gapi/include/opencv2/gapi/infer/ov.hpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend

**Code Changes:**
```diff
@@ -0,0 +1,685 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2023 Intel Corporation
+
+#ifndef OPENCV_GAPI_INFER_OV_HPP
+#define OPENCV_GAPI_INFER_OV_HPP
+
```

Review comment:
Fix doc the same was as for the typed Params
**File:** modules/gapi/test/infer/gapi_infer_ov_tests.cpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2023 Intel Corporation
+
+#ifdef HAVE_INF_ENGINE
+
+#include "../test_precomp.hpp"
```

Review comment:
Probably can be exported from `util.hpp` as well
**File:** modules/gapi/test/infer/gapi_infer_ov_tests.cpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend
**Review Line:** 69

**Code Changes:**
```diff
+
+    double normInf = cvtest::norm(ref, test, cv::NORM_INF);
+    EXPECT_LE(normInf, lInf) << comment;
+}
+
+ov::Core getCore() {
+    static ov::Core core;
+    return core;
+}
+
+// TODO: AGNetGenComp, AGNetTypedComp, AGNetOVComp, AGNetOVCompiled
```

Review comment:
Is it fine to use the different `ov::Core` than it's in `GOVBackend`? (I think so)
**File:** modules/gapi/test/infer/gapi_infer_ov_tests.cpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend
**Review Line:** 81

**Code Changes:**
```diff
+
+struct AGNetGenComp {
+    static constexpr const char* tag = "age-gender-generic";
+    using Params = cv::gapi::ov::Params<cv::gapi::Generic>;
+
+    static Params params(const std::string &xml,
+                         const std::string &bin,
+                         const std::string &device) {
+        return {tag, xml, bin, device};
+    }
+
```

Review comment:
can be variadic with by passing all parameters
**File:** modules/gapi/src/backends/ov/govbackend.cpp
**Change Type:** added
**Context:** PR #23595: [G-API] Implement OpenVINO 2.0 backend

**Code Changes:**
```diff
@@ -0,0 +1,1001 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2023 Intel Corporation
+
+#include "precomp.hpp"
+
+// needs to be included regardless if IE is present or not
```

Review comment:
Probably we need this logic encapsulated somewhere not to check it everywhere!!!