@@ -97,28 +97,29 @@ cpdef utils.dpnp_descriptor dpnp_diag(utils.dpnp_descriptor v, int k):
97
97
return result
98
98
99
99
100
- cpdef dparray dpnp_full(result_shape, value_in, result_dtype):
100
+ cpdef utils.dpnp_descriptor dpnp_full(result_shape, value_in, result_dtype):
101
101
# Convert string type names (dparray.dtype) to C enum DPNPFuncType
102
102
cdef DPNPFuncType dtype_in = dpnp_dtype_to_DPNPFuncType(result_dtype)
103
103
104
104
# get the FPTR data structure
105
105
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_FULL, dtype_in, DPNP_FT_NONE)
106
106
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 )
114
115
115
116
cdef fptr_1in_1out_t func = < fptr_1in_1out_t > kernel_data.ptr
116
117
# 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)
118
119
119
120
return result
120
121
121
-
122
+ # TODO we don't need this function because it is the same as dpnp_full()
122
123
cpdef dparray dpnp_full_like(result_shape, value_in, result_dtype):
123
124
# Convert string type names (dparray.dtype) to C enum DPNPFuncType
124
125
cdef DPNPFuncType dtype_in = dpnp_dtype_to_DPNPFuncType(result_dtype)
0 commit comments