Skip to content

Broadcast tests to be running within github actions #1588

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 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ env:
third_party/cupy/logic_tests/test_comparison.py
third_party/cupy/logic_tests/test_truth.py
third_party/cupy/manipulation_tests/test_basic.py
third_party/cupy/manipulation_tests/test_dims.py
third_party/cupy/manipulation_tests/test_join.py
third_party/cupy/manipulation_tests/test_rearrange.py
third_party/cupy/manipulation_tests/test_transpose.py
Expand Down
16 changes: 10 additions & 6 deletions tests/third_party/cupy/manipulation_tests/test_dims.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from tests.third_party.cupy import testing


@testing.gpu
class TestDims(unittest.TestCase):
def check_atleast(self, func, xp):
a = testing.shaped_arange((), xp)
Expand Down Expand Up @@ -55,6 +54,13 @@ def test_broadcast_to(self, xp, dtype):
b = xp.broadcast_to(a, (2, 3, 3, 4))
return b

@testing.numpy_cupy_array_equal()
def test_broadcast_to_int(self, xp):
# Broadcast 0-dim array to 1-dim.
a = xp.array(10, dtype=xp.float32)
b = xp.broadcast_to(a, 10)
return b

@testing.for_all_dtypes()
def test_broadcast_to_fail(self, dtype):
for xp in (numpy, cupy):
Expand Down Expand Up @@ -286,7 +292,6 @@ def test_external_squeeze(self, xp):
{"shapes": [(0, 1, 1, 3), (2, 1, 0, 0, 3)]},
{"shapes": [(0, 1, 1, 0, 3), (5, 2, 0, 1, 0, 0, 3), (2, 1, 0, 0, 0, 3)]},
)
@testing.gpu
class TestBroadcast(unittest.TestCase):
def _broadcast(self, xp, dtype, shapes):
arrays = [testing.shaped_arange(s, xp, dtype) for s in shapes]
Expand All @@ -296,9 +301,9 @@ def _broadcast(self, xp, dtype, shapes):
def test_broadcast(self, dtype):
broadcast_np = self._broadcast(numpy, dtype, self.shapes)
broadcast_cp = self._broadcast(cupy, dtype, self.shapes)
self.assertEqual(broadcast_np.shape, broadcast_cp.shape)
self.assertEqual(broadcast_np.size, broadcast_cp.size)
self.assertEqual(broadcast_np.nd, broadcast_cp.nd)
assert broadcast_np.shape == broadcast_cp.shape
assert broadcast_np.size == broadcast_cp.size
assert broadcast_np.nd == broadcast_cp.nd

@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
Expand Down Expand Up @@ -329,7 +334,6 @@ def test_broadcast_arrays(self, xp, dtype):
},
{"shapes": [(0,), (2,)]},
)
@testing.gpu
class TestInvalidBroadcast(unittest.TestCase):
@testing.for_all_dtypes()
def test_invalid_broadcast(self, dtype):
Expand Down