@@ -62,13 +62,11 @@ __all__ = [
62
62
" call_origin" ,
63
63
" checker_throw_axis_error" ,
64
64
" checker_throw_index_error" ,
65
- " checker_throw_runtime_error" ,
66
65
" checker_throw_type_error" ,
67
66
" checker_throw_value_error" ,
68
67
" create_output_descriptor_py" ,
69
68
" convert_item" ,
70
69
" dpnp_descriptor" ,
71
- " get_axis_indeces" ,
72
70
" get_axis_offsets" ,
73
71
" get_usm_allocations" ,
74
72
" _get_linear_index" ,
@@ -322,10 +320,6 @@ cpdef checker_throw_index_error(function_name, index, size):
322
320
f" {ERROR_PREFIX} in function {function_name}() index {index} is out of bounds. dimension size `{size}`" )
323
321
324
322
325
- cpdef checker_throw_runtime_error(function_name, message):
326
- raise RuntimeError (f" {ERROR_PREFIX} in function {function_name}(): '{message}'" )
327
-
328
-
329
323
cpdef checker_throw_type_error(function_name, given_type):
330
324
raise TypeError (f" {ERROR_PREFIX} in function {function_name}() type '{given_type}' is not supported" )
331
325
@@ -356,21 +350,6 @@ cpdef dpnp_descriptor create_output_descriptor_py(shape_type_c output_shape,
356
350
sycl_queue = sycl_queue)
357
351
358
352
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
-
374
353
cpdef tuple get_axis_offsets(shape):
375
354
"""
376
355
Compute axis offsets in the linear array memory
@@ -402,36 +381,6 @@ cpdef long _get_linear_index(key, tuple shape, int ndim):
402
381
return li
403
382
404
383
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
-
435
384
cdef shape_type_c get_common_shape(shape_type_c input1_shape, shape_type_c input2_shape) except * :
436
385
cdef shape_type_c input1_shape_orig = input1_shape
437
386
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
458
407
return result_shape
459
408
460
409
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
-
499
410
cdef dpnp_descriptor create_output_descriptor(shape_type_c output_shape,
500
411
DPNPFuncType c_type,
501
412
dpnp_descriptor requested_out,
0 commit comments