-
Notifications
You must be signed in to change notification settings - Fork 23
Update the scope of third party tests with the latest changes #2148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 73 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
9feed4a
Add test_typing.py
antonwolfy f5bed0d
Update test_type_routines.py
antonwolfy 2868b00
Add test_numpy_interop.py
antonwolfy 7222a42
Update test_ndim.py
antonwolfy 6df0f82
Add test_init.py
antonwolfy dec81f1
Update statistics_tests/test_order.py
antonwolfy 7d86f2c
Update statistics_tests/test_meanvar.py
antonwolfy 1fdefe6
Update statistics_tests/test_histogram.py
antonwolfy 2981ec8
Update statistics_tests/test_correlation.py
antonwolfy 74cc56c
Update sorting_tests/test_count.py
antonwolfy 378b9a8
Update sorting_tests/test_search.py
antonwolfy c6cc0f2
Update sorting_tests/test_sort.py
antonwolfy 29bf6ec
Exclude random tests from files with skipped tests
antonwolfy ba19ec6
Update random_tests/test_sample.py
antonwolfy f58598c
Update random_tests/test_random.py
antonwolfy 5d3ce10
Update random_tests/test_permutations.py
antonwolfy 65aa25e
Add random_tests/test_init.py
antonwolfy 5459dc4
Add common_distributions.py, test_generator_api.py, common_distributi…
antonwolfy 589e763
Add test_bit_generator.py
antonwolfy 7a7e7f2
Update random_tests/test_distributions.py
antonwolfy b19b5f1
Update padding tests
antonwolfy f6e6f58
Update misc_tests/test_byte_bounds.py
antonwolfy 849a345
Added misc_tests/test_memory_ranges.py and misc_tests/test_who.py
antonwolfy f7a4fdb
Update math_tests/test_arithmetic.py
antonwolfy 0d1f174
Update math_tests/test_matmul.py
antonwolfy 2e05173
Update math_tests/test_misc.py
antonwolfy d6b87c2
Update math_tests/test_rounding.py
antonwolfy e5701cb
Update math_tests/test_sumprod.py
antonwolfy c991ae6
Add math_tests/test_window.py
antonwolfy 72a49b5
Update remaining tests from math_tests
antonwolfy 59688a3
Update manipulation_tests/test_add_remove.py
antonwolfy 027a0fc
Update manipulation_tests/test_basic.py
antonwolfy 69a3012
Update manipulation_tests/test_dims.py
antonwolfy ee0a78e
Update manipulation_tests/test_join.py
antonwolfy 88b994d
Update manipulation_tests/test_kind.py
antonwolfy f745c2a
Update manipulation_tests/test_rearrange.py
antonwolfy f3445e3
Update manipulation_tests/test_shape.py
antonwolfy e6cc187
Update manipulation_tests/test_transpose.py
antonwolfy 864f32b
Update remaining manipulation tests
antonwolfy dc384cc
dpnp.ndarray.mT wrongly returns usm_ndarray
antonwolfy 01f7329
Update logic_tests/test_content.py
antonwolfy 7ad6446
Update logic_tests/test_truth.py
antonwolfy 6a275a4
Update logic_tests/test_type_test.py
antonwolfy f4a67bc
Update linalg_tests/test_decomposition.py
antonwolfy ec7c4e5
Update linalg_tests/test_eigenvalue.py
antonwolfy 1ee0408
Update linalg_tests/test_einsum.py
antonwolfy 55bb3c5
Update linalg_tests/test_product.py
antonwolfy 0df52ea
Update linalg_tests/test_solve.py
antonwolfy cbca245
Update remaining LinAlg tests
antonwolfy e843d7b
Disable tests for broadcast() and interp() by pytest.mark.skip
antonwolfy eca2d00
Proper handling of input shapes passed to dpnp.random.rand()
antonwolfy 78e0a22
Update scope of lib tests
antonwolfy 977f747
Update scope of I/O tests
antonwolfy 7f7571d
Update scope of indexing tests
antonwolfy 1844089
Update scope of FFT tests
antonwolfy abaf6ee
Update scope of creation tests
antonwolfy 5895a1e
Added unsupported scopes to core tests.
antonwolfy 27b000c
Update core_tests/test_dlpack.py
antonwolfy f373576
Update core_tests/test_elementwise.py
antonwolfy 3e1b80e
Added core_tests/test_ndarray_adv_indexing.py
antonwolfy 9bff168
Update core_tests/test_ndarray_complex_ops.py
antonwolfy dc1735b
Add core_tests/test_ndarray_contiguity.py
antonwolfy a4f5e0a
Update core_tests/test_ndarray_conversion.py
antonwolfy 9bffc04
update core_tests/test_ndarray_copy_and_view.py
antonwolfy 7d02839
Added test_ndarray_cuda_array_interface.py, test_ndarray_elementwise_…
antonwolfy 4ecf11f
Add core_tests/test_ndarray_indexing.py
antonwolfy fc45315
Update core_tests/test_ndarray_math.py
antonwolfy e95c068
Update core_tests/test_ndarray_reduction.py
antonwolfy f588c3b
Add core_tests/test_nep50_examples.py
antonwolfy 3bf5a76
Add core_tests/test_ufunc_methods.py
antonwolfy af98016
Update remaining tests in core scope
antonwolfy 3d44bbd
Update tests from binary scope
antonwolfy cd7e741
Add changes from the latest version of third party tests
antonwolfy 87ea8be
Merge branch 'master' into align-third-party-tests
antonwolfy 33cce1f
Update description of dpnp.random.rand() per review comment
antonwolfy 514bf62
Mute warnings per review comment
antonwolfy 4145b8f
row_stack is an alias on vstack, so no need to run CFD tests for both…
antonwolfy d9e66e1
Merge branch 'master' into align-third-party-tests
antonwolfy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import unittest | ||
|
||
import numpy | ||
import pytest | ||
|
||
import dpnp as cupy | ||
from dpnp.tests.third_party.cupy import testing | ||
|
||
pytest.skip( | ||
"packbits() and unpackbits() are not supported yet", allow_module_level=True | ||
) | ||
|
||
|
||
class TestPacking(unittest.TestCase): | ||
|
||
@testing.for_int_dtypes() | ||
@testing.numpy_cupy_array_equal() | ||
def check_packbits(self, data, xp, dtype, bitorder="big"): | ||
# Note numpy <= 1.9 raises an Exception when an input array is bool. | ||
# See https://github.com/numpy/numpy/issues/5377 | ||
a = xp.array(data, dtype=dtype) | ||
return xp.packbits(a, bitorder=bitorder) | ||
|
||
@testing.numpy_cupy_array_equal() | ||
def check_unpackbits(self, data, xp, bitorder="big"): | ||
a = xp.array(data, dtype=xp.uint8) | ||
return xp.unpackbits(a, bitorder=bitorder) | ||
|
||
def test_packbits(self): | ||
self.check_packbits([0]) | ||
self.check_packbits([1]) | ||
self.check_packbits([0, 1]) | ||
self.check_packbits([1, 0, 1, 1, 0, 1, 1, 1]) | ||
self.check_packbits([1, 0, 1, 1, 0, 1, 1, 1, 1]) | ||
self.check_packbits(numpy.arange(24).reshape((2, 3, 4)) % 2) | ||
|
||
def test_packbits_order(self): | ||
for bo in ["big", "little"]: | ||
self.check_packbits([0], bitorder=bo) | ||
self.check_packbits([1], bitorder=bo) | ||
self.check_packbits([0, 1], bitorder=bo) | ||
self.check_packbits([1, 0, 1, 1, 0, 1, 1, 1], bitorder=bo) | ||
self.check_packbits([1, 0, 1, 1, 0, 1, 1, 1, 1], bitorder=bo) | ||
self.check_packbits( | ||
numpy.arange(24).reshape((2, 3, 4)) % 2, bitorder=bo | ||
) | ||
|
||
def test_packbits_empty(self): | ||
# Note packbits of numpy <= 1.11 has a bug against empty arrays. | ||
# See https://github.com/numpy/numpy/issues/8324 | ||
self.check_packbits([]) | ||
|
||
def test_pack_invalid_order(self): | ||
a = cupy.array([10, 20, 30]) | ||
pytest.raises(ValueError, cupy.packbits, a, bitorder="ascendant") | ||
pytest.raises(ValueError, cupy.packbits, a, bitorder=10.4) | ||
|
||
def test_pack_invalid_array(self): | ||
fa = cupy.array([10, 20, 30], dtype=float) | ||
pytest.raises(TypeError, cupy.packbits, fa) | ||
|
||
def test_unpackbits(self): | ||
self.check_unpackbits([]) | ||
self.check_unpackbits([0]) | ||
self.check_unpackbits([1]) | ||
self.check_unpackbits([255]) | ||
self.check_unpackbits([100, 200, 123, 213]) | ||
|
||
def test_unpack_invalid_array(self): | ||
a = cupy.array([10, 20, 30]) | ||
pytest.raises(TypeError, cupy.unpackbits, a) | ||
pytest.raises(TypeError, cupy.unpackbits, a.astype(float)) | ||
|
||
def test_pack_unpack_order(self): | ||
for bo in ["big", "little"]: | ||
self.check_unpackbits([], bitorder=bo) | ||
self.check_unpackbits([0], bitorder=bo) | ||
self.check_unpackbits([1], bitorder=bo) | ||
self.check_unpackbits([255], bitorder=bo) | ||
self.check_unpackbits([100, 200, 123, 213], bitorder=bo) | ||
|
||
def test_unpack_invalid_order(self): | ||
a = cupy.array([10, 20, 30], dtype=cupy.uint8) | ||
pytest.raises(ValueError, cupy.unpackbits, a, bitorder="r") | ||
pytest.raises(ValueError, cupy.unpackbits, a, bitorder=10) |
64 changes: 64 additions & 0 deletions
64
dpnp/tests/third_party/cupy/core_tests/test_array_function.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import unittest | ||
|
||
import numpy | ||
import pytest | ||
|
||
import dpnp as cupy | ||
from dpnp.tests.third_party.cupy import testing | ||
|
||
pytest.skip( | ||
"__array_function__ protocol is not supported", allow_module_level=True | ||
) | ||
|
||
|
||
class TestArrayFunction(unittest.TestCase): | ||
|
||
@testing.with_requires("numpy>=1.17.0") | ||
def test_array_function(self): | ||
a = numpy.random.randn(100, 100) | ||
a_cpu = numpy.asarray(a) | ||
a_gpu = cupy.asarray(a) | ||
|
||
# The numpy call for both CPU and GPU arrays is intentional to test the | ||
# __array_function__ protocol | ||
qr_cpu = numpy.linalg.qr(a_cpu) | ||
qr_gpu = numpy.linalg.qr(a_gpu) | ||
|
||
if isinstance(qr_cpu, tuple): | ||
for b_cpu, b_gpu in zip(qr_cpu, qr_gpu): | ||
assert b_cpu.dtype == b_gpu.dtype | ||
testing.assert_allclose(b_cpu, b_gpu, atol=1e-4) | ||
else: | ||
assert qr_cpu.dtype == qr_gpu.dtype | ||
testing.assert_allclose(qr_cpu, qr_gpu, atol=1e-4) | ||
|
||
@testing.with_requires("numpy>=1.17.0") | ||
def test_array_function2(self): | ||
a = numpy.random.randn(100, 100) | ||
a_cpu = numpy.asarray(a) | ||
a_gpu = cupy.asarray(a) | ||
|
||
# The numpy call for both CPU and GPU arrays is intentional to test the | ||
# __array_function__ protocol | ||
out_cpu = numpy.sum(a_cpu, axis=1) | ||
out_gpu = numpy.sum(a_gpu, axis=1) | ||
|
||
assert out_cpu.dtype == out_gpu.dtype | ||
testing.assert_allclose(out_cpu, out_gpu, atol=1e-4) | ||
|
||
@testing.with_requires("numpy>=1.17.0") | ||
@testing.numpy_cupy_equal() | ||
def test_array_function_can_cast(self, xp): | ||
return numpy.can_cast(xp.arange(2), "f4") | ||
|
||
@testing.with_requires("numpy>=1.17.0") | ||
@testing.numpy_cupy_equal() | ||
def test_array_function_common_type(self, xp): | ||
return numpy.common_type( | ||
xp.arange(2, dtype="f8"), xp.arange(2, dtype="f4") | ||
) | ||
|
||
@testing.with_requires("numpy>=1.17.0") | ||
@testing.numpy_cupy_equal() | ||
def test_array_function_result_type(self, xp): | ||
return numpy.result_type(3, xp.arange(2, dtype="f8")) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.