Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Resolves gh-1723
`_extract_impl` now coerces USM type from inputs, aligning it with more or less every other function with multiple input arrays
  • Loading branch information
ndgrigorian committed Jul 8, 2024
commit 4f6524d954779bc0fd96dc0ea477a199017563fe
5 changes: 4 additions & 1 deletion dpctl/tensor/_copy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ def _extract_impl(ary, ary_mask, axis=0):
raise TypeError(
f"Expecting type dpctl.tensor.usm_ndarray, got {type(ary_mask)}"
)
dst_usm_type = dpctl.utils.get_coerced_usm_type(
(ary.usm_type, ary_mask.usm_type)
)
exec_q = dpctl.utils.get_execution_queue(
(ary.sycl_queue, ary_mask.sycl_queue)
)
Expand All @@ -733,7 +736,7 @@ def _extract_impl(ary, ary_mask, axis=0):
)
dst_shape = ary.shape[:pp] + (mask_count,) + ary.shape[pp + mask_nd :]
dst = dpt.empty(
dst_shape, dtype=ary.dtype, usm_type=ary.usm_type, device=ary.device
dst_shape, dtype=ary.dtype, usm_type=dst_usm_type, device=ary.device
)
if dst.size == 0:
return dst
Expand Down