Merge pull request #18386 from JulienMaille:patch-1

* Make sure there is a cuda device before getting it

* Update init.hpp
This commit is contained in:
Julien
2020-09-23 11:15:02 +02:00
committed by GitHub
parent f584c6d723
commit 48ddb53332
+6
View File
@@ -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;