Skip to content

Commit

Permalink
test_ufuncs: changing view creation
Browse files Browse the repository at this point in the history
  • Loading branch information
HannanNaeem committed Feb 29, 2024
1 parent 7e597e0 commit 0e4498e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/test_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,16 @@ def test_2d_exposed_ufuncs_vs_numpy(pk_ufunc,
@pytest.mark.parametrize("pk_ufunc, numpy_ufunc", [
(pk.np_matmul, np.matmul),
])
@pytest.mark.parametrize("numpy_dtype", [
(np.float64),
(np.float32),
@pytest.mark.parametrize("pk_dtype, numpy_dtype", [
(pk.double, np.float64),
(pk.float, np.float32),
])
@pytest.mark.parametrize("test_dim", [
[4,4,4,4], [4,3,3,4], [1,1,1,1], [2,5,5,1]
])
def test_np_matmul_2d_2d_vs_numpy(pk_ufunc,
numpy_ufunc,
pk_dtype,
numpy_dtype,
test_dim):

Expand All @@ -483,8 +484,10 @@ def test_np_matmul_2d_2d_vs_numpy(pk_ufunc,
np2 = rng.random((N2, M2)).astype(numpy_dtype)
expected = numpy_ufunc(np1, np2)

view1 = pk.array(np1)
view2 = pk.array(np2)
view1: pk.View2d = pk.View([N1, M1], pk_dtype)
view1[:] = np1
view2: pk.View2d = pk.View([N2, M2], pk_dtype)
view2[:] = np2
actual = pk_ufunc(view1, view2)

assert_allclose(actual, expected)
Expand Down

0 comments on commit 0e4498e

Please sign in to comment.