Skip to content

Commit 8829ab6

Browse files
oleksandr-pavlykndgrigorian
authored andcommitted
Docstring edits for _array_api
Indentation fixed for item list, usm_array.device -> usm_ndarray.device Used double back-quotes instead of single for proper rendering in HTML
1 parent e6439c3 commit 8829ab6

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

dpctl/tensor/_array_api.py

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _isdtype_impl(dtype, kind):
5454

5555
class Info:
5656
"""
57-
namespace returned by `__array_namespace_info__()`
57+
namespace returned by ``__array_namespace_info__()``
5858
"""
5959

6060
def __init__(self):
@@ -82,13 +82,13 @@ def capabilities(self):
8282
"""
8383
capabilities()
8484
85-
Returns a dictionary of `dpctl`'s capabilities.
85+
Returns a dictionary of ``dpctl``'s capabilities.
8686
8787
Returns:
8888
dict:
89-
dictionary of `dpctl`'s capabilities
90-
- `boolean_indexing`: bool
91-
- `data_dependent_shapes`: bool
89+
dictionary of ``dpctl``'s capabilities
90+
- ``"boolean_indexing"``: bool
91+
- ``data_dependent_shapes"``: bool
9292
"""
9393
return self._capabilities.copy()
9494

@@ -104,25 +104,26 @@ def default_dtypes(self, *, device=None):
104104
"""
105105
default_dtypes(*, device=None)
106106
107-
Returns a dictionary of default data types for `device`.
107+
Returns a dictionary of default data types for ``device``.
108108
109109
Args:
110-
device (Optional[dpctl.SyclDevice, dpctl.SyclQueue,
111-
dpctl.tensor.Device]):
110+
device (Optional[:class:`dpctl.SyclDevice`,
111+
:class:`dpctl.SyclQueue`, :class:`dpctl.tensor.Device`]):
112112
array API concept of device used in getting default data types.
113-
`device` can be `None` (in which case the default device is
114-
used), an instance of :class:`dpctl.SyclDevice` corresponding
113+
``device`` can be ``None`` (in which case the default device
114+
is used), an instance of :class:`dpctl.SyclDevice` corresponding
115115
to a non-partitioned SYCL device, an instance of
116-
:class:`dpctl.SyclQueue`, or a `Device` object returned by
117-
:attr:`dpctl.tensor.usm_array.device`. Default: `None`.
116+
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device`
117+
object returned by :attr:`dpctl.tensor.usm_ndarray.device`.
118+
Default: ``None``.
118119
119120
Returns:
120121
dict:
121-
a dictionary of default data types for `device`
122-
- `real floating`: dtype
123-
- `complex floating`: dtype
124-
- `integral`: dtype
125-
- `indexing`: dtype
122+
a dictionary of default data types for ``device``
123+
- ``"real floating"``: dtype
124+
- ``"complex floating"``: dtype
125+
- ``"integral"``: dtype
126+
- ``"indexing"``: dtype
126127
"""
127128
if device is None:
128129
device = dpctl.select_default_device()
@@ -139,8 +140,8 @@ def dtypes(self, *, device=None, kind=None):
139140
"""
140141
dtypes(*, device=None, kind=None)
141142
142-
Returns a dictionary of all Array API data types of a specified `kind`
143-
supported by `device`
143+
Returns a dictionary of all Array API data types of a specified
144+
``kind`` supported by ``device``
144145
145146
This dictionary only includes data types supported by the array API.
146147
@@ -149,37 +150,43 @@ def dtypes(self, *, device=None, kind=None):
149150
[array_api]: https://data-apis.org/array-api/latest/
150151
151152
Args:
152-
device (Optional[dpctl.SyclDevice, dpctl.SyclQueue,
153-
dpctl.tensor.Device, str]):
153+
device (Optional[:class:`dpctl.SyclDevice`,
154+
:class:`dpctl.SyclQueue`, :class:`dpctl.tensor.Device`, str]):
154155
array API concept of device used in getting default data types.
155-
`device` can be `None` (in which case the default device is
156+
``device`` can be ``None`` (in which case the default device is
156157
used), an instance of :class:`dpctl.SyclDevice` corresponding
157158
to a non-partitioned SYCL device, an instance of
158-
:class:`dpctl.SyclQueue`, or a `Device` object returned by
159-
:attr:`dpctl.tensor.usm_array.device`. Default: `None`.
159+
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device`
160+
object returned by :attr:`dpctl.tensor.usm_ndarray.device`.
161+
Default: ``None``.
160162
161163
kind (Optional[str, Tuple[str, ...]]):
162164
data type kind.
163-
- if `kind` is `None`, returns a dictionary of all data types
164-
supported by `device`
165-
- if `kind` is a string, returns a dictionary containing the
166-
data types belonging to the data type kind specified.
165+
166+
- if ``kind`` is ``None``, returns a dictionary of all data
167+
types supported by `device`
168+
- if ``kind`` is a string, returns a dictionary containing the
169+
data types belonging to the data type kind specified.
167170
Supports:
168-
- "bool"
169-
- "signed integer"
170-
- "unsigned integer"
171-
- "integral"
172-
- "real floating"
173-
- "complex floating"
174-
- "numeric"
175-
- if `kind` is a tuple, the tuple represents a union of `kind`
176-
strings, and returns a dictionary containing data types
177-
corresponding to the-specified union.
171+
172+
- ``"bool"``
173+
- ``"signed integer"``
174+
- ``"unsigned integer"``
175+
- ``"integral"``
176+
- ``"real floating"``
177+
- ``"complex floating"``
178+
- ``"numeric"``
179+
180+
- if ``kind`` is a tuple, the tuple represents a union of
181+
``kind`` strings, and returns a dictionary containing data
182+
types corresponding to the-specified union.
183+
178184
Default: `None`.
179185
180186
Returns:
181187
dict:
182-
a dictionary of the supported data types of the specified `kind`
188+
a dictionary of the supported data types of the specified
189+
``kind``
183190
"""
184191
if device is None:
185192
device = dpctl.select_default_device()

0 commit comments

Comments
 (0)