Skip to content

Commit 1f51311

Browse files
committed
Fix bug where out in compress is dpnp_array
Also removes an unnecessary check per PR review
1 parent e22b968 commit 1f51311

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

dpnp/dpnp_iface_indexing.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,9 @@ def _take_1d_index(x, inds, axis, q, usm_type, out=None):
170170
raise IndexError("cannot take non-empty indices from an empty axis")
171171
res_sh = x_sh[:axis] + ind0.shape + x_sh[axis_end:]
172172

173-
orig_out = out
173+
orig_out = None
174174
if out is not None:
175-
dpnp.check_supported_arrays_type(out)
176-
out = dpnp.get_usm_ndarray(out)
175+
orig_out = out = dpnp.get_usm_ndarray(out)
177176

178177
if not out.flags.writable:
179178
raise ValueError("provided `out` array is read-only")
@@ -286,7 +285,7 @@ def compress(condition, a, axis=None, out=None):
286285
inds = _nonzero_impl(cond_ary)
287286

288287
return dpnp.get_result_array(
289-
_take_1d_index(a_ary, inds, axis, exec_q, res_usm_type, out)
288+
_take_1d_index(a_ary, inds, axis, exec_q, res_usm_type, out), out=out
290289
)
291290

292291

0 commit comments

Comments
 (0)