From e027740e7745bb0843d31337be3a17b805f4f712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=BChrke?= <46906556+LukasM937@users.noreply.github.com> Date: Fri, 14 Oct 2022 19:59:33 +0000 Subject: [PATCH] Chore: Add 'mps' to the docs of tensor_attributes (#86585) Since PyTorch supports 'mps' (Apple metal) devices it should be reflected in the documentation. Pull Request resolved: https://github.com/pytorch/pytorch/pull/86585 Approved by: https://github.com/albanD --- docs/source/tensor_attributes.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/tensor_attributes.rst b/docs/source/tensor_attributes.rst index 47becf990d5..c6592476d43 100644 --- a/docs/source/tensor_attributes.rst +++ b/docs/source/tensor_attributes.rst @@ -139,7 +139,7 @@ torch.device A :class:`torch.device` is an object representing the device on which a :class:`torch.Tensor` is or will be allocated. -The :class:`torch.device` contains a device type (``'cpu'`` or ``'cuda'``) and optional device +The :class:`torch.device` contains a device type (``'cpu'``, ``'cuda'`` or ``'mps'``) and optional device ordinal for the device type. If the device ordinal is not present, this object will always represent the current device for the device type, even after :func:`torch.cuda.set_device()` is called; e.g., a :class:`torch.Tensor` constructed with device ``'cuda'`` is equivalent to ``'cuda:X'`` where X is @@ -158,6 +158,9 @@ Via a string: >>> torch.device('cpu') device(type='cpu') + >>> torch.device('mps') + device(type='mps') + >>> torch.device('cuda') # current cuda device device(type='cuda') @@ -168,6 +171,9 @@ Via a string and device ordinal: >>> torch.device('cuda', 0) device(type='cuda', index=0) + >>> torch.device('mps', 0) + device(type='mps', index=0) + >>> torch.device('cpu', 0) device(type='cpu', index=0)