@@ -38,9 +38,7 @@ and the rest of the library
38
38
__all__ += [
39
39
" dpnp_average" ,
40
40
" dpnp_correlate" ,
41
- " dpnp_max" ,
42
41
" dpnp_median" ,
43
- " dpnp_min" ,
44
42
" dpnp_nanvar" ,
45
43
" dpnp_std" ,
46
44
" dpnp_var" ,
@@ -64,16 +62,6 @@ ctypedef c_dpctl.DPCTLSyclEventRef(*custom_statistic_1in_1out_func_ptr_t)(c_dpct
64
62
void * , void * , shape_elem_type * , size_t,
65
63
shape_elem_type * , size_t,
66
64
const c_dpctl.DPCTLEventVectorRef)
67
- ctypedef c_dpctl.DPCTLSyclEventRef(* custom_statistic_1in_1out_func_ptr_t_max)(c_dpctl.DPCTLSyclQueueRef,
68
- void * ,
69
- void * ,
70
- const size_t,
71
- shape_elem_type * ,
72
- size_t,
73
- shape_elem_type * ,
74
- size_t,
75
- const c_dpctl.DPCTLEventVectorRef)
76
-
77
65
78
66
cdef utils.dpnp_descriptor call_fptr_custom_std_var_1in_1out(DPNPFuncName fptr_name, utils.dpnp_descriptor x1, ddof):
79
67
cdef shape_type_c x1_shape = x1.shape
@@ -177,86 +165,6 @@ cpdef utils.dpnp_descriptor dpnp_correlate(utils.dpnp_descriptor x1, utils.dpnp_
177
165
return result
178
166
179
167
180
- cdef utils.dpnp_descriptor _dpnp_max(utils.dpnp_descriptor x1, _axis_, shape_type_c result_shape):
181
- cdef shape_type_c x1_shape = x1.shape
182
- cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(x1.dtype)
183
-
184
- cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_MAX_EXT, param1_type, param1_type)
185
-
186
- x1_obj = x1.get_array()
187
-
188
- # create result array with type given by FPTR data
189
- cdef utils.dpnp_descriptor result = utils.create_output_descriptor(result_shape,
190
- kernel_data.return_type,
191
- None ,
192
- device = x1_obj.sycl_device,
193
- usm_type = x1_obj.usm_type,
194
- sycl_queue = x1_obj.sycl_queue)
195
-
196
- result_sycl_queue = result.get_array().sycl_queue
197
-
198
- cdef c_dpctl.SyclQueue q = < c_dpctl.SyclQueue> result_sycl_queue
199
- cdef c_dpctl.DPCTLSyclQueueRef q_ref = q.get_queue_ref()
200
-
201
- cdef custom_statistic_1in_1out_func_ptr_t_max func = < custom_statistic_1in_1out_func_ptr_t_max > kernel_data.ptr
202
- cdef shape_type_c axis
203
- cdef Py_ssize_t axis_size = 0
204
- cdef shape_type_c axis_ = axis
205
-
206
- if _axis_ is not None :
207
- axis = _axis_
208
- axis_.reserve(len (axis))
209
- for shape_it in axis:
210
- axis_.push_back(shape_it)
211
- axis_size = len (axis)
212
-
213
- cdef c_dpctl.DPCTLSyclEventRef event_ref = func(q_ref,
214
- x1.get_data(),
215
- result.get_data(),
216
- result.size,
217
- x1_shape.data(),
218
- x1.ndim,
219
- axis_.data(),
220
- axis_size,
221
- NULL ) # dep_events_ref
222
-
223
- with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
224
- c_dpctl.DPCTLEvent_Delete(event_ref)
225
-
226
- return result
227
-
228
-
229
- cpdef utils.dpnp_descriptor dpnp_max(utils.dpnp_descriptor x1, axis):
230
- cdef shape_type_c x1_shape = x1.shape
231
- cdef shape_type_c output_shape
232
-
233
- if axis is None :
234
- axis_ = axis
235
- output_shape.push_back(1 )
236
- else :
237
- if isinstance (axis, int ):
238
- if axis < 0 :
239
- axis_ = tuple ([x1.ndim - axis])
240
- else :
241
- axis_ = tuple ([axis])
242
- else :
243
- _axis_ = []
244
- for i in range (len (axis)):
245
- if axis[i] < 0 :
246
- _axis_.append(x1.ndim - axis[i])
247
- else :
248
- _axis_.append(axis[i])
249
- axis_ = tuple (_axis_)
250
-
251
- output_shape.resize(len (x1_shape) - len (axis_), 0 )
252
- ind = 0
253
- for id , shape_axis in enumerate (x1_shape):
254
- if id not in axis_:
255
- output_shape[ind] = shape_axis
256
- ind += 1
257
-
258
- return _dpnp_max(x1, axis_, output_shape)
259
-
260
168
cpdef utils.dpnp_descriptor dpnp_median(utils.dpnp_descriptor array1):
261
169
cdef shape_type_c x1_shape = array1.shape
262
170
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(array1.dtype)
@@ -301,85 +209,6 @@ cpdef utils.dpnp_descriptor dpnp_median(utils.dpnp_descriptor array1):
301
209
return result
302
210
303
211
304
- cpdef utils.dpnp_descriptor _dpnp_min(utils.dpnp_descriptor x1, _axis_, shape_type_c shape_output):
305
- cdef shape_type_c x1_shape = x1.shape
306
- cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(x1.dtype)
307
-
308
- cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_MIN_EXT, param1_type, param1_type)
309
-
310
- x1_obj = x1.get_array()
311
-
312
- cdef utils.dpnp_descriptor result = utils.create_output_descriptor(shape_output,
313
- kernel_data.return_type,
314
- None ,
315
- device = x1_obj.sycl_device,
316
- usm_type = x1_obj.usm_type,
317
- sycl_queue = x1_obj.sycl_queue)
318
-
319
- result_sycl_queue = result.get_array().sycl_queue
320
-
321
- cdef c_dpctl.SyclQueue q = < c_dpctl.SyclQueue> result_sycl_queue
322
- cdef c_dpctl.DPCTLSyclQueueRef q_ref = q.get_queue_ref()
323
-
324
- cdef custom_statistic_1in_1out_func_ptr_t_max func = < custom_statistic_1in_1out_func_ptr_t_max > kernel_data.ptr
325
- cdef shape_type_c axis
326
- cdef Py_ssize_t axis_size = 0
327
- cdef shape_type_c axis_ = axis
328
-
329
- if _axis_ is not None :
330
- axis = _axis_
331
- axis_.reserve(len (axis))
332
- for shape_it in axis:
333
- if shape_it < 0 :
334
- raise ValueError (" DPNP algo::_dpnp_min(): Negative values in 'shape' are not allowed" )
335
- axis_.push_back(shape_it)
336
- axis_size = len (axis)
337
-
338
- cdef c_dpctl.DPCTLSyclEventRef event_ref = func(q_ref,
339
- x1.get_data(),
340
- result.get_data(),
341
- result.size,
342
- x1_shape.data(),
343
- x1.ndim,
344
- axis_.data(),
345
- axis_size,
346
- NULL ) # dep_events_ref
347
-
348
- with nogil: c_dpctl.DPCTLEvent_WaitAndThrow(event_ref)
349
- c_dpctl.DPCTLEvent_Delete(event_ref)
350
-
351
- return result
352
-
353
-
354
- cpdef utils.dpnp_descriptor dpnp_min(utils.dpnp_descriptor x1, axis):
355
- cdef shape_type_c x1_shape = x1.shape
356
- cdef shape_type_c shape_output
357
-
358
- if axis is None :
359
- axis_ = axis
360
- shape_output = (1 ,)
361
- else :
362
- if isinstance (axis, int ):
363
- if axis < 0 :
364
- axis_ = tuple ([x1.ndim - axis])
365
- else :
366
- axis_ = tuple ([axis])
367
- else :
368
- _axis_ = []
369
- for i in range (len (axis)):
370
- if axis[i] < 0 :
371
- _axis_.append(x1.ndim - axis[i])
372
- else :
373
- _axis_.append(axis[i])
374
- axis_ = tuple (_axis_)
375
-
376
- for id , shape_axis in enumerate (x1_shape):
377
- if id not in axis_:
378
- shape_output.push_back(shape_axis)
379
-
380
- return _dpnp_min(x1, axis_, shape_output)
381
-
382
-
383
212
cpdef utils.dpnp_descriptor dpnp_nanvar(utils.dpnp_descriptor arr, ddof):
384
213
# dpnp_isnan does not support USM array as input in comparison to dpnp.isnan
385
214
cdef utils.dpnp_descriptor mask_arr = dpnp.get_dpnp_descriptor(dpnp.isnan(arr.get_pyobj()),
0 commit comments