Format code (#624)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-06-24 18:06:17 +08:00
committed by GitHub
parent 04d7813486
commit fad31f24f5
4 changed files with 11 additions and 5 deletions

View File

@@ -58,12 +58,13 @@ class Config:
cmd_opts.noparallel,
cmd_opts.noautoopen,
)
# has_mps is only available in nightly pytorch (for now) and MasOS 12.3+.
# check `getattr` and try it for compatibility
@staticmethod
def has_mps() -> bool:
if not torch.backends.mps.is_available(): return False
if not torch.backends.mps.is_available():
return False
try:
torch.zeros(1).to(torch.device("mps"))
return True