Skip to content

Commit 30848ee

Browse files
committed
Permit copying when flattening for unique funcs
As the array will be copied if it isn't C-contiguous regardless, this change does not impact performance and permits calls to set functions with strided, ND data
1 parent 26d97ba commit 30848ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dpctl/tensor/_set_functions_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def unique_values(x: dpt.usm_ndarray) -> dpt.usm_ndarray:
7979
if x.ndim == 1:
8080
fx = x
8181
else:
82-
fx = dpt.reshape(x, (x.size,), order="C", copy=False)
82+
fx = dpt.reshape(x, (x.size,), order="C")
8383
s = dpt.empty_like(fx, order="C")
8484
host_tasks = []
8585
if fx.flags.c_contiguous:
@@ -166,7 +166,7 @@ def unique_counts(x: dpt.usm_ndarray) -> UniqueCountsResult:
166166
if x.ndim == 1:
167167
fx = x
168168
else:
169-
fx = dpt.reshape(x, (x.size,), order="C", copy=False)
169+
fx = dpt.reshape(x, (x.size,), order="C")
170170
s = dpt.empty_like(fx, order="C")
171171
host_tasks = []
172172
if fx.flags.c_contiguous:
@@ -284,7 +284,7 @@ def unique_inverse(x):
284284
if x.ndim == 1:
285285
fx = x
286286
else:
287-
fx = dpt.reshape(x, (x.size,), order="C", copy=False)
287+
fx = dpt.reshape(x, (x.size,), order="C")
288288
ind_dt = default_device_index_type(exec_q)
289289
sorting_ids = dpt.empty_like(fx, dtype=ind_dt, order="C")
290290
unsorting_ids = dpt.empty_like(sorting_ids, dtype=ind_dt, order="C")

0 commit comments

Comments
 (0)