mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
update mps note with more details (#78669)
Follow up to the comments in https://github.com/pytorch/pytorch/pull/77767#pullrequestreview-978807521 Pull Request resolved: https://github.com/pytorch/pytorch/pull/78669 Approved by: https://github.com/kulinseth, https://github.com/anjali411
This commit is contained in:
@ -14,14 +14,18 @@ capabilities to setup and run operations on GPU.
|
||||
|
||||
To get started, simply move your Tensor and Module to the ``mps`` device:
|
||||
|
||||
.. code::
|
||||
.. code:: python
|
||||
|
||||
# Make sure the current PyTorch binary was built with MPS enabled
|
||||
print(torch.backends.mps.is_built())
|
||||
# And that the current hardware and MacOS version are sufficient to
|
||||
# be able to use MPS
|
||||
print(torch.backends.mps.is_available())
|
||||
# Check that MPS is available
|
||||
if not torch.backends.mps.is_available():
|
||||
if not torch.backends.mps.is_built():
|
||||
print("MPS not available because the current PyTorch install was not "
|
||||
"built with MPS enabled.")
|
||||
else:
|
||||
print("MPS not available because the current MacOS version is not 12.3+ "
|
||||
"and/or you do not have an MPS-enabled device on this machine.")
|
||||
|
||||
else:
|
||||
mps_device = torch.device("mps")
|
||||
|
||||
# Create a Tensor directly on the mps device
|
||||
|
Reference in New Issue
Block a user