@@ -62,13 +62,11 @@ __all__ = [
6262 " call_origin" ,
6363 " checker_throw_axis_error" ,
6464 " checker_throw_index_error" ,
65- " checker_throw_runtime_error" ,
6665 " checker_throw_type_error" ,
6766 " checker_throw_value_error" ,
6867 " create_output_descriptor_py" ,
6968 " convert_item" ,
7069 " dpnp_descriptor" ,
71- " get_axis_indeces" ,
7270 " get_axis_offsets" ,
7371 " get_usm_allocations" ,
7472 " _get_linear_index" ,
@@ -322,10 +320,6 @@ cpdef checker_throw_index_error(function_name, index, size):
322320 f" {ERROR_PREFIX} in function {function_name}() index {index} is out of bounds. dimension size `{size}`" )
323321
324322
325- cpdef checker_throw_runtime_error(function_name, message):
326- raise RuntimeError (f" {ERROR_PREFIX} in function {function_name}(): '{message}'" )
327-
328-
329323cpdef checker_throw_type_error(function_name, given_type):
330324 raise TypeError (f" {ERROR_PREFIX} in function {function_name}() type '{given_type}' is not supported" )
331325
@@ -356,21 +350,6 @@ cpdef dpnp_descriptor create_output_descriptor_py(shape_type_c output_shape,
356350 sycl_queue = sycl_queue)
357351
358352
359- cpdef tuple get_axis_indeces(idx, shape):
360- """
361- Compute axis indices of an element in array from array linear index
362- """
363-
364- ids = []
365- remainder = idx
366- offsets = get_axis_offsets(shape)
367- for i in offsets:
368- quotient, remainder = divmod (remainder, i)
369- ids.append(quotient)
370-
371- return _object_to_tuple(ids)
372-
373-
374353cpdef tuple get_axis_offsets(shape):
375354 """
376355 Compute axis offsets in the linear array memory
@@ -402,36 +381,6 @@ cpdef long _get_linear_index(key, tuple shape, int ndim):
402381 return li
403382
404383
405- cdef tuple get_shape_dtype(object input_obj):
406- cdef shape_type_c return_shape # empty shape means scalar
407- return_dtype = None
408-
409- # TODO replace with checking "shape" and "dtype" attributes
410- if hasattr (input_obj, " shape" ) and hasattr (input_obj, " dtype" ):
411- return (input_obj.shape, input_obj.dtype)
412-
413- cdef shape_type_c elem_shape
414- cdef shape_type_c list_shape
415- if isinstance (input_obj, (list , tuple )):
416- for elem in input_obj:
417- elem_shape, elem_dtype = get_shape_dtype(elem)
418-
419- if return_shape.empty():
420- return_shape = elem_shape
421- return_dtype = elem_dtype
422-
423- # shape and dtype does not match with siblings.
424- if ((return_shape != elem_shape) or (return_dtype != elem_dtype)):
425- return (elem_shape, dpnp.dtype(numpy.object_))
426-
427- list_shape.push_back(len (input_obj))
428- list_shape.insert(list_shape.end(), return_shape.begin(), return_shape.end())
429- return (list_shape, return_dtype)
430-
431- # assume scalar or object
432- return (return_shape, dpnp.dtype(type (input_obj)))
433-
434-
435384cdef shape_type_c get_common_shape(shape_type_c input1_shape, shape_type_c input2_shape) except * :
436385 cdef shape_type_c input1_shape_orig = input1_shape
437386 cdef shape_type_c input2_shape_orig = input2_shape
@@ -458,44 +407,6 @@ cdef shape_type_c get_common_shape(shape_type_c input1_shape, shape_type_c input
458407 return result_shape
459408
460409
461- cdef shape_type_c get_reduction_output_shape(shape_type_c input_shape, object axis, cpp_bool keepdims):
462- cdef shape_type_c result_shape
463- cdef tuple axis_tuple = _object_to_tuple(axis)
464-
465- if axis is not None :
466- for it in range (input_shape.size()):
467- if it not in axis_tuple:
468- result_shape.push_back(input_shape[it])
469- elif keepdims is True :
470- result_shape.push_back(1 )
471- elif keepdims is True :
472- for it in range (input_shape.size()):
473- result_shape.push_back(1 )
474-
475- return result_shape
476-
477-
478- cdef DPNPFuncType get_output_c_type(DPNPFuncName funcID,
479- DPNPFuncType input_array_c_type,
480- object requested_out,
481- object requested_dtype):
482-
483- if requested_out is None :
484- if requested_dtype is None :
485- """ get recommended result type by function ID """
486- kernel_data = get_dpnp_function_ptr(funcID, input_array_c_type, input_array_c_type)
487- return kernel_data.return_type
488- else :
489- """ return type by request """
490- return dpnp_dtype_to_DPNPFuncType(requested_dtype)
491- else :
492- if requested_dtype is None :
493- """ determined by 'out' parameter """
494- return dpnp_dtype_to_DPNPFuncType(requested_out.dtype)
495-
496- checker_throw_value_error(" get_output_c_type" , " dtype and out" , requested_dtype, requested_out)
497-
498-
499410cdef dpnp_descriptor create_output_descriptor(shape_type_c output_shape,
500411 DPNPFuncType c_type,
501412 dpnp_descriptor requested_out,
0 commit comments