@@ -102,24 +102,15 @@ def default_device(self):
102
102
103
103
Returns
104
104
-------
105
- device : Device
105
+ device : str
106
106
The default device used for new PyTorch arrays.
107
107
108
108
Examples
109
109
--------
110
110
>>> info = np.__array_namespace_info__()
111
111
>>> info.default_device()
112
- device(type= 'cpu')
112
+ 'cpu'
113
113
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
123
114
"""
124
115
return torch .device ("cpu" )
125
116
@@ -129,9 +120,9 @@ def default_dtypes(self, *, device=None):
129
120
130
121
Parameters
131
122
----------
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 .
123
+ device : str , optional
124
+ The device to get the default data types for. For PyTorch, only
125
+ ``'cpu'`` is allowed .
135
126
136
127
Returns
137
128
-------
@@ -259,9 +250,8 @@ def dtypes(self, *, device=None, kind=None):
259
250
260
251
Parameters
261
252
----------
262
- device : Device , optional
253
+ device : str , optional
263
254
The device to get the data types for.
264
- Unused for PyTorch, as all devices use the same dtypes.
265
255
kind : str or tuple of str, optional
266
256
The kind of data types to return. If ``None``, all data types are
267
257
returned. If a string, only data types of that kind are returned.
@@ -320,7 +310,7 @@ def devices(self):
320
310
321
311
Returns
322
312
-------
323
- devices : list[Device]
313
+ devices : list of str
324
314
The devices supported by PyTorch.
325
315
326
316
See Also
@@ -343,7 +333,6 @@ def devices(self):
343
333
# device:
344
334
try :
345
335
torch .device ('notadevice' )
346
- raise AssertionError ("unreachable" ) # pragma: nocover
347
336
except RuntimeError as e :
348
337
# The error message is something like:
349
338
# "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