@@ -331,7 +331,7 @@ cpdef dpnp_nansum(object x1):
331331 # return dpnp_sum(result)
332332
333333 result_desc = dpnp.get_dpnp_descriptor(result) # TODO remove it later
334- sum_result = dpnp_sum(result_desc)
334+ sum_result = dpnp_sum(result_desc).get_pyobj()
335335 return x1.dtype.type(sum_result[0 ])
336336
337337
@@ -387,7 +387,7 @@ cpdef dparray dpnp_subtract(object x1_obj, object x2_obj, object dtype=None, dpa
387387 return call_fptr_2in_1out(DPNP_FN_SUBTRACT, x1_obj, x2_obj, dtype = dtype, out = out, where = where)
388388
389389
390- cpdef dparray dpnp_sum(utils.dpnp_descriptor input , object axis = None , object dtype = None , dparray out = None , cpp_bool keepdims = False , object initial = None , object where = True ):
390+ cpdef utils.dpnp_descriptor dpnp_sum(utils.dpnp_descriptor input , object axis = None , object dtype = None , dparray out = None , cpp_bool keepdims = False , object initial = None , object where = True ):
391391
392392 cdef dparray_shape_type input_shape = input .shape
393393 cdef DPNPFuncType input_c_type = dpnp_dtype_to_DPNPFuncType(input .dtype)
@@ -401,10 +401,10 @@ cpdef dparray dpnp_sum(utils.dpnp_descriptor input, object axis=None, object dty
401401 cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_SUM, input_c_type, result_c_type)
402402
403403 """ Create result array """
404- cdef dparray result = utils.create_output_array(result_shape, result_c_type, out)
405- cdef dpnp_reduction_c_t func = < dpnp_reduction_c_t > kernel_data.ptr
404+ cdef utils.dpnp_descriptor result = utils.create_output_descriptor(result_shape, result_c_type, out)
406405
407406 """ Call FPTR interface function """
407+ cdef dpnp_reduction_c_t func = < dpnp_reduction_c_t > kernel_data.ptr
408408 func(result.get_data(), input .get_data(), < size_t * > input_shape.data(), input_shape.size(), axis_shape.data(), axis_shape.size(), NULL , NULL )
409409
410410 return result
0 commit comments