Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion python/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
except ImportError:
has_tf = False


try:
import torch

has_torch_mps = hasattr(torch.backends, "mps") and torch.backends.mps.is_available()
torch_version = [int(v) for v in torch.__version__.split("+")[0].split(".")]
is_torch_212 = torch_version[0] > 2 or (
torch_version[0] == 2 and torch_version[1] >= 12
)
has_torch_mps = (
is_torch_212
and hasattr(torch.backends, "mps")
and torch.backends.mps.is_available()
)
except ImportError:
torch = None
has_torch_mps = False
Expand Down
Loading