Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions dpnp/dpnp_algo/dpnp_algo.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ ctypedef void(*fptr_2in_1out_t)(void *, const void * , const size_t, const long
ctypedef void(*fptr_blas_gemm_2in_1out_t)(void * , void * , void * , size_t, size_t, size_t)
ctypedef void(*dpnp_reduction_c_t)(void * , const void * , const size_t*, const size_t, const long*, const size_t, const void * , const long*)

cdef dparray call_fptr_1out(DPNPFuncName fptr_name, result_shape, result_dtype)
cdef dparray call_fptr_1in_1out(DPNPFuncName fptr_name, dparray x1, dparray_shape_type result_shape)

cpdef dparray dpnp_astype(dparray array1, dtype_target)
cpdef dparray dpnp_flatten(dparray array1)

Expand Down
9 changes: 3 additions & 6 deletions dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,16 @@ cpdef dpnp_DPNPFuncType_to_dtype(size_t type):
utils.checker_throw_type_error("dpnp_DPNPFuncType_to_dtype", type)


cdef dparray call_fptr_1out(DPNPFuncName fptr_name, result_shape, result_dtype):
cdef dparray call_fptr_1out(DPNPFuncName fptr_name, dparray_shape_type result_shape, result_dtype):

# Convert string type names (dparray.dtype) to C enum DPNPFuncType
cdef DPNPFuncType dtype_in = dpnp_dtype_to_DPNPFuncType(result_dtype)

# get the FPTR data structure
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(fptr_name, dtype_in, dtype_in)

result_type = dpnp_DPNPFuncType_to_dtype(< size_t > kernel_data.return_type)

# Create result array with type given by FPTR data
cdef dparray result = dparray(result_shape, dtype=result_type)
cdef dparray result = utils.create_output_array(result_shape, kernel_data.return_type, None)

cdef fptr_1out_t func = <fptr_1out_t > kernel_data.ptr
# Call FPTR function
Expand All @@ -268,9 +266,8 @@ cdef dparray call_fptr_1in_1out(DPNPFuncName fptr_name, dparray x1, dparray_shap
""" get the FPTR data structure """
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(fptr_name, param1_type, param1_type)

result_type = dpnp_DPNPFuncType_to_dtype( < size_t > kernel_data.return_type)
""" Create result array with type given by FPTR data """
cdef dparray result = dparray(result_shape, dtype=result_type)
cdef dparray result = utils.create_output_array(result_shape, kernel_data.return_type, None)

cdef fptr_1in_1out_t func = <fptr_1in_1out_t > kernel_data.ptr
""" Call FPTR function """
Expand Down
8 changes: 4 additions & 4 deletions dpnp/dpnp_algo/dpnp_algo_arraycreation.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ cpdef list dpnp_meshgrid(xi, copy, sparse, indexing):


cpdef dparray dpnp_ones(result_shape, result_dtype):
return call_fptr_1out(DPNP_FN_ONES, result_shape, result_dtype)
return call_fptr_1out(DPNP_FN_ONES, utils._object_to_tuple(result_shape), result_dtype)


cpdef dparray dpnp_ones_like(result_shape, result_dtype):
return call_fptr_1out(DPNP_FN_ONES_LIKE, result_shape, result_dtype)
return call_fptr_1out(DPNP_FN_ONES_LIKE, utils._object_to_tuple(result_shape), result_dtype)


cpdef dparray dpnp_trace(arr, offset=0, axis1=0, axis2=1, dtype=None, out=None):
Expand Down Expand Up @@ -369,8 +369,8 @@ cpdef dparray dpnp_vander(dparray x1, int N, int increasing):


cpdef dparray dpnp_zeros(result_shape, result_dtype):
return call_fptr_1out(DPNP_FN_ZEROS, result_shape, result_dtype)
return call_fptr_1out(DPNP_FN_ZEROS, utils._object_to_tuple(result_shape), result_dtype)


cpdef dparray dpnp_zeros_like(result_shape, result_dtype):
return call_fptr_1out(DPNP_FN_ZEROS_LIKE, result_shape, result_dtype)
return call_fptr_1out(DPNP_FN_ZEROS_LIKE, utils._object_to_tuple(result_shape), result_dtype)