Skip to content

Commit 9173fed

Browse files
Add docstring to shape.setter documenting its limitations
1 parent 20847f2 commit 9173fed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dpctl/tensor/_usmarray.pyx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,22 @@ cdef class usm_ndarray:
563563

564564
@shape.setter
565565
def shape(self, new_shape):
566+
"""
567+
Modifies usm_ndarray instance in-place by changing its metadata
568+
about the shape and the strides of the array, or raises
569+
`AttributeError` exception if in-place change is not possible.
570+
571+
Args:
572+
new_shape: (tuple, int)
573+
New shape. Only non-negative values are supported.
574+
The new shape may not lead to the change in the
575+
number of elements in the array.
576+
577+
Whether the array can be reshape in-place depends on its
578+
strides. Use :func:`dpctl.tensor.reshape` function which
579+
always succeeds to reshape the array by performing a copy
580+
if necessary.
581+
"""
566582
cdef int new_nd = -1
567583
cdef Py_ssize_t nelems = -1
568584
cdef int err = 0

0 commit comments

Comments
 (0)