From 7cd2e794c22c75fd16dac53bba564a883bc3122e Mon Sep 17 00:00:00 2001 From: Kaushal Dhaked Date: Wed, 2 Dec 2026 16:24:59 +0530 Subject: [PATCH] dnn: accept DNN_TARGET_CPU on mainGraph when HAVE_CUDA is disabled --- modules/dnn/src/net_impl_backend.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/dnn/src/net_impl_backend.cpp b/modules/dnn/src/net_impl_backend.cpp index 91a5ba7461..afdc8bc27b 100644 --- a/modules/dnn/src/net_impl_backend.cpp +++ b/modules/dnn/src/net_impl_backend.cpp @@ -375,8 +375,11 @@ void Net::Impl::setPreferableTarget(int targetId) if (mainGraph) { + if (targetId == DNN_TARGET_CPU #ifdef HAVE_CUDA - if (targetId == DNN_TARGET_CPU || IS_DNN_CUDA_TARGET(targetId)) + || IS_DNN_CUDA_TARGET(targetId) +#endif + ) { if (preferableTarget != targetId) { preferableTarget = targetId; @@ -384,7 +387,6 @@ void Net::Impl::setPreferableTarget(int targetId) } return; } -#endif CV_LOG_WARNING(NULL, "Targets are not supported by the new graph engine for now"); return; }