Skip to content

Commit 757ed59

Browse files
committed
Align docstring of device keyword accross all the functions
1 parent 44db6af commit 757ed59

File tree

9 files changed

+498
-359
lines changed

9 files changed

+498
-359
lines changed

dpnp/dpnp_array.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -816,13 +816,17 @@ def astype(
816816
this is set to ``False``, and the `dtype`, `order`, and `subok`
817817
requirements are satisfied, the input array is returned instead of
818818
a copy.
819-
device : {None, string, SyclDevice, SyclQueue}, optional
819+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
820820
An array API concept of device where the output array is created.
821-
The `device` can be ``None`` (the default), an OneAPI filter selector
822-
string, an instance of :class:`dpctl.SyclDevice` corresponding to
823-
a non-partitioned SYCL device, an instance of :class:`dpctl.SyclQueue`,
824-
or a `Device` object returned by
825-
:obj:`dpnp.dpnp_array.dpnp_array.device` property. Default: ``None``.
821+
`device` can be ``None``, a oneAPI filter selector string,
822+
an instance of :class:`dpctl.SyclDevice` corresponding to
823+
a non-partitioned SYCL device, an instance of
824+
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
825+
returned by :attr:`dpnp.ndarray.device`.
826+
If the value is ``None``, returned array is created on the same
827+
device as that array.
828+
829+
Default: ``None``.
826830
827831
Returns
828832
-------
@@ -925,13 +929,14 @@ def copy(self, order="C", device=None, usm_type=None, sycl_queue=None):
925929
order : {"C", "F", "A", "K"}, optional
926930
Memory layout of the newly output array.
927931
Default: ``"C"``.
928-
device : {None, string, SyclDevice, SyclQueue}, optional
932+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
929933
An array API concept of device where the output array is created.
930-
The `device` can be ``None`` (the default), an OneAPI filter
931-
selector string, an instance of :class:`dpctl.SyclDevice`
932-
corresponding to a non-partitioned SYCL device, an instance of
933-
:class:`dpctl.SyclQueue`, or a `Device` object returned by
934-
:obj:`dpnp.dpnp_array.dpnp_array.device` property.
934+
`device` can be ``None``, a oneAPI filter selector string,
935+
an instance of :class:`dpctl.SyclDevice` corresponding to
936+
a non-partitioned SYCL device, an instance of
937+
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
938+
returned by :attr:`dpnp.ndarray.device`.
939+
935940
Default: ``None``.
936941
usm_type : {None, "device", "shared", "host"}, optional
937942
The type of SYCL USM allocation for the output array.
@@ -1821,12 +1826,13 @@ def to_device(self, device, /, *, stream=None):
18211826
18221827
Parameters
18231828
----------
1824-
device : {string, SyclDevice, SyclQueue}
1825-
Array API concept of target device. It can be an OneAPI filter
1826-
selector string, an instance of :class:`dpctl.SyclDevice`
1827-
corresponding to a non-partitioned SYCL device, an instance of
1829+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
1830+
An array API concept of device where the output array is created.
1831+
`device` can be ``None``, a oneAPI filter selector string,
1832+
an instance of :class:`dpctl.SyclDevice` corresponding to
1833+
a non-partitioned SYCL device, an instance of
18281834
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
1829-
returned by :obj:`dpnp.dpnp_array.dpnp_array.device` property.
1835+
returned by :attr:`dpnp.ndarray.device`.
18301836
stream : {SyclQueue, None}, optional
18311837
Execution queue to synchronize with. If ``None``, synchronization
18321838
is not performed.

dpnp/dpnp_iface.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,15 @@ def astype(x, dtype, /, *, order="K", casting="unsafe", copy=True, device=None):
247247
returned; otherwise, a newly allocated array must be returned.
248248
249249
Default: ``True``.
250-
device : {None, string, SyclDevice, SyclQueue}, optional
251-
An array API specification of device where the output array is created.
252-
Device can be specified by a filter selector string, an instance of
253-
:class:`dpctl.SyclDevice`, an instance of :class:`dpctl.SyclQueue`, or
254-
an instance of :class:`dpctl.tensor.Device`. If the value is ``None``,
255-
returned array is created on the same device as `x`.
250+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
251+
An array API concept of device where the output array is created.
252+
`device` can be ``None``, a oneAPI filter selector string, an instance
253+
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
254+
device, an instance of :class:`dpctl.SyclQueue`, or a
255+
:class:`dpctl.tensor.Device` object returned by
256+
:attr:`dpnp.ndarray.device`.
257+
If the value is ``None``, returned array is created on the same device
258+
as `x`.
256259
257260
Default: ``None``.
258261
@@ -310,12 +313,15 @@ def as_usm_ndarray(a, dtype=None, device=None, usm_type=None, sycl_queue=None):
310313
considering Promotion Type Rule and device capabilities when necessary).
311314
312315
Default: ``None``.
313-
device : {None, string, SyclDevice, SyclQueue}, optional
314-
An array API specification of device where the output array is created.
315-
Device can be specified by a filter selector string, an instance of
316-
:class:`dpctl.SyclDevice`, an instance of :class:`dpctl.SyclQueue`, or
317-
an instance of :class:`dpctl.tensor.Device`. If the value is ``None``,
318-
returned array is created on the same device as `a`.
316+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
317+
An array API concept of device where the output array is created.
318+
`device` can be ``None``, a oneAPI filter selector string, an instance
319+
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
320+
device, an instance of :class:`dpctl.SyclQueue`, or a
321+
:class:`dpctl.tensor.Device` object returned by
322+
:attr:`dpnp.ndarray.device`.
323+
If the value is ``None``, returned array is created on the same device
324+
as `a`.
319325
320326
Default: ``None``.
321327
usm_type : {None, "device", "shared", "host"}, optional
@@ -466,12 +472,14 @@ def default_float_type(device=None, sycl_queue=None):
466472
467473
Parameters
468474
----------
469-
device : {None, string, SyclDevice, SyclQueue}, optional
470-
An array API specification of device where the output array is created.
471-
Device can be specified by a filter selector string, an instance of
472-
:class:`dpctl.SyclDevice`, an instance of :class:`dpctl.SyclQueue`, or
473-
an instance of :class:`dpctl.tensor.Device`. The value ``None`` is
474-
interpreted as to use a default device.
475+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
476+
An array API concept of device where the output array is created.
477+
`device` can be ``None``, a oneAPI filter selector string, an instance
478+
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
479+
device, an instance of :class:`dpctl.SyclQueue`, or a
480+
:class:`dpctl.tensor.Device` object returned by
481+
:attr:`dpnp.ndarray.device`.
482+
The value ``None`` is interpreted as to use a default device.
475483
476484
Default: ``None``.
477485
sycl_queue : {None, SyclQueue}, optional
@@ -608,12 +616,14 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
608616
or to use default queue.
609617
610618
Default: ``None``.
611-
device : {None, string, SyclDevice, SyclQueue}, optional
612-
An array API specification of device where the output array is created.
613-
Device can be specified by a filter selector string, an instance of
614-
:class:`dpctl.SyclDevice`, an instance of :class:`dpctl.SyclQueue`, or
615-
an instance of :class:`dpctl.tensor.Device`. The value ``None`` is
616-
interpreted as to use the same device as `obj`.
619+
device : {None, string, SyclDevice, SyclQueue, Device}, optional
620+
An array API concept of device where the output array is created.
621+
`device` can be ``None``, a oneAPI filter selector string, an instance
622+
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
623+
device, an instance of :class:`dpctl.SyclQueue`, or a
624+
:class:`dpctl.tensor.Device` object returned by
625+
:attr:`dpnp.ndarray.device`.
626+
The value ``None`` is interpreted as to use the same device as `obj`.
617627
618628
Default: ``None``.
619629

0 commit comments

Comments
 (0)