Skip to content

Commit 3547962

Browse files
committed
fix cpu issues
1 parent 1bea4bf commit 3547962

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

dpnp/tests/test_arraycreation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def test_dpctl_tensor_input(func, args):
703703

704704

705705
@pytest.mark.parametrize("start", [0, -5, 10, -2.5, 9.7])
706-
@pytest.mark.parametrize("stop", [0, 10, -2, 20.5, 1000])
706+
@pytest.mark.parametrize("stop", [0, 10, -2, 20.5, 120])
707707
@pytest.mark.parametrize(
708708
"num",
709709
[1, 5, numpy.array(10), dpnp.array(17), dpt.asarray(100)],
@@ -852,7 +852,7 @@ def test_space_num_error():
852852
@pytest.mark.parametrize("endpoint", [True, False])
853853
def test_geomspace(sign, dtype, num, endpoint):
854854
start = 2 * sign
855-
stop = 256 * sign
855+
stop = 127 * sign
856856

857857
func = lambda xp: xp.geomspace(
858858
start, stop, num, endpoint=endpoint, dtype=dtype

dpnp/tests/test_indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def test_array_method(self, dtype):
449449
class TestPut:
450450
@pytest.mark.parametrize("a_dt", get_all_dtypes(no_none=True))
451451
@pytest.mark.parametrize(
452-
"indices", [[0, 2], [-4, 4]], ids=["[0, 2]", "[-4, 4]"]
452+
"indices", [[0, 2], [-3, 4]], ids=["[0, 2]", "[-3, 4]"]
453453
)
454454
@pytest.mark.parametrize("ind_dt", get_all_dtypes(no_none=True))
455455
@pytest.mark.parametrize(
@@ -504,8 +504,8 @@ def test_input_1d(self, a_dt, indices, ind_dt, vals, mode):
504504
@pytest.mark.parametrize("a_dt", get_all_dtypes(no_none=True))
505505
@pytest.mark.parametrize(
506506
"indices",
507-
[[0, 7], [3, 4], [-8, 8]],
508-
ids=["[0, 7]", "[3, 4]", "[-8, 8]"],
507+
[[0, 7], [3, 4], [-7, 8]],
508+
ids=["[0, 7]", "[3, 4]", "[-7, 8]"],
509509
)
510510
@pytest.mark.parametrize("ind_dt", get_integer_dtypes())
511511
@pytest.mark.parametrize("mode", ["clip", "wrap"])

dpnp/tests/test_mathematical.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,8 +3751,8 @@ def test_matmul_bool(self, shape1, shape2):
37513751
],
37523752
)
37533753
def test_matmul_axes_ND_ND(self, dtype, axes):
3754-
a = generate_random_numpy_array((2, 5, 3, 4), dtype)
3755-
b = generate_random_numpy_array((4, 2, 5, 3), dtype)
3754+
a = generate_random_numpy_array((2, 5, 3, 4), dtype, low=-5, high=5)
3755+
b = generate_random_numpy_array((4, 2, 5, 3), dtype, low=-5, high=5)
37563756
ia = dpnp.array(a)
37573757
ib = dpnp.array(b)
37583758

@@ -3820,8 +3820,8 @@ def test_matmul_axes_1D_1D(self):
38203820
],
38213821
)
38223822
def test_matmul_axes_out(self, dtype, axes, out_shape):
3823-
a = generate_random_numpy_array((2, 5, 3, 4), dtype)
3824-
b = generate_random_numpy_array((4, 2, 5, 3), dtype)
3823+
a = generate_random_numpy_array((2, 5, 3, 4), dtype, low=-5, high=5)
3824+
b = generate_random_numpy_array((4, 2, 5, 3), dtype, low=-5, high=5)
38253825
ia = dpnp.array(a)
38263826
ib = dpnp.array(b)
38273827

@@ -3872,8 +3872,8 @@ def test_matmul_axes_out_1D(self, axes, b_shape, out_shape):
38723872
],
38733873
)
38743874
def test_matmul_dtype_matrix_inout(self, in_dt, out_dt, shape1, shape2):
3875-
a1 = generate_random_numpy_array(shape1, in_dt)
3876-
a2 = generate_random_numpy_array(shape2, in_dt)
3875+
a1 = generate_random_numpy_array(shape1, in_dt, low=-5, high=5)
3876+
a2 = generate_random_numpy_array(shape2, in_dt, low=-5, high=5)
38773877
b1 = dpnp.asarray(a1)
38783878
b2 = dpnp.asarray(a2)
38793879

