Skip to content

Commit 26ad67f

Browse files
authored
Merge fb93a76 into 9127df2
2 parents 9127df2 + fb93a76 commit 26ad67f

File tree

12 files changed

+714
-152
lines changed

12 files changed

+714
-152
lines changed

tests/skipped_tests.tbl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -309,46 +309,3 @@ tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bo
309309
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bound_2
310310
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit
311311
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit_2
312-
313-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef
314-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_diag_exception
315-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_rowvar
316-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_y
317-
318-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[linear]
319-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[lower]
320-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[higher]
321-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[midpoint]
322-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[linear]
323-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[lower]
324-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[higher]
325-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[midpoint]
326-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[linear]
327-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[lower]
328-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[higher]
329-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[midpoint]
330-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[linear]
331-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[lower]
332-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[higher]
333-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[midpoint]
334-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[linear]
335-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[lower]
336-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[higher]
337-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[midpoint]
338-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[linear]
339-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[lower]
340-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[higher]
341-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[midpoint]
342-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[linear]
343-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[lower]
344-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[higher]
345-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[midpoint]
346-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[linear]
347-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[lower]
348-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[higher]
349-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[midpoint]
350-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[linear]
351-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[lower]
352-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[higher]
353-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[midpoint]
354-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_unxpected_method

tests/skipped_tests_gpu.tbl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -319,46 +319,3 @@ tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bo
319319
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_bound_2
320320
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit
321321
tests/third_party/cupy/random_tests/test_sample.py::TestRandomIntegers2::test_goodness_of_fit_2
322-
323-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef
324-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_diag_exception
325-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_rowvar
326-
tests/third_party/cupy/statistics_tests/test_correlation.py::TestCorrcoef::test_corrcoef_y
327-
328-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[linear]
329-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[lower]
330-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[higher]
331-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_defaults[midpoint]
332-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[linear]
333-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[lower]
334-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[higher]
335-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_q_list[midpoint]
336-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[linear]
337-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[lower]
338-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[higher]
339-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_no_axis[midpoint]
340-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[linear]
341-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[lower]
342-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[higher]
343-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_neg_axis[midpoint]
344-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[linear]
345-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[lower]
346-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[higher]
347-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_tuple_axis[midpoint]
348-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[linear]
349-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[lower]
350-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[higher]
351-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_scalar_q[midpoint]
352-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[linear]
353-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[lower]
354-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[higher]
355-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_keepdims[midpoint]
356-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[linear]
357-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[lower]
358-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[higher]
359-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_out[midpoint]
360-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[linear]
361-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[lower]
362-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[higher]
363-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_bad_q[midpoint]
364-
tests/third_party/cupy/statistics_tests/test_order.py::TestOrder::test_percentile_unxpected_method

tests/third_party/cupy/__init__.py

Whitespace-only changes.

tests/third_party/cupy/statistics_tests/test_correlation.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import sys
21
import unittest
32

43
import numpy
54
import pytest
6-
from dpctl import select_default_device
75

86
import dpnp as cupy
97
from tests.helper import has_support_aspect64
108
from tests.third_party.cupy import testing
119

1210

11+
@pytest.mark.skip("dpnp.corrcoef() is not implemented yet")
1312
class TestCorrcoef(unittest.TestCase):
13+
1414
@testing.for_all_dtypes()
1515
@testing.numpy_cupy_allclose()
1616
def test_corrcoef(self, xp, dtype):
@@ -37,10 +37,16 @@ def test_corrcoef_rowvar(self, xp, dtype):
3737
y = testing.shaped_arange((2, 3), xp, dtype)
3838
return xp.corrcoef(a, y=y, rowvar=False)
3939

40+
@testing.with_requires("numpy>=1.20")
41+
@testing.for_all_dtypes()
42+
@testing.numpy_cupy_allclose(accept_error=True)
43+
def test_corrcoef_dtype(self, xp, dtype):
44+
a = testing.shaped_arange((2, 3), xp, dtype)
45+
y = testing.shaped_arange((2, 3), xp, dtype)
46+
return xp.corrcoef(a, y=y, dtype=dtype)
47+
4048

4149
class TestCov(unittest.TestCase):
42-
# resulting dtype will differ with numpy if no fp64 support by a default device
43-
_has_fp64 = select_default_device().has_aspect_fp64
4450

