@@ -97,27 +97,8 @@ def convert_list_args(input_list):
97
97
98
98
return result_list
99
99
100
- def copy_from_origin (src , device = None , usm_type = " device" , sycl_queue = None ):
101
- """ Copy result from origin."""
102
- if not isinstance (src, numpy.ndarray):
103
- return src
104
-
105
- if src.size == 0 :
106
- return dpnp_container.empty(src.shape,
107
- dtype = src.dtype,
108
- device = device,
109
- usm_type = usm_type,
110
- sycl_queue = sycl_queue)
111
-
112
- array_obj = dpctl.tensor._copy_utils.from_numpy(src,
113
- device = device,
114
- usm_type = usm_type,
115
- sycl_queue = sycl_queue)
116
100
117
- return dpnp.dpnp_array.dpnp_array(src.shape, buffer = array_obj)
118
-
119
-
120
- def copy_from_origin_into (dst , src ):
101
+ def copy_from_origin (dst , src ):
121
102
""" Copy origin result to output result."""
122
103
if config.__DPNP_OUTPUT_DPCTL__ and hasattr (dst, " __sycl_usm_array_interface__" ):
123
104
if src.size:
@@ -164,7 +145,7 @@ def call_origin(function, *args, **kwargs):
164
145
if args and args_new:
165
146
arg, arg_new = args[0 ], args_new[0 ]
166
147
if isinstance (arg_new, numpy.ndarray):
167
- copy_from_origin_into (arg, arg_new)
148
+ copy_from_origin (arg, arg_new)
168
149
elif isinstance (arg_new, list ):
169
150
for i, val in enumerate (arg_new):
170
151
arg[i] = val
@@ -176,18 +157,20 @@ def call_origin(function, *args, **kwargs):
176
157
if (kwargs_dtype is not None ):
177
158
result_dtype = kwargs_dtype
178
159
179
- result = copy_from_origin (result_origin)
160
+ result = dpnp_container.empty (result_origin.shape, dtype = result_dtype )
180
161
else :
181
162
result = kwargs_out
182
- copy_from_origin_into(result, result_origin)
163
+
164
+ copy_from_origin(result, result_origin)
183
165
184
166
elif isinstance (result, tuple ):
185
167
# convert tuple(fallback_array) to tuple(result_array)
186
168
result_list = []
187
169
for res_origin in result:
188
170
res = res_origin
189
171
if isinstance (res_origin, numpy.ndarray):
190
- res = copy_from_origin(res_origin)
172
+ res = dpnp_container.empty(res_origin.shape, dtype = res_origin.dtype)
173
+ copy_from_origin(res, res_origin)
191
174
result_list.append(res)
192
175
193
176
result = tuple (result_list)
0 commit comments