Skip to content

Commit 10c2022

Browse files
Move check vals.size after getting nz_count
1 parent e7a878c commit 10c2022

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dpctl/tensor/_indexing_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,12 @@ def place(arr, mask, vals):
293293
raise dpctl.utils.ExecutionPlacementError
294294
if arr.shape != mask.shape or vals.ndim != 1:
295295
raise ValueError("Array sizes are not as required")
296-
if vals.size == 0 and dpt.nonzero(mask)[0].size:
297-
raise ValueError("Cannot insert from an empty array!")
298296
cumsum = dpt.empty(mask.size, dtype="i8", sycl_queue=exec_q)
299297
nz_count = ti.mask_positions(mask, cumsum, sycl_queue=exec_q)
300298
if nz_count == 0:
301299
return
300+
if vals.size == 0:
301+
raise ValueError("Cannot insert from an empty array!")
302302
if vals.dtype == arr.dtype:
303303
rhs = vals
304304
else:

0 commit comments

Comments
 (0)