mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Add torch.cuda.cudnn_is_available (#8703)
This commit is contained in:
parent
85468155ce
commit
0acddd6cee
1 changed files with 6 additions and 1 deletions
|
|
@ -74,12 +74,17 @@ CUDNN_TENSOR_TYPES = {
|
|||
}
|
||||
|
||||
|
||||
def is_available():
|
||||
r"""Returns a bool indicating if CUDNN is currently available."""
|
||||
return torch._C.has_cudnn
|
||||
|
||||
|
||||
def is_acceptable(tensor):
|
||||
if not torch._C._get_cudnn_enabled():
|
||||
return False
|
||||
if tensor.type() not in CUDNN_TENSOR_TYPES:
|
||||
return False
|
||||
if not torch._C.has_cudnn:
|
||||
if not is_available():
|
||||
warnings.warn(
|
||||
"PyTorch was compiled without cuDNN support. To use cuDNN, rebuild "
|
||||
"PyTorch making sure the library is visible to the build system.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue