@@ -33,6 +33,7 @@ and the rest of the library
3333"""
3434
3535from libc.time cimport time, time_t
36+ import dpnp
3637import dpnp.config as config
3738import numpy
3839
@@ -111,7 +112,7 @@ cpdef dparray dpnp_array(obj, dtype=None):
111112 if not cpython.PySequence_Check(obj):
112113 raise TypeError (f" DPNP array(): Unsupported non-sequence obj={type(obj)}" )
113114
114- obj_shape, elem_dtype = get_shape_dtype(obj)
115+ obj_shape, elem_dtype = utils. get_shape_dtype(obj)
115116 if dtype is not None :
116117 """ Set type from parameter. result might be empty array """
117118 result = dparray(obj_shape, dtype = dtype)
@@ -122,7 +123,7 @@ cpdef dparray dpnp_array(obj, dtype=None):
122123 else :
123124 result = dparray(obj_shape, dtype = elem_dtype)
124125
125- copy_values_to_dparray(result, obj)
126+ utils. copy_values_to_dparray(result, obj)
126127
127128 return result
128129
@@ -241,9 +242,9 @@ cpdef dparray dpnp_matmul(dparray in_array1, dparray in_array2, dparray out=None
241242
242243 if out is not None :
243244 if out.dtype != result_type:
244- checker_throw_value_error(' matmul' , ' out.dtype' , out.dtype, result_type)
245+ utils. checker_throw_value_error(' matmul' , ' out.dtype' , out.dtype, result_type)
245246 if out.shape != shape_result:
246- checker_throw_value_error(' matmul' , ' out.shape' , out.shape, shape_result)
247+ utils. checker_throw_value_error(' matmul' , ' out.shape' , out.shape, shape_result)
247248 result = out
248249 else :
249250 result = dparray(shape_result, dtype = result_type)
@@ -302,7 +303,7 @@ cpdef DPNPFuncType dpnp_dtype_to_DPNPFuncType(dtype):
302303 elif dtype in [numpy.bool, numpy.bool_, ' bool' , ' ?' ]:
303304 return DPNP_FT_BOOL
304305 else :
305- checker_throw_type_error(" dpnp_dtype_to_DPNPFuncType" , dtype)
306+ utils. checker_throw_type_error(" dpnp_dtype_to_DPNPFuncType" , dtype)
306307
307308cpdef dpnp_DPNPFuncType_to_dtype(size_t type ):
308309 """
@@ -322,7 +323,7 @@ cpdef dpnp_DPNPFuncType_to_dtype(size_t type):
322323 elif type == < size_t > DPNP_FT_BOOL:
323324 return numpy.bool
324325 else :
325- checker_throw_type_error(" dpnp_DPNPFuncType_to_dtype" , type )
326+ utils. checker_throw_type_error(" dpnp_DPNPFuncType_to_dtype" , type )
326327
327328
328329cdef dparray call_fptr_1out(DPNPFuncName fptr_name, result_shape, result_dtype):
@@ -373,23 +374,23 @@ cdef dparray call_fptr_2in_1out(DPNPFuncName fptr_name, object x1_obj, object x2
373374
374375 cdef dparray x1_dparray, x2_dparray
375376
376- common_type = find_common_type(x1_obj, x2_obj)
377+ common_type = utils. find_common_type(x1_obj, x2_obj)
377378
378379 if x1_obj_is_dparray:
379380 x1_dparray = x1_obj
380381 else :
381382 x1_dparray = dparray((1 ,), dtype = common_type)
382- copy_values_to_dparray(x1_dparray, (x1_obj,))
383+ utils. copy_values_to_dparray(x1_dparray, (x1_obj,))
383384
384385 if x2_obj_is_dparray:
385386 x2_dparray = x2_obj
386387 else :
387388 x2_dparray = dparray((1 ,), dtype = common_type)
388- copy_values_to_dparray(x2_dparray, (x2_obj,))
389+ utils. copy_values_to_dparray(x2_dparray, (x2_obj,))
389390
390391 x1_shape = x1_dparray.shape
391392 x2_shape = x2_dparray.shape
392- result_shape = get_common_shape(x1_shape, x2_shape)
393+ result_shape = utils. get_common_shape(x1_shape, x2_shape)
393394
394395 # Convert string type names (dparray.dtype) to C enum DPNPFuncType
395396 cdef DPNPFuncType x1_c_type = dpnp_dtype_to_DPNPFuncType(x1_dparray.dtype)
@@ -401,7 +402,7 @@ cdef dparray call_fptr_2in_1out(DPNPFuncName fptr_name, object x1_obj, object x2
401402 # TODO: apply parameters out and dtype after reafactoring fmap (required 4th level nesting)
402403
403404 # Create result array
404- cdef dparray result = create_output_array(result_shape, kernel_data.return_type, out)
405+ cdef dparray result = utils. create_output_array(result_shape, kernel_data.return_type, out)
405406
406407 """ Call FPTR function """
407408 cdef fptr_2in_1out_t func = < fptr_2in_1out_t > kernel_data.ptr
@@ -411,7 +412,7 @@ cdef dparray call_fptr_2in_1out(DPNPFuncName fptr_name, object x1_obj, object x2
411412 return result
412413
413414# this is replacement for "call_fptr_2in_1out". original function must be deleted after transotion.
414- cdef dparray call_fptr_2in_1out_new(DPNPFuncName fptr_name, dpnp_descriptor x1_obj, dpnp_descriptor x2_obj,
415+ cdef dparray call_fptr_2in_1out_new(DPNPFuncName fptr_name, utils. dpnp_descriptor x1_obj, utils. dpnp_descriptor x2_obj,
415416 object dtype = None , dparray out = None , object where = True ):
416417 # Convert string type names (dparray.dtype) to C enum DPNPFuncType
417418 cdef DPNPFuncType x1_c_type = dpnp_dtype_to_DPNPFuncType(x1_obj.dtype)
@@ -423,8 +424,8 @@ cdef dparray call_fptr_2in_1out_new(DPNPFuncName fptr_name, dpnp_descriptor x1_o
423424 # Create result array
424425 cdef dparray_shape_type x1_shape = x1_obj.shape
425426 cdef dparray_shape_type x2_shape = x2_obj.shape
426- cdef dparray_shape_type result_shape = get_common_shape(x1_shape, x2_shape)
427- cdef dparray result = create_output_array(result_shape, kernel_data.return_type, out)
427+ cdef dparray_shape_type result_shape = utils. get_common_shape(x1_shape, x2_shape)
428+ cdef dparray result = utils. create_output_array(result_shape, kernel_data.return_type, out)
428429
429430 """ Call FPTR function """
430431 cdef fptr_2in_1out_t func = < fptr_2in_1out_t > kernel_data.ptr
0 commit comments