@@ -77,7 +77,7 @@ cpdef utils.dpnp_descriptor dpnp_dot(utils.dpnp_descriptor in_array1, utils.dpnp
77
77
if size1 != size2:
78
78
utils.checker_throw_runtime_error(" dpnp_dot" , " input vectors must be of equal size" )
79
79
80
- # convert string type names (dparray .dtype) to C enum DPNPFuncType
80
+ # convert string type names (array .dtype) to C enum DPNPFuncType
81
81
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(in_array1.dtype)
82
82
cdef DPNPFuncType param2_type = dpnp_dtype_to_DPNPFuncType(in_array2.dtype)
83
83
@@ -104,7 +104,7 @@ cpdef utils.dpnp_descriptor dpnp_dot(utils.dpnp_descriptor in_array1, utils.dpnp
104
104
return result
105
105
106
106
107
- cpdef dparray dpnp_inner(dpnp_descriptor array1, dpnp_descriptor array2):
107
+ cpdef utils.dpnp_descriptor dpnp_inner(dpnp_descriptor array1, dpnp_descriptor array2):
108
108
result_type = numpy.promote_types(array1.dtype, array1.dtype)
109
109
110
110
assert (len (array1.shape) == len (array2.shape))
@@ -115,7 +115,8 @@ cpdef dparray dpnp_inner(dpnp_descriptor array1, dpnp_descriptor array2):
115
115
cdef shape_type_c result_shape = array1_no_last_axes
116
116
result_shape.insert(result_shape.end(), array2_no_last_axes.begin(), array2_no_last_axes.end())
117
117
118
- cdef dparray result = dparray(result_shape, dtype = result_type)
118
+ # ceate result array with type given by FPTR data
119
+ cdef utils.dpnp_descriptor result = utils_py.create_output_descriptor_py(result_shape, result_type, None )
119
120
120
121
# calculate input arrays offsets
121
122
cdef shape_type_c array1_offsets = [1 ] * len (array1.shape)
@@ -157,14 +158,14 @@ cpdef dparray dpnp_inner(dpnp_descriptor array1, dpnp_descriptor array2):
157
158
array2_lin_index_base += array2_offsets[axis] * xyz[axis2]
158
159
159
160
# do inner product
160
- result[idx1] = 0
161
+ result.get_pyobj() [idx1] = 0
161
162
for idx2 in range (array1.shape[- 1 ]):
162
- result[idx1] += array1[array1_lin_index_base + idx2] * array2[array2_lin_index_base + idx2]
163
+ result.get_pyobj() [idx1] += array1.get_pyobj() [array1_lin_index_base + idx2] * array2.get_pyobj() [array2_lin_index_base + idx2]
163
164
164
165
return result
165
166
166
167
167
- cpdef dparray dpnp_kron(dpnp_descriptor in_array1, dpnp_descriptor in_array2):
168
+ cpdef utils.dpnp_descriptor dpnp_kron(dpnp_descriptor in_array1, dpnp_descriptor in_array2):
168
169
cdef size_t ndim = max (in_array1.ndim, in_array2.ndim)
169
170
170
171
cdef shape_type_c in_array1_shape
@@ -185,16 +186,15 @@ cpdef dparray dpnp_kron(dpnp_descriptor in_array1, dpnp_descriptor in_array2):
185
186
for i in range (ndim):
186
187
result_shape.push_back(in_array1_shape[i] * in_array2_shape[i])
187
188
188
- # convert string type names (dparray .dtype) to C enum DPNPFuncType
189
+ # convert string type names (array .dtype) to C enum DPNPFuncType
189
190
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(in_array1.dtype)
190
191
cdef DPNPFuncType param2_type = dpnp_dtype_to_DPNPFuncType(in_array2.dtype)
191
192
192
193
# get the FPTR data structure
193
194
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_KRON, param1_type, param2_type)
194
195
195
- result_type = dpnp_DPNPFuncType_to_dtype(< size_t > kernel_data.return_type)
196
196
# ceate result array with type given by FPTR data
197
- cdef dparray result = dparray (result_shape, dtype = result_type )
197
+ cdef utils.dpnp_descriptor result = utils.create_output_descriptor (result_shape, kernel_data.return_type, None )
198
198
199
199
cdef fptr_2in_1out_shapes_t func = < fptr_2in_1out_shapes_t > kernel_data.ptr
200
200
# call FPTR function
@@ -257,7 +257,7 @@ cpdef utils.dpnp_descriptor dpnp_matmul(utils.dpnp_descriptor in_array1, utils.d
257
257
"""
258
258
shape_result = shape1[:- 1 ] + shape2[1 :]
259
259
260
- # convert string type names (dparray .dtype) to C enum DPNPFuncType
260
+ # convert string type names (array .dtype) to C enum DPNPFuncType
261
261
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(in_array1.dtype)
262
262
cdef DPNPFuncType param2_type = dpnp_dtype_to_DPNPFuncType(in_array2.dtype)
263
263
@@ -276,14 +276,14 @@ cpdef utils.dpnp_descriptor dpnp_matmul(utils.dpnp_descriptor in_array1, utils.d
276
276
return result
277
277
278
278
279
- cpdef dparray dpnp_outer(dpnp_descriptor array1, dpnp_descriptor array2):
279
+ cpdef utils.dpnp_descriptor dpnp_outer(utils. dpnp_descriptor array1, utils. dpnp_descriptor array2):
280
280
cdef shape_type_c result_shape = (array1.size, array2.size)
281
281
result_type = numpy.promote_types(array1.dtype, array1.dtype)
282
282
283
- cdef dparray result = dparray (result_shape, dtype = result_type)
283
+ cdef utils.dpnp_descriptor result = utils_py.create_output_descriptor_py (result_shape, result_type, None )
284
284
285
285
for idx1 in range (array1.size):
286
286
for idx2 in range (array2.size):
287
- result[idx1 * array2.size + idx2] = array1[idx1] * array2[idx2]
287
+ result.get_pyobj() [idx1 * array2.size + idx2] = array1.get_pyobj() [idx1] * array2.get_pyobj() [idx2]
288
288
289
289
return result
0 commit comments