Skip to content

Commit 0acddd6

Browse files
authored
Add torch.cuda.cudnn_is_available (#8703)
1 parent 8546815 commit 0acddd6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

torch/backends/cudnn/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ def version():
7474
}
7575

7676

77+
def is_available():
78+
r"""Returns a bool indicating if CUDNN is currently available."""
79+
return torch._C.has_cudnn
80+
81+
7782
def is_acceptable(tensor):
7883
if not torch._C._get_cudnn_enabled():
7984
return False
8085
if tensor.type() not in CUDNN_TENSOR_TYPES:
8186
return False
82-
if not torch._C.has_cudnn:
87+
if not is_available():
8388
warnings.warn(
8489
"PyTorch was compiled without cuDNN support. To use cuDNN, rebuild "
8590
"PyTorch making sure the library is visible to the build system.")

0 commit comments

Comments
 (0)