Skip to content

Commit 2fe40b7

Browse files
authored
Unskip tests (#659)
* unskip 308 tests
1 parent e674b7c commit 2fe40b7

File tree

3 files changed

+653
-800
lines changed

3 files changed

+653
-800
lines changed

dpnp/dparray.pyx

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ cdef class dparray:
762762
def __truediv__(self, other):
763763
return divide(self, other)
764764
765-
cpdef dparray astype(self, dtype, order='K', casting=None, subok=None, copy=True):
765+
cpdef dparray astype(self, dtype, order='K', casting='unsafe', subok=True, copy=True):
766766
"""Copy the array with data type casting.
767767

768768
Args:
@@ -784,19 +784,22 @@ cdef class dparray:
784784

785785
"""
786786
787-
if casting is not None:
788-
utils.checker_throw_value_error("astype", "casting", casting, None)
789-
790-
if subok is not None:
791-
utils.checker_throw_value_error("astype", "subok", subok, None)
792-
793-
if copy is not True:
794-
utils.checker_throw_value_error("astype", "copy", copy, True)
787+
if casting is not 'unsafe':
788+
pass
789+
elif subok is not True:
790+
pass
791+
elif copy is not True:
792+
pass
793+
elif order is not 'K':
794+
pass
795+
elif self.dtype == numpy.complex128:
796+
pass
797+
else:
798+
return dpnp_astype(self, dtype)
795799
796-
if order is not 'K':
797-
utils.checker_throw_value_error("astype", "order", order, 'K')
800+
result = utils.dp2nd_array(self).astype(dtype=dtype, order=order, casting=casting, subok=subok, copy=copy)
798801
799-
return dpnp_astype(self, dtype)
802+
return utils.nd2dp_array(result)
800803
801804
def conj(self):
802805
"""
@@ -854,12 +857,12 @@ cdef class dparray:
854857
855858
return iface_sum(*args, **kwargs)
856859
857-
def max(self, axis=None):
860+
def max(self, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue):
858861
"""
859862
Return the maximum along an axis.
860863
"""
861864
862-
return max(self, axis)
865+
return max(self, axis, out, keepdims, initial, where)
863866
864867
def mean(self, axis=None):
865868
"""
@@ -868,12 +871,12 @@ cdef class dparray:
868871
869872
return mean(self, axis)
870873
871-
def min(self, axis=None):
874+
def min(self, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue):
872875
"""
873876
Return the minimum along a given axis.
874877
"""
875878
876-
return min(self, axis)
879+
return min(self, axis, out, keepdims, initial, where)
877880
878881
"""
879882
-------------------------------------------------------------------------
@@ -887,6 +890,12 @@ cdef class dparray:
887890
"""
888891
return choose(input, choices, out, mode)
889892
893+
def diagonal(input, offset=0, axis1=0, axis2=1):
894+
"""
895+
Return specified diagonals.
896+
"""
897+
return diagonal(input, offset, axis1, axis2)
898+
890899
def take(self, indices, axis=None, out=None, mode='raise'):
891900
"""
892901
Take elements from an array.

dpnp/dpnp_iface_statistics.py

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=N
276276
return call_origin(numpy.cov, m, y, rowvar, bias, ddof, fweights, aweights)
277277

278278

279-
def max(input, axis=None, out=None):
279+
def max(input, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue):
280280
"""
281281
Return the maximum of an array or maximum along an axis.
282282
@@ -300,33 +300,27 @@ def max(input, axis=None, out=None):
300300
301301
"""
302302

303-
dim_input = input.ndim
304-
305-
is_input_dparray = isinstance(input, dparray)
306-
307-
if not use_origin_backend(input) and is_input_dparray:
308-
if out is not None:
309-
checker_throw_value_error("max", "out", type(out), None)
310-
311-
result = dpnp_max(input, axis=axis)
312-
313-
# scalar returned
314-
if result.shape == (1,):
315-
return result.dtype.type(result[0])
316-
317-
return result
303+
if not use_origin_backend(input):
304+
if not isinstance(input, dparray):
305+
pass
306+
elif out is not None:
307+
pass
308+
elif keepdims is not numpy._NoValue:
309+
pass
310+
elif initial is not numpy._NoValue:
311+
pass
312+
elif where is not numpy._NoValue:
313+
pass
314+
else:
315+
result = dpnp_max(input, axis=axis)
318316

319-
input1 = dpnp.asnumpy(input) if is_input_dparray else input
317+
# scalar returned
318+
if result.shape == (1,):
319+
return result.dtype.type(result[0])
320320

321-
# TODO need to put dparray memory into NumPy call
322-
result_numpy = numpy.max(input1, axis=axis)
323-
result = result_numpy
324-
if isinstance(result, numpy.ndarray):
325-
result = dparray(result_numpy.shape, dtype=result_numpy.dtype)
326-
for i in range(result.size):
327-
result._setitem_scalar(i, result_numpy.item(i))
321+
return result
328322

329-
return result
323+
return call_origin(numpy.max, input, axis, out, keepdims, initial, where)
330324

331325

332326
def mean(a, axis=None, **kwargs):
@@ -433,7 +427,7 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False):
433427
return call_origin(numpy.median, a, axis, out, overwrite_input, keepdims)
434428

435429

436-
def min(input, axis=None, out=None):
430+
def min(input, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue):
437431
"""
438432
Return the minimum along a given axis.
439433
@@ -457,31 +451,27 @@ def min(input, axis=None, out=None):
457451
458452
"""
459453

460-
is_input_dparray = isinstance(input, dparray)
461-
462-
if not use_origin_backend(input) and is_input_dparray:
463-
if out is not None:
464-
checker_throw_value_error("min", "out", type(out), None)
465-
466-
result = dpnp_min(input, axis=axis)
467-
468-
# scalar returned
469-
if result.shape == (1,):
470-
return result.dtype.type(result[0])
471-
472-
return result
454+
if not use_origin_backend(input):
455+
if not isinstance(input, dparray):
456+
pass
457+
elif out is not None:
458+
pass
459+
elif keepdims is not numpy._NoValue:
460+
pass
461+
elif initial is not numpy._NoValue:
462+
pass
463+
elif where is not numpy._NoValue:
464+
pass
465+
else:
466+
result = dpnp_min(input, axis=axis)
473467

474-
input1 = dpnp.asnumpy(input) if is_input_dparray else input
468+
# scalar returned
469+
if result.shape == (1,):
470+
return result.dtype.type(result[0])
475471

476-
# TODO need to put dparray memory into NumPy call
477-
result_numpy = numpy.min(input1, axis=axis)
478-
result = result_numpy
479-
if isinstance(result, numpy.ndarray):
480-
result = dparray(result_numpy.shape, dtype=result_numpy.dtype)
481-
for i in range(result.size):
482-
result._setitem_scalar(i, result_numpy.item(i))
472+
return result
483473

484-
return result
474+
return call_origin(numpy.min, input, axis, out, keepdims, initial, where)
485475

486476

487477
def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=numpy._NoValue):

0 commit comments

Comments
 (0)