Skip to content

Commit

Permalink
fixes fastai#3981 to stop deprecated warning messages, use the curren…
Browse files Browse the repository at this point in the history
…t torch.backends.mps.is_built attribute
  • Loading branch information
jkyamog committed Dec 15, 2023
1 parent 7723c4e commit 2e4beb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fastai/torch_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def to_float(b):
# %% ../nbs/00_torch_core.ipynb 71
def _has_mps():
if nested_attr(torch, 'backends.mps.is_available', noop)(): return True
return getattr(torch, 'has_mps', False)
return nested_attr(torch, 'backends.mps.is_built', False)()

def default_device(use=-1):
"Return or set default device; `use_cuda`: -1 - CUDA/mps if available; True - error if not available; False - CPU"
Expand Down
2 changes: 1 addition & 1 deletion nbs/00_torch_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@
"#|export\n",
"def _has_mps():\n",
" if nested_attr(torch, 'backends.mps.is_available', noop)(): return True\n",
" return getattr(torch, 'has_mps', False)\n",
" return nested_attr(torch, 'backends.mps.is_built', False)()\n",
"\n",
"def default_device(use=-1):\n",
" \"Return or set default device; `use_cuda`: -1 - CUDA/mps if available; True - error if not available; False - CPU\"\n",
Expand Down

0 comments on commit 2e4beb1

Please sign in to comment.