Skip to content

Commit eafb644

Browse files
committed
factor common call out of logic in _asarray_from_numpy_ndarray
1 parent d73cddd commit eafb644

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dpctl/tensor/_ctors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def _asarray_from_numpy_ndarray(
236236
if dtype is None:
237237
# deduce device-representable output data type
238238
dtype = _map_to_device_dtype(ary.dtype, copy_q)
239+
_ensure_native_dtype_device_support(dtype, copy_q.sycl_device)
239240
f_contig = ary.flags["F"]
240241
c_contig = ary.flags["C"]
241242
fc_contig = f_contig or c_contig
@@ -245,10 +246,8 @@ def _asarray_from_numpy_ndarray(
245246
order = "C" if c_contig else "F"
246247
if order == "K":
247248
# new USM allocation
248-
_ensure_native_dtype_device_support(dtype, copy_q.sycl_device)
249249
res = _from_numpy_empty_like_orderK(ary, dtype, usm_type, copy_q)
250250
else:
251-
_ensure_native_dtype_device_support(dtype, copy_q.sycl_device)
252251
res = dpt.usm_ndarray(
253252
ary.shape,
254253
dtype=dtype,

0 commit comments

Comments
 (0)