python: check if device mps is available Oct 12, 2022 mps_available = hasattr(torch.backends, "mps") and torch.backends.mps.is_available()