Skip to content

Commit 27f56a1

Browse files
committed
Add detailed description to DLPackCreationError exception
1 parent 00d1496 commit 27f56a1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

doc/reference/exceptions.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,27 @@ specific, such as linear algebra errors.
1111
Exceptions
1212
----------
1313

14-
.. autodata:: DLPackCreationError
14+
.. data:: AxisError
15+
16+
Given when an axis is invalid.
17+
18+
.. data:: DLPackCreationError
19+
20+
Given when constructing DLPack capsule from either :class:`dpnp.ndarray` or
21+
:class:`dpctl.tensor.usm_ndarray` based on a USM allocation
22+
on a partitioned SYCL device.
23+
24+
.. rubric:: Examples
25+
26+
.. code-block:: python
27+
28+
>>> import dpnp as np
29+
>>> import dpctl
30+
>>> dev = dpctl.SyclDevice('cpu')
31+
>>> sdevs = dev.create_sub_devices(partition=[1, 1])
32+
>>> q = dpctl.SyclQueue(sdevs[0])
33+
>>> x = np.ones(10, sycl_queue=q)
34+
>>> np.from_dlpack(x)
35+
Traceback (most recent call last):
36+
...
37+
DLPackCreationError: to_dlpack_capsule: DLPack can only export arrays based on USM allocations bound to a default platform SYCL context

0 commit comments

Comments
 (0)