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:
parent
f584c6d723
commit
48ddb53332
@ -57,6 +57,9 @@ namespace cv { namespace dnn { namespace cuda4dnn {
|
|||||||
|
|
||||||
bool isDeviceCompatible()
|
bool isDeviceCompatible()
|
||||||
{
|
{
|
||||||
|
if (getDeviceCount() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
int device_id = getDevice();
|
int device_id = getDevice();
|
||||||
if (device_id < 0)
|
if (device_id < 0)
|
||||||
return false;
|
return false;
|
||||||
@ -77,6 +80,9 @@ namespace cv { namespace dnn { namespace cuda4dnn {
|
|||||||
|
|
||||||
bool doesDeviceSupportFP16()
|
bool doesDeviceSupportFP16()
|
||||||
{
|
{
|
||||||
|
if (getDeviceCount() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
int device_id = getDevice();
|
int device_id = getDevice();
|
||||||
if (device_id < 0)
|
if (device_id < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user