Skip to content

Commit

Permalink
Merge pull request #3994 from jkyamog/fix_for_mps_deprecated_warning
Browse files Browse the repository at this point in the history
fixes #3981 to stop deprecated warning messages
  • Loading branch information
jph00 committed Jan 7, 2024
2 parents 7723c4e + 2e4beb1 commit 43dbef3
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
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
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 43dbef3

Please sign in to comment.