@@ -97,28 +97,29 @@ cpdef utils.dpnp_descriptor dpnp_diag(utils.dpnp_descriptor v, int k):
9797 return result
9898
9999
100- cpdef dparray dpnp_full(result_shape, value_in, result_dtype):
100+ cpdef utils.dpnp_descriptor dpnp_full(result_shape, value_in, result_dtype):
101101 # Convert string type names (dparray.dtype) to C enum DPNPFuncType
102102 cdef DPNPFuncType dtype_in = dpnp_dtype_to_DPNPFuncType(result_dtype)
103103
104104 # get the FPTR data structure
105105 cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_FULL, dtype_in, DPNP_FT_NONE)
106106
107- result_type = dpnp_DPNPFuncType_to_dtype(< size_t > kernel_data.return_type)
108- # Create single-element input array with type given by FPTR data
109- cdef dparray_shape_type shape_in = (1 ,)
110- cdef dparray array_in = dparray(shape_in, dtype = result_type)
111- array_in[0 ] = value_in
112- # Create result array with type given by FPTR data
113- cdef dparray result = dparray(result_shape, dtype = result_type)
107+ # Create single-element input fill array with type given by FPTR data
108+ cdef dparray_shape_type shape_in = (1 ,)
109+ cdef utils.dpnp_descriptor array_fill = utils.create_output_descriptor(shape_in, kernel_data.return_type, None )
110+ array_fill.get_pyobj()[0 ] = value_in
111+
112+ # ceate result array with type given by FPTR data
113+ cdef dparray_shape_type result_shape_c = utils._object_to_tuple(result_shape)
114+ cdef utils.dpnp_descriptor result = utils.create_output_descriptor(result_shape_c, kernel_data.return_type, None )
114115
115116 cdef fptr_1in_1out_t func = < fptr_1in_1out_t > kernel_data.ptr
116117 # Call FPTR function
117- func(array_in .get_data(), result.get_data(), result.size)
118+ func(array_fill .get_data(), result.get_data(), result.size)
118119
119120 return result
120121
121-
122+ # TODO we don't need this function because it is the same as dpnp_full()
122123cpdef dparray dpnp_full_like(result_shape, value_in, result_dtype):
123124 # Convert string type names (dparray.dtype) to C enum DPNPFuncType
124125 cdef DPNPFuncType dtype_in = dpnp_dtype_to_DPNPFuncType(result_dtype)
0 commit comments