@@ -337,14 +337,13 @@ cpdef dparray dpnp_median(utils.dpnp_descriptor array1):
337
337
return result
338
338
339
339
340
- cpdef dparray _dpnp_min(dparray input , _axis_, output_shape ):
340
+ cpdef utils.dpnp_descriptor _dpnp_min(utils.dpnp_descriptor input , _axis_, shape_type_c shape_output ):
341
341
cdef shape_type_c input_shape = input .shape
342
342
cdef DPNPFuncType param1_type = dpnp_dtype_to_DPNPFuncType(input .dtype)
343
343
344
344
cdef DPNPFuncData kernel_data = get_dpnp_function_ptr(DPNP_FN_MIN, param1_type, param1_type)
345
345
346
- result_type = dpnp_DPNPFuncType_to_dtype(< size_t > kernel_data.return_type)
347
- cdef dparray result = dparray(output_shape, dtype = result_type)
346
+ cdef utils.dpnp_descriptor result = utils.create_output_descriptor(shape_output, kernel_data.return_type, None )
348
347
349
348
cdef custom_statistic_1in_1out_func_ptr_t func = < custom_statistic_1in_1out_func_ptr_t > kernel_data.ptr
350
349
cdef shape_type_c axis
@@ -356,22 +355,27 @@ cpdef dparray _dpnp_min(dparray input, _axis_, output_shape):
356
355
axis_.reserve(len (axis))
357
356
for shape_it in axis:
358
357
if shape_it < 0 :
359
- raise ValueError (" DPNP dparray::__init__ (): Negative values in 'shape' are not allowed" )
358
+ raise ValueError (" DPNP algo::_dpnp_min (): Negative values in 'shape' are not allowed" )
360
359
axis_.push_back(shape_it)
361
360
axis_size = len (axis)
362
361
363
- func(input .get_data(), result.get_data(), < size_t * > input_shape.data(), input .ndim, < size_t * > axis_.data(), axis_size)
362
+ func(input .get_data(),
363
+ result.get_data(),
364
+ < size_t * > input_shape.data(),
365
+ input .ndim,
366
+ < size_t * > axis_.data(),
367
+ axis_size)
364
368
365
- dpnp_array = dpnp.array(result, dtype = input .dtype)
366
- dpnp_result_array = dpnp_array.reshape(output_shape)
367
- return dpnp_result_array
369
+ return result
368
370
369
371
370
- cpdef dparray dpnp_min(dparray input , axis):
372
+ cpdef utils.dpnp_descriptor dpnp_min(utils.dpnp_descriptor input , axis):
371
373
cdef shape_type_c shape_input = input .shape
374
+ cdef shape_type_c shape_output
375
+
372
376
if axis is None :
373
377
axis_ = axis
374
- output_shape = 1
378
+ shape_output = ( 1 ,)
375
379
else :
376
380
if isinstance (axis, int ):
377
381
if axis < 0 :
@@ -387,13 +391,11 @@ cpdef dparray dpnp_min(dparray input, axis):
387
391
_axis_.append(axis[i])
388
392
axis_ = tuple (_axis_)
389
393
390
- output_shape = dparray(len (shape_input) - len (axis_), dtype = numpy.int64)
391
- ind = 0
392
394
for id , shape_axis in enumerate (shape_input):
393
395
if id not in axis_:
394
- output_shape[ind] = shape_axis
395
- ind += 1
396
- return _dpnp_min(input , axis_, output_shape )
396
+ shape_output.push_back( shape_axis)
397
+
398
+ return _dpnp_min(input , axis_, shape_output )
397
399
398
400
399
401
cpdef dparray dpnp_nanvar(utils.dpnp_descriptor arr, ddof):
0 commit comments