4551
def generate_input(self, a_shape, y_shape, xp, dtype):
4652
a = testing.shaped_arange(a_shape, xp, dtype)
@@ -50,7 +56,9 @@ def generate_input(self, a_shape, y_shape, xp, dtype):
5056
return a, y
5157

5258
@testing.for_all_dtypes()
53-
@testing.numpy_cupy_allclose(type_check=_has_fp64, accept_error=True)
59+
@testing.numpy_cupy_allclose(
60+
type_check=has_support_aspect64(), accept_error=True
61+
)
5462
def check(
5563
self,
5664
a_shape,
@@ -153,6 +161,7 @@ def test_cov_empty(self):
153161
)
154162
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
155163
class TestCorrelateShapeCombination(unittest.TestCase):
164+
156165
@testing.for_all_dtypes(no_float16=True)
157166
@testing.numpy_cupy_allclose(rtol=1e-4)
158167
def test_correlate(self, xp, dtype):
@@ -161,34 +170,36 @@ def test_correlate(self, xp, dtype):
161170
return xp.correlate(a, b, mode=self.mode)
162171

163172

164-
@testing.parameterize(*testing.product({"mode": ["valid", "full", "same"]}))
173+
@pytest.mark.parametrize("mode", ["valid", "full", "same"])
165174
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
166-
class TestCorrelate(unittest.TestCase):
175+
class TestCorrelate:
176+
167177
@testing.for_all_dtypes()
168178
@testing.numpy_cupy_allclose(rtol=1e-5)
169-
def test_correlate_non_contiguous(self, xp, dtype):
179+
def test_correlate_non_contiguous(self, xp, dtype, mode):
170180
a = testing.shaped_arange((300,), xp, dtype)
171181
b = testing.shaped_arange((100,), xp, dtype)
172-
return xp.correlate(a[::200], b[10::70], mode=self.mode)
182+
return xp.correlate(a[::200], b[10::70], mode=mode)
173183

174184
@testing.for_all_dtypes(no_float16=True)
175185
@testing.numpy_cupy_allclose(rtol=1e-4)
176-
def test_correlate_large_non_contiguous(self, xp, dtype):
186+
def test_correlate_large_non_contiguous(self, xp, dtype, mode):
177187
a = testing.shaped_arange((10000,), xp, dtype)
178188
b = testing.shaped_arange((1000,), xp, dtype)
179-
return xp.correlate(a[200::], b[10::700], mode=self.mode)
189+
return xp.correlate(a[200::], b[10::700], mode=mode)
180190

181191
@testing.for_all_dtypes_combination(names=["dtype1", "dtype2"])
182192
@testing.numpy_cupy_allclose(rtol=1e-2, type_check=has_support_aspect64())
183-
def test_correlate_diff_types(self, xp, dtype1, dtype2):
193+
def test_correlate_diff_types(self, xp, dtype1, dtype2, mode):
184194
a = testing.shaped_random((200,), xp, dtype1)
185195
b = testing.shaped_random((100,), xp, dtype2)
186-
return xp.correlate(a, b, mode=self.mode)
196+
return xp.correlate(a, b, mode=mode)
187197

188198

189199
@testing.parameterize(*testing.product({"mode": ["valid", "same", "full"]}))
190200
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
191201
class TestCorrelateInvalid(unittest.TestCase):
202+
192203
@testing.with_requires("numpy>=1.18")
193204
@testing.for_all_dtypes()
194205
def test_correlate_empty(self, dtype):

tests/third_party/cupy/statistics_tests/test_histogram.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def for_all_dtypes_combination_bincount(names):
4242

4343

4444
class TestHistogram(unittest.TestCase):
45+
4546
@testing.for_all_dtypes(no_bool=True, no_complex=True)
4647
@testing.numpy_cupy_allclose(atol=1e-6, type_check=has_support_aspect64())
4748
def test_histogram(self, xp, dtype):
@@ -94,7 +95,7 @@ def test_histogram_range_with_density(self, xp, dtype):
9495
return h
9596

