Skip to content

Commit 9f0c8c2

Browse files
Expanded docstring of dpctl.tensor.from_dlpack
1 parent c496091 commit 9f0c8c2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dpctl/tensor/_dlpack.pyx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,16 @@ cpdef usm_ndarray from_dlpack_capsule(object py_caps) except +:
361361

362362

363363
cpdef from_dlpack(array):
364-
"""Constructs `usm_ndarray` from a Python object that implements
365-
`__dlpack__` protocol.
364+
"""dpctl.tensor.from_dlpack(obj)
365+
366+
Constructs :class:`dpctl.tensor.usm_ndarray` instance from a Python
367+
object `obj` that implements `__dlpack__` protocol. The output
368+
array is always a zero-copy view of the input.
369+
370+
Raises:
371+
TypeError: if `obj` does not implement `__dlpack__` method.
372+
ValueError: if zero copy view can not be constructed because
373+
the input array resides on an unsupported device.
366374
"""
367375
if not hasattr(array, "__dlpack__"):
368376
raise TypeError(

0 commit comments

Comments
 (0)