Repository: opencv
Issue: Test_ONNX_conformance.Layer_Test/test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded_CUDA_CUDA crashes
Labels: bug,category: gpu/cuda (contrib),category: dnn

### System Information

Ubuntu 18.04
CUDA: 11.8
CuDNN: 8.9.7

### Detailed description

Related PR: https://github.com/opencv/opencv/pull/25465
Core dumped.

### Steps to reproduce

```
alexander@paradox:~/Projects/OpenCV/opencv_contrib_build$ ./bin/opencv_test_dnn --gtest_filter=Test_ONNX_conformance.Layer_Test/test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded_CUDA_CUDA 
CTEST_FULL_OUTPUT
OpenCV version: 5.0.0-pre
OpenCV VCS version: 4.9.0-686-g07404e6da4
Build type: Release
Compiler: /usr/bin/c++  (ver 7.5.0)
Parallel framework: pthreads (nthreads=4)
CPU features: SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16? *AVX *AVX2? *AVX512-SKX?
Intel(R) IPP version: ippIP SSE4.2 (y8) 2021.11.0 (-) Feb  1 2024
Intel(R) IPP features code: 0x80
OpenCL Platforms: 
    NVIDIA CUDA
        dGPU: NVIDIA GeForce GTX 1080 (OpenCL 3.0 CUDA)
Current OpenCL device: 
    Type = dGPU
    Name = NVIDIA GeForce GTX 1080
    Version = OpenCL 3.0 CUDA
    Driver version = 530.30.02
    Address bits = 64
    Compute units = 20
    Max work group size = 1024
    Local memory size = 48 KB
    Max memory allocation size = 1 GB 1004 MB 16 KB
    Double support = Yes
    Half support = No
    Host unified memory = No
    Device extensions:
        cl_khr_global_int32_base_atomics
        cl_khr_global_int32_extended_atomics
        cl_khr_local_int32_base_atomics
        cl_khr_local_int32_extended_atomics
        cl_khr_fp64
        cl_khr_3d_image_writes
        cl_khr_byte_addressable_store
        cl_khr_icd
        cl_khr_gl_sharing
        cl_nv_compiler_options
        cl_nv_device_attribute_query
        cl_nv_pragma_unroll
        cl_nv_copy_opts
        cl_nv_create_buffer
        cl_khr_int64_base_atomics
        cl_khr_int64_extended_atomics
        cl_khr_device_uuid
        cl_khr_pci_bus_info
        cl_khr_external_semaphore
        cl_khr_external_memory
        cl_khr_external_semaphore_opaque_fd
        cl_khr_external_memory_opaque_fd
    Has AMD Blas = No
    Has AMD Fft = No
    Preferred vector width char = 1
    Preferred vector width short = 1
    Preferred vector width int = 1
    Preferred vector width long = 1
    Preferred vector width float = 1
    Preferred vector width double = 1
    Preferred vector width half = 0
TEST: Skip tests with tags: 'mem_6gb', 'verylong', 'dnn_skip_opencv_backend', 'dnn_skip_cpu', 'dnn_skip_cpu_fp16', 'dnn_skip_ocl', 'dnn_skip_ocl_fp16', 'dnn_skip_cuda', 'dnn_skip_cuda_fp32', 'dnn_skip_cuda_fp16', 'dnn_skip_onnx_conformance', 'dnn_skip_parser'
Note: Google Test filter = Test_ONNX_conformance.Layer_Test/test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded_CUDA_CUDA
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Test_ONNX_conformance
[ RUN      ] Test_ONNX_conformance.Layer_Test/test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded_CUDA_CUDA, where GetParam() = (test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded, CUDA/CUDA)
terminate called without an active exception
Ошибка сегментирования (стек памяти сброшен на диск)
```

### 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
- [X] There is reproducer code and related data files (videos, images, onnx, etc)