9697
@testing.for_float_dtypes()
97-
@testing.numpy_cupy_allclose(atol=1e-6, type_check=False)
98+
@testing.numpy_cupy_allclose(atol=1e-6, type_check=has_support_aspect64())
9899
def test_histogram_range_with_weights_and_density(self, xp, dtype):
99100
a = xp.arange(10, dtype=dtype) + 0.5
100101
w = xp.arange(10, dtype=dtype) + 0.5
@@ -135,7 +136,9 @@ def test_histogram_int_weights_dtype(self, xp, dtype):
135136
def test_histogram_float_weights_dtype(self, xp, dtype):
136137
# Check the type of the returned histogram
137138
a = xp.arange(10, dtype=dtype)
138-
h, b = xp.histogram(a, weights=xp.ones(10, dtype=xp.float32))
139+
h, b = xp.histogram(
140+
a, weights=xp.ones(10, dtype=cupy.default_float_type())
141+
)
139142
assert xp.issubdtype(h.dtype, xp.floating)
140143
return h
141144

@@ -363,6 +366,7 @@ def test_bincount_too_small_minlength(self, dtype):
363366
)
364367
)
365368
class TestDigitize:
369+
366370
@testing.for_all_dtypes(no_bool=True, no_complex=True)
367371
@testing.numpy_cupy_array_equal()
368372
def test_digitize(self, xp, dtype):
@@ -377,6 +381,7 @@ def test_digitize(self, xp, dtype):
377381

378382
@testing.parameterize({"right": True}, {"right": False})
379383
class TestDigitizeNanInf(unittest.TestCase):
384+
380385
@testing.numpy_cupy_array_equal()
381386
def test_digitize_nan(self, xp):
382387
x = testing.shaped_arange((14,), xp, xp.float32)
@@ -446,6 +451,7 @@ def test_searchsorted_minf(self, xp):
446451

447452

448453
class TestDigitizeInvalid(unittest.TestCase):
454+
449455
def test_digitize_complex(self):
450456
for xp in (numpy, cupy):
451457
x = testing.shaped_arange((14,), xp, xp.complex64)
@@ -462,6 +468,7 @@ def test_digitize_nd_bins(self):
462468

463469

464470
@pytest.mark.skip("histogramdd() is not implemented yet")
471+
# @pytest.mark.skip(reason="XXX: NP2.0: histogramdd dtype")
465472
@testing.parameterize(
466473
*testing.product(
467474
{
@@ -481,6 +488,7 @@ def test_digitize_nd_bins(self):
481488
)
482489
)
483490
class TestHistogramdd:
491+
484492
@testing.for_all_dtypes(no_bool=True, no_complex=True)
485493
@testing.numpy_cupy_allclose(atol=1e-7, rtol=1e-7)
486494
def test_histogramdd(self, xp, dtype):
@@ -507,6 +515,7 @@ def test_histogramdd(self, xp, dtype):
507515

508516
@pytest.mark.skip("histogramdd() is not implemented yet")
509517
class TestHistogramddErrors(unittest.TestCase):
518+
510519
def test_histogramdd_invalid_bins(self):
511520
for xp in (numpy, cupy):
512521
x = testing.shaped_random((16, 2), xp, scale=100)
@@ -552,6 +561,7 @@ def test_histogramdd_disallow_arraylike_bins(self):
552561

553562

554563
@pytest.mark.skip("histogram2d() is not implemented yet")
564+
# @pytest.mark.skip(reason="XXX: NP2.0: histogram2d dtype")
555565
@testing.parameterize(
556566
*testing.product(
557567
{
@@ -564,11 +574,13 @@ def test_histogramdd_disallow_arraylike_bins(self):
564574
)
565575
)
566576
class TestHistogram2d:
577+
567578
@testing.for_all_dtypes(no_bool=True, no_complex=True)
568-
@testing.numpy_cupy_allclose(atol=1e-7, rtol=1e-7)
579+
@testing.numpy_cupy_allclose(atol=1e-2, rtol=1e-7)
569580
def test_histogram2d(self, xp, dtype):
570581
x = testing.shaped_random((100,), xp, dtype, scale=100)
571582
y = testing.shaped_random((100,), xp, dtype, scale=100)
583+
572584
if self.bins == "array_list":
573585
bins = [xp.arange(0, 100, 4), xp.arange(0, 100, 10)]
574586
elif self.bins == "array":
@@ -592,6 +604,7 @@ def test_histogram2d(self, xp, dtype):
592604

593605
@pytest.mark.skip("histogram2d() is not implemented yet")
594606
class TestHistogram2dErrors(unittest.TestCase):
607+
595608
def test_histogram2d_disallow_arraylike_bins(self):
596609
x = testing.shaped_random((16,), cupy, scale=100)
597610
y = testing.shaped_random((16,), cupy, scale=100)

0 commit comments

Comments
 (0)