Merge pull request #18386 from JulienMaille:patch-1

* Make sure there is a cuda device before getting it

* Update init.hpp
pull/18408/head
Julien 5 years ago committed by GitHub
parent f584c6d723
commit 48ddb53332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      modules/dnn/src/cuda4dnn/init.hpp

@ -57,6 +57,9 @@ namespace cv { namespace dnn { namespace cuda4dnn {
bool isDeviceCompatible()
{
if (getDeviceCount() <= 0)
return false;
int device_id = getDevice();
if (device_id < 0)
return false;
@ -77,6 +80,9 @@ namespace cv { namespace dnn { namespace cuda4dnn {
bool doesDeviceSupportFP16()
{
if (getDeviceCount() <= 0)
return false;
int device_id = getDevice();
if (device_id < 0)
return false;

Loading…
Cancel
Save