Skip to content

Commit ef407d2

Browse files
Fixed typos pointed in PR feedback
Removed duplicated statements clarifying type of the return object from entries describing supported device keyword values to the paragraph describing the return type. Moved the note pertaining to the SYCL queue of the returned usm_ndarray there as well.
1 parent 34296a8 commit ef407d2

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

dpctl/tensor/_dlpack.pyx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -976,10 +976,7 @@ def from_dlpack(x, /, *, device=None, copy=None):
976976
Device where the output array is to be placed. ``device`` keyword values can be:
977977
978978
* ``None``
979-
The data remains on the same device. If the data backing up
980-
input object ``x`` resides on ``"kDLCPU"`` device, the return
981-
type would be :class:`numpy.ndarray`, otherwise the return
982-
type would be :class:`dpctl.tensor.usm_ndarray`.
979+
The data remains on the same device.
983980
* oneAPI filter selector string
984981
SYCL device selected by :ref:`filter selector string <filter_selector_string>`.
985982
* :class:`dpctl.SyclDevice`
@@ -995,21 +992,10 @@ def from_dlpack(x, /, *, device=None, copy=None):
995992
method: an integer enumerator representing the device type followed by
996993
an integer representing the index of the device.
997994
The only supported :class:`dpctl.tensor.DLDeviceType` device types
998-
are ``"kDLCPU"`` and ``"kDLOneAPI"``. If ``"kDLCPU"`` requested, the
999-
output type is :class:`numpy.ndarray`, otherwise it is
1000-
:class:`dpctl.tensor.usm_ndarray`.
995+
are ``"kDLCPU"`` and ``"kDLOneAPI"``.
1001996
1002997
Default: ``None``.
1003998
1004-
.. note::
1005-
1006-
If the return type if :class:`dpctl.tensor.usm_ndarray`, the associated
1007-
SYCL queue is derived from the ``device`` keyword. When ``device``
1008-
keyword value has type :class:`dpctl.SyclQueue`, the explicit queue
1009-
instance is used, when ``device`` keyword value has type :class:`dpctl.tensor.Device`,
1010-
the ``device.sycl_queue`` is used. In all other cases, the cached
1011-
SYCL queue corresponding the implied SYCL device is used.
1012-
1013999
copy (bool, optional)
10141000
Boolean indicating whether or not to copy the input.
10151001
@@ -1029,6 +1015,22 @@ def from_dlpack(x, /, *, device=None, copy=None):
10291015
``None`` or ``False``, this may be a view into the original
10301016
memory.
10311017
1018+
The type of the returned object
1019+
depends on where the data backing up input object ``x`` resides.
1020+
If it resides in a USM allocation on a SYCL device, the
1021+
type :class:`dpctl.tensor.usm_ndarray` is returned, otherwise if it resides
1022+
on ``"kDLCPU"`` device the type is :class:`numpy.ndarray`, and otherwise
1023+
an exception is raised.
1024+
1025+
.. note::
1026+
1027+
If the return type is :class:`dpctl.tensor.usm_ndarray`, the associated
1028+
SYCL queue is derived from the ``device`` keyword. When ``device``
1029+
keyword value has type :class:`dpctl.SyclQueue`, the explicit queue
1030+
instance is used, when ``device`` keyword value has type :class:`dpctl.tensor.Device`,
1031+
the ``device.sycl_queue`` is used. In all other cases, the cached
1032+
SYCL queue corresponding to the implied SYCL device is used.
1033+
10321034
Raises:
10331035
TypeError:
10341036
if ``x`` does not implement ``__dlpack__`` method

0 commit comments

Comments
 (0)