Repository: opencv
Issue: ML_ANN_Params.ActivationFunction fails on Intel Sapphire Rapids
Labels: bug,optimization,category: ml

### System Information

OpenCV version 4.10
Operating system: RHEL 8
Compiler: GCC 8.4.1

### Detailed description

Test fails on Intel Sapphire Rapids but passes on Intel Raptor Lake and Intel Cascade Lake. In both release and debug modes.
```
$ OPENCV_IPP=disabled ./bin/opencv_test_ml --gtest_filter=ML_ANN_Params.ActivationFunction*
CTEST_FULL_OUTPUT
OpenCV version: 4.10.0
OpenCV VCS version: 4.9.0-552-ge4b378abf9
Build type: Debug
Compiler: /usr/bin/c++  (ver 8.4.1)
[ INFO:0@0.003] global registry_parallel.impl.hpp:96 ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)
Parallel framework: pthreads (nthreads=96)
CPU features: SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX
[ INFO:0@0.003] global ocl.cpp:1185 haveOpenCL Initialize OpenCL runtime...
[ INFO:0@0.004] global ocl.cpp:1191 haveOpenCL OpenCL: found 0 platforms
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong', 'debug_verylong'
Note: Google Test filter = ML_ANN_Params.ActivationFunction*
[==========] Running 5 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 5 tests from ML_ANN_Params
[ RUN      ] ML_ANN_Params.ActivationFunction/0, where GetParam() = identity
[       OK ] ML_ANN_Params.ActivationFunction/0 (1540 ms)
[ RUN      ] ML_ANN_Params.ActivationFunction/1, where GetParam() = sigmoid_sym
/localdisk/eplankin/libraries.performance.ipp.integrations.opencv-src/modules/ml/test/test_ann.cpp:73: Failure
The max difference between matrices "rx" and "ry" is 3.43167 at (1166, 0), which exceeds "1.19209289550781250000000000000000000e-7F", where "rx" at (1166, 0) evaluates to (1.71587), "ry" at (1166, 0) evaluates to (-1.7158), "1.19209289550781250000000000000000000e-7F" evaluates to 1.19209e-07
[  FAILED  ] ML_ANN_Params.ActivationFunction/1, where GetParam() = sigmoid_sym (1887 ms)
[ RUN      ] ML_ANN_Params.ActivationFunction/2, where GetParam() = gaussian
/localdisk/eplankin/libraries.performance.ipp.integrations.opencv-src/modules/ml/test/test_ann.cpp:73: Failure
The max difference between matrices "rx" and "ry" is 0.988031 at (3586, 0), which exceeds "1.19209289550781250000000000000000000e-7F", where "rx" at (3586, 0) evaluates to (0.998486), "ry" at (3586, 0) evaluates to (0.0104549), "1.19209289550781250000000000000000000e-7F" evaluates to 1.19209e-07
[  FAILED  ] ML_ANN_Params.ActivationFunction/2, where GetParam() = gaussian (2180 ms)
[ RUN      ] ML_ANN_Params.ActivationFunction/3, where GetParam() = relu
[       OK ] ML_ANN_Params.ActivationFunction/3 (197 ms)
[ RUN      ] ML_ANN_Params.ActivationFunction/4, where GetParam() = leakyrelu
/localdisk/eplankin/libraries.performance.ipp.integrations.opencv-src/modules/ml/test/test_ann.cpp:73: Failure
The max difference between matrices "rx" and "ry" is 46.9776 at (4440, 0), which exceeds "1.19209289550781250000000000000000000e-7F", where "rx" at (4440, 0) evaluates to (46.087), "ry" at (4440, 0) evaluates to (-0.890567), "1.19209289550781250000000000000000000e-7F" evaluates to 1.19209e-07
[  FAILED  ] ML_ANN_Params.ActivationFunction/4, where GetParam() = leakyrelu (1586 ms)
[----------] 5 tests from ML_ANN_Params (7390 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 1 test case ran. (7390 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] ML_ANN_Params.ActivationFunction/1, where GetParam() = sigmoid_sym
[  FAILED  ] ML_ANN_Params.ActivationFunction/2, where GetParam() = gaussian
[  FAILED  ] ML_ANN_Params.ActivationFunction/4, where GetParam() = leakyrelu

 3 FAILED TESTS
 ```

### Steps to reproduce

```
$ cmake CMakeLists.txt -DWITH_IPP=OFF -B.build
$ cd .build && make
$ ./bin/opencv_test_ml --gtest_filter=ML_ANN_Params.ActivationFunction*
```

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [ ] There is reproducer code and related data files (videos, images, onnx, etc)