Skip to content

Commit 356cf22

Browse files
committed
Fixes clip writing to read-only out arrays when min and max are none
1 parent 8ac67c7 commit 356cf22

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dpctl/tensor/_clip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
440440
f"{type(out)}"
441441
)
442442

443+
if not out.flags.writable:
444+
raise ValueError("provided `out` array is read-only")
445+
443446
if out.shape != x.shape:
444447
raise ValueError(
445448
"The shape of input and output arrays are "

0 commit comments

Comments
 (0)