@@ -65,7 +65,13 @@ def _array_info_dispatch(obj):
65
65
return _empty_tuple , int , _host_set
66
66
if isinstance (obj , complex ):
67
67
return _empty_tuple , complex , _host_set
68
- if isinstance (obj , (list , tuple , range )):
68
+ if isinstance (
69
+ obj ,
70
+ (
71
+ list ,
72
+ tuple ,
73
+ ),
74
+ ):
69
75
return _array_info_sequence (obj )
70
76
if _is_object_with_buffer_protocol (obj ):
71
77
np_obj = np .array (obj )
@@ -333,7 +339,7 @@ def _usm_types_walker(o, usm_types_list):
333
339
return
334
340
if isinstance (o , (int , bool , float , complex )):
335
341
return
336
- if isinstance (o , (list , tuple )):
342
+ if isinstance (o , (list , tuple , range )):
337
343
for el in o :
338
344
_usm_types_walker (el , usm_types_list )
339
345
return
@@ -641,37 +647,28 @@ def asarray(
641
647
)
642
648
elif len (devs ) > 1 :
643
649
devs = [dev for dev in devs if dev is not None ]
644
- if len (devs ) == 1 :
645
- seq_dev = devs [0 ]
646
- return _asarray_from_seq_single_device (
647
- obj ,
648
- seq_shape ,
649
- seq_dt ,
650
- seq_dev ,
651
- dtype = dtype ,
652
- usm_type = usm_type ,
653
- sycl_queue = sycl_queue ,
654
- order = order ,
655
- )
656
- else :
657
- if sycl_queue is None :
650
+ if sycl_queue is None :
651
+ if len (devs ) == 1 :
652
+ alloc_q = devs [0 ]
653
+ else :
658
654
raise dpctl .utils .ExecutionPlacementError (
659
655
"Please specify `device` or `sycl_queue` keyword "
660
- "argument to determine where to allocated the "
656
+ "argument to determine where to allocate the "
661
657
"resulting array."
662
658
)
659
+ else :
663
660
alloc_q = sycl_queue
664
- exec_q = None # force copying via host
665
- return _asarray_from_seq (
666
- obj ,
667
- seq_shape ,
668
- seq_dt ,
669
- alloc_q ,
670
- exec_q ,
671
- dtype = dtype ,
672
- usm_type = usm_type ,
673
- order = order ,
674
- )
661
+ return _asarray_from_seq (
662
+ obj ,
663
+ seq_shape ,
664
+ seq_dt ,
665
+ alloc_q ,
666
+ # force copying via host
667
+ None ,
668
+ dtype = dtype ,
669
+ usm_type = usm_type ,
670
+ order = order ,
671
+ )
675
672
676
673
raise NotImplementedError (
677
674
"Converting Python sequences is not implemented"
0 commit comments