Skip to content

Commit 49c3a9c

Browse files
Fixed docstrings with remnants of old header style
1 parent 81bf848 commit 49c3a9c

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

dpctl/tensor/_dlpack.pyx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,25 @@ cpdef usm_ndarray from_dlpack_capsule(object py_caps) except +:
469469

470470

471471
cpdef from_dlpack(array):
472-
"""
473-
dpctl.tensor.from_dlpack(obj) -> dpctl.tensor.usm_ndarray
472+
""" from_dlpack(obj)
474473
475474
Constructs :class:`dpctl.tensor.usm_ndarray` instance from a Python
476475
object `obj` that implements `__dlpack__` protocol. The output
477476
array is always a zero-copy view of the input.
478477
478+
Args:
479+
obj: A Python object representing an array that supports `__dlpack__`
480+
protocol.
481+
482+
Returns:
483+
out (usm_ndarray):
484+
An array with a view into the tensor underlying the input `obj`.
485+
486+
Raises:
487+
TypeError: if `obj` does not implement `__dlpack__` method.
488+
ValueError: if zero copy view can not be constructed because
489+
the input array resides on an unsupported device.
490+
479491
See https://dmlc.github.io/dlpack/latest/ for more details.
480492
481493
:Example:
@@ -498,13 +510,6 @@ cpdef from_dlpack(array):
498510
C = Container(dpt.linspace(0, 100, num=20, dtype="int16"))
499511
X = dpt.from_dlpack(C)
500512
501-
Args:
502-
obj: A Python object representing an array that supports `__dlpack__`
503-
protocol.
504-
Raises:
505-
TypeError: if `obj` does not implement `__dlpack__` method.
506-
ValueError: if zero copy view can not be constructed because
507-
the input array resides on an unsupported device.
508513
"""
509514
if not hasattr(array, "__dlpack__"):
510515
raise TypeError(

dpctl/tensor/_reshape.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,26 @@ def reshaped_strides(old_sh, old_sts, new_sh, order="C"):
7676

7777

7878
def reshape(X, shape, order="C", copy=None):
79-
"""
80-
reshape(X: usm_ndarray, shape: tuple, order="C") -> usm_ndarray
79+
"""reshape(x, shape, order="C")
80+
81+
Reshapes array `x` into new shape.
82+
83+
Args:
84+
x (usm_ndarray):
85+
input array
86+
shape (tuple):
87+
the desired shape of the resulting array.
88+
order ({"C", "F"}, optional):
89+
memory layout of the resulting array
90+
if a copy is found to be necessary. Supported
91+
choices are `"C"` for C-contiguous, or row-major layout;
92+
and `"F"` for F-contiguous, or column-major layout.
8193
82-
Reshapes given usm_ndarray into new shape. Returns a view, if possible,
83-
a copy otherwise. Memory layout of the copy is controlled by order keyword.
94+
Returns:
95+
out (usm_ndarray):
96+
Reshaped array is a view, if possible,
97+
and a copy otherwise with memory layout as indicated
98+
by `order` keyword.
8499
"""
85100
if not isinstance(X, dpt.usm_ndarray):
86101
raise TypeError

0 commit comments

Comments
 (0)