@@ -102,15 +102,24 @@ def default_device(self):
102102
103103 Returns
104104 -------
105- device : str
105+ device : Device
106106 The default device used for new PyTorch arrays.
107107
108108 Examples
109109 --------
110110 >>> info = np.__array_namespace_info__()
111111 >>> info.default_device()
112- 'cpu'
112+ device(type= 'cpu')
113113
114+ Notes
115+ -----
116+ This method returns the static default device when PyTorch is initialized.
117+ However, the *current* device used by creation functions (``empty`` etc.)
118+ can be changed at runtime.
119+
120+ See Also
121+ --------
122+ https://github.com/data-apis/array-api/issues/835
114123 """
115124 return torch .device ("cpu" )
116125
@@ -120,9 +129,9 @@ def default_dtypes(self, *, device=None):
120129
121130 Parameters
122131 ----------
123- device : str , optional
124- The device to get the default data types for. For PyTorch, only
125- ``'cpu'`` is allowed .
132+ device : Device , optional
133+ The device to get the default data types for.
134+ Unused for PyTorch, as all devices use the same default dtypes .
126135
127136 Returns
128137 -------
@@ -250,8 +259,9 @@ def dtypes(self, *, device=None, kind=None):
250259
251260 Parameters
252261 ----------
253- device : str , optional
262+ device : Device , optional
254263 The device to get the data types for.
264+ Unused for PyTorch, as all devices use the same dtypes.
255265 kind : str or tuple of str, optional
256266 The kind of data types to return. If ``None``, all data types are
257267 returned. If a string, only data types of that kind are returned.
@@ -310,7 +320,7 @@ def devices(self):
310320
311321 Returns
312322 -------
313- devices : list of str
323+ devices : list[Device]
314324 The devices supported by PyTorch.
315325
316326 See Also
@@ -333,6 +343,7 @@ def devices(self):
333343 # device:
334344 try :
335345 torch .device ('notadevice' )
346+ raise AssertionError ("unreachable" ) # pragma: nocover
336347 except RuntimeError as e :
337348 # The error message is something like:
338349 # "Expected one of cpu, cuda, ipu, xpu, mkldnn, opengl, opencl, ideep, hip, ve, fpga, ort, xla, lazy, vulkan, mps, meta, hpu, mtia, privateuseone device type at start of device string: notadevice"
0 commit comments