Skip to content

Commit b8336de

Browse files
Adds test for reshape with order="F"
1 parent 6f8dee0 commit b8336de

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,23 @@ def test_reshape():
14541454
assert A4.shape == requested_shape
14551455

14561456

1457+
def test_reshape_orderF():
1458+
try:
1459+
a = dpt.arange(6 * 3 * 4, dtype="i4")
1460+
except dpctl.SyclDeviceCreationError:
1461+
pytest.skip("No SYCL devices available")
1462+
b = dpt.reshape(a, (6, 2, 6))
1463+
c = dpt.reshape(b, (9, 8), order="F")
1464+
assert c.flags.f_contiguous
1465+
assert c._pointer != b._pointer
1466+
assert b._pointer == a._pointer
1467+
1468+
a_np = np.arange(6 * 3 * 4, dtype="i4")
1469+
b_np = np.reshape(a_np, (6, 2, 6))
1470+
c_np = np.reshape(b_np, (9, 8), order="F")
1471+
assert np.array_equal(c_np, dpt.asnumpy(c))
1472+
1473+
14571474
def test_reshape_zero_size():
14581475
try:
14591476
a = dpt.empty((0,))

0 commit comments

Comments
 (0)