File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -86,22 +86,34 @@ def asarray(x1,
86
86
usm_type = None ,
87
87
sycl_queue = None ):
88
88
"""Converts `x1` to `dpnp_array`."""
89
- if isinstance (x1 , dpnp_array ):
90
- x1_obj = x1 .get_array ()
91
- else :
92
- x1_obj = x1
89
+ dpu .validate_usm_type (usm_type , allow_none = True )
93
90
94
91
if order is None :
95
92
order = 'C'
96
93
97
94
"""Converts incoming 'x1' object to 'dpnp_array'."""
98
- array_obj = dpt .asarray (x1_obj ,
99
- dtype = dtype ,
100
- copy = copy ,
101
- order = order ,
102
- device = device ,
103
- usm_type = usm_type ,
104
- sycl_queue = sycl_queue )
95
+ if isinstance (x1 , (list , tuple , range )):
96
+ array_obj = dpt .asarray (x1 ,
97
+ dtype = dtype ,
98
+ copy = copy ,
99
+ order = order ,
100
+ device = device ,
101
+ usm_type = usm_type ,
102
+ sycl_queue = sycl_queue )
103
+ else :
104
+ if isinstance (x1 , dpnp_array ):
105
+ x1_obj = x1 .get_array ()
106
+ else :
107
+ x1_obj = x1
108
+
109
+ sycl_queue_normalized = dpnp .get_normalized_queue_device (x1_obj , device = device , sycl_queue = sycl_queue )
110
+
111
+ array_obj = dpt .asarray (x1_obj ,
112
+ dtype = dtype ,
113
+ copy = copy ,
114
+ order = order ,
115
+ usm_type = usm_type ,
116
+ sycl_queue = sycl_queue_normalized )
105
117
return dpnp_array (array_obj .shape , buffer = array_obj , order = order )
106
118
107
119
You can’t perform that action at this time.
0 commit comments