@@ -3901,8 +3901,8 @@ def test_matmul_dtype_matrix_inout(self, in_dt, out_dt, shape1, shape2):
39013901
],
39023902
)
39033903
def test_matmul_dtype_matrix_inputs(self, dtype1, dtype2, shape1, shape2):
3904-
a1 = generate_random_numpy_array(shape1, dtype1)
3905-
a2 = generate_random_numpy_array(shape2, dtype2)
3904+
a1 = generate_random_numpy_array(shape1, dtype1, low=-5, high=5)
3905+
a2 = generate_random_numpy_array(shape2, dtype2, low=-5, high=5)
39063906
b1 = dpnp.asarray(a1)
39073907
b2 = dpnp.asarray(a2)
39083908

@@ -4115,9 +4115,10 @@ def test_matmul_strided_vec_mat(self, shape, incx, incy, transpose):
41154115
)
41164116
def test_matmul_out1(self, order1, order2, out_order, dtype):
41174117
# test gemm with out keyword
4118-
a1 = numpy.arange(20, dtype=dtype).reshape(5, 4, order=order1)
4119-
a2 = numpy.arange(28, dtype=dtype).reshape(4, 7, order=order2)
4120-
4118+
a1 = generate_random_numpy_array((5, 4), dtype, low=-5, high=5)
4119+
a2 = generate_random_numpy_array((4, 7), dtype, low=-5, high=5)
4120+
a1 = numpy.array(a1, order=order1)
4121+
a2 = numpy.array(a2, order=order2)
41214122
b1 = dpnp.asarray(a1)
41224123
b2 = dpnp.asarray(a2)
41234124

@@ -4139,8 +4140,8 @@ def test_matmul_out2(self, trans, dtype):
41394140
# test gemm_batch with out keyword
41404141
# the base of input arrays is c-contiguous
41414142
# the base of output array is c-contiguous or f-contiguous
4142-
a1 = numpy.arange(24, dtype=dtype).reshape(2, 3, 4)
4143-
a2 = numpy.arange(40, dtype=dtype).reshape(2, 4, 5)
4143+
a1 = generate_random_numpy_array((2, 3, 4), dtype, low=-5, high=5)
4144+
a2 = generate_random_numpy_array((2, 4, 5), dtype, low=-5, high=5)
41444145
b1 = dpnp.asarray(a1)
41454146
b2 = dpnp.asarray(a2)
41464147

@@ -4167,8 +4168,8 @@ def test_matmul_out3(self, trans, dtype):
41674168
# test gemm_batch with out keyword
41684169
# the base of input arrays is f-contiguous
41694170
# the base of output array is c-contiguous or f-contiguous
4170-
a1 = numpy.arange(24, dtype=dtype).reshape(2, 4, 3)
4171-
a2 = numpy.arange(40, dtype=dtype).reshape(2, 5, 4)
4171+
a1 = generate_random_numpy_array((2, 4, 3), dtype, low=-5, high=5)
4172+
a2 = generate_random_numpy_array((2, 5, 4), dtype, low=-5, high=5)
41724173
b1 = dpnp.asarray(a1)
41734174
b2 = dpnp.asarray(a2)
41744175

dpnp/tests/test_product.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ def test_scalar(self, dtype):
257257
],
258258
)
259259
def test_basic(self, dtype, shape1, shape2):
260-
a = generate_random_numpy_array(shape1, dtype)
261-
b = generate_random_numpy_array(shape2, dtype)
260+
a = generate_random_numpy_array(shape1, dtype, low=-5, high=5)
261+
b = generate_random_numpy_array(shape2, dtype, low=-5, high=5)
262262
ia = dpnp.array(a)
263263
ib = dpnp.array(b)
264264

@@ -328,8 +328,8 @@ def test_out_scalar(self, dtype):
328328
],
329329
)
330330
def test_out(self, dtype, shape1, shape2, out_shape):
331-
a = generate_random_numpy_array(shape1, dtype)
332-
b = generate_random_numpy_array(shape2, dtype)
331+
a = generate_random_numpy_array(shape1, dtype, low=-5, high=5)
332+
b = generate_random_numpy_array(shape2, dtype, low=-5, high=5)
333333
ia = dpnp.array(a)
334334
ib = dpnp.array(b)
335335

