Check if the current compiled version of pytorch supports MPS (#30664)

This commit is contained in:
jiaqianjing 2024-05-06 16:32:19 +08:00 committed by GitHub
parent 307f632bb2
commit 09edd77f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -373,7 +373,7 @@ def is_torch_mps_available():
import torch
if hasattr(torch.backends, "mps"):
return torch.backends.mps.is_available()
return torch.backends.mps.is_available() and torch.backends.mps.is_built()
return False