@@ -466,8 +466,8 @@ def test_scalar(self, dtype):
466466
],
467467
)
468468
def test_basic(self, dtype, shape1, shape2):
469-
a = generate_random_numpy_array(shape1, dtype)
470-
b = generate_random_numpy_array(shape2, dtype)
469+
a = generate_random_numpy_array(shape1, dtype, low=-5, high=5)
470+
b = generate_random_numpy_array(shape2, dtype, low=-5, high=5)
471471
ia = dpnp.array(a)
472472
ib = dpnp.array(b)
473473

@@ -617,7 +617,7 @@ def setup_method(self):
617617
((6,), (6, 10), (10, 7), (7, 8)),
618618
((4, 6), (6, 10), (10, 7), (7,)),
619619
((6,), (6, 10), (10, 7), (7,)),
620-
((4, 6), (6, 9), (9, 7), (7, 8), (8, 3)),
620+
((4, 6), (6, 2), (2, 7), (7, 5), (5, 3)),
621621
],
622622
ids=[
623623
"two_arrays",
@@ -637,7 +637,7 @@ def test_basic(self, shapes, dtype):
637637
numpy_array_list = []
638638
dpnp_array_list = []
639639
for shape in shapes:
640-
a = generate_random_numpy_array(shape, dtype, low=-4, high=4)
640+
a = generate_random_numpy_array(shape, dtype, low=-2, high=2)
641641
ia = dpnp.array(a)
642642

643643
numpy_array_list.append(a)
@@ -661,7 +661,7 @@ def test_basic(self, shapes, dtype):
661661
((6,), (6, 10), (10, 7), (7, 8), (8,)),
662662
((4, 6), (6, 10), (10, 7), (7,), (4,)),
663663
((6,), (6, 10), (10, 7), (7,), ()),
664-
((4, 6), (6, 9), (9, 7), (7, 8), (8, 3), (4, 3)),
664+
((4, 6), (6, 2), (2, 7), (7, 5), (5, 3), (4, 3)),
665665
],
666666
ids=[
667667
"two_arrays",
@@ -681,7 +681,7 @@ def test_out(self, shapes, dtype):
681681
numpy_array_list = []
682682
dpnp_array_list = []
683683
for shape in shapes[:-1]:
684-
a = generate_random_numpy_array(shape, dtype, low=-4, high=4)
684+
a = generate_random_numpy_array(shape, dtype, low=-2, high=2)
685685
ia = dpnp.array(a)
686686

687687
numpy_array_list.append(a)
@@ -777,8 +777,8 @@ def test_scalar(self, dtype):
777777
@pytest.mark.parametrize("dtype", get_all_dtypes(no_none=True))
778778
@pytest.mark.parametrize("axes", [0, 1, 2])
779779
def test_basic(self, dtype, axes):
780-
a = generate_random_numpy_array((4, 4, 4), dtype)
781-
b = generate_random_numpy_array((4, 4, 4), dtype)
780+
a = generate_random_numpy_array((4, 4, 4), dtype, low=-5, high=5)
781+
b = generate_random_numpy_array((4, 4, 4), dtype, low=-5, high=5)
782782
ia = dpnp.array(a)
783783
ib = dpnp.array(b)
784784

@@ -798,8 +798,8 @@ def test_basic(self, dtype, axes):
798798
],
799799
)
800800
def test_axes(self, dtype, axes):
801-
a = generate_random_numpy_array((2, 5, 3, 4), dtype)
802-
b = generate_random_numpy_array((4, 2, 5, 3), dtype)
801+
a = generate_random_numpy_array((2, 5, 3, 4), dtype, low=-5, high=5)
802+
b = generate_random_numpy_array((4, 2, 5, 3), dtype, low=-5, high=5)
803803
ia = dpnp.array(a)
804804
ib = dpnp.array(b)
805805

@@ -810,8 +810,8 @@ def test_axes(self, dtype, axes):
810810
@pytest.mark.parametrize("dtype1", get_all_dtypes())
811811
@pytest.mark.parametrize("dtype2", get_all_dtypes())
812812
def test_input_dtype_matrix(self, dtype1, dtype2):
813-
a = generate_random_numpy_array((3, 4, 5), dtype1)
814-
b = generate_random_numpy_array((4, 5, 2), dtype2)
813+
a = generate_random_numpy_array((3, 4, 5), dtype1, low=-5, high=5)
814+
b = generate_random_numpy_array((4, 5, 2), dtype2, low=-5, high=5)
815815
ia = dpnp.array(a)
816816
ib = dpnp.array(b)
817817

0 commit comments

Comments
 (0)